1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 10:07:44 +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:
sin-ack 2021-07-29 10:14:12 +00:00 committed by Andreas Kling
parent 95ab61e3db
commit 611370e7dc
19 changed files with 150 additions and 255 deletions

View file

@ -3,13 +3,10 @@
endpoint WindowServer
{
create_menubar(i32 menubar_id) =|
destroy_menubar(i32 menubar_id) =|
create_menu(i32 menu_id, [UTF8] String menu_title) =|
destroy_menu(i32 menu_id) =|
add_menu_to_menubar(i32 menubar_id, i32 menu_id) =|
add_menu(i32 window_id, i32 menu_id) =|
add_menu_item(
i32 menu_id,
@ -53,8 +50,6 @@ endpoint WindowServer
destroy_window(i32 window_id) => (Vector<i32> destroyed_window_ids)
set_window_menubar(i32 window_id, i32 menubar_id) =|
set_window_title(i32 window_id, [UTF8] String title) =|
get_window_title(i32 window_id) => ([UTF8] String title)