| 1 |
#include <QObject> |
| 2 |
|
| 3 |
#include <wayland-client.hpp> |
| 4 |
|
| 5 |
class UkuiDisplay; |
| 6 |
|
| 7 |
UkuiDisplay *ukuiDisplay(); |
| 8 |
|
| 9 |
class UkuiDisplay : public QObject |
| 10 |
{ |
| 11 |
Q_OBJECT |
| 12 |
public: |
| 13 |
~UkuiDisplay(); |
| 14 |
|
| 15 |
bool isInitialized() const; |
| 16 |
|
| 17 |
const wayland::display_t &display() const; |
| 18 |
const wayland::seat_t &seat() const; |
| 19 |
|
| 20 |
wayland::proxy_t bind(const std::string &name, wayland::proxy_t &interface, uint32_t minVersion = 1); |
| 21 |
|
| 22 |
private: |
| 23 |
explicit UkuiDisplay(QObject *parent = nullptr); |
| 24 |
bool init(); |
| 25 |
void handle_global(uint32_t name, const std::string &interface, uint32_t version); |
| 26 |
void handle_global_remove(uint32_t name); |
| 27 |
|
| 28 |
struct WaylandInterface |
| 29 |
{ |
| 30 |
uint32_t name; |
| 31 |
std::string interface; |
| 32 |
uint32_t version; |
| 33 |
}; |
| 34 |
QList<WaylandInterface> globalInterfaces(); |
| 35 |
|
| 36 |
std::unique_ptr<wayland::display_t> m_display; |
| 37 |
wayland::seat_t m_seat; |
| 38 |
wayland::registry_t m_registry; |
| 39 |
|
| 40 |
QList<WaylandInterface> m_globalInterfaces; |
| 41 |
|
| 42 |
bool m_initialized = false; |
| 43 |
|
| 44 |
friend UkuiDisplay * ::ukuiDisplay(); |
| 45 |
}; |