From 257519ce8a6fc225e04313ae27cd63643b75f0fd Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Martin=20Gr=C3=A4=C3=9Flin?= <mgraesslin@kde.org>
Date: Wed, 28 Oct 2015 13:14:35 +0100
Subject: [PATCH] Add wl_shell_surface as nativeResourceForWindow

Allows to get the wl_shell_surface for a QWindow, if it exists.

Change-Id: I16b1c578a1c605e58c96e94ae55a3331ecfa353d
Reviewed-by: Giulio Camuffo <giulio.camuffo@jollamobile.com>
---
 src/client/qwaylandnativeinterface.cpp | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/src/client/qwaylandnativeinterface.cpp b/src/client/qwaylandnativeinterface.cpp
index 0d20075f0..98e1a7366 100644
--- a/src/client/qwaylandnativeinterface.cpp
+++ b/src/client/qwaylandnativeinterface.cpp
@@ -39,6 +39,7 @@
 #include "qwaylanddisplay_p.h"
 #include "qwaylandwindowmanagerintegration_p.h"
 #include "qwaylandscreen_p.h"
+#include "qwaylandwlshellsurface_p.h"
 #include <QtGui/private/qguiapplication_p.h>
 #include <QtGui/QScreen>
 #include <QtWaylandClient/private/qwaylandclientbufferintegration_p.h>
@@ -80,6 +81,15 @@ void *QWaylandNativeInterface::nativeResourceForWindow(const QByteArray &resourc
     if (lowerCaseResource == "surface") {
         return ((QWaylandWindow *) window->handle())->object();
     }
+    if (lowerCaseResource == "wl_shell_surface") {
+        QWaylandWindow *w = (QWaylandWindow *) window->handle();
+        if (!w)
+            return NULL;
+        QWaylandWlShellSurface *s = qobject_cast<QWaylandWlShellSurface *>(w->shellSurface());
+        if (!s)
+            return NULL;
+        return s->object();
+    }
     if (lowerCaseResource == "egldisplay" && m_integration->clientBufferIntegration())
         return m_integration->clientBufferIntegration()->nativeResource(QWaylandClientBufferIntegration::EglDisplay);
 
-- 
GitLab