[wayland] Add support for PlasmaWindowManagement interface

So far this only allows to trigger show desktop functionality and exports
the state.

In future this should be restricted to just one dedicated desktop shell
process.
This commit is contained in:
Martin Gräßlin 2015-06-13 01:48:11 +02:00
parent 01ac0abfd7
commit 859a3bb598
3 changed files with 46 additions and 0 deletions

View file

@ -597,6 +597,7 @@ KWIN_EXPORT int kdemain(int argc, char * argv[])
server->backend()->setInitialWindowSize(initialWindowSize);
}
QObject::connect(&a, &KWin::Application::workspaceCreated, server, &KWin::WaylandServer::initWorkspace);
a.setStartXwayland(parser.isSet(xwaylandOption));
a.setApplicationsToStart(parser.positionalArguments());
a.setInputMethodServerToStart(parser.value(inputMethodOption));

View file

@ -34,6 +34,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include <KWayland/Server/display.h>
#include <KWayland/Server/output_interface.h>
#include <KWayland/Server/plasmashell_interface.h>
#include <KWayland/Server/plasmawindowmanagement_interface.h>
#include <KWayland/Server/qtsurfaceextension_interface.h>
#include <KWayland/Server/seat_interface.h>
#include <KWayland/Server/shell_interface.h>
@ -156,6 +157,47 @@ void WaylandServer::init(const QByteArray &socketName)
}
}
);
m_windowManagement = m_display->createPlasmaWindowManagement(m_display);
m_windowManagement->create();
m_windowManagement->setShowingDesktopState(PlasmaWindowManagementInterface::ShowingDesktopState::Disabled);
connect(m_windowManagement, &PlasmaWindowManagementInterface::requestChangeShowingDesktop, this,
[] (PlasmaWindowManagementInterface::ShowingDesktopState state) {
if (!workspace()) {
return;
}
bool set = false;
switch (state) {
case PlasmaWindowManagementInterface::ShowingDesktopState::Disabled:
set = false;
break;
case PlasmaWindowManagementInterface::ShowingDesktopState::Enabled:
set = true;
break;
default:
Q_UNREACHABLE();
break;
}
if (set == workspace()->showingDesktop()) {
return;
}
workspace()->setShowingDesktop(set);
}
);
}
void WaylandServer::initWorkspace()
{
if (m_windowManagement) {
connect(workspace(), &Workspace::showingDesktopChanged, this,
[this] (bool set) {
using namespace KWayland::Server;
m_windowManagement->setShowingDesktopState(set ?
PlasmaWindowManagementInterface::ShowingDesktopState::Enabled :
PlasmaWindowManagementInterface::ShowingDesktopState::Disabled
);
}
);
}
}
void WaylandServer::initOutputs()

View file

@ -44,6 +44,7 @@ class SeatInterface;
class SurfaceInterface;
class OutputInterface;
class PlasmaShellInterface;
class PlasmaWindowManagementInterface;
class QtSurfaceExtensionInterface;
}
}
@ -106,6 +107,7 @@ public:
int createQtConnection();
void createInternalConnection();
void createDummyQtWindow();
void initWorkspace();
KWayland::Server::ClientConnection *xWaylandConnection() const {
return m_xwaylandConnection;
@ -140,6 +142,7 @@ private:
KWayland::Server::SeatInterface *m_seat = nullptr;
KWayland::Server::ShellInterface *m_shell = nullptr;
KWayland::Server::PlasmaShellInterface *m_plasmaShell = nullptr;
KWayland::Server::PlasmaWindowManagementInterface *m_windowManagement = nullptr;
KWayland::Server::QtSurfaceExtensionInterface *m_qtExtendedSurface = nullptr;
KWayland::Server::ClientConnection *m_xwaylandConnection = nullptr;
KWayland::Server::ClientConnection *m_inputMethodServerConnection = nullptr;