1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 11:08:11 +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:
Andreas Kling 2019-01-27 08:48:34 +01:00
parent 15fad649ea
commit 069d21ed7f
15 changed files with 105 additions and 7 deletions

View file

@ -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;
}