2015-02-09 15:28:37 +03:00
|
|
|
/********************************************************************
|
|
|
|
KWin - the KDE window manager
|
|
|
|
This file is part of the KDE project.
|
|
|
|
|
|
|
|
Copyright (C) 2015 Martin Gräßlin <mgraesslin@kde.org>
|
|
|
|
|
|
|
|
This program is free software; you can redistribute it and/or modify
|
|
|
|
it under the terms of the GNU General Public License as published by
|
|
|
|
the Free Software Foundation; either version 2 of the License, or
|
|
|
|
(at your option) any later version.
|
|
|
|
|
|
|
|
This program is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
GNU General Public License for more details.
|
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
|
|
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
*********************************************************************/
|
|
|
|
#ifndef KWIN_WAYLAND_SERVER_H
|
|
|
|
#define KWIN_WAYLAND_SERVER_H
|
|
|
|
|
|
|
|
#include <kwinglobals.h>
|
|
|
|
|
|
|
|
#include <QObject>
|
|
|
|
|
2015-08-17 10:42:12 +03:00
|
|
|
class QThread;
|
2015-05-18 12:23:45 +03:00
|
|
|
class QWindow;
|
|
|
|
|
2015-02-09 15:28:37 +03:00
|
|
|
namespace KWayland
|
|
|
|
{
|
2015-04-02 15:37:23 +03:00
|
|
|
namespace Client
|
|
|
|
{
|
|
|
|
class ConnectionThread;
|
2015-08-14 10:28:46 +03:00
|
|
|
class Registry;
|
2015-04-02 15:37:23 +03:00
|
|
|
class ShmPool;
|
2015-05-18 12:23:45 +03:00
|
|
|
class Surface;
|
2015-04-02 15:37:23 +03:00
|
|
|
}
|
2015-02-09 15:28:37 +03:00
|
|
|
namespace Server
|
|
|
|
{
|
2015-02-25 16:15:32 +03:00
|
|
|
class ClientConnection;
|
2015-02-09 15:28:37 +03:00
|
|
|
class CompositorInterface;
|
|
|
|
class Display;
|
|
|
|
class ShellInterface;
|
|
|
|
class SeatInterface;
|
2015-05-21 10:59:45 +03:00
|
|
|
class SurfaceInterface;
|
2015-02-09 15:28:37 +03:00
|
|
|
class OutputInterface;
|
2015-06-09 20:10:56 +03:00
|
|
|
class PlasmaShellInterface;
|
2015-06-13 02:48:11 +03:00
|
|
|
class PlasmaWindowManagementInterface;
|
2015-06-10 01:59:53 +03:00
|
|
|
class QtSurfaceExtensionInterface;
|
2015-02-09 15:28:37 +03:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
namespace KWin
|
|
|
|
{
|
2015-03-04 11:21:10 +03:00
|
|
|
class ShellClient;
|
2015-02-09 15:28:37 +03:00
|
|
|
|
2015-03-20 16:41:03 +03:00
|
|
|
class AbstractBackend;
|
2015-06-16 07:50:22 +03:00
|
|
|
class AbstractClient;
|
2015-03-20 16:41:03 +03:00
|
|
|
|
2015-02-09 15:28:37 +03:00
|
|
|
class KWIN_EXPORT WaylandServer : public QObject
|
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
public:
|
|
|
|
virtual ~WaylandServer();
|
|
|
|
void init(const QByteArray &socketName = QByteArray());
|
2015-02-20 16:54:21 +03:00
|
|
|
void initOutputs();
|
2015-02-09 15:28:37 +03:00
|
|
|
|
|
|
|
KWayland::Server::Display *display() {
|
|
|
|
return m_display;
|
|
|
|
}
|
|
|
|
KWayland::Server::CompositorInterface *compositor() {
|
|
|
|
return m_compositor;
|
|
|
|
}
|
|
|
|
KWayland::Server::SeatInterface *seat() {
|
|
|
|
return m_seat;
|
|
|
|
}
|
|
|
|
KWayland::Server::ShellInterface *shell() {
|
|
|
|
return m_shell;
|
|
|
|
}
|
2015-07-09 10:10:33 +03:00
|
|
|
KWayland::Server::PlasmaWindowManagementInterface *windowManagement() {
|
|
|
|
return m_windowManagement;
|
|
|
|
}
|
2015-03-04 11:21:10 +03:00
|
|
|
QList<ShellClient*> clients() const {
|
|
|
|
return m_clients;
|
|
|
|
}
|
2015-05-21 11:35:03 +03:00
|
|
|
QList<ShellClient*> internalClients() const {
|
|
|
|
return m_internalClients;
|
|
|
|
}
|
2015-03-04 11:21:10 +03:00
|
|
|
void removeClient(ShellClient *c);
|
2015-05-18 15:51:40 +03:00
|
|
|
ShellClient *findClient(quint32 id) const;
|
2015-06-09 20:10:56 +03:00
|
|
|
ShellClient *findClient(KWayland::Server::SurfaceInterface *surface) const;
|
2015-08-17 15:56:15 +03:00
|
|
|
ShellClient *findClient(QWindow *w) const;
|
2015-02-09 15:28:37 +03:00
|
|
|
|
2015-03-20 16:41:03 +03:00
|
|
|
AbstractBackend *backend() const {
|
|
|
|
return m_backend;
|
|
|
|
}
|
|
|
|
void installBackend(AbstractBackend *backend);
|
|
|
|
void uninstallBackend(AbstractBackend *backend);
|
|
|
|
|
2015-02-25 16:15:32 +03:00
|
|
|
/**
|
|
|
|
* @returns file descriptor for Xwayland to connect to.
|
|
|
|
**/
|
|
|
|
int createXWaylandConnection();
|
|
|
|
|
2015-06-13 05:06:12 +03:00
|
|
|
/**
|
|
|
|
* @returns file descriptor to the input method server's socket.
|
|
|
|
**/
|
|
|
|
int createInputMethodConnection();
|
|
|
|
|
2015-04-02 15:37:23 +03:00
|
|
|
void createInternalConnection();
|
2015-06-13 02:48:11 +03:00
|
|
|
void initWorkspace();
|
2015-02-25 16:46:30 +03:00
|
|
|
|
2015-04-02 10:49:39 +03:00
|
|
|
KWayland::Server::ClientConnection *xWaylandConnection() const {
|
|
|
|
return m_xwaylandConnection;
|
|
|
|
}
|
2015-06-13 05:06:12 +03:00
|
|
|
KWayland::Server::ClientConnection *inputMethodConnection() const {
|
|
|
|
return m_inputMethodServerConnection;
|
|
|
|
}
|
2015-04-02 15:37:23 +03:00
|
|
|
KWayland::Server::ClientConnection *internalConnection() const {
|
|
|
|
return m_internalConnection.server;
|
|
|
|
}
|
|
|
|
KWayland::Client::ShmPool *internalShmPool() {
|
|
|
|
return m_internalConnection.shm;
|
|
|
|
}
|
|
|
|
KWayland::Client::ConnectionThread *internalClientConection() {
|
|
|
|
return m_internalConnection.client;
|
|
|
|
}
|
2015-08-14 10:28:46 +03:00
|
|
|
KWayland::Client::Registry *internalClientRegistry() {
|
|
|
|
return m_internalConnection.registry;
|
|
|
|
}
|
2015-05-18 12:33:00 +03:00
|
|
|
void dispatch();
|
2015-05-21 10:59:45 +03:00
|
|
|
quint32 createWindowId(KWayland::Server::SurfaceInterface *surface);
|
2015-04-02 10:49:39 +03:00
|
|
|
|
2015-03-04 11:21:10 +03:00
|
|
|
Q_SIGNALS:
|
2015-10-05 18:35:53 +03:00
|
|
|
void shellClientAdded(KWin::ShellClient*);
|
|
|
|
void shellClientRemoved(KWin::ShellClient*);
|
2015-03-04 11:21:10 +03:00
|
|
|
|
2015-02-09 15:28:37 +03:00
|
|
|
private:
|
2015-05-21 10:59:45 +03:00
|
|
|
quint16 createClientId(KWayland::Server::ClientConnection *c);
|
2015-02-09 15:28:37 +03:00
|
|
|
KWayland::Server::Display *m_display = nullptr;
|
|
|
|
KWayland::Server::CompositorInterface *m_compositor = nullptr;
|
|
|
|
KWayland::Server::SeatInterface *m_seat = nullptr;
|
|
|
|
KWayland::Server::ShellInterface *m_shell = nullptr;
|
2015-06-09 20:10:56 +03:00
|
|
|
KWayland::Server::PlasmaShellInterface *m_plasmaShell = nullptr;
|
2015-06-13 02:48:11 +03:00
|
|
|
KWayland::Server::PlasmaWindowManagementInterface *m_windowManagement = nullptr;
|
2015-06-10 01:59:53 +03:00
|
|
|
KWayland::Server::QtSurfaceExtensionInterface *m_qtExtendedSurface = nullptr;
|
2015-02-25 16:15:32 +03:00
|
|
|
KWayland::Server::ClientConnection *m_xwaylandConnection = nullptr;
|
2015-06-13 05:06:12 +03:00
|
|
|
KWayland::Server::ClientConnection *m_inputMethodServerConnection = nullptr;
|
2015-04-02 15:37:23 +03:00
|
|
|
struct {
|
|
|
|
KWayland::Server::ClientConnection *server = nullptr;
|
|
|
|
KWayland::Client::ConnectionThread *client = nullptr;
|
2015-08-17 10:42:12 +03:00
|
|
|
QThread *clientThread = nullptr;
|
2015-08-14 10:28:46 +03:00
|
|
|
KWayland::Client::Registry *registry = nullptr;
|
2015-04-02 15:37:23 +03:00
|
|
|
KWayland::Client::ShmPool *shm = nullptr;
|
|
|
|
|
|
|
|
} m_internalConnection;
|
2015-03-20 16:41:03 +03:00
|
|
|
AbstractBackend *m_backend = nullptr;
|
2015-03-04 11:21:10 +03:00
|
|
|
QList<ShellClient*> m_clients;
|
2015-05-21 11:35:03 +03:00
|
|
|
QList<ShellClient*> m_internalClients;
|
2015-05-21 10:59:45 +03:00
|
|
|
QHash<KWayland::Server::ClientConnection*, quint16> m_clientIds;
|
2015-02-09 15:28:37 +03:00
|
|
|
KWIN_SINGLETON(WaylandServer)
|
|
|
|
};
|
|
|
|
|
|
|
|
inline
|
|
|
|
WaylandServer *waylandServer() {
|
|
|
|
return WaylandServer::self();
|
|
|
|
}
|
|
|
|
|
|
|
|
} // namespace KWin
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|