mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 05:37:34 +00:00
Add API's and plumbing for WindowServer clients to make menus.
This commit is contained in:
parent
bb31d961b4
commit
133706d697
17 changed files with 322 additions and 24 deletions
|
@ -230,6 +230,14 @@ public:
|
|||
int gui$get_window_rect(int window_id, GUI_Rect*);
|
||||
int gui$set_window_rect(int window_id, const GUI_Rect*);
|
||||
int gui$set_global_cursor_tracking_enabled(int window_id, bool enabled);
|
||||
int gui$menubar_create();
|
||||
int gui$menubar_destroy(int menubar_id);
|
||||
int gui$menubar_add_menu(int menubar_id, int menu_id);
|
||||
int gui$menu_create(const char* name);
|
||||
int gui$menu_destroy(int menu_id);
|
||||
int gui$menu_add_separator(int menu_id);
|
||||
int gui$menu_add_item(int menu_id, unsigned identifier, const char* text);
|
||||
int gui$set_menubar(int menubar_id);
|
||||
|
||||
DisplayInfo set_video_resolution(int width, int height);
|
||||
|
||||
|
|
|
@ -6,6 +6,7 @@
|
|||
#include <WindowServer/WSMessageLoop.h>
|
||||
#include <WindowServer/WSWindow.h>
|
||||
#include <WindowServer/WSWindowManager.h>
|
||||
#include <WindowServer/WSMenuBar.h>
|
||||
#include <Kernel/BochsVGADevice.h>
|
||||
|
||||
//#define LOG_GUI_SYSCALLS
|
||||
|
@ -284,3 +285,48 @@ DisplayInfo Process::set_video_resolution(int width, int height)
|
|||
BochsVGADevice::the().set_resolution(width, height);
|
||||
return info;
|
||||
}
|
||||
|
||||
int Process::gui$menubar_create()
|
||||
{
|
||||
return WSWindowManager::the().api$menubar_create();
|
||||
}
|
||||
|
||||
int Process::gui$menubar_destroy(int menubar_id)
|
||||
{
|
||||
return WSWindowManager::the().api$menubar_destroy(menubar_id);
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
int Process::gui$menu_add_item(int menu_id, unsigned identifier, const char* text)
|
||||
{
|
||||
if (!validate_read_str(text))
|
||||
return -EFAULT;
|
||||
return WSWindowManager::the().api$menu_add_item(menu_id, identifier, String(text));
|
||||
}
|
||||
|
||||
int Process::gui$set_menubar(int menubar_id)
|
||||
{
|
||||
kprintf("gui$set_menubar %d\n", menubar_id);
|
||||
return WSWindowManager::the().api$app_set_menubar(menubar_id);
|
||||
}
|
||||
|
|
|
@ -223,6 +223,22 @@ 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_create:
|
||||
return current->gui$menubar_create();
|
||||
case Syscall::SC_gui_menubar_destroy:
|
||||
return current->gui$menubar_destroy((int)arg1);
|
||||
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,6 +85,14 @@
|
|||
__ENUMERATE_SYSCALL(rmdir) \
|
||||
__ENUMERATE_SYSCALL(chmod) \
|
||||
__ENUMERATE_SYSCALL(usleep) \
|
||||
__ENUMERATE_SYSCALL(gui_menubar_create) \
|
||||
__ENUMERATE_SYSCALL(gui_menubar_destroy) \
|
||||
__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