File indexing completed on 2022-04-21 12:37:46

0001 /********************************************************************
0002  KSld - the KDE Screenlocker Daemon
0003  This file is part of the KDE project.
0004 
0005  Copyright (C) 2014 Martin Gräßlin <mgraesslin@kde.org>
0006 
0007 This program is free software; you can redistribute it and/or modify
0008 it under the terms of the GNU General Public License as published by
0009 the Free Software Foundation; either version 2 of the License, or
0010 (at your option) any later version.
0011 
0012 This program is distributed in the hope that it will be useful,
0013 but WITHOUT ANY WARRANTY; without even the implied warranty of
0014 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
0015 GNU General Public License for more details.
0016 
0017 You should have received a copy of the GNU General Public License
0018 along with this program.  If not, see <http://www.gnu.org/licenses/>.
0019 *********************************************************************/
0020 #ifndef SCREENLOCKER_WAYLANDSERVER_H
0021 #define SCREENLOCKER_WAYLANDSERVER_H
0022 
0023 #include <QSocketNotifier>
0024 
0025 #include <wayland-server.h>
0026 
0027 namespace ScreenLocker
0028 {
0029 class WaylandServer : public QObject
0030 {
0031     Q_OBJECT
0032 public:
0033     explicit WaylandServer(QObject *parent = nullptr);
0034     ~WaylandServer() override;
0035     int start();
0036     void stop();
0037 
0038 Q_SIGNALS:
0039     void x11WindowAdded(quint32 window);
0040 
0041 private:
0042     void flush();
0043     void dispatchEvents();
0044 
0045     static void bind(wl_client *client, void *data, uint32_t version, uint32_t id);
0046 
0047     QSocketNotifier *m_notifier = nullptr;
0048     ::wl_display *m_display = nullptr;
0049     ::wl_client *m_greeter = nullptr;
0050     ::wl_global *m_interface = nullptr;
0051 
0052     struct Listener {
0053         ::wl_listener listener;
0054         WaylandServer *server;
0055     } m_listener;
0056 };
0057 
0058 }
0059 
0060 #endif