summaryrefslogtreecommitdiff
path: root/Userland/Services
diff options
context:
space:
mode:
authorAndreas Kling <kling@serenityos.org>2021-03-26 08:59:32 +0100
committerAndreas Kling <kling@serenityos.org>2021-03-26 08:59:32 +0100
commitdfb81242f3f18383e6a9760c1b5aec039e903d95 (patch)
tree49fc17c06457197eb633f831f63cb11c558626b0 /Userland/Services
parent6ae174f80aad9caccf60d068864b19fe1ef6541e (diff)
downloadserenity-dfb81242f3f18383e6a9760c1b5aec039e903d95.zip
WindowServer: Redraw window menubars when moving with arrow keys
Also, make sure we don't draw a menu in hovered state while another menu is open. Fixes #5949.
Diffstat (limited to 'Userland/Services')
-rw-r--r--Userland/Services/WindowServer/MenuManager.cpp2
-rw-r--r--Userland/Services/WindowServer/WindowFrame.cpp7
2 files changed, 7 insertions, 2 deletions
diff --git a/Userland/Services/WindowServer/MenuManager.cpp b/Userland/Services/WindowServer/MenuManager.cpp
index 863d6eb661..4731a55317 100644
--- a/Userland/Services/WindowServer/MenuManager.cpp
+++ b/Userland/Services/WindowServer/MenuManager.cpp
@@ -159,6 +159,7 @@ void MenuManager::event(Core::Event& event)
if (target_menu) {
target_menu->ensure_menu_window().move_to(target_menu->rect_in_window_menubar().bottom_left().translated(wm.window_with_active_menu()->frame().rect().location()).translated(wm.window_with_active_menu()->frame().menubar_rect().location()));
open_menu(*target_menu);
+ wm.window_with_active_menu()->invalidate_menubar();
}
}
}
@@ -175,6 +176,7 @@ void MenuManager::event(Core::Event& event)
if (target_menu) {
target_menu->ensure_menu_window().move_to(target_menu->rect_in_window_menubar().bottom_left().translated(wm.window_with_active_menu()->frame().rect().location()).translated(wm.window_with_active_menu()->frame().menubar_rect().location()));
open_menu(*target_menu);
+ wm.window_with_active_menu()->invalidate_menubar();
close_everyone_not_in_lineage(*target_menu);
}
}
diff --git a/Userland/Services/WindowServer/WindowFrame.cpp b/Userland/Services/WindowServer/WindowFrame.cpp
index 8b65955576..34a153528c 100644
--- a/Userland/Services/WindowServer/WindowFrame.cpp
+++ b/Userland/Services/WindowServer/WindowFrame.cpp
@@ -314,8 +314,11 @@ void WindowFrame::paint_menubar(Gfx::Painter& painter)
Color text_color = palette.window_text();
if (MenuManager::the().is_open(menu))
text_rect.move_by(1, 1);
- if (&menu == MenuManager::the().hovered_menu() || MenuManager::the().is_open(menu))
- Gfx::StylePainter::paint_button(painter, menu.rect_in_window_menubar(), palette, Gfx::ButtonStyle::CoolBar, MenuManager::the().is_open(menu), true);
+ bool paint_as_pressed = MenuManager::the().is_open(menu);
+ bool paint_as_hovered = !paint_as_pressed && &menu == MenuManager::the().hovered_menu();
+ if (paint_as_pressed || paint_as_hovered) {
+ Gfx::StylePainter::paint_button(painter, menu.rect_in_window_menubar(), palette, Gfx::ButtonStyle::CoolBar, paint_as_pressed, paint_as_hovered);
+ }
painter.draw_text(
text_rect,
menu.name(),