mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-01-24 10:12:25 -05:00
WindowServer+LibGUI: Add "frameless" window flag
This allows you to create windows with no title bar or window frame.
This commit is contained in:
parent
bb7eb3e104
commit
d847304cb9
Notes:
sideshowbarker
2024-07-19 07:07:17 +09:00
Author: https://github.com/awesomekling Commit: https://github.com/SerenityOS/serenity/commit/d847304cb9a
6 changed files with 18 additions and 0 deletions
|
@ -100,6 +100,7 @@ void Window::show()
|
|||
m_minimizable,
|
||||
m_resizable,
|
||||
m_fullscreen,
|
||||
m_frameless,
|
||||
m_opacity_when_windowless,
|
||||
m_base_size,
|
||||
m_size_increment,
|
||||
|
|
|
@ -62,6 +62,9 @@ public:
|
|||
bool is_fullscreen() const { return m_fullscreen; }
|
||||
void set_fullscreen(bool);
|
||||
|
||||
bool is_frameless() const { return m_frameless; }
|
||||
void set_frameless(bool frameless) { m_frameless = frameless; }
|
||||
|
||||
bool is_resizable() const { return m_resizable; }
|
||||
void set_resizable(bool resizable) { m_resizable = resizable; }
|
||||
|
||||
|
@ -219,6 +222,7 @@ private:
|
|||
bool m_resizable { true };
|
||||
bool m_minimizable { true };
|
||||
bool m_fullscreen { false };
|
||||
bool m_frameless { false };
|
||||
bool m_layout_pending { false };
|
||||
bool m_visible_for_timer_purposes { true };
|
||||
bool m_visible { false };
|
||||
|
|
|
@ -475,6 +475,8 @@ OwnPtr<Messages::WindowServer::CreateWindowResponse> ClientConnection::handle(co
|
|||
window->set_parent_window(*parent_window);
|
||||
}
|
||||
|
||||
window->set_frameless(message.frameless());
|
||||
|
||||
window->set_has_alpha_channel(message.has_alpha_channel());
|
||||
window->set_title(message.title());
|
||||
if (!message.fullscreen()) {
|
||||
|
|
|
@ -229,6 +229,9 @@ public:
|
|||
Vector<WeakPtr<Window>>& child_windows() { return m_child_windows; }
|
||||
const Vector<WeakPtr<Window>>& child_windows() const { return m_child_windows; }
|
||||
|
||||
void set_frameless(bool frameless) { m_frameless = frameless; }
|
||||
bool is_frameless() const { return m_frameless; }
|
||||
|
||||
private:
|
||||
void handle_mouse_event(const MouseEvent&);
|
||||
void update_menu_item_text(PopupMenuItem item);
|
||||
|
@ -259,6 +262,7 @@ private:
|
|||
WindowTileType m_tiled { WindowTileType::None };
|
||||
Gfx::Rect m_untiled_rect;
|
||||
bool m_occluded { false };
|
||||
bool m_frameless { false };
|
||||
RefPtr<Gfx::Bitmap> m_backing_store;
|
||||
RefPtr<Gfx::Bitmap> m_last_backing_store;
|
||||
int m_window_id { -1 };
|
||||
|
|
|
@ -257,6 +257,9 @@ void WindowFrame::paint_normal_frame(Gfx::Painter& painter)
|
|||
|
||||
void WindowFrame::paint(Gfx::Painter& painter)
|
||||
{
|
||||
if (m_window.is_frameless())
|
||||
return;
|
||||
|
||||
Gfx::PainterStateSaver saver(painter);
|
||||
painter.translate(rect().location());
|
||||
|
||||
|
@ -274,6 +277,9 @@ void WindowFrame::paint(Gfx::Painter& painter)
|
|||
|
||||
static Gfx::Rect frame_rect_for_window(Window& window, const Gfx::Rect& rect)
|
||||
{
|
||||
if (window.is_frameless())
|
||||
return rect;
|
||||
|
||||
auto type = window.type();
|
||||
|
||||
switch (type) {
|
||||
|
|
|
@ -36,6 +36,7 @@ endpoint WindowServer = 2
|
|||
bool minimizable,
|
||||
bool resizable,
|
||||
bool fullscreen,
|
||||
bool frameless,
|
||||
float opacity,
|
||||
Gfx::Size base_size,
|
||||
Gfx::Size size_increment,
|
||||
|
|
Loading…
Add table
Reference in a new issue