mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 22:07:35 +00: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
6 changed files with 18 additions and 0 deletions
|
@ -100,6 +100,7 @@ void Window::show()
|
||||||
m_minimizable,
|
m_minimizable,
|
||||||
m_resizable,
|
m_resizable,
|
||||||
m_fullscreen,
|
m_fullscreen,
|
||||||
|
m_frameless,
|
||||||
m_opacity_when_windowless,
|
m_opacity_when_windowless,
|
||||||
m_base_size,
|
m_base_size,
|
||||||
m_size_increment,
|
m_size_increment,
|
||||||
|
|
|
@ -62,6 +62,9 @@ public:
|
||||||
bool is_fullscreen() const { return m_fullscreen; }
|
bool is_fullscreen() const { return m_fullscreen; }
|
||||||
void set_fullscreen(bool);
|
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; }
|
bool is_resizable() const { return m_resizable; }
|
||||||
void set_resizable(bool resizable) { m_resizable = resizable; }
|
void set_resizable(bool resizable) { m_resizable = resizable; }
|
||||||
|
|
||||||
|
@ -219,6 +222,7 @@ private:
|
||||||
bool m_resizable { true };
|
bool m_resizable { true };
|
||||||
bool m_minimizable { true };
|
bool m_minimizable { true };
|
||||||
bool m_fullscreen { false };
|
bool m_fullscreen { false };
|
||||||
|
bool m_frameless { false };
|
||||||
bool m_layout_pending { false };
|
bool m_layout_pending { false };
|
||||||
bool m_visible_for_timer_purposes { true };
|
bool m_visible_for_timer_purposes { true };
|
||||||
bool m_visible { false };
|
bool m_visible { false };
|
||||||
|
|
|
@ -475,6 +475,8 @@ OwnPtr<Messages::WindowServer::CreateWindowResponse> ClientConnection::handle(co
|
||||||
window->set_parent_window(*parent_window);
|
window->set_parent_window(*parent_window);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
window->set_frameless(message.frameless());
|
||||||
|
|
||||||
window->set_has_alpha_channel(message.has_alpha_channel());
|
window->set_has_alpha_channel(message.has_alpha_channel());
|
||||||
window->set_title(message.title());
|
window->set_title(message.title());
|
||||||
if (!message.fullscreen()) {
|
if (!message.fullscreen()) {
|
||||||
|
|
|
@ -229,6 +229,9 @@ public:
|
||||||
Vector<WeakPtr<Window>>& child_windows() { return m_child_windows; }
|
Vector<WeakPtr<Window>>& child_windows() { return m_child_windows; }
|
||||||
const Vector<WeakPtr<Window>>& child_windows() const { 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:
|
private:
|
||||||
void handle_mouse_event(const MouseEvent&);
|
void handle_mouse_event(const MouseEvent&);
|
||||||
void update_menu_item_text(PopupMenuItem item);
|
void update_menu_item_text(PopupMenuItem item);
|
||||||
|
@ -259,6 +262,7 @@ private:
|
||||||
WindowTileType m_tiled { WindowTileType::None };
|
WindowTileType m_tiled { WindowTileType::None };
|
||||||
Gfx::Rect m_untiled_rect;
|
Gfx::Rect m_untiled_rect;
|
||||||
bool m_occluded { false };
|
bool m_occluded { false };
|
||||||
|
bool m_frameless { false };
|
||||||
RefPtr<Gfx::Bitmap> m_backing_store;
|
RefPtr<Gfx::Bitmap> m_backing_store;
|
||||||
RefPtr<Gfx::Bitmap> m_last_backing_store;
|
RefPtr<Gfx::Bitmap> m_last_backing_store;
|
||||||
int m_window_id { -1 };
|
int m_window_id { -1 };
|
||||||
|
|
|
@ -257,6 +257,9 @@ void WindowFrame::paint_normal_frame(Gfx::Painter& painter)
|
||||||
|
|
||||||
void WindowFrame::paint(Gfx::Painter& painter)
|
void WindowFrame::paint(Gfx::Painter& painter)
|
||||||
{
|
{
|
||||||
|
if (m_window.is_frameless())
|
||||||
|
return;
|
||||||
|
|
||||||
Gfx::PainterStateSaver saver(painter);
|
Gfx::PainterStateSaver saver(painter);
|
||||||
painter.translate(rect().location());
|
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)
|
static Gfx::Rect frame_rect_for_window(Window& window, const Gfx::Rect& rect)
|
||||||
{
|
{
|
||||||
|
if (window.is_frameless())
|
||||||
|
return rect;
|
||||||
|
|
||||||
auto type = window.type();
|
auto type = window.type();
|
||||||
|
|
||||||
switch (type) {
|
switch (type) {
|
||||||
|
|
|
@ -36,6 +36,7 @@ endpoint WindowServer = 2
|
||||||
bool minimizable,
|
bool minimizable,
|
||||||
bool resizable,
|
bool resizable,
|
||||||
bool fullscreen,
|
bool fullscreen,
|
||||||
|
bool frameless,
|
||||||
float opacity,
|
float opacity,
|
||||||
Gfx::Size base_size,
|
Gfx::Size base_size,
|
||||||
Gfx::Size size_increment,
|
Gfx::Size size_increment,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue