mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 20:07:34 +00:00
Make buttons unpress when the cursor leaves the button rect.
Implement this functionality by adding global cursor tracking. It's currently only possible for one GWidget per GWindow to track the cursor.
This commit is contained in:
parent
15fad649ea
commit
069d21ed7f
15 changed files with 105 additions and 7 deletions
|
@ -206,6 +206,7 @@ public:
|
|||
int gui$set_window_title(int window_id, const char* title, size_t size);
|
||||
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);
|
||||
|
||||
DisplayInfo get_display_info();
|
||||
|
||||
|
|
|
@ -244,3 +244,16 @@ int Process::gui$set_window_rect(int window_id, const GUI_Rect* rect)
|
|||
WSMessageLoop::the().server_process().request_wakeup();
|
||||
return 0;
|
||||
}
|
||||
|
||||
int Process::gui$set_global_cursor_tracking_enabled(int window_id, bool enabled)
|
||||
{
|
||||
if (window_id < 0)
|
||||
return -EINVAL;
|
||||
auto it = m_windows.find(window_id);
|
||||
if (it == m_windows.end())
|
||||
return -EBADWINDOW;
|
||||
auto& window = *(*it).value;
|
||||
WSWindowLocker locker(window);
|
||||
window.set_global_cursor_tracking_enabled(enabled);
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -217,6 +217,8 @@ static dword handle(RegisterDump& regs, dword function, dword arg1, dword arg2,
|
|||
return current->sys$read_tsc((dword*)arg1, (dword*)arg2);
|
||||
case Syscall::SC_gui_notify_paint_finished:
|
||||
return current->gui$notify_paint_finished((int)arg1, (const GUI_Rect*)arg2);
|
||||
case Syscall::SC_gui_set_global_cursor_tracking_enabled:
|
||||
return current->gui$set_global_cursor_tracking_enabled((int)arg1, (bool)arg2);
|
||||
default:
|
||||
kprintf("<%u> int0x80: Unknown function %u requested {%x, %x, %x}\n", current->pid(), function, arg1, arg2, arg3);
|
||||
break;
|
||||
|
|
|
@ -81,6 +81,7 @@
|
|||
__ENUMERATE_SYSCALL(gui_get_window_rect) \
|
||||
__ENUMERATE_SYSCALL(gui_set_window_rect) \
|
||||
__ENUMERATE_SYSCALL(gui_notify_paint_finished) \
|
||||
__ENUMERATE_SYSCALL(gui_set_global_cursor_tracking_enabled) \
|
||||
|
||||
|
||||
#ifdef SERENITY
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue