From 1a4c431ae7f04ae26e642fb4bfad11baede7ebd5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Gr=C3=A4=C3=9Flin?= Date: Fri, 19 Jun 2015 04:34:50 +0200 Subject: [PATCH] Request state changes in PlasmaWindow interface --- .../plasmawindowmanagement_interface.cpp | 50 +++++++++++++++++++ .../plasmawindowmanagement_interface.h | 12 +++++ 2 files changed, 62 insertions(+) diff --git a/src/wayland/plasmawindowmanagement_interface.cpp b/src/wayland/plasmawindowmanagement_interface.cpp index 3d8b89a1bf..8b964516fd 100644 --- a/src/wayland/plasmawindowmanagement_interface.cpp +++ b/src/wayland/plasmawindowmanagement_interface.cpp @@ -78,6 +78,8 @@ public: private: static void unbind(wl_resource *resource); static void destroyListenerCallback(wl_listener *listener, void *data); + static void setStateCallback(wl_client *client, wl_resource *resource, uint32_t flags, uint32_t state); + static void setVirtualDesktopCallback(wl_client *client, wl_resource *resource, uint32_t number); static void closeCallback(wl_client *client, wl_resource *resource); static Private *cast(wl_resource *resource) { return reinterpret_cast(wl_resource_get_user_data(resource)); @@ -204,6 +206,8 @@ PlasmaWindowInterface *PlasmaWindowManagementInterface::createWindow(QObject *pa } const struct org_kde_plasma_window_interface PlasmaWindowInterface::Private::s_interface = { + setStateCallback, + setVirtualDesktopCallback, closeCallback }; @@ -343,6 +347,52 @@ void PlasmaWindowInterface::Private::closeCallback(wl_client *client, wl_resourc emit p->q->closeRequested(); } +void PlasmaWindowInterface::Private::setVirtualDesktopCallback(wl_client *client, wl_resource *resource, uint32_t number) +{ + Q_UNUSED(client) + Private *p = cast(resource); + emit p->q->virtualDesktopRequested(number); +} + +void PlasmaWindowInterface::Private::setStateCallback(wl_client *client, wl_resource *resource, uint32_t flags, uint32_t state) +{ + Q_UNUSED(client) + Private *p = cast(resource); + if (flags & ORG_KDE_PLASMA_WINDOW_MANAGEMENT_STATE_ACTIVE) { + emit p->q->activeRequested(state & ORG_KDE_PLASMA_WINDOW_MANAGEMENT_STATE_ACTIVE); + } + if (flags & ORG_KDE_PLASMA_WINDOW_MANAGEMENT_STATE_MINIMIZED) { + emit p->q->minimizedRequested(state & ORG_KDE_PLASMA_WINDOW_MANAGEMENT_STATE_MINIMIZED); + } + if (flags & ORG_KDE_PLASMA_WINDOW_MANAGEMENT_STATE_MAXIMIZED) { + emit p->q->maximizedRequested(state & ORG_KDE_PLASMA_WINDOW_MANAGEMENT_STATE_MAXIMIZED); + } + if (flags & ORG_KDE_PLASMA_WINDOW_MANAGEMENT_STATE_FULLSCREEN) { + emit p->q->fullscreenRequested(state & ORG_KDE_PLASMA_WINDOW_MANAGEMENT_STATE_FULLSCREEN); + } + if (flags & ORG_KDE_PLASMA_WINDOW_MANAGEMENT_STATE_KEEP_ABOVE) { + emit p->q->keepAboveRequested(state & ORG_KDE_PLASMA_WINDOW_MANAGEMENT_STATE_KEEP_ABOVE); + } + if (flags & ORG_KDE_PLASMA_WINDOW_MANAGEMENT_STATE_KEEP_BELOW) { + emit p->q->keepBelowRequested(state & ORG_KDE_PLASMA_WINDOW_MANAGEMENT_STATE_KEEP_BELOW); + } + if (flags & ORG_KDE_PLASMA_WINDOW_MANAGEMENT_STATE_DEMANDS_ATTENTION) { + emit p->q->demandsAttentionRequested(state & ORG_KDE_PLASMA_WINDOW_MANAGEMENT_STATE_DEMANDS_ATTENTION); + } + if (flags & ORG_KDE_PLASMA_WINDOW_MANAGEMENT_STATE_CLOSEABLE) { + emit p->q->closeableRequested(state & ORG_KDE_PLASMA_WINDOW_MANAGEMENT_STATE_CLOSEABLE); + } + if (flags & ORG_KDE_PLASMA_WINDOW_MANAGEMENT_STATE_MINIMIZABLE) { + emit p->q->minimizeableRequested(state & ORG_KDE_PLASMA_WINDOW_MANAGEMENT_STATE_MINIMIZABLE); + } + if (flags & ORG_KDE_PLASMA_WINDOW_MANAGEMENT_STATE_MAXIMIZABLE) { + emit p->q->maximizeableRequested(state & ORG_KDE_PLASMA_WINDOW_MANAGEMENT_STATE_MAXIMIZABLE); + } + if (flags & ORG_KDE_PLASMA_WINDOW_MANAGEMENT_STATE_FULLSCREENABLE) { + emit p->q->fullscreenableRequested(state & ORG_KDE_PLASMA_WINDOW_MANAGEMENT_STATE_FULLSCREENABLE); + } +} + PlasmaWindowInterface::PlasmaWindowInterface(PlasmaWindowManagementInterface *wm, QObject *parent) : QObject(parent) , d(new Private(wm, this)) diff --git a/src/wayland/plasmawindowmanagement_interface.h b/src/wayland/plasmawindowmanagement_interface.h index bed8996d4b..0c5f3b9005 100644 --- a/src/wayland/plasmawindowmanagement_interface.h +++ b/src/wayland/plasmawindowmanagement_interface.h @@ -87,6 +87,18 @@ public: Q_SIGNALS: void closeRequested(); + void virtualDesktopRequested(quint32 desktop); + void activeRequested(bool set); + void minimizedRequested(bool set); + void maximizedRequested(bool set); + void fullscreenRequested(bool set); + void keepAboveRequested(bool set); + void keepBelowRequested(bool set); + void demandsAttentionRequested(bool set); + void closeableRequested(bool set); + void minimizeableRequested(bool set); + void maximizeableRequested(bool set); + void fullscreenableRequested(bool set); private: friend class PlasmaWindowManagementInterface;