diff options
-rw-r--r-- | Userland/Libraries/LibGUI/Window.cpp | 12 | ||||
-rw-r--r-- | Userland/Libraries/LibGUI/Window.h | 4 | ||||
-rw-r--r-- | Userland/Services/WindowServer/ConnectionFromClient.cpp | 20 | ||||
-rw-r--r-- | Userland/Services/WindowServer/ConnectionFromClient.h | 2 | ||||
-rw-r--r-- | Userland/Services/WindowServer/WindowServer.ipc | 3 |
5 files changed, 41 insertions, 0 deletions
diff --git a/Userland/Libraries/LibGUI/Window.cpp b/Userland/Libraries/LibGUI/Window.cpp index 84ac0f610b..9f6e671a1c 100644 --- a/Userland/Libraries/LibGUI/Window.cpp +++ b/Userland/Libraries/LibGUI/Window.cpp @@ -1036,6 +1036,18 @@ void Window::set_maximized(bool maximized) ConnectionToWindowServer::the().async_set_maximized(m_window_id, maximized); } +void Window::set_minimized(bool minimized) +{ + if (!is_minimizable()) + return; + + m_minimized = minimized; + if (!is_visible()) + return; + + ConnectionToWindowServer::the().async_set_minimized(m_window_id, minimized); +} + void Window::update_min_size() { if (main_widget()) { diff --git a/Userland/Libraries/LibGUI/Window.h b/Userland/Libraries/LibGUI/Window.h index 12031d41a8..68c4b372c8 100644 --- a/Userland/Libraries/LibGUI/Window.h +++ b/Userland/Libraries/LibGUI/Window.h @@ -45,6 +45,9 @@ public: bool is_maximized() const { return m_maximized; } void set_maximized(bool); + bool is_minimized() const { return m_minimized; } + void set_minimized(bool); + bool is_frameless() const { return m_frameless; } void set_frameless(bool); @@ -306,6 +309,7 @@ private: bool m_minimizable { true }; bool m_closeable { true }; bool m_maximized { false }; + bool m_minimized { false }; bool m_fullscreen { false }; bool m_frameless { false }; bool m_forced_shadow { false }; diff --git a/Userland/Services/WindowServer/ConnectionFromClient.cpp b/Userland/Services/WindowServer/ConnectionFromClient.cpp index 64fd194428..6d8aefc7c1 100644 --- a/Userland/Services/WindowServer/ConnectionFromClient.cpp +++ b/Userland/Services/WindowServer/ConnectionFromClient.cpp @@ -414,6 +414,26 @@ void ConnectionFromClient::set_maximized(i32 window_id, bool maximized) it->value->set_maximized(maximized); } +Messages::WindowServer::IsMinimizedResponse ConnectionFromClient::is_minimized(i32 window_id) +{ + auto it = m_windows.find(window_id); + if (it == m_windows.end()) { + did_misbehave("IsMinimized: Bad window ID"); + return nullptr; + } + return it->value->is_minimized(); +} + +void ConnectionFromClient::set_minimized(i32 window_id, bool minimized) +{ + auto it = m_windows.find(window_id); + if (it == m_windows.end()) { + did_misbehave("SetMinimized: Bad window ID"); + return; + } + it->value->set_minimized(minimized); +} + void ConnectionFromClient::set_window_icon_bitmap(i32 window_id, Gfx::ShareableBitmap const& icon) { auto it = m_windows.find(window_id); diff --git a/Userland/Services/WindowServer/ConnectionFromClient.h b/Userland/Services/WindowServer/ConnectionFromClient.h index 211da366ed..1d69214ab5 100644 --- a/Userland/Services/WindowServer/ConnectionFromClient.h +++ b/Userland/Services/WindowServer/ConnectionFromClient.h @@ -109,6 +109,8 @@ private: virtual Messages::WindowServer::GetWindowTitleResponse get_window_title(i32) override; virtual Messages::WindowServer::IsMaximizedResponse is_maximized(i32) override; virtual void set_maximized(i32, bool) override; + virtual Messages::WindowServer::IsMinimizedResponse is_minimized(i32) override; + virtual void set_minimized(i32, bool) override; virtual void start_window_resize(i32, i32) override; virtual Messages::WindowServer::SetWindowRectResponse set_window_rect(i32, Gfx::IntRect const&) override; virtual Messages::WindowServer::GetWindowRectResponse get_window_rect(i32) override; diff --git a/Userland/Services/WindowServer/WindowServer.ipc b/Userland/Services/WindowServer/WindowServer.ipc index 111a4ab83c..75c262c916 100644 --- a/Userland/Services/WindowServer/WindowServer.ipc +++ b/Userland/Services/WindowServer/WindowServer.ipc @@ -85,6 +85,9 @@ endpoint WindowServer is_maximized(i32 window_id) => (bool maximized) set_maximized(i32 window_id, bool maximized) =| + is_minimized(i32 window_id) => (bool minimized) + set_minimized(i32 window_id, bool minimized) =| + invalidate_rect(i32 window_id, Vector<Gfx::IntRect> rects, bool ignore_occlusion) =| did_finish_painting(i32 window_id, Vector<Gfx::IntRect> rects) =| |