diff options
Diffstat (limited to 'Libraries/LibGUI')
-rw-r--r-- | Libraries/LibGUI/Window.cpp | 15 | ||||
-rw-r--r-- | Libraries/LibGUI/Window.h | 2 |
2 files changed, 16 insertions, 1 deletions
diff --git a/Libraries/LibGUI/Window.cpp b/Libraries/LibGUI/Window.cpp index ead7ba78fa..60d80d938e 100644 --- a/Libraries/LibGUI/Window.cpp +++ b/Libraries/LibGUI/Window.cpp @@ -89,6 +89,9 @@ void Window::show() { if (is_visible()) return; + + auto* parent_window = find_parent_window(); + m_override_cursor = StandardCursor::None; auto response = WindowServerConnection::the().send_sync<Messages::WindowServer::CreateWindow>( m_rect_when_windowless, @@ -102,7 +105,8 @@ void Window::show() m_base_size, m_size_increment, (i32)m_window_type, - m_title_when_windowless); + m_title_when_windowless, + parent_window ? parent_window->window_id() : 0); m_window_id = response->window_id(); m_visible = true; @@ -113,6 +117,15 @@ void Window::show() update(); } +Window* Window::find_parent_window() +{ + for (auto* ancestor = parent(); ancestor; ancestor = ancestor->parent()) { + if (ancestor->is_window()) + return static_cast<Window*>(ancestor); + } + return nullptr; +} + void Window::hide() { if (!is_visible()) diff --git a/Libraries/LibGUI/Window.h b/Libraries/LibGUI/Window.h index 59d20a1bcd..20f20eac71 100644 --- a/Libraries/LibGUI/Window.h +++ b/Libraries/LibGUI/Window.h @@ -182,6 +182,8 @@ public: void did_remove_widget(Badge<Widget>, const Widget&); + Window* find_parent_window(); + protected: Window(Core::Object* parent = nullptr); virtual void wm_event(WMEvent&); |