KWayland

event_queue.h
1 /*
2  SPDX-FileCopyrightText: 2014 Martin Gräßlin <[email protected]>
3 
4  SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL
5 */
6 #ifndef WAYLAND_EVENT_QUEUE_H
7 #define WAYLAND_EVENT_QUEUE_H
8 
9 #include <QObject>
10 
11 #include <KWayland/Client/kwaylandclient_export.h>
12 
13 struct wl_display;
14 struct wl_proxy;
15 struct wl_event_queue;
16 
17 namespace KWayland
18 {
19 namespace Client
20 {
21 
22 class ConnectionThread;
23 
55 class KWAYLANDCLIENT_EXPORT EventQueue : public QObject
56 {
57  Q_OBJECT
58 public:
59  explicit EventQueue(QObject *parent = nullptr);
60  virtual ~EventQueue();
61 
70  void setup(wl_display *display);
79  void setup(ConnectionThread *connection);
80 
84  bool isValid();
90  void release();
102  void destroy();
103 
107  void addProxy(wl_proxy *proxy);
111  template <typename wl_interface>
112  void addProxy(wl_interface *proxy);
116  template <typename wl_interface, typename T>
117  void addProxy(T *proxy);
118 
119  operator wl_event_queue*();
120  operator wl_event_queue*() const;
121 
122 public Q_SLOTS:
126  void dispatch();
127 
128 private:
129  class Private;
131 };
132 
133 template <typename wl_interface>
134 inline
135 void EventQueue::addProxy(wl_interface *proxy)
136 {
137  addProxy(reinterpret_cast<wl_proxy*>(proxy));
138 }
139 
140 template <typename wl_interface, typename T>
141 inline
142 void EventQueue::addProxy(T *proxy)
143 {
144  addProxy(reinterpret_cast<wl_proxy*>((wl_interface*)*(proxy)));
145 }
146 
147 }
148 }
149 
150 #endif
Wrapper class for wl_event_queue interface.
Definition: event_queue.h:55
Creates and manages the connection to a Wayland server.
void addProxy(wl_proxy *proxy)
Adds the proxy to the EventQueue.
Definition: event_queue.cpp:76
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Wed Oct 21 2020 22:54:50 by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.