1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 06:08:10 +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

@ -17,6 +17,7 @@ WSWindow::WSWindow(WSMessageReceiver& internal_owner, WSWindowType type)
: m_internal_owner(&internal_owner)
, m_type(type)
, m_icon(default_window_icon())
, m_frame(*this)
{
WSWindowManager::the().add_window(*this);
}
@ -27,6 +28,7 @@ WSWindow::WSWindow(WSClientConnection& client, WSWindowType window_type, int win
, m_modal(modal)
, m_window_id(window_id)
, m_icon(default_window_icon())
, m_frame(*this)
{
// FIXME: This should not be hard-coded here.
if (m_type == WSWindowType::Taskbar)
@ -57,7 +59,7 @@ void WSWindow::set_rect(const Rect& rect)
if (!m_client && (!m_backing_store || old_rect.size() != rect.size())) {
m_backing_store = GraphicsBitmap::create(GraphicsBitmap::Format::RGB32, m_rect.size());
}
WSWindowManager::the().notify_rect_changed(*this, old_rect, rect);
m_frame.notify_window_rect_changed(old_rect, rect);
}
// FIXME: Just use the same types.