diff --git a/recipes-kde/kf5/tier1/kwayland/files/0001-do-not-perform-runtime-tests.patch b/recipes-kde/kf5/tier1/kwayland/files/0001-do-not-perform-runtime-tests.patch deleted file mode 100644 index 94fcd59c..00000000 --- a/recipes-kde/kf5/tier1/kwayland/files/0001-do-not-perform-runtime-tests.patch +++ /dev/null @@ -1,30 +0,0 @@ -From da4f66eb232ab3b9dfc2e8c294358641d3ef1348 Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Andreas=20M=C3=BCller?= -Date: Tue, 28 Apr 2015 14:38:24 +0200 -Subject: [PATCH] do not perform runtime tests -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -Upstream-Status: Inappropriate [embedded specific] - -Signed-off-by: Andreas Müller ---- - CMakeLists.txt | 1 - - 1 file changed, 1 deletion(-) - -diff --git a/CMakeLists.txt b/CMakeLists.txt -index ed3d185..08c56b8 100644 ---- a/CMakeLists.txt -+++ b/CMakeLists.txt -@@ -51,7 +51,6 @@ if (IS_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/po") - endif() - add_subdirectory(src) - add_subdirectory(autotests) --add_subdirectory(tests) - - # create a Config.cmake and a ConfigVersion.cmake file and install them - set(CMAKECONFIG_INSTALL_DIR "${CMAKECONFIG_INSTALL_PREFIX}/KF5Wayland") --- -1.9.3 - diff --git a/recipes-kde/kf5/tier1/kwayland/files/0002-PlasmaShell-and-PlasmaSurface-interfaces.patch b/recipes-kde/kf5/tier1/kwayland/files/0002-PlasmaShell-and-PlasmaSurface-interfaces.patch deleted file mode 100644 index b1420f2b..00000000 --- a/recipes-kde/kf5/tier1/kwayland/files/0002-PlasmaShell-and-PlasmaSurface-interfaces.patch +++ /dev/null @@ -1,1132 +0,0 @@ -From 44ade574441cb9516e2d16c9441e58c8eeab4f0a Mon Sep 17 00:00:00 2001 -From: Pier Luigi Fiorini -Date: Sun, 7 Sep 2014 18:01:36 +0200 -Subject: [PATCH 2/4] PlasmaShell and PlasmaSurface interfaces - -Conflicts: - src/client/CMakeLists.txt - src/client/registry.cpp - src/client/registry.h - -+ names of generated header changed ---- - autotests/client/test_wayland_registry.cpp | 1 + - src/client/CMakeLists.txt | 11 ++ - src/client/plasma_shell.cpp | 209 +++++++++++++++++++++++ - src/client/plasma_shell.h | 191 +++++++++++++++++++++ - src/client/plasma_surface.cpp | 264 +++++++++++++++++++++++++++++ - src/client/plasma_surface.h | 210 +++++++++++++++++++++++ - src/client/registry.cpp | 24 +++ - src/client/registry.h | 16 ++ - 8 files changed, 926 insertions(+) - create mode 100644 src/client/plasma_shell.cpp - create mode 100644 src/client/plasma_shell.h - create mode 100644 src/client/plasma_surface.cpp - create mode 100644 src/client/plasma_surface.h - -diff --git a/autotests/client/test_wayland_registry.cpp b/autotests/client/test_wayland_registry.cpp -index d3f6863..7004f5e 100644 ---- a/autotests/client/test_wayland_registry.cpp -+++ b/autotests/client/test_wayland_registry.cpp -@@ -237,6 +237,7 @@ void TestWaylandRegistry::testRemoval() - QVERIFY(registry.hasInterface(KWayland::Client::Registry::Interface::Shm)); - QVERIFY(registry.hasInterface(KWayland::Client::Registry::Interface::SubCompositor)); - QVERIFY(!registry.hasInterface(KWayland::Client::Registry::Interface::FullscreenShell)); -+ QVERIFY(!registry.hasInterface(KWayland::Client::Registry::Interface::PlasmaShell)); - - QSignalSpy seatRemovedSpy(®istry, SIGNAL(seatRemoved(quint32))); - QVERIFY(seatRemovedSpy.isValid()); -diff --git a/src/client/CMakeLists.txt b/src/client/CMakeLists.txt -index b1a1167..b1dfe95 100644 ---- a/src/client/CMakeLists.txt -+++ b/src/client/CMakeLists.txt -@@ -1,3 +1,5 @@ -+include_directories(${Qt5Gui_PRIVATE_INCLUDE_DIRS}) -+ - remove_definitions(-DQT_NO_CAST_FROM_BYTEARRAY) - remove_definitions(-DQT_NO_CAST_FROM_ASCII) - remove_definitions(-DQT_NO_CAST_TO_ASCII) -@@ -14,6 +16,8 @@ set(CLIENT_LIB_SRCS - fullscreen_shell.cpp - keyboard.cpp - output.cpp -+ plasma_shell.cpp -+ plasma_surface.cpp - pointer.cpp - region.cpp - registry.cpp -@@ -30,6 +34,11 @@ ecm_add_wayland_client_protocol(CLIENT_LIB_SRCS - BASENAME fullscreen-shell - ) - -+ecm_add_wayland_client_protocol(CLIENT_LIB_SRCS -+ PROTOCOL ${KWAYLAND_SOURCE_DIR}/src/client/protocols/plasma-shell.xml -+ BASENAME plasma-shell -+) -+ - add_library(KF5WaylandClient ${CLIENT_LIB_SRCS}) - generate_export_header(KF5WaylandClient - BASE_NAME -@@ -72,6 +81,8 @@ install(FILES - fullscreen_shell.h - keyboard.h - output.h -+ plasma_shell.h -+ plasma_surface.h - pointer.h - region.h - registry.h -diff --git a/src/client/plasma_shell.cpp b/src/client/plasma_shell.cpp -new file mode 100644 -index 0000000..1d3a2f5 ---- /dev/null -+++ b/src/client/plasma_shell.cpp -@@ -0,0 +1,209 @@ -+/******************************************************************** -+Copyright 2014 Pier Luigi Fiorini -+Copyright 2014 Martin Gräßlin -+ -+This library is free software; you can redistribute it and/or -+modify it under the terms of the GNU Lesser General Public -+License as published by the Free Software Foundation; either -+version 2.1 of the License, or (at your option) version 3, or any -+later version accepted by the membership of KDE e.V. (or its -+successor approved by the membership of KDE e.V.), which shall -+act as a proxy defined in Section 6 of version 3 of the license. -+ -+This library 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 -+Lesser General Public License for more details. -+ -+You should have received a copy of the GNU Lesser General Public -+License along with this library. If not, see . -+*********************************************************************/ -+ -+#include "plasma_shell.h" -+#include "plasma_surface.h" -+#include "surface.h" -+ -+// Qt -+#include -+#include -+#include -+ -+// wayland -+#include -+#include -+ -+namespace KWayland -+{ -+namespace Client -+{ -+ -+class PlasmaShell::Private -+{ -+public: -+ Private(PlasmaShell *q); -+ -+ void setup(org_kde_plasma_shell *s); -+ -+ org_kde_plasma_shell *shell = Q_NULLPTR; -+ -+private: -+ PlasmaShell *q; -+ -+ void handleLoaded(); -+ -+ static org_kde_plasma_shell_listener s_plasmaShellListener; -+ static void loadedCallback(void *data, org_kde_plasma_shell *shell); -+}; -+ -+org_kde_plasma_shell_listener PlasmaShell::Private::s_plasmaShellListener = { -+ PlasmaShell::Private::loadedCallback -+}; -+ -+PlasmaShell::Private::Private(PlasmaShell *q) -+ : q(q) -+{ -+} -+ -+void PlasmaShell::Private::setup(org_kde_plasma_shell *s) -+{ -+ Q_ASSERT(!shell); -+ Q_ASSERT(s); -+ shell = s; -+ org_kde_plasma_shell_add_listener(shell, &s_plasmaShellListener, this); -+} -+ -+void PlasmaShell::Private::loadedCallback(void *data, org_kde_plasma_shell *shell) -+{ -+ Q_UNUSED(shell); -+ -+ auto s = reinterpret_cast(data); -+ Q_ASSERT(shell == s->shell); -+ s->handleLoaded(); -+} -+ -+void PlasmaShell::Private::handleLoaded() -+{ -+ emit q->loaded(); -+} -+ -+PlasmaShell::PlasmaShell(QObject *parent) -+ : QObject(parent) -+ , d(new Private(this)) -+{ -+} -+ -+PlasmaShell::~PlasmaShell() -+{ -+ release(); -+} -+ -+bool PlasmaShell::isValid() const -+{ -+ return d->shell != Q_NULLPTR; -+} -+ -+PlasmaShell::operator org_kde_plasma_shell*() -+{ -+ return d->shell; -+} -+ -+PlasmaShell::operator org_kde_plasma_shell*() const -+{ -+ return d->shell; -+} -+ -+void PlasmaShell::release() -+{ -+ if (d->shell) { -+ emit interfaceAboutToBeReleased(); -+ org_kde_plasma_shell_destroy(d->shell); -+ } -+} -+ -+void PlasmaShell::destroy() -+{ -+ if (d->shell) { -+ emit interfaceAboutToBeDestroyed(); -+ free(d->shell); -+ d->shell = Q_NULLPTR; -+ } -+} -+ -+void PlasmaShell::setup(org_kde_plasma_shell *s) -+{ -+ d->setup(s); -+} -+ -+PlasmaSurface *PlasmaShell::createSurface(wl_surface *surface, QObject *parent) -+{ -+ Q_ASSERT(d->shell); -+ -+ PlasmaSurface *plasmaSurface = new PlasmaSurface(parent); -+ connect(this, &PlasmaShell::interfaceAboutToBeReleased, plasmaSurface, &PlasmaSurface::release); -+ connect(this, &PlasmaShell::interfaceAboutToBeDestroyed, plasmaSurface, &PlasmaSurface::destroy); -+ plasmaSurface->setup(surface, org_kde_plasma_shell_get_surface(d->shell, surface)); -+ return plasmaSurface; -+} -+ -+PlasmaSurface *PlasmaShell::createSurface(Surface *surface, QObject *parent) -+{ -+ Q_ASSERT(surface); -+ return createSurface(*surface, parent); -+} -+ -+PlasmaSurface *PlasmaShell::createSurface(QWindow *window, QObject *parent) -+{ -+ Q_ASSERT(window); -+ -+ // Platform native interface -+ QPlatformNativeInterface *native = QGuiApplication::platformNativeInterface(); -+ Q_ASSERT(native); -+ -+ // Make sure the compositor won't create a traditional shell surface -+ window->setFlags(Qt::BypassWindowManagerHint); -+ -+ // Create platform window, otherwise we can't get the wl_surface -+ window->winId(); -+ -+ // Get the Wayland surface for this window -+ wl_surface *wlSurface = static_cast( -+ native->nativeResourceForWindow("surface", window)); -+ -+ return createSurface(wlSurface, parent); -+} -+ -+void PlasmaShell::desktopReady() -+{ -+ Q_ASSERT(d->shell); -+ org_kde_plasma_shell_desktop_ready(d->shell); -+} -+ -+void PlasmaShell::present(QList &surfaces) -+{ -+ Q_ASSERT(d->shell); -+ -+ QByteArray buffer; -+ QDataStream stream(&buffer, QIODevice::WriteOnly); -+ for (const wl_surface *surface: surfaces) { -+ stream << surface; -+ } -+ -+ struct wl_array array; -+ array.size = buffer.size(); -+ array.data = static_cast(const_cast(buffer.constData())); -+ array.alloc = 0; -+ -+ org_kde_plasma_shell_present(d->shell, &array); -+} -+ -+void PlasmaShell::present(QList &surfaces) -+{ -+ QList list; -+ for (Surface *surface: surfaces) { -+ list.append(*surface); -+ } -+ present(list); -+} -+ -+} // namespace Client -+} // namespace KWayland -diff --git a/src/client/plasma_shell.h b/src/client/plasma_shell.h -new file mode 100644 -index 0000000..32106fa ---- /dev/null -+++ b/src/client/plasma_shell.h -@@ -0,0 +1,191 @@ -+/******************************************************************** -+Copyright 2014 Pier Luigi Fiorini -+Copyright 2014 Martin Gräßlin -+ -+This library is free software; you can redistribute it and/or -+modify it under the terms of the GNU Lesser General Public -+License as published by the Free Software Foundation; either -+version 2.1 of the License, or (at your option) version 3, or any -+later version accepted by the membership of KDE e.V. (or its -+successor approved by the membership of KDE e.V.), which shall -+act as a proxy defined in Section 6 of version 3 of the license. -+ -+This library 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 -+Lesser General Public License for more details. -+ -+You should have received a copy of the GNU Lesser General Public -+License along with this library. If not, see . -+*********************************************************************/ -+ -+#ifndef WAYLAND_PLASMA_SHELL_H -+#define WAYLAND_PLASMA_SHELL_H -+ -+#include -+ -+#include -+ -+class QWindow; -+ -+struct wl_surface; -+struct org_kde_plasma_shell; -+ -+namespace KWayland -+{ -+namespace Client -+{ -+ -+class PlasmaSurface; -+class Surface; -+ -+/** -+ * @short Wrapper for the org_kde_plasma_shell interface. -+ * -+ * This class provides a convenient wrapper for the org_kde_plasma_shell interface. -+ * It' used to create a PlasmaSurface and perform operations on surfaces like -+ * move, set screen edge or ask the compositor to present surfaces. -+ * -+ * To use this class one needs to interact with the Registry. There are two -+ * possible ways to create the Shell interface: -+ * @code -+ * PlasmaShell *s = registry->createShell(name, version); -+ * @endcode -+ * -+ * This creates the PlasmaShell and sets it up directly. As an alternative this -+ * can also be done in a more low level way: -+ * @code -+ * PlasmaShell *s = new PlasmaShell; -+ * s->setup(registry->bindShell(name, version)); -+ * @endcode -+ * -+ * The PlasmaShell can be used as a drop-in replacement for any wl_shell -+ * pointer as it provides matching cast operators. -+ * -+ * @see Registry -+ * @see PlasmaSurface -+ **/ -+class KWAYLANDCLIENT_EXPORT PlasmaShell : public QObject -+{ -+ Q_OBJECT -+public: -+ explicit PlasmaShell(QObject *parent = Q_NULLPTR); -+ virtual ~PlasmaShell(); -+ -+ /** -+ * @returns @c true if managing a org_kde_plasma_shell. -+ **/ -+ bool isValid() const; -+ /** -+ * Releases the org_kde_plasma_shell interface. -+ * After the interface has been released the PlasmaShell instance is no -+ * longer valid and can be setup with another org_kde_plasma_shell interface. -+ * -+ * Right before the interface is released the signal interfaceAboutToBeReleased is emitted. -+ * @see interfaceAboutToBeReleased -+ **/ -+ void release(); -+ /** -+ * Destroys the data hold by this PlasmaShell. -+ * This method is supposed to be used when the connection to the Wayland -+ * server goes away. If the connection is not valid anymore, it's not -+ * possible to call release anymore as that calls into the Wayland -+ * connection and the call would fail. This method cleans up the data, so -+ * that the instance can be deleted or setup to a new org_kde_plasma_shell interface -+ * once there is a new connection available. -+ * -+ * It is suggested to connect this method to ConnectionThread::connectionDied: -+ * @code -+ * connect(connection, &ConnectionThread::connectionDied, shell, &PlasmaShell::destroyed); -+ * @endcode -+ * -+ * Right before the data is destroyed the signal interfaceAboutToBeDestroyed is emitted. -+ * -+ * @see release -+ * @see interfaceAboutToBeDestroyed -+ **/ -+ void destroy(); -+ /** -+ * Setup this PlasmaShell to manage the @p shell. -+ * When using Registry::createPlasmaShell there is no need to call this -+ * method. -+ **/ -+ void setup(org_kde_plasma_shell *s); -+ -+ /** -+ * Creates a PlasmaSurface for the given @p surface and sets it up. -+ * -+ * @param surface The native surface to create the PlasmaSurface for -+ * @param parent The parent to use for the PlasmaSurface -+ * @returns created PlasmaSurface -+ **/ -+ PlasmaSurface *createSurface(wl_surface *surface, QObject *parent); -+ /** -+ * Creates a ShellSurface for the given @p surface and sets it up. -+ * -+ * @param surface The Surface to create the PlasmaSurface for -+ * @param parent The parent to use for the PlasmaSurface -+ * @returns created PlasmaSurface -+ **/ -+ PlasmaSurface *createSurface(Surface *surface, QObject *parent = Q_NULLPTR); -+ /** -+ * Creates a PlasmaSurface for the given @p window and sets it up. -+ * Native surface for @p window is requested from the QPA native -+ * interface, therefore the user must not use another Wayland connection -+ * besides the one created by QPA (thus implicitely available) such as -+ * the one from ConnectionThread. -+ * -+ * @param window The window to create the PlasmaSurface for -+ * @param parent The parent to use for the PlasmaSurface -+ * @returns created PlasmaSurface -+ **/ -+ PlasmaSurface *createSurface(QWindow *window, QObject *parent = Q_NULLPTR); -+ -+ /** -+ * Inform the Wayland server that the desktop is ready to use. -+ * Compositors often wants to hide the desktop while it is setting -+ * up and fade-in when the desktop is ready. -+ */ -+ void desktopReady(); -+ -+ /** -+ * Present the windows corresponding to the given @p surfaces. -+ * -+ * @param surfaces List of native surfaces to present -+ **/ -+ void present(QList &surfaces); -+ -+ /** -+ * Present the windows corresponding to the given @p surfaces. -+ * -+ * @param surfaces List of surfaces to present -+ **/ -+ void present(QList &surfaces); -+ -+ operator org_kde_plasma_shell*(); -+ operator org_kde_plasma_shell*() const; -+ -+Q_SIGNALS: -+ /** -+ * This signal is emitted right before the interface is going to be released. -+ **/ -+ void interfaceAboutToBeReleased(); -+ /** -+ * This signal is emitted right before the data is going to be destroyed. -+ **/ -+ void interfaceAboutToBeDestroyed(); -+ /** -+ * This signal is emitted when the desktop is started and begins to -+ * create panels and windows. -+ **/ -+ void loaded(); -+ -+private: -+ class Private; -+ QScopedPointer d; -+}; -+ -+} // namespace Client -+} // namespace KWayland -+ -+#endif // WAYLAND_PLASMA_SHELL_H -diff --git a/src/client/plasma_surface.cpp b/src/client/plasma_surface.cpp -new file mode 100644 -index 0000000..eb75d32 ---- /dev/null -+++ b/src/client/plasma_surface.cpp -@@ -0,0 +1,264 @@ -+/******************************************************************** -+Copyright 2014 Pier Luigi Fiorini -+Copyright 2014 Martin Gräßlin -+ -+This library is free software; you can redistribute it and/or -+modify it under the terms of the GNU Lesser General Public -+License as published by the Free Software Foundation; either -+version 2.1 of the License, or (at your option) version 3, or any -+later version accepted by the membership of KDE e.V. (or its -+successor approved by the membership of KDE e.V.), which shall -+act as a proxy defined in Section 6 of version 3 of the license. -+ -+This library 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 -+Lesser General Public License for more details. -+ -+You should have received a copy of the GNU Lesser General Public -+License along with this library. If not, see . -+*********************************************************************/ -+ -+#include "plasma_surface.h" -+#include "output.h" -+ -+// Qt -+#include -+#include -+#include -+ -+// wayland -+#include -+#include -+ -+namespace KWayland -+{ -+namespace Client -+{ -+ -+class PlasmaSurface::Private -+{ -+public: -+ Private(PlasmaSurface *q); -+ -+ wl_surface *wlSurface = Q_NULLPTR; -+ org_kde_plasma_surface *surface = Q_NULLPTR; -+ PlasmaSurface::Role role; -+ PlasmaSurface::Flags flags; -+ PlasmaSurface::ScreenEdge screenEdge; -+ -+private: -+ PlasmaSurface *q; -+}; -+ -+PlasmaSurface::Private::Private(PlasmaSurface *q) -+ : role(PlasmaSurface::Role::Unknown) -+ , q(q) -+{ -+} -+ -+PlasmaSurface::PlasmaSurface(QObject *parent) -+ : QObject(parent) -+ , d(new Private(this)) -+{ -+} -+ -+PlasmaSurface::~PlasmaSurface() -+{ -+ if (d->surface) { -+ org_kde_plasma_surface_destroy(d->surface); -+ } -+} -+ -+bool PlasmaSurface::isValid() const -+{ -+ return d->surface != Q_NULLPTR; -+} -+ -+PlasmaSurface::operator org_kde_plasma_surface*() -+{ -+ return d->surface; -+} -+ -+PlasmaSurface::operator org_kde_plasma_surface*() const -+{ -+ return d->surface; -+} -+ -+PlasmaSurface::operator wl_surface*() -+{ -+ return d->wlSurface; -+} -+ -+PlasmaSurface::operator wl_surface*() const -+{ -+ return d->wlSurface; -+} -+ -+void PlasmaSurface::release() -+{ -+ if (d->surface) { -+ org_kde_plasma_surface_destroy(d->surface); -+ d->surface = Q_NULLPTR; -+ } -+} -+ -+void PlasmaSurface::destroy() -+{ -+ if (d->surface) { -+ free(d->surface); -+ d->surface = Q_NULLPTR; -+ } -+} -+ -+void PlasmaSurface::setOutput(wl_output *output) -+{ -+ Q_ASSERT(d->surface); -+ Q_ASSERT(output); -+ org_kde_plasma_surface_set_output(d->surface, output); -+} -+ -+void PlasmaSurface::setOutput(Output *output) -+{ -+ Q_ASSERT(output); -+ setOutput(*output); -+} -+ -+void PlasmaSurface::setOutput(QScreen *screen) -+{ -+ Q_ASSERT(screen); -+ -+ // Platform native interface -+ QPlatformNativeInterface *native = QGuiApplication::platformNativeInterface(); -+ Q_ASSERT(native); -+ -+ // Get the wl_output -+ wl_output *wlOutput = static_cast( -+ native->nativeResourceForScreen("output", screen)); -+ setOutput(wlOutput); -+} -+ -+void PlasmaSurface::move(const QPoint &pos) -+{ -+ Q_ASSERT(d->surface); -+ org_kde_plasma_surface_set_position(d->surface, pos.x(), pos.y()); -+} -+ -+PlasmaSurface::Role PlasmaSurface::role() const -+{ -+ return d->role; -+} -+ -+void PlasmaSurface::setRole(const Role &role) -+{ -+ Q_ASSERT(d->surface); -+ -+ if (d->role == role) -+ return; -+ -+ quint32 wlRole = ORG_KDE_PLASMA_SURFACE_ROLE_NONE; -+ switch (role) { -+ case Role::Splash: -+ wlRole = ORG_KDE_PLASMA_SURFACE_ROLE_SPLASH; -+ break; -+ case Role::Desktop: -+ wlRole = ORG_KDE_PLASMA_SURFACE_ROLE_DESKTOP; -+ break; -+ case Role::Dashboard: -+ wlRole = ORG_KDE_PLASMA_SURFACE_ROLE_DASHBOARD; -+ break; -+ case Role::Panel: -+ wlRole = ORG_KDE_PLASMA_SURFACE_ROLE_PANEL; -+ break; -+ case Role::Overlay: -+ wlRole = ORG_KDE_PLASMA_SURFACE_ROLE_OVERLAY; -+ break; -+ case Role::Notification: -+ wlRole = ORG_KDE_PLASMA_SURFACE_ROLE_NOTIFICATION; -+ break; -+ case Role::Lock: -+ wlRole = ORG_KDE_PLASMA_SURFACE_ROLE_LOCK; -+ break; -+ default: -+ break; -+ } -+ -+ d->role = role; -+ org_kde_plasma_surface_set_role(d->surface, wlRole); -+ emit roleChanged(role); -+} -+ -+PlasmaSurface::Flags PlasmaSurface::flags() const -+{ -+ return d->flags; -+} -+ -+void PlasmaSurface::setFlags(const Flags &flags) -+{ -+ Q_ASSERT(d->surface); -+ -+ if (d->flags == flags) -+ return; -+ -+ quint32 wlFlags = 0; -+ if (flags & Flag::PanelAlwaysVisible) { -+ wlFlags |= ORG_KDE_PLASMA_SURFACE_FLAG_PANEL_ALWAYS_VISIBLE; -+ } -+ if (flags & Flag::PanelAutoHide) { -+ wlFlags |= ORG_KDE_PLASMA_SURFACE_FLAG_PANEL_AUTO_HIDE; -+ } -+ if (flags & Flag::PanelWindowsCanCover) { -+ wlFlags |= ORG_KDE_PLASMA_SURFACE_FLAG_PANEL_WINDOWS_CAN_COVER; -+ } -+ if (flags & Flag::PanelWindowsGoBelow) { -+ wlFlags |= ORG_KDE_PLASMA_SURFACE_FLAG_PANEL_WINDOWS_GO_BELOW; -+ } -+ -+ d->flags = flags; -+ org_kde_plasma_surface_set_flags(d->surface, wlFlags); -+ emit flagsChanged(flags); -+} -+ -+PlasmaSurface::ScreenEdge PlasmaSurface::screenEdge() const -+{ -+ return d->screenEdge; -+} -+ -+void PlasmaSurface::setScreenEdge(const ScreenEdge &edge) -+{ -+ Q_ASSERT(d->surface); -+ -+ if (d->screenEdge == edge) -+ return; -+ -+ qint32 wlEdge = ORG_KDE_PLASMA_SURFACE_SCREEN_EDGE_NONE; -+ switch (edge) { -+ case ScreenEdge::Left: -+ wlEdge = ORG_KDE_PLASMA_SURFACE_SCREEN_EDGE_LEFT; -+ case ScreenEdge::Top: -+ wlEdge = ORG_KDE_PLASMA_SURFACE_SCREEN_EDGE_TOP; -+ case ScreenEdge::Right: -+ wlEdge = ORG_KDE_PLASMA_SURFACE_SCREEN_EDGE_RIGHT; -+ case ScreenEdge::Bottom: -+ wlEdge = ORG_KDE_PLASMA_SURFACE_SCREEN_EDGE_BOTTOM; -+ default: -+ break; -+ } -+ -+ d->screenEdge = edge; -+ org_kde_plasma_surface_set_screen_edge(d->surface, wlEdge); -+ emit screenEdgeChanged(edge); -+} -+ -+void PlasmaSurface::setup(wl_surface *s, org_kde_plasma_surface *ps) -+{ -+ Q_ASSERT(!d->wlSurface); -+ Q_ASSERT(!d->surface); -+ Q_ASSERT(s); -+ Q_ASSERT(ps); -+ d->wlSurface = s; -+ d->surface = ps; -+} -+ -+} // namespace Client -+} // namespace KWayland -diff --git a/src/client/plasma_surface.h b/src/client/plasma_surface.h -new file mode 100644 -index 0000000..689e624 ---- /dev/null -+++ b/src/client/plasma_surface.h -@@ -0,0 +1,210 @@ -+/******************************************************************** -+Copyright 2014 Pier Luigi Fiorini -+Copyright 2014 Martin Gräßlin -+ -+This library is free software; you can redistribute it and/or -+modify it under the terms of the GNU Lesser General Public -+License as published by the Free Software Foundation; either -+version 2.1 of the License, or (at your option) version 3, or any -+later version accepted by the membership of KDE e.V. (or its -+successor approved by the membership of KDE e.V.), which shall -+act as a proxy defined in Section 6 of version 3 of the license. -+ -+This library 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 -+Lesser General Public License for more details. -+ -+You should have received a copy of the GNU Lesser General Public -+License along with this library. If not, see . -+*********************************************************************/ -+ -+#ifndef WAYLAND_PLASMA_SURFACE_H -+#define WAYLAND_PLASMA_SURFACE_H -+ -+#include -+ -+#include -+ -+class QScreen; -+ -+struct wl_output; -+struct wl_surface; -+struct org_kde_plasma_surface; -+ -+namespace KWayland -+{ -+namespace Client -+{ -+ -+class Output; -+class PlasmaShell; -+class Surface; -+ -+/** -+ * @short Wrapper for the org_kde_plasma_surface interface. -+ * -+ * This class is a convenient wrapper for the org_kde_plasma_surface interface. -+ * -+ * To create an instance use PlasmaShell::createSurface. -+ * -+ * @see PlasmaShell -+ * @see Surface -+ **/ -+class KWAYLANDCLIENT_EXPORT PlasmaSurface : public QObject -+{ -+ Q_OBJECT -+ /** -+ * The role of the PlasmaSurface. -+ **/ -+ Q_PROPERTY(Role role READ role WRITE setRole NOTIFY roleChanged) -+ /** -+ * Flags that change the PlasmaSurface behavior. -+ */ -+ Q_PROPERTY(Flags flags READ flags WRITE setFlags NOTIFY flagsChanged) -+ /** -+ * Screen edge for activation. -+ **/ -+ Q_PROPERTY(ScreenEdge screenEdge READ screenEdge WRITE setScreenEdge NOTIFY screenEdgeChanged) -+public: -+ enum class Role { -+ Unknown = 0, ///< Role is unknown -+ Splash, ///< Splash screen -+ Desktop, ///< Desktop window -+ Dashboard, ///< Dashboard window -+ Panel, ///< Panel and its configuration window -+ Overlay, ///< Overlay (OSD window) -+ Notification, ///< Notification window -+ Lock ///< Screen locker -+ }; -+ -+ enum class Flag { -+ PanelAlwaysVisible = 0x0001, ///< Windows below panel -+ PanelAutoHide = 0x0002, ///< Panel is shown and hidden automatically -+ PanelWindowsCanCover = 0x0004, ///< Windows cover panel -+ PanelWindowsGoBelow = 0x0008 ///< Windows below panel but take whole space -+ }; -+ Q_DECLARE_FLAGS(Flags, Flag) -+ -+ enum class ScreenEdge { -+ None, ///< No activation -+ Left, ///< Left edge -+ Top, ///< Top edge -+ Right, ///< Right edge -+ Bottom ///< Bottom edge -+ }; -+ -+ virtual ~PlasmaSurface(); -+ -+ /** -+ * @returns @c true if managing a org_kde_plasma_surface. -+ **/ -+ bool isValid() const; -+ /** -+ * Releases the org_kde_surface interface. -+ * After the interface has been released the PlasmaSurface instance is no -+ * longer valid and can be setup with another org_kde_plasma_surface interface. -+ * -+ * This method is automatically invoked when the PlasmaShell which created this -+ * PlasmaSurface gets released. -+ **/ -+ void release(); -+ /** -+ * Destroys the data hold by this PlasmaSurface. -+ * This method is supposed to be used when the connection to the Wayland -+ * server goes away. If the connection is not valid anymore, it's not -+ * possible to call release anymore as that calls into the Wayland -+ * connection and the call would fail. This method cleans up the data, so -+ * that the instance can be deleted or setup to a new org_kde_plasma_surface interface -+ * once there is a new connection available. -+ * -+ * This method is automatically invoked when the PlasmaShell which created this -+ * PlasmaSurface gets destroyed. -+ * -+ * @see release -+ **/ -+ void destroy(); -+ -+ /** -+ * Sets the output where this surface will be mapped on. -+ * -+ * @param output Output where this surface will be mapped on -+ **/ -+ void setOutput(wl_output *output); -+ /** -+ * Sets the output where this surface will be mapped on. -+ * -+ * @param output Output where this surface will be mapped on -+ **/ -+ void setOutput(Output *output); -+ /** -+ * Sets the screen where this surface will be mapped on. -+ * Native output for @p screen is requested from the QPA native -+ * interface, therefore the user must not use another Wayland connection -+ * besides the one created by QPA (thus implicitely available) such as -+ * the one from ConnectionThread. -+ * -+ * @param screen Screen where this surface will be mapped on -+ **/ -+ void setOutput(QScreen *screen); -+ -+ /** -+ * Move the surface to @p pos coordinates. -+ * Coordinates are in global space. -+ * -+ * @param pos Position in global coordinates space. -+ * -+ * @see setOutput -+ **/ -+ void move(const QPoint &pos); -+ -+ Role role() const; -+ void setRole(const Role &role); -+ -+ Flags flags() const; -+ void setFlags(const Flags &flags); -+ -+ ScreenEdge screenEdge() const; -+ void setScreenEdge(const ScreenEdge &edge); -+ -+ operator org_kde_plasma_surface*(); -+ operator org_kde_plasma_surface*() const; -+ -+ operator wl_surface*(); -+ operator wl_surface*() const; -+ -+Q_SIGNALS: -+ /** -+ * Emitted when the role is changed. -+ **/ -+ void roleChanged(const Role &role); -+ /** -+ * Emitted when flags are changed. -+ **/ -+ void flagsChanged(const Flags &flags); -+ /** -+ * Emitted when the screen edge for activation is changed. -+ **/ -+ void screenEdgeChanged(const ScreenEdge &edge); -+ -+private: -+ class Private; -+ QScopedPointer d; -+ -+ explicit PlasmaSurface(QObject *parent = Q_NULLPTR); -+ -+ /** -+ * Setup this PlasmaSurface to manage the @p surface. -+ * This method is invoked by PlasmaShell::createSurface. -+ **/ -+ void setup(wl_surface *s, org_kde_plasma_surface *ps); -+ -+ friend class PlasmaShell; -+}; -+ -+Q_DECLARE_OPERATORS_FOR_FLAGS(PlasmaSurface::Flags) -+ -+} // namespace Client -+} // namespace KWayland -+ -+#endif // WAYLAND_PLASMA_SURFACE_H -diff --git a/src/client/registry.cpp b/src/client/registry.cpp -index 19cce81..192af78 100644 ---- a/src/client/registry.cpp -+++ b/src/client/registry.cpp -@@ -24,6 +24,7 @@ License along with this library. If not, see . - #include "event_queue.h" - #include "fullscreen_shell.h" - #include "output.h" -+#include "plasma_shell.h" - #include "seat.h" - #include "shell.h" - #include "shm_pool.h" -@@ -34,6 +35,7 @@ License along with this library. If not, see . - // wayland - #include - #include -+#include - - namespace KWayland - { -@@ -211,6 +213,8 @@ static Registry::Interface nameToInterface(const char *interface) - return Registry::Interface::SubCompositor; - } else if (strcmp(interface, "wl_data_device_manager") == 0) { - return Registry::Interface::DataDeviceManager; -+ } else if (strcmp(interface, "org_kde_plasma_shell") == 0) { -+ return Registry::Interface::PlasmaShell; - } - return Registry::Interface::Unknown; - } -@@ -250,6 +254,9 @@ void Registry::Private::handleAnnounce(uint32_t name, const char *interface, uin - case Interface::DataDeviceManager: - emit q->dataDeviceManagerAnnounced(name, version); - break; -+ case Interface::PlasmaShell: -+ emit q->plasmaShellAnnounced(name, version); -+ break; - case Interface::Unknown: - default: - // nothing -@@ -292,6 +299,9 @@ void Registry::Private::handleRemove(uint32_t name) - case Interface::DataDeviceManager: - emit q->dataDeviceManagerRemoved(data.name); - break; -+ case Interface::PlasmaShell: -+ emit q->plasmaShellRemoved(data.name); -+ break; - case Interface::Unknown: - default: - // nothing -@@ -351,6 +361,11 @@ _wl_fullscreen_shell *Registry::bindFullscreenShell(uint32_t name, uint32_t vers - return d->bind<_wl_fullscreen_shell>(Interface::FullscreenShell, name, version); - } - -+org_kde_plasma_shell *Registry::bindPlasmaShell(uint32_t name, uint32_t version) const -+{ -+ return d->bind(Interface::PlasmaShell, name, version); -+} -+ - wl_data_device_manager *Registry::bindDataDeviceManager(uint32_t name, uint32_t version) const - { - return d->bind(Interface::DataDeviceManager, name, qMin(s_dataDeviceManagerMaxVersion, version)); -@@ -418,6 +433,13 @@ DataDeviceManager *Registry::createDataDeviceManager(quint32 name, quint32 versi - return m; - } - -+PlasmaShell *Registry::createPlasmaShell(quint32 name, quint32 version, QObject *parent) -+{ -+ PlasmaShell *s = new PlasmaShell(parent); -+ s->setup(bindPlasmaShell(name, version)); -+ return s; -+} -+ - static const wl_interface *wlInterface(Registry::Interface interface) - { - switch (interface) { -@@ -437,6 +459,8 @@ static const wl_interface *wlInterface(Registry::Interface interface) - return &wl_subcompositor_interface; - case Registry::Interface::DataDeviceManager: - return &wl_data_device_manager_interface; -+ case Registry::Interface::PlasmaShell: -+ return &org_kde_plasma_shell_interface; - case Registry::Interface::Unknown: - default: - return nullptr; -diff --git a/src/client/registry.h b/src/client/registry.h -index 52ef843..5fbb499 100644 ---- a/src/client/registry.h -+++ b/src/client/registry.h -@@ -35,6 +35,7 @@ struct wl_shell; - struct wl_shm; - struct wl_subcompositor; - struct _wl_fullscreen_shell; -+struct org_kde_plasma_shell; - - namespace KWayland - { -@@ -47,6 +48,7 @@ class DataDeviceManager; - class EventQueue; - class FullscreenShell; - class Output; -+class PlasmaShell; - class Seat; - class Shell; - class ShmPool; -@@ -93,6 +95,7 @@ public: - Seat, ///< Refers to the wl_seat interface - Shm, ///< Refers to the wl_shm interface - Output, ///< Refers to the wl_output interface -+ PlasmaShell, ///< Refers to the org_kde_plasma_shell interface - FullscreenShell, ///< Refers to the _wl_fullscreen_shell interface - SubCompositor, ///< Refers to the wl_subcompositor interface; - DataDeviceManager ///< Refers to the wl_data_device_manager interface -@@ -227,6 +230,7 @@ public: - **/ - _wl_fullscreen_shell *bindFullscreenShell(uint32_t name, uint32_t version) const; - wl_data_device_manager *bindDataDeviceManager(uint32_t name, uint32_t version) const; -+ org_kde_plasma_shell *bindPlasmaShell(uint32_t name, uint32_t version) const; - - /** - * Creates a Compositor and sets it up to manage the interface identified by -@@ -334,6 +338,7 @@ public: - **/ - FullscreenShell *createFullscreenShell(quint32 name, quint32 version, QObject *parent = nullptr); - DataDeviceManager *createDataDeviceManager(quint32 name, quint32 version, QObject *parent = nullptr); -+ PlasmaShell *createPlasmaShell(quint32 name, quint32 version, QObject *parent = nullptr); - - operator wl_registry*(); - operator wl_registry*() const; -@@ -377,6 +382,12 @@ Q_SIGNALS: - **/ - void outputAnnounced(quint32 name, quint32 version); - /** -+ * Emitted whenever a org_kde_plasma_shell interface gets announced. -+ * @param name The name for the announced interface -+ * @param version The maximum supported version of the announced interface -+ **/ -+ void plasmaShellAnnounced(quint32 name, quint32 version); -+ /** - * Emitted whenever a _wl_fullscreen_shell interface gets announced. - * @param name The name for the announced interface - * @param version The maximum supported version of the announced interface -@@ -414,6 +425,11 @@ Q_SIGNALS: - **/ - void outputRemoved(quint32 name); - /** -+ * Emitted whenever a org_kde_plasma_shell interface gets removed. -+ * @param name The name for the removed interface -+ **/ -+ void plasmaShellRemoved(quint32 name); -+ /** - * Emitted whenever a _wl_fullscreen_shell interface gets removed. - * @param name The name for the removed interface - **/ --- -1.8.3.1 - diff --git a/recipes-kde/kf5/tier1/kwayland/files/0003-PlasmaEffects-interface.patch b/recipes-kde/kf5/tier1/kwayland/files/0003-PlasmaEffects-interface.patch deleted file mode 100644 index abe6baff..00000000 --- a/recipes-kde/kf5/tier1/kwayland/files/0003-PlasmaEffects-interface.patch +++ /dev/null @@ -1,654 +0,0 @@ -From 7133d2781230b0a45e18c8c84a3b10b178cb16a6 Mon Sep 17 00:00:00 2001 -From: Pier Luigi Fiorini -Date: Sun, 21 Sep 2014 12:25:53 +0200 -Subject: [PATCH 3/4] PlasmaEffects interface - -Conflicts: - src/client/CMakeLists.txt - src/client/registry.cpp - -+ names of generated header changed ---- - autotests/client/test_wayland_registry.cpp | 1 + - src/client/CMakeLists.txt | 7 + - src/client/plasma_effects.cpp | 319 +++++++++++++++++++++++++++++ - src/client/plasma_effects.h | 102 +++++++++ - src/client/registry.cpp | 24 +++ - src/client/registry.h | 16 ++ - 6 files changed, 469 insertions(+) - create mode 100644 src/client/plasma_effects.cpp - create mode 100644 src/client/plasma_effects.h - -diff --git a/autotests/client/test_wayland_registry.cpp b/autotests/client/test_wayland_registry.cpp -index 7004f5e..8eacd3c 100644 ---- a/autotests/client/test_wayland_registry.cpp -+++ b/autotests/client/test_wayland_registry.cpp -@@ -238,6 +238,7 @@ void TestWaylandRegistry::testRemoval() - QVERIFY(registry.hasInterface(KWayland::Client::Registry::Interface::SubCompositor)); - QVERIFY(!registry.hasInterface(KWayland::Client::Registry::Interface::FullscreenShell)); - QVERIFY(!registry.hasInterface(KWayland::Client::Registry::Interface::PlasmaShell)); -+ QVERIFY(!registry.hasInterface(KWayland::Client::Registry::Interface::PlasmaEffects)); - - QSignalSpy seatRemovedSpy(®istry, SIGNAL(seatRemoved(quint32))); - QVERIFY(seatRemovedSpy.isValid()); -diff --git a/src/client/CMakeLists.txt b/src/client/CMakeLists.txt -index b1dfe95..666fa52 100644 ---- a/src/client/CMakeLists.txt -+++ b/src/client/CMakeLists.txt -@@ -16,6 +16,7 @@ set(CLIENT_LIB_SRCS - fullscreen_shell.cpp - keyboard.cpp - output.cpp -+ plasma_effects.cpp - plasma_shell.cpp - plasma_surface.cpp - pointer.cpp -@@ -39,6 +40,11 @@ ecm_add_wayland_client_protocol(CLIENT_LIB_SRCS - BASENAME plasma-shell - ) - -+ecm_add_wayland_client_protocol(CLIENT_LIB_SRCS -+ PROTOCOL ${KWAYLAND_SOURCE_DIR}/src/client/protocols/plasma-effects.xml -+ BASENAME plasma-effects -+) -+ - add_library(KF5WaylandClient ${CLIENT_LIB_SRCS}) - generate_export_header(KF5WaylandClient - BASE_NAME -@@ -81,6 +87,7 @@ install(FILES - fullscreen_shell.h - keyboard.h - output.h -+ plasma_effects.h - plasma_shell.h - plasma_surface.h - pointer.h -diff --git a/src/client/plasma_effects.cpp b/src/client/plasma_effects.cpp -new file mode 100644 -index 0000000..61866a4 ---- /dev/null -+++ b/src/client/plasma_effects.cpp -@@ -0,0 +1,319 @@ -+/******************************************************************** -+Copyright 2014 Pier Luigi Fiorini -+ -+This library is free software; you can redistribute it and/or -+modify it under the terms of the GNU Lesser General Public -+License as published by the Free Software Foundation; either -+version 2.1 of the License, or (at your option) version 3, or any -+later version accepted by the membership of KDE e.V. (or its -+successor approved by the membership of KDE e.V.), which shall -+act as a proxy defined in Section 6 of version 3 of the license. -+ -+This library 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 -+Lesser General Public License for more details. -+ -+You should have received a copy of the GNU Lesser General Public -+License along with this library. If not, see . -+*********************************************************************/ -+ -+#include "output.h" -+#include "plasma_effects.h" -+#include "surface.h" -+ -+// Qt -+#include -+#include -+#include -+#include -+#include -+ -+// wayland -+#include -+#include -+ -+namespace KWayland -+{ -+namespace Client -+{ -+ -+class PlasmaEffects::Private -+{ -+public: -+ Private(PlasmaEffects *q); -+ -+ void setup(org_kde_plasma_effects *e); -+ -+ wl_region *createRegion(const QRegion ®ion); -+ -+ org_kde_plasma_effects *effects = Q_NULLPTR; -+ -+private: -+ PlasmaEffects *q; -+}; -+ -+PlasmaEffects::Private::Private(PlasmaEffects *q) -+ : q(q) -+{ -+} -+ -+void PlasmaEffects::Private::setup(org_kde_plasma_effects *e) -+{ -+ Q_ASSERT(!effects); -+ Q_ASSERT(e); -+ effects = e; -+} -+ -+wl_region *PlasmaEffects::Private::createRegion(const QRegion ®ion) -+{ -+ // Platform native interface -+ QPlatformNativeInterface *native = QGuiApplication::platformNativeInterface(); -+ Q_ASSERT(native); -+ -+ // Compositor -+ wl_compositor *compositor = static_cast( -+ native->nativeResourceForIntegration("compositor")); -+ Q_ASSERT(compositor); -+ -+ // Create wl_region -+ wl_region *wlRegion = wl_compositor_create_region(compositor); -+ Q_ASSERT(wlRegion); -+ -+ for (QRect rect: region.rects()) -+ wl_region_add(wlRegion, rect.x(), rect.y(), rect.width(), rect.height()); -+ -+ return wlRegion; -+} -+ -+PlasmaEffects::PlasmaEffects(QObject *parent) -+ : QObject(parent) -+ , d(new Private(this)) -+{ -+} -+ -+PlasmaEffects::~PlasmaEffects() -+{ -+ release(); -+} -+ -+bool PlasmaEffects::isValid() const -+{ -+ return d->effects != Q_NULLPTR; -+} -+ -+void PlasmaEffects::setup(org_kde_plasma_effects *e) -+{ -+ d->setup(e); -+} -+ -+void PlasmaEffects::release() -+{ -+ if (d->effects) { -+ org_kde_plasma_effects_destroy(d->effects); -+ } -+} -+ -+void PlasmaEffects::destroy() -+{ -+ if (d->effects) { -+ free(d->effects); -+ d->effects = Q_NULLPTR; -+ } -+} -+ -+void PlasmaEffects::slide(wl_output *output, wl_surface *surface, -+ const Location &from, const QPoint &to) -+{ -+ Q_ASSERT(d->effects); -+ Q_ASSERT(output); -+ Q_ASSERT(surface); -+ -+ quint32 wlFrom = ORG_KDE_PLASMA_EFFECTS_LOCATION_NONE; -+ switch (from) { -+ case Location::Left: -+ wlFrom = ORG_KDE_PLASMA_EFFECTS_LOCATION_LEFT; -+ break; -+ case Location::Top: -+ wlFrom = ORG_KDE_PLASMA_EFFECTS_LOCATION_TOP; -+ break; -+ case Location::Right: -+ wlFrom = ORG_KDE_PLASMA_EFFECTS_LOCATION_RIGHT; -+ break; -+ case Location::Bottom: -+ wlFrom = ORG_KDE_PLASMA_EFFECTS_LOCATION_BOTTOM; -+ break; -+ default: -+ break; -+ } -+ -+ org_kde_plasma_effects_slide(d->effects, output, surface, -+ wlFrom, to.x(), to.y()); -+} -+ -+void PlasmaEffects::slide(Output *output, Surface *surface, -+ const Location &from, const QPoint &to) -+{ -+ Q_ASSERT(output); -+ Q_ASSERT(surface); -+ -+ slide(*output, *surface, from, to); -+} -+ -+void PlasmaEffects::slide(QWindow *window, -+ const Location &from, const QPoint &to) -+{ -+ Q_ASSERT(window); -+ -+ // Platform native interface -+ QPlatformNativeInterface *native = QGuiApplication::platformNativeInterface(); -+ Q_ASSERT(native); -+ -+ // Get surface and output -+ wl_surface *wlSurface = static_cast( -+ native->nativeResourceForWindow("surface", window)); -+ wl_output *wlOutput = static_cast( -+ native->nativeResourceForScreen("output", window->screen())); -+ -+ slide(wlOutput, wlSurface, from, to); -+} -+ -+void PlasmaEffects::enableBlurBehind(wl_surface *surface, -+ const QRegion ®ion) -+{ -+ Q_ASSERT(d->effects); -+ Q_ASSERT(surface); -+ -+ wl_region *wlRegion = d->createRegion(region); -+ org_kde_plasma_effects_set_blur_behind_region(d->effects, surface, wlRegion); -+} -+ -+void PlasmaEffects::enableBlurBehind(Surface *surface, -+ const QRegion ®ion) -+{ -+ Q_ASSERT(surface); -+ -+ enableBlurBehind(*surface, region); -+} -+ -+void PlasmaEffects::enableBlurBehind(QWindow *window, -+ const QRegion ®ion) -+{ -+ Q_ASSERT(window); -+ -+ // Platform native interface -+ QPlatformNativeInterface *native = QGuiApplication::platformNativeInterface(); -+ Q_ASSERT(native); -+ -+ // Get surface -+ wl_surface *wlSurface = static_cast( -+ native->nativeResourceForWindow("surface", window)); -+ -+ enableBlurBehind(wlSurface, region); -+} -+ -+void PlasmaEffects::disableBlurBehind(wl_surface *surface) -+{ -+ Q_ASSERT(d->effects); -+ Q_ASSERT(surface); -+ -+ org_kde_plasma_effects_set_blur_behind_region(d->effects, surface, Q_NULLPTR); -+} -+ -+void PlasmaEffects::disableBlurBehind(Surface *surface) -+{ -+ Q_ASSERT(surface); -+ -+ disableBlurBehind(*surface); -+} -+ -+void PlasmaEffects::disableBlurBehind(QWindow *window) -+{ -+ Q_ASSERT(window); -+ -+ // Platform native interface -+ QPlatformNativeInterface *native = QGuiApplication::platformNativeInterface(); -+ Q_ASSERT(native); -+ -+ // Get surface -+ wl_surface *wlSurface = static_cast( -+ native->nativeResourceForWindow("surface", window)); -+ -+ disableBlurBehind(wlSurface); -+} -+ -+void PlasmaEffects::enableBackgroundContrast(wl_surface *surface, const QRegion ®ion, -+ qreal contrast, qreal intensity, -+ qreal saturation) -+{ -+ Q_ASSERT(d->effects); -+ Q_ASSERT(surface); -+ -+ wl_region *wlRegion = d->createRegion(region); -+ org_kde_plasma_effects_set_contrast_region(d->effects, surface, wlRegion, -+ contrast, intensity, saturation); -+} -+ -+void PlasmaEffects::enableBackgroundContrast(Surface *surface, const QRegion ®ion, -+ qreal contrast, qreal intensity, -+ qreal saturation) -+{ -+ Q_ASSERT(surface); -+ -+ // Convert values to integers -+ quint32 c = qFloor(contrast * 255); -+ quint32 i = qFloor(intensity * 255); -+ quint32 s = qFloor(saturation * 255); -+ -+ enableBackgroundContrast(*surface, region, c, i, s); -+} -+ -+void PlasmaEffects::enableBackgroundContrast(QWindow *window, const QRegion ®ion, -+ qreal contrast, qreal intensity, -+ qreal saturation) -+{ -+ Q_ASSERT(window); -+ -+ // Platform native interface -+ QPlatformNativeInterface *native = QGuiApplication::platformNativeInterface(); -+ Q_ASSERT(native); -+ -+ // Get surface -+ wl_surface *wlSurface = static_cast( -+ native->nativeResourceForWindow("surface", window)); -+ -+ enableBackgroundContrast(wlSurface, region, contrast, intensity, saturation); -+} -+ -+void PlasmaEffects::disableBackgroundContrast(wl_surface *surface) -+{ -+ Q_ASSERT(d->effects); -+ Q_ASSERT(surface); -+ -+ org_kde_plasma_effects_set_contrast_region(d->effects, surface, Q_NULLPTR, 0, 0, 0); -+} -+ -+void PlasmaEffects::disableBackgroundContrast(Surface *surface) -+{ -+ Q_ASSERT(surface); -+ -+ disableBackgroundContrast(*surface); -+} -+ -+void PlasmaEffects::disableBackgroundContrast(QWindow *window) -+{ -+ Q_ASSERT(window); -+ -+ // Platform native interface -+ QPlatformNativeInterface *native = QGuiApplication::platformNativeInterface(); -+ Q_ASSERT(native); -+ -+ // Get surface -+ wl_surface *wlSurface = static_cast( -+ native->nativeResourceForWindow("surface", window)); -+ -+ disableBackgroundContrast(wlSurface); -+} -+ -+} // namespace Client -+} // namespace KWayland -diff --git a/src/client/plasma_effects.h b/src/client/plasma_effects.h -new file mode 100644 -index 0000000..9a1e89d ---- /dev/null -+++ b/src/client/plasma_effects.h -@@ -0,0 +1,102 @@ -+/******************************************************************** -+Copyright 2014 Pier Luigi Fiorini -+ -+This library is free software; you can redistribute it and/or -+modify it under the terms of the GNU Lesser General Public -+License as published by the Free Software Foundation; either -+version 2.1 of the License, or (at your option) version 3, or any -+later version accepted by the membership of KDE e.V. (or its -+successor approved by the membership of KDE e.V.), which shall -+act as a proxy defined in Section 6 of version 3 of the license. -+ -+This library 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 -+Lesser General Public License for more details. -+ -+You should have received a copy of the GNU Lesser General Public -+License along with this library. If not, see . -+*********************************************************************/ -+ -+#ifndef WAYLAND_PLASMA_EFFECTS_H -+#define WAYLAND_PLASMA_EFFECTS_H -+ -+#include -+#include -+ -+#include -+ -+class QWindow; -+ -+struct wl_output; -+struct wl_surface; -+struct org_kde_plasma_effects; -+ -+namespace KWayland -+{ -+namespace Client -+{ -+ -+class Output; -+class Surface; -+ -+class KWAYLANDCLIENT_EXPORT PlasmaEffects : public QObject -+{ -+ Q_OBJECT -+public: -+ enum class Location { -+ None, -+ Left, -+ Top, -+ Right, -+ Bottom -+ }; -+ -+ explicit PlasmaEffects(QObject *parent = Q_NULLPTR); -+ virtual ~PlasmaEffects(); -+ -+ bool isValid() const; -+ -+ void setup(org_kde_plasma_effects *s); -+ -+ void release(); -+ void destroy(); -+ -+ void slide(wl_output *output, wl_surface *surface, -+ const Location &from, const QPoint &to); -+ void slide(Output *output, Surface *surface, -+ const Location &from, const QPoint &to); -+ void slide(QWindow *window, -+ const Location &from, const QPoint &to); -+ -+ void enableBlurBehind(wl_surface *surface, -+ const QRegion ®ion); -+ void enableBlurBehind(Surface *surface, -+ const QRegion ®ion); -+ void enableBlurBehind(QWindow *window, -+ const QRegion ®ion); -+ -+ void disableBlurBehind(wl_surface *surface); -+ void disableBlurBehind(Surface *surface); -+ void disableBlurBehind(QWindow *window); -+ -+ void enableBackgroundContrast(wl_surface *surface, const QRegion ®ion, -+ qreal contrast, qreal intensity, qreal saturation); -+ void enableBackgroundContrast(Surface *surface, const QRegion ®ion, -+ qreal contrast, qreal intensity, qreal saturation); -+ void enableBackgroundContrast(QWindow *window, const QRegion ®ion, -+ qreal contrast, qreal intensity, qreal saturation); -+ -+ void disableBackgroundContrast(wl_surface *surface); -+ void disableBackgroundContrast(Surface *surface); -+ void disableBackgroundContrast(QWindow *window); -+ -+private: -+ class Private; -+ QScopedPointer d; -+}; -+ -+} // namespace Client -+} // namespace KWayland -+ -+#endif // WAYLAND_PLASMA_EFFECTS_H -diff --git a/src/client/registry.cpp b/src/client/registry.cpp -index 192af78..541b1c5 100644 ---- a/src/client/registry.cpp -+++ b/src/client/registry.cpp -@@ -24,6 +24,7 @@ License along with this library. If not, see . - #include "event_queue.h" - #include "fullscreen_shell.h" - #include "output.h" -+#include "plasma_effects.h" - #include "plasma_shell.h" - #include "seat.h" - #include "shell.h" -@@ -36,6 +37,7 @@ License along with this library. If not, see . - #include - #include - #include -+#include - - namespace KWayland - { -@@ -215,6 +217,8 @@ static Registry::Interface nameToInterface(const char *interface) - return Registry::Interface::DataDeviceManager; - } else if (strcmp(interface, "org_kde_plasma_shell") == 0) { - return Registry::Interface::PlasmaShell; -+ } else if (strcmp(interface, "org_kde_plasma_effects") == 0) { -+ return Registry::Interface::PlasmaEffects; - } - return Registry::Interface::Unknown; - } -@@ -257,6 +261,9 @@ void Registry::Private::handleAnnounce(uint32_t name, const char *interface, uin - case Interface::PlasmaShell: - emit q->plasmaShellAnnounced(name, version); - break; -+ case Interface::PlasmaEffects: -+ emit q->plasmaEffectsAnnounced(name, version); -+ break; - case Interface::Unknown: - default: - // nothing -@@ -302,6 +309,9 @@ void Registry::Private::handleRemove(uint32_t name) - case Interface::PlasmaShell: - emit q->plasmaShellRemoved(data.name); - break; -+ case Interface::PlasmaEffects: -+ emit q->plasmaEffectsRemoved(data.name); -+ break; - case Interface::Unknown: - default: - // nothing -@@ -371,6 +381,11 @@ wl_data_device_manager *Registry::bindDataDeviceManager(uint32_t name, uint32_t - return d->bind(Interface::DataDeviceManager, name, qMin(s_dataDeviceManagerMaxVersion, version)); - } - -+org_kde_plasma_effects *Registry::bindPlasmaEffects(uint32_t name, uint32_t version) const -+{ -+ return d->bind(Interface::PlasmaEffects, name, version); -+} -+ - Compositor *Registry::createCompositor(quint32 name, quint32 version, QObject *parent) - { - Compositor *c = new Compositor(parent); -@@ -440,6 +455,13 @@ PlasmaShell *Registry::createPlasmaShell(quint32 name, quint32 version, QObject - return s; - } - -+PlasmaEffects *Registry::createPlasmaEffects(quint32 name, quint32 version, QObject *parent) -+{ -+ PlasmaEffects *e = new PlasmaEffects(parent); -+ e->setup(bindPlasmaEffects(name, version)); -+ return e; -+} -+ - static const wl_interface *wlInterface(Registry::Interface interface) - { - switch (interface) { -@@ -461,6 +483,8 @@ static const wl_interface *wlInterface(Registry::Interface interface) - return &wl_data_device_manager_interface; - case Registry::Interface::PlasmaShell: - return &org_kde_plasma_shell_interface; -+ case Registry::Interface::PlasmaEffects: -+ return &org_kde_plasma_effects_interface; - case Registry::Interface::Unknown: - default: - return nullptr; -diff --git a/src/client/registry.h b/src/client/registry.h -index 5fbb499..5ef2b97 100644 ---- a/src/client/registry.h -+++ b/src/client/registry.h -@@ -36,6 +36,7 @@ struct wl_shm; - struct wl_subcompositor; - struct _wl_fullscreen_shell; - struct org_kde_plasma_shell; -+struct org_kde_plasma_effects; - - namespace KWayland - { -@@ -48,6 +49,7 @@ class DataDeviceManager; - class EventQueue; - class FullscreenShell; - class Output; -+class PlasmaEffects; - class PlasmaShell; - class Seat; - class Shell; -@@ -95,6 +97,7 @@ public: - Seat, ///< Refers to the wl_seat interface - Shm, ///< Refers to the wl_shm interface - Output, ///< Refers to the wl_output interface -+ PlasmaEffects, ///< Refers to the org_kde_plasma_effects interface - PlasmaShell, ///< Refers to the org_kde_plasma_shell interface - FullscreenShell, ///< Refers to the _wl_fullscreen_shell interface - SubCompositor, ///< Refers to the wl_subcompositor interface; -@@ -231,6 +234,7 @@ public: - _wl_fullscreen_shell *bindFullscreenShell(uint32_t name, uint32_t version) const; - wl_data_device_manager *bindDataDeviceManager(uint32_t name, uint32_t version) const; - org_kde_plasma_shell *bindPlasmaShell(uint32_t name, uint32_t version) const; -+ org_kde_plasma_effects *bindPlasmaEffects(uint32_t name, uint32_t version) const; - - /** - * Creates a Compositor and sets it up to manage the interface identified by -@@ -339,6 +343,7 @@ public: - FullscreenShell *createFullscreenShell(quint32 name, quint32 version, QObject *parent = nullptr); - DataDeviceManager *createDataDeviceManager(quint32 name, quint32 version, QObject *parent = nullptr); - PlasmaShell *createPlasmaShell(quint32 name, quint32 version, QObject *parent = nullptr); -+ PlasmaEffects *createPlasmaEffects(quint32 name, quint32 version, QObject *parent = nullptr); - - operator wl_registry*(); - operator wl_registry*() const; -@@ -382,6 +387,12 @@ Q_SIGNALS: - **/ - void outputAnnounced(quint32 name, quint32 version); - /** -+ * Emitted whenever a org_kde_plasma_effects interface gets announced. -+ * @param name The name for the announced interface -+ * @param version The maximum supported version of the announced interface -+ **/ -+ void plasmaEffectsAnnounced(quint32 name, quint32 version); -+ /** - * Emitted whenever a org_kde_plasma_shell interface gets announced. - * @param name The name for the announced interface - * @param version The maximum supported version of the announced interface -@@ -425,6 +436,11 @@ Q_SIGNALS: - **/ - void outputRemoved(quint32 name); - /** -+ * Emitted whenever a org_kde_plasma_effects interface gets removed. -+ * @param name The name for the removed interface -+ **/ -+ void plasmaEffectsRemoved(quint32 name); -+ /** - * Emitted whenever a org_kde_plasma_shell interface gets removed. - * @param name The name for the removed interface - **/ --- -1.8.3.1 - diff --git a/recipes-kde/kf5/tier1/kwayland/files/0004-Server-side-interface.patch b/recipes-kde/kf5/tier1/kwayland/files/0004-Server-side-interface.patch deleted file mode 100644 index c8ca9ba6..00000000 --- a/recipes-kde/kf5/tier1/kwayland/files/0004-Server-side-interface.patch +++ /dev/null @@ -1,845 +0,0 @@ -From 690e2b1ae73ca69a14e111a779cae571a8fcf616 Mon Sep 17 00:00:00 2001 -From: Pier Luigi Fiorini -Date: Fri, 17 Oct 2014 09:06:04 +0200 -Subject: [PATCH 4/4] Server side interface - -Conflicts: - src/server/CMakeLists.txt - -+ names/loactions of generated header changed ---- - autotests/client/test_plasma_shell.cpp | 358 +++++++++++++++++++++++++++++++++ - src/server/CMakeLists.txt | 7 + - src/server/plasma_shell_interface.cpp | 331 ++++++++++++++++++++++++++++++ - src/server/plasma_shell_interface.h | 84 ++++++++ - 4 files changed, 780 insertions(+) - create mode 100644 autotests/client/test_plasma_shell.cpp - create mode 100644 src/server/plasma_shell_interface.cpp - create mode 100644 src/server/plasma_shell_interface.h - -diff --git a/autotests/client/test_plasma_shell.cpp b/autotests/client/test_plasma_shell.cpp -new file mode 100644 -index 0000000..c9257ce ---- /dev/null -+++ b/autotests/client/test_plasma_shell.cpp -@@ -0,0 +1,358 @@ -+/******************************************************************** -+Copyright 2014 Martin Gräßlin -+ -+This library is free software; you can redistribute it and/or -+modify it under the terms of the GNU Lesser General Public -+License as published by the Free Software Foundation; either -+version 2.1 of the License, or (at your option) version 3, or any -+later version accepted by the membership of KDE e.V. (or its -+successor approved by the membership of KDE e.V.), which shall -+act as a proxy defined in Section 6 of version 3 of the license. -+ -+This library 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 -+Lesser General Public License for more details. -+ -+You should have received a copy of the GNU Lesser General Public -+License along with this library. If not, see . -+*********************************************************************/ -+// Qt -+#include -+// KWin -+#include "../../src/client/compositor.h" -+#include "../../src/client/connection_thread.h" -+#include "../../src/client/event_queue.h" -+#include "../../src/client/shell.h" -+#include "../../src/client/surface.h" -+#include "../../src/client/registry.h" -+#include "../../src/server/buffer_interface.h" -+#include "../../src/server/compositor_interface.h" -+#include "../../src/server/display.h" -+#include "../../src/server/shell_interface.h" -+#include "../../src/server/surface_interface.h" -+// Wayland -+#include -+ -+class TestPlasmaShell : public QObject -+{ -+ Q_OBJECT -+public: -+ explicit TestPlasmaShell(QObject *parent = nullptr); -+private Q_SLOTS: -+ void init(); -+ void cleanup(); -+ -+ void testFullscreen(); -+ void testPing(); -+ void testTitle(); -+ void testWindowClass(); -+ void testDestroy(); -+ void testCast(); -+ -+private: -+ KWayland::Server::Display *m_display; -+ KWayland::Server::CompositorInterface *m_compositorInterface; -+ KWayland::Server::ShellInterface *m_shellInterface; -+ KWayland::Client::ConnectionThread *m_connection; -+ KWayland::Client::Compositor *m_compositor; -+ KWayland::Client::Shell *m_shell; -+ KWayland::Client::EventQueue *m_queue; -+ QThread *m_thread; -+}; -+ -+static const QString s_socketName = QStringLiteral("kwin-test-plasma-shell-0"); -+ -+TestPlasmaShell::TestPlasmaShell(QObject *parent) -+ : QObject(parent) -+ , m_display(nullptr) -+ , m_compositorInterface(nullptr) -+ , m_shellInterface(nullptr) -+ , m_connection(nullptr) -+ , m_compositor(nullptr) -+ , m_shell(nullptr) -+ , m_queue(nullptr) -+ , m_thread(nullptr) -+{ -+} -+ -+void TestPlasmaShell::init() -+{ -+ using namespace KWayland::Server; -+ delete m_display; -+ m_display = new Display(this); -+ m_display->setSocketName(s_socketName); -+ m_display->start(); -+ QVERIFY(m_display->isRunning()); -+ -+ m_compositorInterface = m_display->createCompositor(m_display); -+ QVERIFY(m_compositorInterface); -+ m_compositorInterface->create(); -+ QVERIFY(m_compositorInterface->isValid()); -+ -+ m_shellInterface = m_display->createShell(m_display); -+ QVERIFY(m_shellInterface); -+ m_shellInterface->create(); -+ QVERIFY(m_shellInterface->isValid()); -+ -+ // setup connection -+ m_connection = new KWayland::Client::ConnectionThread; -+ QSignalSpy connectedSpy(m_connection, SIGNAL(connected())); -+ m_connection->setSocketName(s_socketName); -+ -+ m_thread = new QThread(this); -+ m_connection->moveToThread(m_thread); -+ m_thread->start(); -+ -+ m_connection->initConnection(); -+ QVERIFY(connectedSpy.wait()); -+ -+ m_queue = new KWayland::Client::EventQueue(this); -+ QVERIFY(!m_queue->isValid()); -+ m_queue->setup(m_connection); -+ QVERIFY(m_queue->isValid()); -+ -+ KWayland::Client::Registry registry; -+ QSignalSpy compositorSpy(®istry, SIGNAL(compositorAnnounced(quint32,quint32))); -+ QSignalSpy shellSpy(®istry, SIGNAL(shellAnnounced(quint32,quint32))); -+ QVERIFY(!registry.eventQueue()); -+ registry.setEventQueue(m_queue); -+ QCOMPARE(registry.eventQueue(), m_queue); -+ registry.create(m_connection->display()); -+ QVERIFY(registry.isValid()); -+ registry.setup(); -+ QVERIFY(compositorSpy.wait()); -+ -+ m_compositor = new KWayland::Client::Compositor(this); -+ m_compositor->setup(registry.bindCompositor(compositorSpy.first().first().value(), compositorSpy.first().last().value())); -+ QVERIFY(m_compositor->isValid()); -+ -+ if (shellSpy.isEmpty()) { -+ QVERIFY(shellSpy.wait()); -+ } -+ m_shell = registry.createShell(shellSpy.first().first().value(), shellSpy.first().last().value(), this); -+ QVERIFY(m_shell->isValid()); -+} -+ -+void TestPlasmaShell::cleanup() -+{ -+ if (m_shell) { -+ delete m_shell; -+ m_shell = nullptr; -+ } -+ if (m_compositor) { -+ delete m_compositor; -+ m_compositor = nullptr; -+ } -+ if (m_queue) { -+ delete m_queue; -+ m_queue = nullptr; -+ } -+ if (m_connection) { -+ m_connection->deleteLater(); -+ m_connection = nullptr; -+ } -+ if (m_thread) { -+ m_thread->quit(); -+ m_thread->wait(); -+ delete m_thread; -+ m_thread = nullptr; -+ } -+ -+ delete m_shellInterface; -+ m_shellInterface = nullptr; -+ -+ delete m_compositorInterface; -+ m_compositorInterface = nullptr; -+ -+ delete m_display; -+ m_display = nullptr; -+} -+ -+void TestPlasmaShell::testFullscreen() -+{ -+ using namespace KWayland::Server; -+ QScopedPointer s(m_compositor->createSurface()); -+ QVERIFY(!s.isNull()); -+ QVERIFY(s->isValid()); -+ KWayland::Client::ShellSurface *surface = m_shell->createSurface(s.data(), m_shell); -+ QSignalSpy sizeSpy(surface, SIGNAL(sizeChanged(QSize))); -+ QVERIFY(sizeSpy.isValid()); -+ QCOMPARE(surface->size(), QSize()); -+ -+ QSignalSpy serverSurfaceSpy(m_shellInterface, SIGNAL(surfaceCreated(KWayland::Server::ShellSurfaceInterface*))); -+ QVERIFY(serverSurfaceSpy.isValid()); -+ QVERIFY(serverSurfaceSpy.wait()); -+ ShellSurfaceInterface *serverSurface = serverSurfaceSpy.first().first().value(); -+ QVERIFY(serverSurface); -+ -+ QSignalSpy fullscreenSpy(serverSurface, SIGNAL(fullscreenChanged(bool))); -+ QVERIFY(fullscreenSpy.isValid()); -+ -+ surface->setFullscreen(); -+ QVERIFY(fullscreenSpy.wait()); -+ QCOMPARE(fullscreenSpy.count(), 1); -+ QVERIFY(fullscreenSpy.first().first().toBool()); -+ serverSurface->requestSize(QSize(1024, 768)); -+ -+ QVERIFY(sizeSpy.wait()); -+ QCOMPARE(sizeSpy.count(), 1); -+ QCOMPARE(sizeSpy.first().first().toSize(), QSize(1024, 768)); -+ QCOMPARE(surface->size(), QSize(1024, 768)); -+ -+ // set back to toplevel -+ fullscreenSpy.clear(); -+ wl_shell_surface_set_toplevel(*surface); -+ QVERIFY(fullscreenSpy.wait()); -+ QCOMPARE(fullscreenSpy.count(), 1); -+ QVERIFY(!fullscreenSpy.first().first().toBool()); -+} -+ -+void TestPlasmaShell::testPing() -+{ -+ using namespace KWayland::Server; -+ QScopedPointer s(m_compositor->createSurface()); -+ QVERIFY(!s.isNull()); -+ QVERIFY(s->isValid()); -+ KWayland::Client::ShellSurface *surface = m_shell->createSurface(s.data(), m_shell); -+ QSignalSpy pingSpy(surface, SIGNAL(pinged())); -+ -+ QSignalSpy serverSurfaceSpy(m_shellInterface, SIGNAL(surfaceCreated(KWayland::Server::ShellSurfaceInterface*))); -+ QVERIFY(serverSurfaceSpy.isValid()); -+ QVERIFY(serverSurfaceSpy.wait()); -+ ShellSurfaceInterface *serverSurface = serverSurfaceSpy.first().first().value(); -+ QVERIFY(serverSurface); -+ -+ QSignalSpy pingTimeoutSpy(serverSurface, SIGNAL(pingTimeout())); -+ QVERIFY(pingTimeoutSpy.isValid()); -+ QSignalSpy pongSpy(serverSurface, SIGNAL(pongReceived())); -+ QVERIFY(pongSpy.isValid()); -+ -+ serverSurface->ping(); -+ QVERIFY(pingSpy.wait()); -+ wl_display_flush(m_connection->display()); -+ -+ if (pongSpy.isEmpty()) { -+ QVERIFY(pongSpy.wait()); -+ } -+ QVERIFY(!pongSpy.isEmpty()); -+ QVERIFY(pingTimeoutSpy.isEmpty()); -+ -+ // evil trick - timeout of zero will make it not get the pong -+ serverSurface->setPingTimeout(0); -+ pongSpy.clear(); -+ pingTimeoutSpy.clear(); -+ serverSurface->ping(); -+ QTest::qWait(100); -+ if (pingTimeoutSpy.isEmpty()) { -+ QVERIFY(pingTimeoutSpy.wait()); -+ } -+ QCOMPARE(pingTimeoutSpy.count(), 1); -+ QVERIFY(pongSpy.isEmpty()); -+} -+ -+void TestPlasmaShell::testTitle() -+{ -+ using namespace KWayland::Server; -+ QScopedPointer s(m_compositor->createSurface()); -+ QVERIFY(!s.isNull()); -+ QVERIFY(s->isValid()); -+ KWayland::Client::ShellSurface *surface = m_shell->createSurface(s.data(), m_shell); -+ -+ QSignalSpy serverSurfaceSpy(m_shellInterface, SIGNAL(surfaceCreated(KWayland::Server::ShellSurfaceInterface*))); -+ QVERIFY(serverSurfaceSpy.isValid()); -+ QVERIFY(serverSurfaceSpy.wait()); -+ ShellSurfaceInterface *serverSurface = serverSurfaceSpy.first().first().value(); -+ QVERIFY(serverSurface); -+ -+ QSignalSpy titleSpy(serverSurface, SIGNAL(titleChanged(QString))); -+ QVERIFY(titleSpy.isValid()); -+ QString testTitle = QStringLiteral("fooBar"); -+ QVERIFY(serverSurface->title().isNull()); -+ -+ wl_shell_surface_set_title(*(const KWayland::Client::ShellSurface *)surface, testTitle.toUtf8().constData()); -+ QVERIFY(titleSpy.wait()); -+ QCOMPARE(serverSurface->title(), testTitle); -+ QCOMPARE(titleSpy.first().first().toString(), testTitle); -+} -+ -+void TestPlasmaShell::testWindowClass() -+{ -+ using namespace KWayland::Server; -+ QScopedPointer s(m_compositor->createSurface()); -+ QVERIFY(!s.isNull()); -+ QVERIFY(s->isValid()); -+ KWayland::Client::ShellSurface *surface = m_shell->createSurface(s.data(), m_shell); -+ -+ QSignalSpy serverSurfaceSpy(m_shellInterface, SIGNAL(surfaceCreated(KWayland::Server::ShellSurfaceInterface*))); -+ QVERIFY(serverSurfaceSpy.isValid()); -+ QVERIFY(serverSurfaceSpy.wait()); -+ ShellSurfaceInterface *serverSurface = serverSurfaceSpy.first().first().value(); -+ QVERIFY(serverSurface); -+ -+ QSignalSpy windowClassSpy(serverSurface, SIGNAL(windowClassChanged(QByteArray))); -+ QVERIFY(windowClassSpy.isValid()); -+ QByteArray testClass = QByteArrayLiteral("fooBar"); -+ QVERIFY(serverSurface->windowClass().isNull()); -+ -+ wl_shell_surface_set_class(*surface, testClass.constData()); -+ QVERIFY(windowClassSpy.wait()); -+ QCOMPARE(serverSurface->windowClass(), testClass); -+ QCOMPARE(windowClassSpy.first().first().toByteArray(), testClass); -+} -+ -+void TestPlasmaShell::testDestroy() -+{ -+ using namespace KWayland::Client; -+ QScopedPointer s(m_compositor->createSurface()); -+ QVERIFY(!s.isNull()); -+ QVERIFY(s->isValid()); -+ ShellSurface *surface = m_shell->createSurface(s.data(), m_shell); -+ QVERIFY(surface->isValid()); -+ -+ connect(m_connection, &ConnectionThread::connectionDied, m_shell, &Shell::destroy); -+ connect(m_connection, &ConnectionThread::connectionDied, m_compositor, &Compositor::destroy); -+ connect(m_connection, &ConnectionThread::connectionDied, s.data(), &Surface::destroy); -+ connect(m_connection, &ConnectionThread::connectionDied, m_queue, &EventQueue::destroy); -+ -+ QSignalSpy connectionDiedSpy(m_connection, SIGNAL(connectionDied())); -+ QVERIFY(connectionDiedSpy.isValid()); -+ delete m_display; -+ m_display = nullptr; -+ m_compositorInterface = nullptr; -+ m_shellInterface = nullptr; -+ QVERIFY(connectionDiedSpy.wait()); -+ -+ QVERIFY(!m_shell->isValid()); -+ QVERIFY(!surface->isValid()); -+ -+ m_shell->destroy(); -+ surface->destroy(); -+} -+ -+void TestPlasmaShell::testCast() -+{ -+ using namespace KWayland::Client; -+ Registry registry; -+ QSignalSpy shellSpy(®istry, SIGNAL(shellAnnounced(quint32,quint32))); -+ registry.setEventQueue(m_queue); -+ registry.create(m_connection->display()); -+ QVERIFY(registry.isValid()); -+ registry.setup(); -+ QVERIFY(shellSpy.wait()); -+ -+ Shell s; -+ auto wlShell = registry.bindShell(shellSpy.first().first().value(), shellSpy.first().last().value()); -+ m_queue->addProxy(wlShell); -+ QVERIFY(wlShell); -+ QVERIFY(!s.isValid()); -+ s.setup(wlShell); -+ QVERIFY(s.isValid()); -+ QCOMPARE((wl_shell*)s, wlShell); -+ -+ const Shell &s2(s); -+ QCOMPARE((wl_shell*)s2, wlShell); -+} -+ -+QTEST_GUILESS_MAIN(TestPlasmaShell) -+#include "test_plasma_shell.moc" -diff --git a/src/server/CMakeLists.txt b/src/server/CMakeLists.txt -index 8363c37..4a0d895 100644 ---- a/src/server/CMakeLists.txt -+++ b/src/server/CMakeLists.txt -@@ -7,6 +7,7 @@ set(SERVER_LIB_SRCS - dataoffer_interface.cpp - datasource_interface.cpp - display.cpp -+ plasma_shell_interface.cpp - global.cpp - keyboard_interface.cpp - output_interface.cpp -@@ -19,6 +20,11 @@ set(SERVER_LIB_SRCS - subcompositor_interface.cpp - ) - -+ecm_add_wayland_server_protocol(SERVER_LIB_SRCS -+ PROTOCOL ${KWAYLAND_SOURCE_DIR}//src/client/protocols/plasma-shell.xml -+ BASENAME plasma-shell -+) -+ - add_library(KF5WaylandServer ${SERVER_LIB_SRCS}) - generate_export_header(KF5WaylandServer - BASE_NAME -@@ -60,6 +66,7 @@ install(FILES - dataoffer_interface.h - datasource_interface.h - display.h -+ plasma_shell_interface.h - global.h - keyboard_interface.h - output_interface.h -diff --git a/src/server/plasma_shell_interface.cpp b/src/server/plasma_shell_interface.cpp -new file mode 100644 -index 0000000..dfe6b2d ---- /dev/null -+++ b/src/server/plasma_shell_interface.cpp -@@ -0,0 +1,331 @@ -+/******************************************************************** -+Copyright 2014 Pier Luigi Fiorini -+Copyright 2014 Martin Gräßlin -+ -+This library is free software; you can redistribute it and/or -+modify it under the terms of the GNU Lesser General Public -+License as published by the Free Software Foundation; either -+version 2.1 of the License, or (at your option) version 3, or any -+later version accepted by the membership of KDE e.V. (or its -+successor approved by the membership of KDE e.V.), which shall -+act as a proxy defined in Section 6 of version 3 of the license. -+ -+This library 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 -+Lesser General Public License for more details. -+ -+You should have received a copy of the GNU Lesser General Public -+License along with this library. If not, see . -+*********************************************************************/ -+#include "plasma_shell_interface.h" -+#include "display.h" -+#include "surface_interface.h" -+#include "output_interface.h" -+ -+#include -+ -+#include -+#include "wayland-plasma-shell-server-protocol.h" -+ -+namespace KWayland -+{ -+namespace Server -+{ -+ -+static const quint32 s_version = 1; -+ -+class PlasmaShellInterface::Private -+{ -+public: -+ Private(PlasmaShellInterface *q, Display *d); -+ void create(); -+ -+ Display *display; -+ wl_global *shell = nullptr; -+ QList surfaces; -+ -+private: -+ static void bind(wl_client *client, void *data, uint32_t version, uint32_t id); -+ static void createSurfaceCallback(wl_client *client, wl_resource *resource, uint32_t id, wl_resource *surface); -+ static void desktopReadyCallback(wl_client *client, wl_resource *resource); -+ static void presentCallback(wl_client *client, wl_resource *resource, wl_array *surfaces); -+ void bind(wl_client *client, uint32_t version, uint32_t id); -+ void createSurface(wl_client *client, uint32_t version, uint32_t id, SurfaceInterface *surface); -+ void desktopReady(wl_client *client); -+ void present(wl_client *client, wl_array *surfaces); -+ -+ PlasmaShellInterface *q; -+ static const struct org_kde_plasma_shell_interface s_interface; -+}; -+ -+PlasmaShellInterface::Private::Private(PlasmaShellInterface *q, Display *d) -+ : display(d) -+ , q(q) -+{ -+} -+ -+void PlasmaShellInterface::Private::create() -+{ -+ Q_ASSERT(!shell); -+ shell = wl_global_create(*display, &org_kde_plasma_shell_interface, s_version, this, &bind); -+} -+ -+const struct org_kde_plasma_shell_interface PlasmaShellInterface::Private::s_interface = { -+ createSurfaceCallback, -+ desktopReadyCallback, -+ presentCallback -+}; -+ -+ -+ -+class PlasmaSurfaceInterface::Private -+{ -+public: -+ Private(PlasmaSurfaceInterface *q, PlasmaShellInterface *shell, SurfaceInterface *surface); -+ void create(wl_client *client, quint32 version, quint32 id); -+ -+ SurfaceInterface *surface; -+ PlasmaShellInterface *shell; -+ wl_resource *shellSurface = nullptr; -+ wl_client *client = nullptr; -+ -+private: -+ static Private *cast(wl_resource *r) { -+ return reinterpret_cast(wl_resource_get_user_data(r)); -+ } -+ -+ static void unbind(wl_resource *r); -+ // interface callbacks -+ static void destroyCallback(wl_client *client, wl_resource *resource); -+ static void setOutputCallback(wl_client *client, wl_resource *resource, wl_resource *output); -+ static void setPositionCallback(wl_client *client, wl_resource *resource, -+ int32_t x, int32_t y); -+ static void setRoleCallback(wl_client *client, wl_resource *resource, uint32_t role); -+ static void setFlagsCallback(wl_client *client, wl_resource *resource, uint32_t flags); -+ static void setScreenEdgeCallback(wl_client *client, wl_resource *resource, uint32_t edge); -+ -+ PlasmaSurfaceInterface *q; -+ static const struct org_kde_plasma_surface_interface s_interface; -+}; -+ -+PlasmaShellInterface::PlasmaShellInterface(Display *display, QObject *parent) -+ : QObject(parent) -+ , d(new Private(this, display)) -+{ -+} -+ -+PlasmaShellInterface::~PlasmaShellInterface() -+{ -+ destroy(); -+} -+ -+void PlasmaShellInterface::create() -+{ -+ d->create(); -+} -+ -+void PlasmaShellInterface::destroy() -+{ -+ if (!d->shell) { -+ return; -+ } -+ wl_global_destroy(d->shell); -+ d->shell = nullptr; -+} -+ -+void PlasmaShellInterface::Private::bind(wl_client *client, void *data, uint32_t version, uint32_t id) -+{ -+ reinterpret_cast(data)->bind(client, version, id); -+} -+ -+void PlasmaShellInterface::Private::bind(wl_client *client, uint32_t version, uint32_t id) -+{ -+ wl_resource *shell = wl_resource_create(client, &org_kde_plasma_shell_interface, qMin(version, s_version), id); -+ if (!shell) { -+ wl_client_post_no_memory(client); -+ return; -+ } -+ wl_resource_set_implementation(shell, &s_interface, this, nullptr); -+} -+ -+void PlasmaShellInterface::Private::createSurfaceCallback(wl_client *client, wl_resource *resource, uint32_t id, wl_resource *surface) -+{ -+ auto s = reinterpret_cast(wl_resource_get_user_data(resource)); -+ s->createSurface(client, wl_resource_get_version(resource), id, SurfaceInterface::get(surface)); -+} -+ -+void PlasmaShellInterface::Private::createSurface(wl_client *client, uint32_t version, uint32_t id, SurfaceInterface *surface) -+{ -+ auto it = std::find_if(surfaces.constBegin(), surfaces.constEnd(), -+ [surface](PlasmaSurfaceInterface *s) { -+ return surface == s->surface(); -+ } -+ ); -+ if (it != surfaces.constEnd()) { -+ wl_resource_post_error(surface->resource(), WL_DISPLAY_ERROR_INVALID_OBJECT, "PlasmaSurface already created"); -+ return; -+ } -+ PlasmaSurfaceInterface *shellSurface = new PlasmaSurfaceInterface(q, surface); -+ surfaces << shellSurface; -+ QObject::connect(shellSurface, &PlasmaSurfaceInterface::destroyed, q, -+ [this, shellSurface] { -+ surfaces.removeAll(shellSurface); -+ } -+ ); -+ shellSurface->d->create(client, version, id); -+ emit q->surfaceCreated(shellSurface); -+} -+ -+void PlasmaShellInterface::Private::desktopReadyCallback(wl_client *client, wl_resource *resource) -+{ -+ auto s = reinterpret_cast(wl_resource_get_user_data(resource)); -+ s->desktopReady(client); -+} -+ -+void PlasmaShellInterface::Private::desktopReady(wl_client *client) -+{ -+ Q_UNUSED(client); -+ emit q->ready(); -+} -+ -+void PlasmaShellInterface::Private::presentCallback(wl_client *client, wl_resource *resource, wl_array *surfaces) -+{ -+ auto s = reinterpret_cast(wl_resource_get_user_data(resource)); -+ s->present(client, surfaces); -+} -+ -+void PlasmaShellInterface::Private::present(wl_client *client, wl_array *surfaces) -+{ -+ Q_UNUSED(client); -+ Q_UNUSED(surfaces); -+ // TODO: implement -+} -+ -+bool PlasmaShellInterface::isValid() const -+{ -+ return d->shell != nullptr; -+} -+ -+Display *PlasmaShellInterface::display() const -+{ -+ return d->display; -+} -+ -+/********************************* -+ * PlasmaSurfaceInterface -+ *********************************/ -+PlasmaSurfaceInterface::Private::Private(PlasmaSurfaceInterface *q, PlasmaShellInterface *shell, SurfaceInterface *surface) -+ : surface(surface) -+ , shell(shell) -+ , q(q) -+{ -+} -+ -+const struct org_kde_plasma_surface_interface PlasmaSurfaceInterface::Private::s_interface = { -+ destroyCallback, -+ setOutputCallback, -+ setPositionCallback, -+ setRoleCallback, -+ setFlagsCallback, -+ setScreenEdgeCallback -+}; -+ -+PlasmaSurfaceInterface::PlasmaSurfaceInterface(PlasmaShellInterface *shell, SurfaceInterface *parent) -+ : QObject(parent) -+ , d(new Private(this, shell, parent)) -+{ -+} -+ -+PlasmaSurfaceInterface::~PlasmaSurfaceInterface() -+{ -+ if (d->shellSurface) { -+ wl_resource_destroy(d->shellSurface); -+ } -+} -+ -+void PlasmaSurfaceInterface::Private::create(wl_client *c, quint32 version, quint32 id) -+{ -+ Q_ASSERT(!client); -+ Q_ASSERT(!shellSurface); -+ shellSurface = wl_resource_create(c, &org_kde_plasma_surface_interface, version, id); -+ if (!shellSurface) { -+ wl_client_post_no_memory(c); -+ return; -+ } -+ client = c; -+ -+ wl_resource_set_implementation(shellSurface, &s_interface, this, unbind); -+} -+ -+void PlasmaSurfaceInterface::Private::unbind(wl_resource *r) -+{ -+ auto s = cast(r); -+ s->shellSurface = nullptr; -+ s->q->deleteLater(); -+} -+ -+void PlasmaSurfaceInterface::Private::destroyCallback(wl_client *client, wl_resource *resource) -+{ -+ Q_UNUSED(client); -+ unbind(resource); -+ auto s = cast(resource); -+ delete s; -+} -+ -+void PlasmaSurfaceInterface::Private::setOutputCallback(wl_client *client, wl_resource *resource, wl_resource *output) -+{ -+ Q_UNUSED(client); -+ Q_UNUSED(output) -+ auto s = cast(resource); -+ Q_ASSERT(client == s->client); -+ // TODO: implement -+} -+ -+void PlasmaSurfaceInterface::Private::setPositionCallback(wl_client *client, wl_resource *resource, -+ int32_t x, int32_t y) -+{ -+ Q_UNUSED(x) -+ Q_UNUSED(y) -+ auto s = cast(resource); -+ Q_ASSERT(client == s->client); -+ // TODO: implement -+} -+ -+void PlasmaSurfaceInterface::Private::setRoleCallback(wl_client *client, wl_resource *resource, uint32_t role) -+{ -+ Q_UNUSED(role) -+ auto s = cast(resource); -+ Q_ASSERT(client == s->client); -+ // TODO: implement -+} -+ -+void PlasmaSurfaceInterface::Private::setFlagsCallback(wl_client *client, wl_resource *resource, uint32_t flags) -+{ -+ Q_UNUSED(flags) -+ auto s = cast(resource); -+ Q_ASSERT(client == s->client); -+ // TODO: implement -+} -+ -+void PlasmaSurfaceInterface::Private::setScreenEdgeCallback(wl_client *client, wl_resource *resource, uint32_t edge) -+{ -+ auto s = cast(resource); -+ Q_ASSERT(client == s->client); -+ // TODO: implement -+} -+ -+SurfaceInterface *PlasmaSurfaceInterface::surface() const { -+ return d->surface; -+} -+ -+PlasmaShellInterface *PlasmaSurfaceInterface::shell() const { -+ return d->shell; -+} -+ -+wl_resource *PlasmaSurfaceInterface::shellSurface() const { -+ return d->shellSurface; -+} -+ -+} -+} -diff --git a/src/server/plasma_shell_interface.h b/src/server/plasma_shell_interface.h -new file mode 100644 -index 0000000..169679d ---- /dev/null -+++ b/src/server/plasma_shell_interface.h -@@ -0,0 +1,84 @@ -+/******************************************************************** -+Copyright 2014 Pier Luigi Fiorini -+Copyright 2014 Martin Gräßlin -+ -+This library is free software; you can redistribute it and/or -+modify it under the terms of the GNU Lesser General Public -+License as published by the Free Software Foundation; either -+version 2.1 of the License, or (at your option) version 3, or any -+later version accepted by the membership of KDE e.V. (or its -+successor approved by the membership of KDE e.V.), which shall -+act as a proxy defined in Section 6 of version 3 of the license. -+ -+This library 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 -+Lesser General Public License for more details. -+ -+You should have received a copy of the GNU Lesser General Public -+License along with this library. If not, see . -+*********************************************************************/ -+#ifndef WAYLAND_SERVER_PLASMA_SHELL_INTERFACE_H -+#define WAYLAND_SERVER_PLASMA_SHELL_INTERFACE_H -+ -+#include -+ -+#include -+ -+struct wl_resource; -+ -+namespace KWayland -+{ -+namespace Server -+{ -+ -+class Display; -+class SurfaceInterface; -+class PlasmaSurfaceInterface; -+class OutputInterface; -+ -+class KWAYLANDSERVER_EXPORT PlasmaShellInterface : public QObject -+{ -+ Q_OBJECT -+public: -+ virtual ~PlasmaShellInterface(); -+ -+ void create(); -+ void destroy(); -+ -+ bool isValid() const; -+ -+ Display *display() const; -+ -+Q_SIGNALS: -+ void surfaceCreated(KWayland::Server::PlasmaSurfaceInterface*); -+ void ready(); -+ -+private: -+ friend class Display; -+ explicit PlasmaShellInterface(Display *display, QObject *parent); -+ class Private; -+ QScopedPointer d; -+}; -+ -+class KWAYLANDSERVER_EXPORT PlasmaSurfaceInterface : public QObject -+{ -+ Q_OBJECT -+public: -+ virtual ~PlasmaSurfaceInterface(); -+ -+ SurfaceInterface *surface() const; -+ PlasmaShellInterface *shell() const; -+ wl_resource *shellSurface() const; -+ -+private: -+ friend class PlasmaShellInterface; -+ explicit PlasmaSurfaceInterface(PlasmaShellInterface *shell, SurfaceInterface *parent); -+ class Private; -+ QScopedPointer d; -+}; -+ -+} -+} -+ -+#endif --- -1.8.3.1 -