mirror of
				https://github.com/RGBCube/serenity
				synced 2025-10-31 16:52:43 +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; |     return *s_icon; | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| WSWindow::WSWindow(CObject& internal_owner, WSWindowType type) | WSWindow::WSWindow(CObject& parent, WSWindowType type) | ||||||
|     : m_internal_owner(&internal_owner) |     : CObject(&parent) | ||||||
|     , m_type(type) |     , m_type(type) | ||||||
|     , m_icon(default_window_icon()) |     , m_icon(default_window_icon()) | ||||||
|     , m_frame(*this) |     , 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) | 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_type(window_type) | ||||||
|     , m_modal(modal) |     , m_modal(modal) | ||||||
|     , m_resizable(resizable) |     , m_resizable(resizable) | ||||||
|  | @ -174,8 +175,10 @@ void WSWindow::set_maximized(bool maximized) | ||||||
| 
 | 
 | ||||||
| void WSWindow::event(CEvent& event) | void WSWindow::event(CEvent& event) | ||||||
| { | { | ||||||
|     if (m_internal_owner) |     if (!m_client) { | ||||||
|         return m_internal_owner->event(event); |         ASSERT(parent()); | ||||||
|  |         return parent()->event(event); | ||||||
|  |     } | ||||||
| 
 | 
 | ||||||
|     if (is_blocked_by_modal_window()) |     if (is_blocked_by_modal_window()) | ||||||
|         return; |         return; | ||||||
|  |  | ||||||
|  | @ -153,7 +153,6 @@ private: | ||||||
|     void handle_mouse_event(const WSMouseEvent&); |     void handle_mouse_event(const WSMouseEvent&); | ||||||
| 
 | 
 | ||||||
|     WSClientConnection* m_client { nullptr }; |     WSClientConnection* m_client { nullptr }; | ||||||
|     CObject* m_internal_owner { nullptr }; |  | ||||||
|     String m_title; |     String m_title; | ||||||
|     Rect m_rect; |     Rect m_rect; | ||||||
|     WSWindowType m_type { WSWindowType::Normal }; |     WSWindowType m_type { WSWindowType::Normal }; | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Andreas Kling
						Andreas Kling