WindowServer+LibGUI: Add "frameless" window flag

This allows you to create windows with no title bar or window frame.
This commit is contained in:
Andreas Kling 2020-05-01 23:26:32 +02:00
parent bb7eb3e104
commit d847304cb9
Notes: sideshowbarker 2024-07-19 07:07:17 +09:00
6 changed files with 18 additions and 0 deletions

View File

@ -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,

View File

@ -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 };

View File

@ -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()) {

View File

@ -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 };

View File

@ -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) {

View File

@ -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,