2015-02-09 12:28:37 +00: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-05-18 09:23:45 +00:00
|
|
|
class QWindow;
|
|
|
|
|
2015-02-09 12:28:37 +00:00
|
|
|
namespace KWayland
|
|
|
|
{
|
2015-04-02 12:37:23 +00:00
|
|
|
namespace Client
|
|
|
|
{
|
|
|
|
class ConnectionThread;
|
|
|
|
class ShmPool;
|
2015-05-18 09:23:45 +00:00
|
|
|
class Surface;
|
2015-04-02 12:37:23 +00:00
|
|
|
}
|
2015-02-09 12:28:37 +00:00
|
|
|
namespace Server
|
|
|
|
{
|
2015-02-25 13:15:32 +00:00
|
|
|
class ClientConnection;
|
2015-02-09 12:28:37 +00:00
|
|
|
class CompositorInterface;
|
|
|
|
class Display;
|
|
|
|
class ShellInterface;
|
|
|
|
class SeatInterface;
|
2015-05-21 07:59:45 +00:00
|
|
|
class SurfaceInterface;
|
2015-02-09 12:28:37 +00:00
|
|
|
class OutputInterface;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
namespace KWin
|
|
|
|
{
|
2015-03-04 08:21:10 +00:00
|
|
|
class ShellClient;
|
2015-02-09 12:28:37 +00:00
|
|
|
|
2015-03-20 13:41:03 +00:00
|
|
|
class AbstractBackend;
|
|
|
|
|
2015-02-09 12:28:37 +00:00
|
|
|
class KWIN_EXPORT WaylandServer : public QObject
|
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
public:
|
|
|
|
virtual ~WaylandServer();
|
|
|
|
void init(const QByteArray &socketName = QByteArray());
|
2015-02-20 13:54:21 +00:00
|
|
|
void initOutputs();
|
2015-02-09 12:28:37 +00: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-03-04 08:21:10 +00:00
|
|
|
QList<ShellClient*> clients() const {
|
|
|
|
return m_clients;
|
|
|
|
}
|
2015-05-21 08:35:03 +00:00
|
|
|
QList<ShellClient*> internalClients() const {
|
|
|
|
return m_internalClients;
|
|
|
|
}
|
2015-03-04 08:21:10 +00:00
|
|
|
void removeClient(ShellClient *c);
|
2015-05-18 12:51:40 +00:00
|
|
|
ShellClient *findClient(quint32 id) const;
|
2015-02-09 12:28:37 +00:00
|
|
|
|
2015-03-20 13:41:03 +00:00
|
|
|
AbstractBackend *backend() const {
|
|
|
|
return m_backend;
|
|
|
|
}
|
|
|
|
void installBackend(AbstractBackend *backend);
|
|
|
|
void uninstallBackend(AbstractBackend *backend);
|
|
|
|
|
2015-02-25 13:15:32 +00:00
|
|
|
/**
|
|
|
|
* @returns file descriptor for Xwayland to connect to.
|
|
|
|
**/
|
|
|
|
int createXWaylandConnection();
|
|
|
|
|
2015-02-25 13:46:30 +00:00
|
|
|
/**
|
|
|
|
* @returns file descriptor for QtWayland
|
|
|
|
**/
|
|
|
|
int createQtConnection();
|
2015-04-02 12:37:23 +00:00
|
|
|
void createInternalConnection();
|
2015-05-18 09:23:45 +00:00
|
|
|
void createDummyQtWindow();
|
2015-02-25 13:46:30 +00:00
|
|
|
|
2015-04-02 07:49:39 +00:00
|
|
|
KWayland::Server::ClientConnection *xWaylandConnection() const {
|
|
|
|
return m_xwaylandConnection;
|
|
|
|
}
|
2015-05-18 12:51:40 +00:00
|
|
|
KWayland::Server::ClientConnection *qtConnection() const {
|
|
|
|
return m_qtConnection;
|
|
|
|
}
|
2015-04-02 12:37:23 +00: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-05-18 09:33:00 +00:00
|
|
|
void dispatch();
|
2015-05-21 07:59:45 +00:00
|
|
|
quint32 createWindowId(KWayland::Server::SurfaceInterface *surface);
|
2015-04-02 07:49:39 +00:00
|
|
|
|
2015-03-04 08:21:10 +00:00
|
|
|
Q_SIGNALS:
|
|
|
|
void shellClientAdded(ShellClient*);
|
|
|
|
void shellClientRemoved(ShellClient*);
|
|
|
|
|
2015-02-09 12:28:37 +00:00
|
|
|
private:
|
2015-05-18 09:23:45 +00:00
|
|
|
void fakeDummyQtWindowInput();
|
2015-05-21 07:59:45 +00:00
|
|
|
quint16 createClientId(KWayland::Server::ClientConnection *c);
|
2015-02-09 12:28:37 +00: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-02-25 13:15:32 +00:00
|
|
|
KWayland::Server::ClientConnection *m_xwaylandConnection = nullptr;
|
2015-02-25 13:46:30 +00:00
|
|
|
KWayland::Server::ClientConnection *m_qtConnection = nullptr;
|
2015-05-18 09:33:00 +00:00
|
|
|
KWayland::Client::ConnectionThread *m_qtClientConnection = nullptr;
|
2015-04-02 12:37:23 +00:00
|
|
|
struct {
|
|
|
|
KWayland::Server::ClientConnection *server = nullptr;
|
|
|
|
KWayland::Client::ConnectionThread *client = nullptr;
|
|
|
|
KWayland::Client::ShmPool *shm = nullptr;
|
|
|
|
|
|
|
|
} m_internalConnection;
|
2015-03-20 13:41:03 +00:00
|
|
|
AbstractBackend *m_backend = nullptr;
|
2015-03-04 08:21:10 +00:00
|
|
|
QList<ShellClient*> m_clients;
|
2015-05-21 08:35:03 +00:00
|
|
|
QList<ShellClient*> m_internalClients;
|
2015-05-18 09:23:45 +00:00
|
|
|
QScopedPointer<QWindow> m_dummyWindow;
|
|
|
|
KWayland::Client::Surface *m_dummyWindowSurface = nullptr;
|
2015-05-21 07:59:45 +00:00
|
|
|
QHash<KWayland::Server::ClientConnection*, quint16> m_clientIds;
|
2015-02-09 12:28:37 +00:00
|
|
|
KWIN_SINGLETON(WaylandServer)
|
|
|
|
};
|
|
|
|
|
|
|
|
inline
|
|
|
|
WaylandServer *waylandServer() {
|
|
|
|
return WaylandServer::self();
|
|
|
|
}
|
|
|
|
|
|
|
|
} // namespace KWin
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|