From e9db10e3a96eae955ebb84751fd6d468de9c3078 Mon Sep 17 00:00:00 2001 From: Andreas Kling Date: Thu, 25 Mar 2021 23:27:11 +0100 Subject: [PATCH] WindowServer+LibGUI: Remove the global menubar :^) This leaves menu applets running but invisible, and that's a regression we need to take care of obviously. But not today, because it's getting too late. --- Userland/Libraries/LibGUI/ComboBox.cpp | 3 +-- Userland/Libraries/LibGUI/Desktop.h | 1 - Userland/Services/WindowServer/Compositor.h | 1 - .../Services/WindowServer/MenuManager.cpp | 1 + .../Services/WindowServer/WindowManager.cpp | 21 ++++--------------- .../Services/WindowServer/WindowManager.h | 1 - 6 files changed, 6 insertions(+), 22 deletions(-) diff --git a/Userland/Libraries/LibGUI/ComboBox.cpp b/Userland/Libraries/LibGUI/ComboBox.cpp index 776f7068d36..3563f4621b3 100644 --- a/Userland/Libraries/LibGUI/ComboBox.cpp +++ b/Userland/Libraries/LibGUI/ComboBox.cpp @@ -244,12 +244,11 @@ void ComboBox::open() }; auto taskbar_height = GUI::Desktop::the().taskbar_height(); - auto menubar_height = GUI::Desktop::the().menubar_height(); // NOTE: This is so the combobox bottom edge exactly fits the taskbar's // top edge - the value was found through trial and error though. auto offset = 8; Gfx::IntRect list_window_rect { my_screen_rect.bottom_left(), size }; - list_window_rect.intersect(Desktop::the().rect().shrunken(0, taskbar_height + menubar_height + offset)); + list_window_rect.intersect(Desktop::the().rect().shrunken(0, taskbar_height + offset)); m_editor->set_focus(true); if (m_selected_index.has_value()) { diff --git a/Userland/Libraries/LibGUI/Desktop.h b/Userland/Libraries/LibGUI/Desktop.h index 5b531ad3d1b..3de64a7571e 100644 --- a/Userland/Libraries/LibGUI/Desktop.h +++ b/Userland/Libraries/LibGUI/Desktop.h @@ -48,7 +48,6 @@ public: Gfx::IntRect rect() const { return m_rect; } int taskbar_height() const { return 28; } - int menubar_height() const { return 19; } void did_receive_screen_rect(Badge, const Gfx::IntRect&); diff --git a/Userland/Services/WindowServer/Compositor.h b/Userland/Services/WindowServer/Compositor.h index 0f10627c57e..01fb0e7b8ea 100644 --- a/Userland/Services/WindowServer/Compositor.h +++ b/Userland/Services/WindowServer/Compositor.h @@ -81,7 +81,6 @@ private: void init_bitmaps(); void flip_buffers(); void flush(const Gfx::IntRect&); - void draw_menubar(); void run_animations(Gfx::DisjointRectSet&); void notify_display_links(); void start_compose_async_timer(); diff --git a/Userland/Services/WindowServer/MenuManager.cpp b/Userland/Services/WindowServer/MenuManager.cpp index ab8828f764f..ac4bf133a17 100644 --- a/Userland/Services/WindowServer/MenuManager.cpp +++ b/Userland/Services/WindowServer/MenuManager.cpp @@ -56,6 +56,7 @@ MenuManager::MenuManager() m_window = Window::construct(*this, WindowType::Menubar); m_window->set_rect(menubar_rect()); + m_window->set_visible(false); m_search_timer = Core::Timer::create_single_shot(0, [this] { m_current_search.clear(); diff --git a/Userland/Services/WindowServer/WindowManager.cpp b/Userland/Services/WindowServer/WindowManager.cpp index 5636caa9f7a..ab9ab968523 100644 --- a/Userland/Services/WindowServer/WindowManager.cpp +++ b/Userland/Services/WindowServer/WindowManager.cpp @@ -929,8 +929,7 @@ void WindowManager::process_mouse_event(MouseEvent& event, Window*& hovered_wind MenuManager::the().set_hovered_menu(nullptr); if (MenuManager::the().has_open_menu() - || hitting_menu_in_window_with_active_menu - || menubar_rect().contains(event.position())) { + || hitting_menu_in_window_with_active_menu) { for_each_visible_window_of_type_from_front_to_back(WindowType::MenuApplet, [&](auto& window) { if (!window.rect_in_menubar().contains(event.position())) return IterationDecision::Continue; @@ -1113,22 +1112,15 @@ void WindowManager::clear_resize_candidate() m_resize_candidate = nullptr; } -Gfx::IntRect WindowManager::menubar_rect() const -{ - if (active_fullscreen_window()) - return {}; - return MenuManager::the().menubar_rect(); -} - Gfx::IntRect WindowManager::desktop_rect() const { if (active_fullscreen_window()) return Screen::the().rect(); return { 0, - menubar_rect().bottom() + 1, + 0, Screen::the().width(), - Screen::the().height() - menubar_rect().height() - 28 + Screen::the().height() - 28 }; } @@ -1447,10 +1439,6 @@ Gfx::IntRect WindowManager::maximized_window_rect(const Window& window) const rect.set_y(rect.y() + window.frame().title_bar_rect().height() + window.frame().menubar_rect().height()); rect.set_height(rect.height() - window.frame().title_bar_rect().height() - window.frame().menubar_rect().height()); - // Subtract menu bar - rect.set_y(rect.y() + menubar_rect().height()); - rect.set_height(rect.height() - menubar_rect().height()); - // Subtract taskbar window height if present const_cast(this)->for_each_visible_window_of_type_from_back_to_front(WindowType::Taskbar, [&rect](Window& taskbar_window) { rect.set_height(rect.height() - taskbar_window.height()); @@ -1558,7 +1546,6 @@ Gfx::IntPoint WindowManager::get_recommended_window_position(const Gfx::IntPoint // FIXME: Find a better source for this. int taskbar_height = 28; - int menubar_height = MenuManager::the().menubar_rect().height(); const Window* overlap_window = nullptr; for_each_visible_window_of_type_from_front_to_back(WindowType::Normal, [&](Window& window) { @@ -1573,7 +1560,7 @@ Gfx::IntPoint WindowManager::get_recommended_window_position(const Gfx::IntPoint point = overlap_window->position() + shift; point = { point.x() % Screen::the().width(), (point.y() >= (Screen::the().height() - taskbar_height)) - ? menubar_height + Gfx::WindowTheme::current().title_bar_height(Gfx::WindowTheme::WindowType::Normal, palette()) + ? Gfx::WindowTheme::current().title_bar_height(Gfx::WindowTheme::WindowType::Normal, palette()) : point.y() }; } else { point = desired; diff --git a/Userland/Services/WindowServer/WindowManager.h b/Userland/Services/WindowServer/WindowManager.h index b52d065dd40..671167e426f 100644 --- a/Userland/Services/WindowServer/WindowManager.h +++ b/Userland/Services/WindowServer/WindowManager.h @@ -121,7 +121,6 @@ public: void move_to_front_and_make_active(Window&); - Gfx::IntRect menubar_rect() const; Gfx::IntRect desktop_rect() const; Gfx::IntRect arena_rect_for_type(WindowType) const;