Deskflow 1.26.0.0
Keyboard and mouse sharing utility
Loading...
Searching...
No Matches
XWindowsEventQueueBuffer.h
Go to the documentation of this file.
1/*
2 * Deskflow -- mouse and keyboard sharing utility
3 * SPDX-FileCopyrightText: (C) 2026 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
12
13#include <mutex>
14#include <vector>
15
16#include <X11/Xlib.h>
17
18class IEventQueue;
19
22{
23public:
24 XWindowsEventQueueBuffer(Display *, Window, IEventQueue *events);
28
31
32 // IEventQueueBuffer overrides
33 void init() override
34 {
35 // do nothing
36 }
37 void waitForEvent(double timeout) override;
38 Type getEvent(Event &event, uint32_t &dataID) override;
39 bool addEvent(uint32_t dataID) override;
40 bool isEmpty() const override;
41
42private:
43 void flush();
44
45 int getPendingCountLocked();
46
47private:
48 using EventList = std::vector<XEvent>;
49
50 mutable std::mutex m_mutex;
51 Display *m_display;
52 Window m_window;
53 Atom m_userEvent;
54 XEvent m_event;
55 EventList m_postedEvents;
56 bool m_waiting = false;
57 int m_pipefd[2];
58 IEventQueue *m_events;
59};
static fd_set FAR fd_set FAR fd_set FAR const struct timeval FAR * timeout
Definition ArchNetworkWinsock.cpp:40
Event.
Definition Event.h:29
Event queue buffer interface.
Definition IEventQueueBuffer.h:22
Type
Definition IEventQueueBuffer.h:26
Event queue interface.
Definition IEventQueue.h:29
~XWindowsEventQueueBuffer() override
Definition XWindowsEventQueueBuffer.cpp:37
XWindowsEventQueueBuffer(XWindowsEventQueueBuffer &&)=delete
Type getEvent(Event &event, uint32_t &dataID) override
Get the next event.
Definition XWindowsEventQueueBuffer.cpp:125
void init() override
Initialize.
Definition XWindowsEventQueueBuffer.h:33
XWindowsEventQueueBuffer(XWindowsEventQueueBuffer const &)=delete
XWindowsEventQueueBuffer & operator=(XWindowsEventQueueBuffer const &)=delete
XWindowsEventQueueBuffer & operator=(XWindowsEventQueueBuffer &&)=delete
bool isEmpty() const override
Check if event queue buffer is empty.
Definition XWindowsEventQueueBuffer.cpp:180
bool addEvent(uint32_t dataID) override
Post an event.
Definition XWindowsEventQueueBuffer.cpp:145
void waitForEvent(double timeout) override
Block waiting for an event.
Definition XWindowsEventQueueBuffer.cpp:50
XWindowsEventQueueBuffer(Display *, Window, IEventQueue *events)
Definition XWindowsEventQueueBuffer.cpp:23