diff options
author | Andreas Kling <kling@serenityos.org> | 2021-01-07 20:12:17 +0100 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2021-01-08 12:33:34 +0100 |
commit | 56ff0f89af5dc8ba858b1bc4ce401ae242b2ac79 (patch) | |
tree | 4b16905a35de74489143485f290c8e20048e7bf7 /Services/WindowServer | |
parent | 6a970611d65b1d410636f7155de1986021f22267 (diff) | |
download | serenity-56ff0f89af5dc8ba858b1bc4ce401ae242b2ac79.zip |
WindowServer: is_blocked_by_modal_window() => blocking_modal_window()
The name of this function was weird, since it returned the blocking
modal window itself, and not just a bool answering the question.
Diffstat (limited to 'Services/WindowServer')
-rw-r--r-- | Services/WindowServer/ClientConnection.cpp | 4 | ||||
-rw-r--r-- | Services/WindowServer/Window.cpp | 10 | ||||
-rw-r--r-- | Services/WindowServer/Window.h | 2 | ||||
-rw-r--r-- | Services/WindowServer/WindowFrame.cpp | 2 | ||||
-rw-r--r-- | Services/WindowServer/WindowManager.cpp | 12 | ||||
-rw-r--r-- | Services/WindowServer/WindowManager.h | 4 |
6 files changed, 17 insertions, 17 deletions
diff --git a/Services/WindowServer/ClientConnection.cpp b/Services/WindowServer/ClientConnection.cpp index 419f4f13ac..29fee3c7ed 100644 --- a/Services/WindowServer/ClientConnection.cpp +++ b/Services/WindowServer/ClientConnection.cpp @@ -679,8 +679,8 @@ void ClientConnection::handle(const Messages::WindowServer::WM_PopupWindowMenu& return; } auto& window = *(*it).value; - if (auto* blocked_by_modal = window.is_blocked_by_modal_window()) { - blocked_by_modal->popup_window_menu(message.screen_position(), WindowMenuDefaultAction::BasedOnWindowState); + if (auto* modal_window = window.blocking_modal_window()) { + modal_window->popup_window_menu(message.screen_position(), WindowMenuDefaultAction::BasedOnWindowState); } else { window.popup_window_menu(message.screen_position(), WindowMenuDefaultAction::BasedOnWindowState); } diff --git a/Services/WindowServer/Window.cpp b/Services/WindowServer/Window.cpp index bf7b7d0707..b79684e79e 100644 --- a/Services/WindowServer/Window.cpp +++ b/Services/WindowServer/Window.cpp @@ -227,7 +227,7 @@ void Window::set_minimized(bool minimized) update_menu_item_text(PopupMenuItem::Minimize); Compositor::the().invalidate_occlusions(); Compositor::the().invalidate_screen(frame().rect()); - if (!is_blocked_by_modal_window()) + if (!blocking_modal_window()) start_minimize_animation(); if (!minimized) request_update({ {}, size() }); @@ -330,7 +330,7 @@ void Window::event(Core::Event& event) return; } - if (is_blocked_by_modal_window()) { + if (blocking_modal_window()) { // We still want to handle the WindowDeactivated event below when a new modal is // created to notify its parent window, despite it being "blocked by modal window". if (event.type() != Event::WindowDeactivated) @@ -472,7 +472,7 @@ bool Window::is_active() const return WindowManager::the().active_window() == this; } -Window* Window::is_blocked_by_modal_window() +Window* Window::blocking_modal_window() { // A window is blocked if any immediate child, or any child further // down the chain is modal @@ -481,8 +481,8 @@ Window* Window::is_blocked_by_modal_window() if (window->is_modal()) return window; - if (auto* blocking_modal_window = window->is_blocked_by_modal_window()) - return blocking_modal_window; + if (auto* blocking_window = window->blocking_modal_window()) + return blocking_window; } } return nullptr; diff --git a/Services/WindowServer/Window.h b/Services/WindowServer/Window.h index 75e7175a41..286d543cc4 100644 --- a/Services/WindowServer/Window.h +++ b/Services/WindowServer/Window.h @@ -122,7 +122,7 @@ public: WindowFrame& frame() { return m_frame; } const WindowFrame& frame() const { return m_frame; } - Window* is_blocked_by_modal_window(); + Window* blocking_modal_window(); bool listens_to_wm_events() const { return m_listens_to_wm_events; } diff --git a/Services/WindowServer/WindowFrame.cpp b/Services/WindowServer/WindowFrame.cpp index 6df895aa46..fee0e2a939 100644 --- a/Services/WindowServer/WindowFrame.cpp +++ b/Services/WindowServer/WindowFrame.cpp @@ -282,7 +282,7 @@ void WindowFrame::on_mouse_event(const MouseEvent& event) if (event.type() == Event::MouseDown) wm.move_to_front_and_make_active(m_window); - if (m_window.is_blocked_by_modal_window()) + if (m_window.blocking_modal_window()) return; if (title_bar_icon_rect().contains(event.position())) { diff --git a/Services/WindowServer/WindowManager.cpp b/Services/WindowServer/WindowManager.cpp index 9550c70ae9..86c9ed9c77 100644 --- a/Services/WindowServer/WindowManager.cpp +++ b/Services/WindowServer/WindowManager.cpp @@ -902,7 +902,7 @@ void WindowManager::process_mouse_event(MouseEvent& event, Window*& hovered_wind return; for (auto* window = m_windows_in_order.tail(); window; window = window->prev()) { - if (!window->global_cursor_tracking() || !window->is_visible() || window->is_minimized() || window->is_blocked_by_modal_window()) + if (!window->global_cursor_tracking() || !window->is_visible() || window->is_minimized() || window->blocking_modal_window()) continue; windows_who_received_mouse_event_due_to_cursor_tracking.set(window); auto translated_event = event.translated(-window->position()); @@ -975,7 +975,7 @@ void WindowManager::process_mouse_event(MouseEvent& event, Window*& hovered_wind start_window_move(window, event); return; } - if (window.is_resizable() && m_keyboard_modifiers == Mod_Logo && event.type() == Event::MouseDown && event.button() == MouseButton::Right && !window.is_blocked_by_modal_window()) { + if (window.is_resizable() && m_keyboard_modifiers == Mod_Logo && event.type() == Event::MouseDown && event.button() == MouseButton::Right && !window.blocking_modal_window()) { hovered_window = &window; start_window_resize(window, event); return; @@ -997,7 +997,7 @@ void WindowManager::process_mouse_event(MouseEvent& event, Window*& hovered_wind if (event.type() == Event::MouseDown) { // We're clicking on something that's blocked by a modal window. // Flash the modal window to let the user know about it. - if (auto* blocking_modal_window = window.is_blocked_by_modal_window()) + if (auto* blocking_modal_window = window.blocking_modal_window()) blocking_modal_window->frame().start_flash_animation(); if (window.type() == WindowType::Normal) @@ -1009,7 +1009,7 @@ void WindowManager::process_mouse_event(MouseEvent& event, Window*& hovered_wind // Well okay, let's see if we're hitting the frame or the window inside the frame. if (window.rect().contains(event.position())) { hovered_window = &window; - if (!window.global_cursor_tracking() && !windows_who_received_mouse_event_due_to_cursor_tracking.contains(&window) && !window.is_blocked_by_modal_window()) { + if (!window.global_cursor_tracking() && !windows_who_received_mouse_event_due_to_cursor_tracking.contains(&window) && !window.blocking_modal_window()) { auto translated_event = event.translated(-window.position()); deliver_mouse_event(window, translated_event); if (event.type() == Event::MouseDown) { @@ -1210,7 +1210,7 @@ Window* WindowManager::set_active_input_window(Window* window) void WindowManager::set_active_window(Window* window, bool make_input) { if (window) { - if (auto* modal_window = window->is_blocked_by_modal_window()) { + if (auto* modal_window = window->blocking_modal_window()) { ASSERT(modal_window->is_modal()); ASSERT(modal_window != window); window = modal_window; @@ -1326,7 +1326,7 @@ const Cursor& WindowManager::active_cursor() const } if (m_hovered_window) { - if (auto* modal_window = const_cast<Window&>(*m_hovered_window).is_blocked_by_modal_window()) { + if (auto* modal_window = const_cast<Window&>(*m_hovered_window).blocking_modal_window()) { if (modal_window->cursor()) return *modal_window->cursor(); } else if (m_hovered_window->cursor()) { diff --git a/Services/WindowServer/WindowManager.h b/Services/WindowServer/WindowManager.h index 69386da1e3..0aa04f9743 100644 --- a/Services/WindowServer/WindowManager.h +++ b/Services/WindowServer/WindowManager.h @@ -188,12 +188,12 @@ public: template<typename Function> IterationDecision for_each_window_in_modal_stack(Window& window, Function f) { - auto* blocking_modal_window = window.is_blocked_by_modal_window(); + auto* blocking_modal_window = window.blocking_modal_window(); if (blocking_modal_window || window.is_modal()) { Vector<Window*> modal_stack; auto* modal_stack_top = blocking_modal_window ? blocking_modal_window : &window; for (auto* parent = modal_stack_top->parent_window(); parent; parent = parent->parent_window()) { - auto* blocked_by = parent->is_blocked_by_modal_window(); + auto* blocked_by = parent->blocking_modal_window(); if (!blocked_by || (blocked_by != modal_stack_top && !modal_stack_top->is_descendant_of(*blocked_by))) break; modal_stack.append(parent); |