mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 16:37:47 +00:00
LibGUI, WindowServer: Greatly simplify menubar logic
Currently, any number of menubars can be plugged in and out of a window. This is unnecessary complexity, since we only need one menubar on a window. This commit removes most of the logic for dynamically attaching and detaching menubars and makes one menubar always available. The menubar is only considered existent if it has at least a single menu in it (in other words, an empty menubar will not be shown). This commit additionally fixes a bug wherein menus added after a menubar has been attached would not have their rects properly setup, and would therefore appear glitched out on the top left corner of the menubar.
This commit is contained in:
parent
95ab61e3db
commit
611370e7dc
19 changed files with 150 additions and 255 deletions
|
@ -14,6 +14,7 @@
|
|||
#include <LibGfx/DisjointRectSet.h>
|
||||
#include <LibGfx/Rect.h>
|
||||
#include <WindowServer/Cursor.h>
|
||||
#include <WindowServer/Menubar.h>
|
||||
#include <WindowServer/Screen.h>
|
||||
#include <WindowServer/WindowFrame.h>
|
||||
#include <WindowServer/WindowType.h>
|
||||
|
@ -25,7 +26,6 @@ class ClientConnection;
|
|||
class Cursor;
|
||||
class KeyEvent;
|
||||
class Menu;
|
||||
class Menubar;
|
||||
class MenuItem;
|
||||
class MouseEvent;
|
||||
class WindowStack;
|
||||
|
@ -338,9 +338,10 @@ public:
|
|||
// area needs to be rendered
|
||||
auto& affected_transparency_rects() { return m_affected_transparency_rects; }
|
||||
|
||||
Menubar* menubar() { return m_menubar; }
|
||||
const Menubar* menubar() const { return m_menubar; }
|
||||
void set_menubar(Menubar*);
|
||||
Menubar& menubar() { return m_menubar; }
|
||||
Menubar const& menubar() const { return m_menubar; }
|
||||
|
||||
void add_menu(Menu& menu);
|
||||
|
||||
WindowStack& window_stack()
|
||||
{
|
||||
|
@ -395,7 +396,7 @@ private:
|
|||
Vector<WeakPtr<Window>> m_child_windows;
|
||||
Vector<WeakPtr<Window>> m_accessory_windows;
|
||||
|
||||
RefPtr<Menubar> m_menubar;
|
||||
Menubar m_menubar;
|
||||
|
||||
String m_title;
|
||||
Gfx::IntRect m_rect;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue