1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-26 06:47:34 +00:00

WindowManager: Move more of the menu management logic to WSMenuManager

This patch moves a whole lot of the menu logic from WSWindowManager to
its proper home in WSMenuManager.

We also get rid of the "close_current_menu()" concept which was easily
confused in the presence of submenus. All operations should now be
aware of the menu stack instead. (The concept of a single, current menu
made a lot more sense when there were no nested menus.)
This commit is contained in:
Andreas Kling 2019-11-11 12:21:57 +01:00
parent 77de51d251
commit cbecad0a77
7 changed files with 126 additions and 96 deletions

View file

@ -84,8 +84,6 @@ public:
Rect menubar_rect() const;
WSMenuBar* current_menubar() { return m_current_menubar.ptr(); }
void set_current_menubar(WSMenuBar*);
WSMenu* current_menu() { return m_current_menu.ptr(); }
void set_current_menu(WSMenu*, bool is_submenu = false);
WSMenu* system_menu() { return m_system_menu.ptr(); }
const WSCursor& active_cursor() const;
@ -114,7 +112,6 @@ public:
void close_menubar(WSMenuBar&);
Color menu_selection_color() const { return m_menu_selection_color; }
int menubar_menu_margin() const;
void close_current_menu();
void set_resolution(int width, int height);
@ -255,7 +252,6 @@ private:
RefPtr<WSMenu> m_system_menu;
Color m_menu_selection_color;
WeakPtr<WSMenuBar> m_current_menubar;
WeakPtr<WSMenu> m_current_menu;
WSWindowSwitcher m_switcher;
WSMenuManager m_menu_manager;
@ -265,6 +261,13 @@ private:
RefPtr<CConfigFile> m_wm_config;
struct AppMetadata {
String executable;
String name;
String icon_path;
String category;
};
Vector<AppMetadata> m_apps;
HashMap<String, NonnullRefPtr<WSMenu>> m_app_category_menus;
};