From: Jørgen Lind Date: Wed, 14 Mar 2012 12:32:45 +0000 (+0100) Subject: Make the native interface get the waylandintegration handle X-Git-Tag: TIZEN~107 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=02e50ef592f28ec05654acf3f6c9b84d31736269;p=profile%2Fivi%2Fqtwayland.git Make the native interface get the waylandintegration handle Then we don't need to go through the screen and the default screen if we don't have a handle. Change-Id: I2a2bb4d87a41c1acdf9af2f3abf3647b0f405a3a Reviewed-by: Samuel Rødal --- diff --git a/src/plugins/platforms/wayland/qwaylandintegration.cpp b/src/plugins/platforms/wayland/qwaylandintegration.cpp index 9ecebfc..821ade6 100644 --- a/src/plugins/platforms/wayland/qwaylandintegration.cpp +++ b/src/plugins/platforms/wayland/qwaylandintegration.cpp @@ -73,7 +73,7 @@ QWaylandIntegration::QWaylandIntegration() : mFontDb(new QGenericUnixFontDatabase()) , mEventDispatcher(createUnixEventDispatcher()) - , mNativeInterface(new QWaylandNativeInterface) + , mNativeInterface(new QWaylandNativeInterface(this)) , mAccessibility(new QPlatformAccessibility()) { QGuiApplicationPrivate::instance()->setEventDispatcher(mEventDispatcher); @@ -173,3 +173,8 @@ QPlatformAccessibility *QWaylandIntegration::accessibility() const { return mAccessibility; } + +QWaylandDisplay *QWaylandIntegration::display() const +{ + return mDisplay; +} diff --git a/src/plugins/platforms/wayland/qwaylandintegration.h b/src/plugins/platforms/wayland/qwaylandintegration.h index 8528b99..9115a39 100644 --- a/src/plugins/platforms/wayland/qwaylandintegration.h +++ b/src/plugins/platforms/wayland/qwaylandintegration.h @@ -76,6 +76,7 @@ public: QPlatformAccessibility *accessibility() const; + QWaylandDisplay *display() const; private: QPlatformFontDatabase *mFontDb; QAbstractEventDispatcher *mEventDispatcher; diff --git a/src/plugins/platforms/wayland/qwaylandnativeinterface.cpp b/src/plugins/platforms/wayland/qwaylandnativeinterface.cpp index d42d68b..a079b6e 100644 --- a/src/plugins/platforms/wayland/qwaylandnativeinterface.cpp +++ b/src/plugins/platforms/wayland/qwaylandnativeinterface.cpp @@ -43,17 +43,24 @@ #include "qwaylanddisplay.h" #include "qwaylandwindow.h" #include "qwaylandextendedsurface.h" +#include "qwaylandintegration.h" +#include "qwaylanddisplay.h" #include #include #include "windowmanager_integration/qwaylandwindowmanagerintegration.h" +QWaylandNativeInterface::QWaylandNativeInterface(QWaylandIntegration *integration) + : m_integration(integration) +{ +} + void *QWaylandNativeInterface::nativeResourceForWindow(const QByteArray &resourceString, QWindow *window) { QByteArray lowerCaseResource = resourceString.toLower(); if (lowerCaseResource == "display") - return qPlatformScreenForWindow(window)->display()->wl_display(); + return m_integration->display()->wl_display(); if (lowerCaseResource == "surface") { return ((QWaylandWindow *) window->handle())->wl_surface(); } @@ -61,19 +68,6 @@ void *QWaylandNativeInterface::nativeResourceForWindow(const QByteArray &resourc return NULL; } - -QWaylandScreen * QWaylandNativeInterface::qPlatformScreenForWindow(QWindow *window) -{ - QWaylandScreen *screen; - - if (window) { - screen = static_cast(window->screen()->handle()); - } else { - screen = static_cast(QGuiApplication::primaryScreen()->handle()); - } - return screen; -} - QVariantMap QWaylandNativeInterface::windowProperties(QPlatformWindow *window) const { QWaylandWindow *waylandWindow = static_cast(window); diff --git a/src/plugins/platforms/wayland/qwaylandnativeinterface.h b/src/plugins/platforms/wayland/qwaylandnativeinterface.h index 0688ee2..ef35508 100644 --- a/src/plugins/platforms/wayland/qwaylandnativeinterface.h +++ b/src/plugins/platforms/wayland/qwaylandnativeinterface.h @@ -46,9 +46,12 @@ #include #include +class QWaylandIntegration; + class QWaylandNativeInterface : public QPlatformNativeInterface { public: + QWaylandNativeInterface(QWaylandIntegration *integration); void *nativeResourceForWindow(const QByteArray &resourceString, QWindow *window); @@ -62,6 +65,7 @@ private: static QWaylandScreen *qPlatformScreenForWindow(QWindow *window); private: + QWaylandIntegration *m_integration; QHash m_windowProperties; };