diff options
author | thankyouverycool <66646555+thankyouverycool@users.noreply.github.com> | 2022-08-25 14:03:49 -0400 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2022-08-26 12:48:05 +0200 |
commit | d815f659cc382656e11e9d28aeb4a2bbcf1e9f85 (patch) | |
tree | 830eebe6aee38c579eb2d4a04e5143154ff94b7b /Userland/Services | |
parent | 18b111b802751226559ac6e530fbede8104e47c1 (diff) | |
download | serenity-d815f659cc382656e11e9d28aeb4a2bbcf1e9f85.zip |
LibGUI+Taskbar+WindowServer: Prevent minimization when blocked
This was intentionally enabled with WindowModes as a new Taskbar
convenience, but on second thought, it doesn't add up visually.
Taskbar buttons show blockers' context menus when available,
which is a bit confusing when the window isn't visible. The
modeless window's disabled context menu options and inactive title
bar also contradict the button. So, this patch reenables the
restriction for now. Blocking modals you don't want to answer to
immediately can still be tucked away on another workspace.
Diffstat (limited to 'Userland/Services')
-rw-r--r-- | Userland/Services/Taskbar/TaskbarWindow.cpp | 6 | ||||
-rw-r--r-- | Userland/Services/Taskbar/WindowList.h | 4 | ||||
-rw-r--r-- | Userland/Services/WindowServer/WindowManager.cpp | 3 | ||||
-rw-r--r-- | Userland/Services/WindowServer/WindowManagerClient.ipc | 2 |
4 files changed, 11 insertions, 4 deletions
diff --git a/Userland/Services/Taskbar/TaskbarWindow.cpp b/Userland/Services/Taskbar/TaskbarWindow.cpp index 1e3c8d0867..f79c8e2892 100644 --- a/Userland/Services/Taskbar/TaskbarWindow.cpp +++ b/Userland/Services/Taskbar/TaskbarWindow.cpp @@ -156,7 +156,7 @@ void TaskbarWindow::add_window_button(::Window& window, WindowIdentifier const& button->on_click = [window = &window, identifier](auto) { if (window->is_minimized() || !window->is_active()) GUI::ConnectionToWindowManagerServer::the().async_set_active_window(identifier.client_id(), identifier.window_id()); - else + else if (!window->is_blocked()) GUI::ConnectionToWindowManagerServer::the().async_set_window_minimized(identifier.client_id(), identifier.window_id(), true); }; } @@ -263,12 +263,13 @@ void TaskbarWindow::wm_event(GUI::WMEvent& event) case GUI::Event::WM_WindowStateChanged: { auto& changed_event = static_cast<GUI::WMWindowStateChangedEvent&>(event); if constexpr (EVENT_DEBUG) { - dbgln("WM_WindowStateChanged: client_id={}, window_id={}, title={}, rect={}, is_active={}, is_minimized={}", + dbgln("WM_WindowStateChanged: client_id={}, window_id={}, title={}, rect={}, is_active={}, is_blocked={}, is_minimized={}", changed_event.client_id(), changed_event.window_id(), changed_event.title(), changed_event.rect(), changed_event.is_active(), + changed_event.is_blocked(), changed_event.is_minimized()); } if (changed_event.window_type() != GUI::WindowType::Normal || changed_event.is_frameless()) { @@ -280,6 +281,7 @@ void TaskbarWindow::wm_event(GUI::WMEvent& event) window.set_title(changed_event.title()); window.set_rect(changed_event.rect()); window.set_active(changed_event.is_active()); + window.set_blocked(changed_event.is_blocked()); window.set_minimized(changed_event.is_minimized()); window.set_progress(changed_event.progress()); window.set_workspace(changed_event.workspace_row(), changed_event.workspace_column()); diff --git a/Userland/Services/Taskbar/WindowList.h b/Userland/Services/Taskbar/WindowList.h index dc725abbd2..617c69f4d5 100644 --- a/Userland/Services/Taskbar/WindowList.h +++ b/Userland/Services/Taskbar/WindowList.h @@ -39,6 +39,9 @@ public: void set_active(bool active) { m_active = active; } bool is_active() const { return m_active; } + void set_blocked(bool blocked) { m_blocked = blocked; } + bool is_blocked() const { return m_blocked; } + void set_minimized(bool minimized) { m_minimized = minimized; } bool is_minimized() const { return m_minimized; } @@ -72,6 +75,7 @@ private: unsigned m_workspace_row { 0 }; unsigned m_workspace_column { 0 }; bool m_active { false }; + bool m_blocked { false }; bool m_minimized { false }; Optional<int> m_progress; }; diff --git a/Userland/Services/WindowServer/WindowManager.cpp b/Userland/Services/WindowServer/WindowManager.cpp index 9f85e33507..1fed7611c2 100644 --- a/Userland/Services/WindowServer/WindowManager.cpp +++ b/Userland/Services/WindowServer/WindowManager.cpp @@ -432,6 +432,7 @@ void WindowManager::tell_wm_about_window(WMConnectionFromClient& conn, Window& w Window* modeless = window.modeless_ancestor(); if (!modeless) return; + bool is_blocked = modeless->blocking_modal_window(); auto is_active = for_each_window_in_modal_chain(*modeless, [&](auto& w) { if (w.is_active()) return IterationDecision::Break; @@ -439,7 +440,7 @@ void WindowManager::tell_wm_about_window(WMConnectionFromClient& conn, Window& w }); auto& window_stack = is_stationary_window_type(modeless->type()) ? current_window_stack() : modeless->window_stack(); - conn.async_window_state_changed(conn.window_id(), modeless->client_id(), modeless->window_id(), window_stack.row(), window_stack.column(), is_active, modeless->is_minimized(), modeless->is_frameless(), (i32)modeless->type(), modeless->computed_title(), modeless->rect(), modeless->progress()); + conn.async_window_state_changed(conn.window_id(), modeless->client_id(), modeless->window_id(), window_stack.row(), window_stack.column(), is_active, is_blocked, modeless->is_minimized(), modeless->is_frameless(), (i32)modeless->type(), modeless->computed_title(), modeless->rect(), modeless->progress()); } void WindowManager::tell_wm_about_window_rect(WMConnectionFromClient& conn, Window& window) diff --git a/Userland/Services/WindowServer/WindowManagerClient.ipc b/Userland/Services/WindowServer/WindowManagerClient.ipc index 709b99c908..8697ca95c1 100644 --- a/Userland/Services/WindowServer/WindowManagerClient.ipc +++ b/Userland/Services/WindowServer/WindowManagerClient.ipc @@ -3,7 +3,7 @@ endpoint WindowManagerClient { window_removed(i32 wm_id, i32 client_id, i32 window_id) =| - window_state_changed(i32 wm_id, i32 client_id, i32 window_id, u32 workspace_row, u32 workspace_column, bool is_active, bool is_minimized, bool is_frameless, i32 window_type, [UTF8] String title, Gfx::IntRect rect, Optional<i32> progress) =| + window_state_changed(i32 wm_id, i32 client_id, i32 window_id, u32 workspace_row, u32 workspace_column, bool is_active, bool is_blocking, bool is_minimized, bool is_frameless, i32 window_type, [UTF8] String title, Gfx::IntRect rect, Optional<i32> progress) =| window_icon_bitmap_changed(i32 wm_id, i32 client_id, i32 window_id, Gfx::ShareableBitmap bitmap) =| window_rect_changed(i32 wm_id, i32 client_id, i32 window_id, Gfx::IntRect rect) =| applet_area_size_changed(i32 wm_id, Gfx::IntSize size) =| |