summaryrefslogtreecommitdiff
path: root/Userland/Libraries/LibGUI/Window.h
diff options
context:
space:
mode:
authorNick Vella <nick@nxk.io>2021-02-16 00:59:43 +1100
committerAndreas Kling <kling@serenityos.org>2021-02-16 15:46:03 +0100
commit15c1f7a40d988ae6f538d61f4dd088ceeb4b3bf9 (patch)
treec18405151569837cd72f46653db72081b8c20f86 /Userland/Libraries/LibGUI/Window.h
parentdea0d22ab356924f590a44e3b7d2e474f6e9fb61 (diff)
downloadserenity-15c1f7a40d988ae6f538d61f4dd088ceeb4b3bf9.zip
WindowServer, LibGUI: Variable minimum window sizes
Minimum window size can now be customised and set at runtime via the SetWindowMinimumSize WindowServer message and the set_minimum_size LibGUI::Window method. The default minimum size remains at 50x50. Some behind-the-scenes mechanics had to be added to LibGUI::Window to ensure that the minimum size is remembered if set before the window is shown. WindowServer sends a resize event to the client if it requests a size on create that's smaller than it's minimum size.
Diffstat (limited to 'Userland/Libraries/LibGUI/Window.h')
-rw-r--r--Userland/Libraries/LibGUI/Window.h6
1 files changed, 6 insertions, 0 deletions
diff --git a/Userland/Libraries/LibGUI/Window.h b/Userland/Libraries/LibGUI/Window.h
index aca7e0842e..50843e5d78 100644
--- a/Userland/Libraries/LibGUI/Window.h
+++ b/Userland/Libraries/LibGUI/Window.h
@@ -108,6 +108,10 @@ public:
Gfx::IntPoint position() const { return rect().location(); }
+ Gfx::IntSize minimum_size() const;
+ void set_minimum_size(const Gfx::IntSize&);
+ void set_minimum_size(int width, int height) { set_minimum_size({ width, height }); }
+
void move_to(int x, int y) { move_to({ x, y }); }
void move_to(const Gfx::IntPoint& point) { set_rect({ point, size() }); }
@@ -248,6 +252,8 @@ private:
WeakPtr<Widget> m_automatic_cursor_tracking_widget;
WeakPtr<Widget> m_hovered_widget;
Gfx::IntRect m_rect_when_windowless;
+ Gfx::IntSize m_minimum_size_when_windowless { 50, 50 };
+ bool m_minimum_size_modified { false };
String m_title_when_windowless;
Vector<Gfx::IntRect, 32> m_pending_paint_event_rects;
Gfx::IntSize m_size_increment;