1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 08:48:11 +00:00

WindowServer+LibGUI: Implement automatic cursor tracking.

When a mouse button is pressed inside a window, put that window into an
automatic mouse tracking state where all mouse events are sent to that
window until all mouse buttons are released.

This might feel even better if it only cared about the mouse buttons you
actually pressed while *inside* the windows to get released, I don't know.
I'll have to use it for a while and see how it's like.
This commit is contained in:
Andreas Kling 2019-03-24 15:01:56 +01:00
parent e84823360d
commit b4da451c9a
11 changed files with 66 additions and 56 deletions

View file

@ -65,6 +65,10 @@ public:
GWidget* global_cursor_tracking_widget() { return m_global_cursor_tracking_widget.ptr(); }
const GWidget* global_cursor_tracking_widget() const { return m_global_cursor_tracking_widget.ptr(); }
void set_automatic_cursor_tracking_widget(GWidget*);
GWidget* automatic_cursor_tracking_widget() { return m_automatic_cursor_tracking_widget.ptr(); }
const GWidget* automatic_cursor_tracking_widget() const { return m_automatic_cursor_tracking_widget.ptr(); }
bool should_exit_event_loop_on_close() const { return m_should_exit_app_on_close; }
void set_should_exit_event_loop_on_close(bool b) { m_should_exit_app_on_close = b; }
@ -96,6 +100,7 @@ private:
GWidget* m_main_widget { nullptr };
GWidget* m_focused_widget { nullptr };
WeakPtr<GWidget> m_global_cursor_tracking_widget;
WeakPtr<GWidget> m_automatic_cursor_tracking_widget;
WeakPtr<GWidget> m_hovered_widget;
Rect m_rect_when_windowless;
String m_title_when_windowless;