1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-27 23:45:07 +00:00

WindowServer: Flash modal window when clicking on window blocked by it

This makes window modality a bit more discoverable by indicating to the
user that the modal window must be closed before mouse interaction is
possible in the clicked window.
This commit is contained in:
Andreas Kling 2021-01-01 01:10:53 +01:00
parent 2e8db6560f
commit af7800d947
3 changed files with 31 additions and 0 deletions

View file

@ -996,6 +996,11 @@ 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())) {
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())
blocking_modal_window->frame().start_flash_animation();
if (window.type() == WindowType::Normal)
move_to_front_and_make_active(window);
else if (window.type() == WindowType::Desktop)