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

WindowServer: Split double-duty Window::normalize_rect()

This commit:
- merges the two(!) places that defined independently the minimum size of a window.
- splits Window::normalize_rect(), which was originally just a function to apply
  the minimum size requirement, and has taken on the additional job of nudging
  windows back onto the desktop.

This inadvertantly fixes a crash that happens when a malicious program creates a
window of size (0, 0). Now, a window at [0,0 50x50] is created instead.
This commit is contained in:
Ben Wiederhake 2021-01-28 22:47:32 +01:00 committed by Andreas Kling
parent 79f534ef12
commit cf586311a6
4 changed files with 30 additions and 24 deletions

View file

@ -159,7 +159,8 @@ 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 normalize_rect(bool force_titlebar_visible = true);
void apply_minimum_size(Gfx::IntRect&);
void nudge_into_desktop(bool force_titlebar_visible = true);
void set_taskbar_rect(const Gfx::IntRect&);
const Gfx::IntRect& taskbar_rect() const { return m_taskbar_rect; }