1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 18:57:45 +00:00

Move double click events from LibGUI to the window server

This commit is contained in:
Robin Burchell 2019-05-15 22:17:09 +02:00 committed by Andreas Kling
parent 3cba2a8a78
commit a4b0dfff43
10 changed files with 92 additions and 43 deletions

View file

@ -15,6 +15,7 @@
#include <WindowServer/WSCursor.h>
#include <WindowServer/WSEvent.h>
#include <WindowServer/WSCPUMonitor.h>
#include <LibCore/CElapsedTimer.h>
class WSAPIClientRequest;
class WSScreen;
@ -122,7 +123,8 @@ public:
void start_window_resize(WSWindow&, const WSMouseEvent&);
private:
void process_mouse_event(const WSMouseEvent&, WSWindow*& hovered_window);
void process_mouse_event(WSMouseEvent&, WSWindow*& hovered_window);
void deliver_mouse_event(WSWindow& window, WSMouseEvent& event);
bool process_ongoing_window_resize(const WSMouseEvent&, WSWindow*& hovered_window);
bool process_ongoing_window_drag(const WSMouseEvent&, WSWindow*& hovered_window);
void handle_menu_mouse_event(WSMenu&, const WSMouseEvent&);
@ -171,6 +173,22 @@ private:
HashTable<WSWindow*> m_windows;
InlineLinkedList<WSWindow> m_windows_in_order;
struct DoubleClickInfo
{
CElapsedTimer& click_clock(MouseButton);
void reset() {
m_left_click_clock = CElapsedTimer();
m_right_click_clock = CElapsedTimer();
m_middle_click_clock = CElapsedTimer();
}
WeakPtr<WSWindow> m_clicked_window;
CElapsedTimer m_left_click_clock;
CElapsedTimer m_right_click_clock;
CElapsedTimer m_middle_click_clock;
};
DoubleClickInfo m_double_click_info;
WeakPtr<WSWindow> m_active_window;
WeakPtr<WSWindow> m_hovered_window;
WeakPtr<WSWindow> m_highlight_window;