1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 06:47:35 +00:00

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.
This commit is contained in:
Nick Vella 2021-02-16 00:59:43 +11:00 committed by Andreas Kling
parent dea0d22ab3
commit 15c1f7a40d
7 changed files with 130 additions and 8 deletions

View file

@ -169,9 +169,13 @@ public:
void set_rect(const Gfx::IntRect&);
void set_rect(int x, int y, int width, int height) { set_rect({ x, y, width, height }); }
void set_rect_without_repaint(const Gfx::IntRect&);
void apply_minimum_size(Gfx::IntRect&);
bool apply_minimum_size(Gfx::IntRect&);
void nudge_into_desktop(bool force_titlebar_visible = true);
Gfx::IntSize minimum_size() const { return m_minimum_size; }
void set_minimum_size(const Gfx::IntSize&);
void set_minimum_size(int width, int height) { set_minimum_size({ width, height }); }
void set_taskbar_rect(const Gfx::IntRect&);
const Gfx::IntRect& taskbar_rect() const { return m_taskbar_rect; }
@ -190,6 +194,8 @@ public:
void invalidate(const Gfx::IntRect&, bool with_frame = false);
bool invalidate_no_notify(const Gfx::IntRect& rect, bool with_frame = false);
void refresh_client_size();
void prepare_dirty_rects();
void clear_dirty_rects();
Gfx::DisjointRectSet& dirty_rects() { return m_dirty_rects; }
@ -375,6 +381,7 @@ private:
float m_alpha_hit_threshold { 0.0f };
Gfx::IntSize m_size_increment;
Gfx::IntSize m_base_size;
Gfx::IntSize m_minimum_size { 1, 1 };
NonnullRefPtr<Gfx::Bitmap> m_icon;
RefPtr<Cursor> m_cursor;
WindowFrame m_frame;