mirror of
https://github.com/RGBCube/serenity
synced 2025-05-25 22:15:06 +00:00
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.
This commit is contained in:
parent
6a970611d6
commit
56ff0f89af
6 changed files with 17 additions and 17 deletions
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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; }
|
||||
|
||||
|
|
|
@ -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())) {
|
||||
|
|
|
@ -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()) {
|
||||
|
|
|
@ -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);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue