mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 15:47:45 +00:00
WindowServer: Refactor more of the menu APIs to be message-based.
This is all pretty verbose but I can whittle it down later. :^)
This commit is contained in:
parent
fbbf57b61c
commit
cf432b4c3d
13 changed files with 229 additions and 171 deletions
|
@ -70,6 +70,10 @@ struct GUI_ServerMessage {
|
|||
MenuItemActivated,
|
||||
DidCreateMenubar,
|
||||
DidDestroyMenubar,
|
||||
DidCreateMenu,
|
||||
DidDestroyMenu,
|
||||
DidAddMenuToMenubar,
|
||||
DidSetApplicationMenubar,
|
||||
};
|
||||
Type type { Invalid };
|
||||
int window_id { -1 };
|
||||
|
@ -104,6 +108,10 @@ struct GUI_ClientMessage {
|
|||
Invalid,
|
||||
CreateMenubar,
|
||||
DestroyMenubar,
|
||||
CreateMenu,
|
||||
DestroyMenu,
|
||||
AddMenuToMenubar,
|
||||
SetApplicationMenubar,
|
||||
};
|
||||
Type type { Invalid };
|
||||
int window_id { -1 };
|
||||
|
@ -112,6 +120,9 @@ struct GUI_ClientMessage {
|
|||
struct {
|
||||
int menubar_id;
|
||||
int menu_id;
|
||||
unsigned identifier;
|
||||
unsigned text_length;
|
||||
char text[256];
|
||||
} menu;
|
||||
};
|
||||
};
|
||||
|
|
|
@ -292,23 +292,6 @@ DisplayInfo Process::set_video_resolution(int width, int height)
|
|||
return info;
|
||||
}
|
||||
|
||||
int Process::gui$menubar_add_menu(int menubar_id, int menu_id)
|
||||
{
|
||||
return WSWindowManager::the().api$menubar_add_menu(menubar_id, menu_id);
|
||||
}
|
||||
|
||||
int Process::gui$menu_create(const char* name)
|
||||
{
|
||||
if (!validate_read_str(name))
|
||||
return -EFAULT;
|
||||
return WSWindowManager::the().api$menu_create(String(name));
|
||||
}
|
||||
|
||||
int Process::gui$menu_destroy(int menu_id)
|
||||
{
|
||||
return WSWindowManager::the().api$menu_destroy(menu_id);
|
||||
}
|
||||
|
||||
int Process::gui$menu_add_separator(int menu_id)
|
||||
{
|
||||
return WSWindowManager::the().api$menu_add_separator(menu_id);
|
||||
|
@ -320,8 +303,3 @@ int Process::gui$menu_add_item(int menu_id, unsigned identifier, const char* tex
|
|||
return -EFAULT;
|
||||
return WSWindowManager::the().api$menu_add_item(menu_id, identifier, String(text));
|
||||
}
|
||||
|
||||
int Process::gui$set_menubar(int menubar_id)
|
||||
{
|
||||
return WSWindowManager::the().api$app_set_menubar(menubar_id);
|
||||
}
|
||||
|
|
|
@ -223,18 +223,10 @@ static dword handle(RegisterDump& regs, dword function, dword arg1, dword arg2,
|
|||
return current->sys$rmdir((const char*)arg1);
|
||||
case Syscall::SC_chmod:
|
||||
return current->sys$chmod((const char*)arg1, (mode_t)arg2);
|
||||
case Syscall::SC_gui_menubar_add_menu:
|
||||
return current->gui$menubar_add_menu((int)arg1, (int)arg2);
|
||||
case Syscall::SC_gui_menu_create:
|
||||
return current->gui$menu_create((const char*)arg1);
|
||||
case Syscall::SC_gui_menu_destroy:
|
||||
return current->gui$menu_destroy((int)arg1);
|
||||
case Syscall::SC_gui_menu_add_separator:
|
||||
return current->gui$menu_add_separator((int)arg1);
|
||||
case Syscall::SC_gui_menu_add_item:
|
||||
return current->gui$menu_add_item((int)arg1, (unsigned)arg2, (const char*)arg3);
|
||||
case Syscall::SC_gui_app_set_menubar:
|
||||
return current->gui$set_menubar((int)arg1);
|
||||
default:
|
||||
kprintf("<%u> int0x80: Unknown function %u requested {%x, %x, %x}\n", current->pid(), function, arg1, arg2, arg3);
|
||||
break;
|
||||
|
|
|
@ -85,12 +85,8 @@
|
|||
__ENUMERATE_SYSCALL(rmdir) \
|
||||
__ENUMERATE_SYSCALL(chmod) \
|
||||
__ENUMERATE_SYSCALL(usleep) \
|
||||
__ENUMERATE_SYSCALL(gui_menubar_add_menu) \
|
||||
__ENUMERATE_SYSCALL(gui_menu_create) \
|
||||
__ENUMERATE_SYSCALL(gui_menu_destroy) \
|
||||
__ENUMERATE_SYSCALL(gui_menu_add_separator) \
|
||||
__ENUMERATE_SYSCALL(gui_menu_add_item) \
|
||||
__ENUMERATE_SYSCALL(gui_app_set_menubar) \
|
||||
|
||||
|
||||
#ifdef SERENITY
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue