| 1 | // LAF OS Library | 
|---|
| 2 | // Copyright (C) 2021-2022  Igara Studio S.A. | 
|---|
| 3 | // Copyright (C) 2016-2018  David Capello | 
|---|
| 4 | // | 
|---|
| 5 | // This file is released under the terms of the MIT license. | 
|---|
| 6 | // Read LICENSE.txt for more information. | 
|---|
| 7 |  | 
|---|
| 8 | #ifndef OS_X11_EVENT_QUEUE_INCLUDED | 
|---|
| 9 | #define OS_X11_EVENT_QUEUE_INCLUDED | 
|---|
| 10 | #pragma once | 
|---|
| 11 |  | 
|---|
| 12 | #include "base/concurrent_queue.h" | 
|---|
| 13 | #include "os/event.h" | 
|---|
| 14 | #include "os/event_queue.h" | 
|---|
| 15 | #include "os/x11/x11.h" | 
|---|
| 16 |  | 
|---|
| 17 | #include <deque> | 
|---|
| 18 |  | 
|---|
| 19 | namespace os { | 
|---|
| 20 |  | 
|---|
| 21 | class EventQueueX11 : public EventQueue { | 
|---|
| 22 | public: | 
|---|
| 23 | void queueEvent(const Event& ev) override; | 
|---|
| 24 | void getEvent(Event& ev, double timeout) override; | 
|---|
| 25 | void clearEvents() override; | 
|---|
| 26 |  | 
|---|
| 27 | bool isEmpty() const { return m_events.empty(); } | 
|---|
| 28 |  | 
|---|
| 29 | private: | 
|---|
| 30 | void processX11Event(XEvent& event); | 
|---|
| 31 |  | 
|---|
| 32 | base::concurrent_queue<Event> m_events; | 
|---|
| 33 | }; | 
|---|
| 34 |  | 
|---|
| 35 | using EventQueueImpl = EventQueueX11; | 
|---|
| 36 |  | 
|---|
| 37 | } // namespace os | 
|---|
| 38 |  | 
|---|
| 39 | #endif | 
|---|
| 40 |  | 
|---|