1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 17:37:34 +00:00

WindowServer+LibGUI: Make much of menu construction asynchronous

Creating a menu/menubar needs to be synchronous because we need the
ID from the response, but adding stuff *to* menus (and adding menus
to menubars, and menubars to windows) can all be asynchronous.

This dramatically reduces the amount of IPC ping-pong played by
each GUI application during startup.

I measured how long it takes TextEditor to enter the main event loop
and it's over 10% faster here. (Down from ~86ms to ~74ms)
This commit is contained in:
Andreas Kling 2021-05-03 21:27:22 +02:00
parent 8a6db55e79
commit a8a899adbf
5 changed files with 11 additions and 11 deletions

View file

@ -8,7 +8,7 @@ endpoint WindowServer
create_menu([UTF8] String menu_title) => (i32 menu_id)
destroy_menu(i32 menu_id) => ()
add_menu_to_menubar(i32 menubar_id, i32 menu_id) => ()
add_menu_to_menubar(i32 menubar_id, i32 menu_id) =|
add_menu_item(
i32 menu_id,
@ -21,11 +21,11 @@ endpoint WindowServer
bool is_default,
[UTF8] String shortcut,
Gfx::ShareableBitmap icon,
bool exclusive) => ()
bool exclusive) =|
add_menu_separator(i32 menu_id) => ()
add_menu_separator(i32 menu_id) =|
update_menu_item(i32 menu_id, i32 identifier, i32 submenu_id, [UTF8] String text, bool enabled, bool checkable, bool checked, bool is_default, [UTF8] String shortcut) => ()
update_menu_item(i32 menu_id, i32 identifier, i32 submenu_id, [UTF8] String text, bool enabled, bool checkable, bool checked, bool is_default, [UTF8] String shortcut) =|
create_window(
Gfx::IntRect rect,
@ -49,7 +49,7 @@ endpoint WindowServer
destroy_window(i32 window_id) => (Vector<i32> destroyed_window_ids)
set_window_menubar(i32 window_id, i32 menubar_id) => ()
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)