mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 15:37:46 +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:
parent
e84823360d
commit
b4da451c9a
11 changed files with 66 additions and 56 deletions
|
@ -9,6 +9,7 @@
|
|||
|
||||
class WSClientConnection;
|
||||
class WSMenu;
|
||||
class WSMouseEvent;
|
||||
|
||||
class WSWindow final : public WSMessageReceiver, public InlineLinkedListNode<WSWindow> {
|
||||
public:
|
||||
|
@ -78,7 +79,8 @@ public:
|
|||
GraphicsBitmap* last_backing_store() { return m_last_backing_store.ptr(); }
|
||||
|
||||
void set_global_cursor_tracking_enabled(bool);
|
||||
bool global_cursor_tracking() const { return m_global_cursor_tracking_enabled; }
|
||||
void set_automatic_cursor_tracking_enabled(bool enabled) { m_automatic_cursor_tracking_enabled = enabled; }
|
||||
bool global_cursor_tracking() const { return m_global_cursor_tracking_enabled || m_automatic_cursor_tracking_enabled; }
|
||||
|
||||
bool has_alpha_channel() const { return m_has_alpha_channel; }
|
||||
void set_has_alpha_channel(bool value) { m_has_alpha_channel = value; }
|
||||
|
@ -104,12 +106,15 @@ public:
|
|||
WSWindow* m_prev { nullptr };
|
||||
|
||||
private:
|
||||
void handle_mouse_event(const WSMouseEvent&);
|
||||
|
||||
WSClientConnection* m_client { nullptr };
|
||||
WSMessageReceiver* m_internal_owner { nullptr };
|
||||
String m_title;
|
||||
Rect m_rect;
|
||||
WSWindowType m_type { WSWindowType::Normal };
|
||||
bool m_global_cursor_tracking_enabled { false };
|
||||
bool m_automatic_cursor_tracking_enabled { false };
|
||||
bool m_visible { true };
|
||||
bool m_has_alpha_channel { false };
|
||||
bool m_has_painted_since_last_resize { false };
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue