From ebaf20547c5108adba1d7fd0ecddea3086a239f2 Mon Sep 17 00:00:00 2001 From: Andreas Kling Date: Tue, 10 Nov 2020 19:30:22 +0100 Subject: [PATCH] WindowServer: Show modal window's cursor over blocked windows When a window is blocked by a modal window from the same application, we now prefer the modal window's cursor instead of the hovered window. --- Services/WindowServer/WindowManager.cpp | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/Services/WindowServer/WindowManager.cpp b/Services/WindowServer/WindowManager.cpp index bd566d585a..68291c016a 100644 --- a/Services/WindowServer/WindowManager.cpp +++ b/Services/WindowServer/WindowManager.cpp @@ -1306,8 +1306,14 @@ const Cursor& WindowManager::active_cursor() const } } - if (m_hovered_window && m_hovered_window->cursor()) - return *m_hovered_window->cursor(); + if (m_hovered_window) { + if (auto* modal_window = const_cast(*m_hovered_window).is_blocked_by_modal_window()) { + if (modal_window->cursor()) + return *modal_window->cursor(); + } else if (m_hovered_window->cursor()) { + return *m_hovered_window->cursor(); + } + } return *m_arrow_cursor; }