Deskflow 1.24.0.365
Keyboard and mouse sharing utility
Loading...
Searching...
No Matches
IEventQueue.h
Go to the documentation of this file.
1/*
2 * Deskflow -- mouse and keyboard sharing utility
3 * SPDX-FileCopyrightText: (C) 2025 Deskflow Developers
4 * SPDX-FileCopyrightText: (C) 2012 - 2016 Symless Ltd.
5 * SPDX-FileCopyrightText: (C) 2004 Chris Schoeneman
6 * SPDX-License-Identifier: GPL-2.0-only WITH LicenseRef-OpenSSL-Exception
7 */
8
9#pragma once
10
11#include "base/Event.h"
12
13#include <functional>
14
16
17// Opaque type for timer info. This is defined by subclasses of
18// IEventQueueBuffer.
19class EventQueueTimer;
20
22
29{
30public:
31 using EventHandler = std::function<void(const Event &)>;
32
33 virtual ~IEventQueue() = default;
35 {
36 public:
38 uint32_t m_count;
39 };
40
42
43
45
48 virtual void loop() = 0;
49
51
55 virtual void adoptBuffer(IEventQueueBuffer *) = 0;
56
58
63 virtual bool getEvent(Event &event, double timeout = -1.0) = 0;
64
66
73 virtual bool dispatchEvent(const Event &event) = 0;
74
76
79 virtual void addEvent(Event &&event) = 0;
80
82
97 virtual EventQueueTimer *newTimer(double duration, void *target) = 0;
98
100
110 virtual EventQueueTimer *newOneShotTimer(double duration, void *target) = 0;
111
113
117 virtual void deleteTimer(EventQueueTimer *) = 0;
118
120
127 virtual void addHandler(EventTypes type, void *target, const EventHandler &handler) = 0;
128
130
134 virtual void removeHandler(EventTypes type, void *target) = 0;
135
137
140 virtual void removeHandlers(void *target) = 0;
141
143
147 virtual void waitForReady() const = 0;
148
150
152
154
157 virtual void *getSystemTarget() = 0;
158
160};
static fd_set FAR fd_set FAR fd_set FAR const struct timeval FAR * timeout
Definition ArchNetworkWinsock.cpp:40
static int type
Definition ArchNetworkWinsock.cpp:45
Definition EventQueueTimer.h:12
Event.
Definition Event.h:29
Event queue buffer interface.
Definition IEventQueueBuffer.h:22
Definition IEventQueue.h:35
EventQueueTimer * m_timer
The timer.
Definition IEventQueue.h:37
uint32_t m_count
Number of repeats.
Definition IEventQueue.h:38
Event queue interface.
Definition IEventQueue.h:29
virtual void addHandler(EventTypes type, void *target, const EventHandler &handler)=0
Register an event handler for an event type.
virtual EventQueueTimer * newTimer(double duration, void *target)=0
Create a recurring timer.
virtual void waitForReady() const =0
Wait for event queue to become ready.
std::function< void(const Event &)> EventHandler
Definition IEventQueue.h:31
virtual bool getEvent(Event &event, double timeout=-1.0)=0
Remove event from queue.
virtual void removeHandler(EventTypes type, void *target)=0
Unregister an event handler for an event type.
virtual ~IEventQueue()=default
virtual EventQueueTimer * newOneShotTimer(double duration, void *target)=0
Create a one-shot timer.
virtual void removeHandlers(void *target)=0
Unregister all event handlers for an event target.
virtual void deleteTimer(EventQueueTimer *)=0
Destroy a timer.
virtual bool dispatchEvent(const Event &event)=0
Dispatch an event.
virtual void * getSystemTarget()=0
Get the system event type target.
virtual void loop()=0
Loop the event queue until quit.
virtual void adoptBuffer(IEventQueueBuffer *)=0
Set the buffer.
virtual void addEvent(Event &&event)=0
Add event to queue.
EventTypes
Definition EventTypes.h:13