mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 19:07:35 +00:00
WindowServer: Fix menu location on screens other than main screen
The menus always thought they were being outside of the main screen, which caused them to be left and/or top aligned. This also fixes the calculation of the available space by using the screen rectangle where it will be displayed.
This commit is contained in:
parent
2d4eb40f59
commit
30f531a55f
4 changed files with 34 additions and 26 deletions
|
@ -101,7 +101,7 @@ void MenuManager::event(Core::Event& event)
|
|||
else {
|
||||
auto* target_menu = previous_menu(m_current_menu);
|
||||
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()));
|
||||
target_menu->ensure_menu_window(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();
|
||||
}
|
||||
|
@ -118,7 +118,7 @@ void MenuManager::event(Core::Event& event)
|
|||
else if (m_open_menu_stack.size() <= 1 && wm.window_with_active_menu()) {
|
||||
auto* target_menu = next_menu(m_current_menu);
|
||||
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()));
|
||||
target_menu->ensure_menu_window(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);
|
||||
|
@ -300,9 +300,9 @@ void MenuManager::open_menu(Menu& menu, bool as_current_menu)
|
|||
|
||||
if (!menu.is_empty()) {
|
||||
menu.redraw_if_theme_changed();
|
||||
if (!menu.menu_window())
|
||||
menu.ensure_menu_window();
|
||||
menu.set_visible(true);
|
||||
auto* window = menu.menu_window();
|
||||
VERIFY(window);
|
||||
window->set_visible(true);
|
||||
}
|
||||
|
||||
if (m_open_menu_stack.find_if([&menu](auto& other) { return &menu == other.ptr(); }).is_end())
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue