File indexing completed on 2024-04-14 15:33:39

0001 /*
0002     SPDX-FileCopyrightText: 2014 Martin Gräßlin <mgraesslin@kde.org>
0003 
0004 SPDX-License-Identifier: GPL-2.0-or-later
0005 */
0006 #pragma once
0007 
0008 #include <QSocketNotifier>
0009 
0010 #include <wayland-server.h>
0011 
0012 namespace ScreenLocker
0013 {
0014 class WaylandServer : public QObject
0015 {
0016     Q_OBJECT
0017 public:
0018     explicit WaylandServer(QObject *parent = nullptr);
0019     ~WaylandServer() override;
0020     int start();
0021     void stop();
0022 
0023 Q_SIGNALS:
0024     void x11WindowAdded(quint32 window);
0025 
0026 private:
0027     void flush();
0028     void dispatchEvents();
0029 
0030     static void bind(wl_client *client, void *data, uint32_t version, uint32_t id);
0031 
0032     QSocketNotifier *m_notifier = nullptr;
0033     ::wl_display *m_display = nullptr;
0034     ::wl_client *m_greeter = nullptr;
0035     ::wl_global *m_interface = nullptr;
0036 
0037     struct Listener {
0038         ::wl_listener listener;
0039         WaylandServer *server;
0040     } m_listener;
0041 };
0042 
0043 }