diff options
author | Andreas Kling <awesomekling@gmail.com> | 2019-01-27 08:48:34 +0100 |
---|---|---|
committer | Andreas Kling <awesomekling@gmail.com> | 2019-01-27 08:48:34 +0100 |
commit | 069d21ed7f2cf6d5b5f277602b8a969284298b0f (patch) | |
tree | 7337af7a88ca2c469e70b4f74eed28ec54b7eb81 /Kernel/ProcessGUI.cpp | |
parent | 15fad649ea51d25e168e0456b5621beb820e254d (diff) | |
download | serenity-069d21ed7f2cf6d5b5f277602b8a969284298b0f.zip |
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.
Diffstat (limited to 'Kernel/ProcessGUI.cpp')
-rw-r--r-- | Kernel/ProcessGUI.cpp | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/Kernel/ProcessGUI.cpp b/Kernel/ProcessGUI.cpp index adb74b06fb..f5aee91423 100644 --- a/Kernel/ProcessGUI.cpp +++ b/Kernel/ProcessGUI.cpp @@ -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; +} |