mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 19:07:35 +00:00
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.
This commit is contained in:
parent
6ae174f80a
commit
dfb81242f3
2 changed files with 7 additions and 2 deletions
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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(),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue