1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 14:57:35 +00:00

WindowServer: Factor out window frame logic into a WSWindowFrame class.

The window frame is an object that contains a window, its title bar and
window border. This way WSWindowManager doesn't have to know about all the
different types of window borders, titlebar rects, etc.
This commit is contained in:
Andreas Kling 2019-04-05 15:54:56 +02:00
parent 99b98dc653
commit 47d270b577
8 changed files with 312 additions and 237 deletions

View file

@ -6,6 +6,7 @@
#include <AK/InlineLinkedList.h>
#include "WSMessageReceiver.h"
#include <WindowServer/WSWindowType.h>
#include <WindowServer/WSWindowFrame.h>
class WSClientConnection;
class WSCursor;
@ -18,6 +19,9 @@ public:
WSWindow(WSMessageReceiver&, WSWindowType);
virtual ~WSWindow() override;
WSWindowFrame& frame() { return m_frame; }
const WSWindowFrame& frame() const { return m_frame; }
bool is_blocked_by_modal_window() const;
bool listens_to_wm_events() const { return m_listens_to_wm_events; }
@ -52,7 +56,15 @@ public:
Rect rect() const { return m_rect; }
void set_rect(const Rect&);
void set_rect(int x, int y, int width, int height) { set_rect({ x, y, width, height }); }
void set_rect_without_repaint(const Rect& rect) { m_rect = rect; }
void set_rect_without_repaint(const Rect& rect)
{
if (m_rect == rect)
return;
auto old_rect = m_rect;
m_rect = rect;
m_frame.notify_window_rect_changed(old_rect, rect);
}
void set_rect_from_window_manager_resize(const Rect&);
void move_to(const Point& position) { set_rect({ position, size() }); }
@ -136,4 +148,5 @@ private:
Size m_base_size;
Retained<GraphicsBitmap> m_icon;
RetainPtr<WSCursor> m_override_cursor;
WSWindowFrame m_frame;
};