mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 16:07:47 +00:00
WindowServer: Tell WSWindows who their CObject parent is
Instead of using a weird "internal owner" pointer, just set the owning object as the CObject::parent of WSWindow.
This commit is contained in:
parent
68e94f0a2e
commit
9d57e7ed68
2 changed files with 8 additions and 6 deletions
|
@ -18,8 +18,8 @@ static GraphicsBitmap& default_window_icon()
|
|||
return *s_icon;
|
||||
}
|
||||
|
||||
WSWindow::WSWindow(CObject& internal_owner, WSWindowType type)
|
||||
: m_internal_owner(&internal_owner)
|
||||
WSWindow::WSWindow(CObject& parent, WSWindowType type)
|
||||
: CObject(&parent)
|
||||
, m_type(type)
|
||||
, m_icon(default_window_icon())
|
||||
, m_frame(*this)
|
||||
|
@ -28,7 +28,8 @@ WSWindow::WSWindow(CObject& internal_owner, WSWindowType type)
|
|||
}
|
||||
|
||||
WSWindow::WSWindow(WSClientConnection& client, WSWindowType window_type, int window_id, bool modal, bool resizable, bool fullscreen)
|
||||
: m_client(&client)
|
||||
: CObject(&client)
|
||||
, m_client(&client)
|
||||
, m_type(window_type)
|
||||
, m_modal(modal)
|
||||
, m_resizable(resizable)
|
||||
|
@ -174,8 +175,10 @@ void WSWindow::set_maximized(bool maximized)
|
|||
|
||||
void WSWindow::event(CEvent& event)
|
||||
{
|
||||
if (m_internal_owner)
|
||||
return m_internal_owner->event(event);
|
||||
if (!m_client) {
|
||||
ASSERT(parent());
|
||||
return parent()->event(event);
|
||||
}
|
||||
|
||||
if (is_blocked_by_modal_window())
|
||||
return;
|
||||
|
|
|
@ -153,7 +153,6 @@ private:
|
|||
void handle_mouse_event(const WSMouseEvent&);
|
||||
|
||||
WSClientConnection* m_client { nullptr };
|
||||
CObject* m_internal_owner { nullptr };
|
||||
String m_title;
|
||||
Rect m_rect;
|
||||
WSWindowType m_type { WSWindowType::Normal };
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue