mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 14:27:35 +00:00
Make it possible for userspace to alter window title/geometry.
I'm not in love with this syscall API but it allows me to make progress.
This commit is contained in:
parent
8eae89a405
commit
dbe83f3a83
11 changed files with 78 additions and 17 deletions
|
@ -26,7 +26,7 @@ struct GUI_Rect {
|
|||
GUI_Size size;
|
||||
};
|
||||
|
||||
struct GUI_CreateWindowParameters {
|
||||
struct GUI_WindowParameters {
|
||||
GUI_Rect rect;
|
||||
Color background_color;
|
||||
unsigned flags { 0 };
|
||||
|
|
|
@ -192,10 +192,12 @@ public:
|
|||
Unix::clock_t sys$times(Unix::tms*);
|
||||
int sys$utime(const char* pathname, const struct Unix::utimbuf*);
|
||||
|
||||
int gui$create_window(const GUI_CreateWindowParameters*);
|
||||
int gui$create_window(const GUI_WindowParameters*);
|
||||
int gui$destroy_window(int window_id);
|
||||
int gui$get_window_backing_store(int window_id, GUI_WindowBackingStoreInfo*);
|
||||
int gui$invalidate_window(int window_id, const GUI_Rect*);
|
||||
int gui$get_window_parameters(int window_id, GUI_WindowParameters*);
|
||||
int gui$set_window_parameters(int window_id, const GUI_WindowParameters*);
|
||||
|
||||
DisplayInfo get_display_info();
|
||||
|
||||
|
|
|
@ -35,7 +35,7 @@ static void wait_for_gui_server()
|
|||
sleep(10);
|
||||
}
|
||||
|
||||
int Process::gui$create_window(const GUI_CreateWindowParameters* user_params)
|
||||
int Process::gui$create_window(const GUI_WindowParameters* user_params)
|
||||
{
|
||||
wait_for_gui_server();
|
||||
|
||||
|
@ -122,3 +122,33 @@ int Process::gui$invalidate_window(int window_id, const GUI_Rect* rect)
|
|||
WSEventLoop::the().server_process().request_wakeup();
|
||||
return 0;
|
||||
}
|
||||
|
||||
int Process::gui$get_window_parameters(int window_id, GUI_WindowParameters* params)
|
||||
{
|
||||
if (window_id < 0)
|
||||
return -EINVAL;
|
||||
if (!validate_write_typed(params))
|
||||
return -EFAULT;
|
||||
auto it = m_windows.find(window_id);
|
||||
if (it == m_windows.end())
|
||||
return -EBADWINDOW;
|
||||
auto& window = *(*it).value;
|
||||
params->rect = window.rect();
|
||||
strcpy(params->title, window.title().characters());
|
||||
return 0;
|
||||
}
|
||||
|
||||
int Process::gui$set_window_parameters(int window_id, const GUI_WindowParameters* params)
|
||||
{
|
||||
if (window_id < 0)
|
||||
return -EINVAL;
|
||||
if (!validate_read_typed(params))
|
||||
return -EFAULT;
|
||||
auto it = m_windows.find(window_id);
|
||||
if (it == m_windows.end())
|
||||
return -EBADWINDOW;
|
||||
auto& window = *(*it).value;
|
||||
window.set_rect(params->rect);
|
||||
window.set_title(params->title);
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -192,13 +192,17 @@ static dword handle(RegisterDump& regs, dword function, dword arg1, dword arg2,
|
|||
case Syscall::SC_sync:
|
||||
return sync();
|
||||
case Syscall::SC_gui_create_window:
|
||||
return current->gui$create_window((const GUI_CreateWindowParameters*)arg1);
|
||||
return current->gui$create_window((const GUI_WindowParameters*)arg1);
|
||||
case Syscall::SC_gui_destroy_window:
|
||||
return current->gui$destroy_window((int)arg1);
|
||||
case Syscall::SC_gui_get_window_backing_store:
|
||||
return current->gui$get_window_backing_store((int)arg1, (GUI_WindowBackingStoreInfo*)arg2);
|
||||
case Syscall::SC_gui_invalidate_window:
|
||||
return current->gui$invalidate_window((int)arg1, (const GUI_Rect*)arg2);
|
||||
case Syscall::SC_gui_set_window_parameters:
|
||||
return current->gui$set_window_parameters((int)arg1, (const GUI_WindowParameters*)arg2);
|
||||
case Syscall::SC_gui_get_window_parameters:
|
||||
return current->gui$get_window_parameters((int)arg1, (GUI_WindowParameters*)arg2);
|
||||
default:
|
||||
kprintf("<%u> int0x80: Unknown function %u requested {%x, %x, %x}\n", current->pid(), function, arg1, arg2, arg3);
|
||||
break;
|
||||
|
|
|
@ -72,6 +72,8 @@
|
|||
__ENUMERATE_SYSCALL(gui_get_window_backing_store) \
|
||||
__ENUMERATE_SYSCALL(gui_invalidate_window) \
|
||||
__ENUMERATE_SYSCALL(select) \
|
||||
__ENUMERATE_SYSCALL(gui_get_window_parameters) \
|
||||
__ENUMERATE_SYSCALL(gui_set_window_parameters) \
|
||||
|
||||
|
||||
struct fd_set;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue