summaryrefslogtreecommitdiffstats
path: root/src/plugins
diff options
context:
space:
mode:
Diffstat (limited to 'src/plugins')
-rw-r--r--src/plugins/platforms/wayland/gl_integration/wayland_egl/qwaylandeglwindow.h1
-rw-r--r--src/plugins/platforms/wayland/gl_integration/wayland_egl/wayland_egl.pri9
-rw-r--r--src/plugins/platforms/wayland/qwaylandbuffer.h1
-rw-r--r--src/plugins/platforms/wayland/qwaylandinputdevice.cpp21
-rw-r--r--src/plugins/platforms/wayland/qwaylandintegration.cpp7
-rw-r--r--src/plugins/platforms/wayland/qwaylandintegration.h3
-rw-r--r--src/plugins/platforms/wayland/qwaylandnativeinterface.cpp72
-rw-r--r--src/plugins/platforms/wayland/qwaylandnativeinterface.h60
-rw-r--r--src/plugins/platforms/wayland/qwaylandwindow.h3
-rw-r--r--src/plugins/platforms/wayland/wayland.pro2
10 files changed, 170 insertions, 9 deletions
diff --git a/src/plugins/platforms/wayland/gl_integration/wayland_egl/qwaylandeglwindow.h b/src/plugins/platforms/wayland/gl_integration/wayland_egl/qwaylandeglwindow.h
index 549d039bf8..856321dec8 100644
--- a/src/plugins/platforms/wayland/gl_integration/wayland_egl/qwaylandeglwindow.h
+++ b/src/plugins/platforms/wayland/gl_integration/wayland_egl/qwaylandeglwindow.h
@@ -63,7 +63,6 @@ private:
QWaylandEglIntegration *mEglIntegration;
QWaylandGLContext *mGLContext;
struct wl_egl_window *mWaylandEglWindow;
- EGLConfig mConfig;
const QWaylandWindow *mParentWindow;
};
diff --git a/src/plugins/platforms/wayland/gl_integration/wayland_egl/wayland_egl.pri b/src/plugins/platforms/wayland/gl_integration/wayland_egl/wayland_egl.pri
index bc978645c4..cd0701150f 100644
--- a/src/plugins/platforms/wayland/gl_integration/wayland_egl/wayland_egl.pri
+++ b/src/plugins/platforms/wayland/gl_integration/wayland_egl/wayland_egl.pri
@@ -1,12 +1,11 @@
+include (../../../eglconvenience/eglconvenience.pri)
+
LIBS += -lwayland-egl -lEGL
INCLUDEPATH += $$PWD
SOURCES += $$PWD/qwaylandeglintegration.cpp \
$$PWD/qwaylandglcontext.cpp \
- $$PWD/qwaylandeglwindow.cpp \
- $$PWD/../../../eglconvenience/qeglconvenience.cpp
+ $$PWD/qwaylandeglwindow.cpp
HEADERS += $$PWD/qwaylandeglintegration.h \
$$PWD/qwaylandglcontext.h \
- $$PWD/qwaylandeglwindow.h \
- $$PWD/../../../eglconvenience/qeglconvenience.h \
- gl_integration/wayland_egl/qwaylandeglinclude.h
+ $$PWD/qwaylandeglwindow.h
diff --git a/src/plugins/platforms/wayland/qwaylandbuffer.h b/src/plugins/platforms/wayland/qwaylandbuffer.h
index 8779d5fda0..faeb3e85b1 100644
--- a/src/plugins/platforms/wayland/qwaylandbuffer.h
+++ b/src/plugins/platforms/wayland/qwaylandbuffer.h
@@ -44,6 +44,7 @@
#include <QtCore/QSize>
+#include <wayland-client.h>
#include <wayland-client-protocol.h>
class QWaylandBuffer {
diff --git a/src/plugins/platforms/wayland/qwaylandinputdevice.cpp b/src/plugins/platforms/wayland/qwaylandinputdevice.cpp
index 6c2f341f64..2d7df1d613 100644
--- a/src/plugins/platforms/wayland/qwaylandinputdevice.cpp
+++ b/src/plugins/platforms/wayland/qwaylandinputdevice.cpp
@@ -101,6 +101,12 @@ void QWaylandInputDevice::inputHandleMotion(void *data,
QWaylandInputDevice *inputDevice = (QWaylandInputDevice *) data;
QWaylandWindow *window = inputDevice->mPointerFocus;
+ if (window == NULL) {
+ /* We destroyed the pointer focus surface, but the server
+ * didn't get the message yet. */
+ return;
+ }
+
inputDevice->mSurfacePos = QPoint(surface_x, surface_y);
inputDevice->mGlobalPos = QPoint(x, y);
inputDevice->mTime = time;
@@ -120,6 +126,12 @@ void QWaylandInputDevice::inputHandleButton(void *data,
QWaylandWindow *window = inputDevice->mPointerFocus;
Qt::MouseButton qt_button;
+ if (window == NULL) {
+ /* We destroyed the pointer focus surface, but the server
+ * didn't get the message yet. */
+ return;
+ }
+
switch (button) {
case 272:
qt_button = Qt::LeftButton;
@@ -229,6 +241,12 @@ void QWaylandInputDevice::inputHandleKey(void *data,
QEvent::Type type;
char s[2];
+ if (window == NULL) {
+ /* We destroyed the keyboard focus surface, but the server
+ * didn't get the message yet. */
+ return;
+ }
+
code = key + inputDevice->mXkb->min_key_code;
level = 0;
@@ -250,9 +268,6 @@ void QWaylandInputDevice::inputHandleKey(void *data,
sym = translateKey(sym, s, sizeof s);
- qWarning("keycode %d, sym %d, string %d, modifiers 0x%x",
- code, sym, s[0], (int) inputDevice->mModifiers);
-
if (window) {
QWindowSystemInterface::handleKeyEvent(window->widget(),
time, type, sym,
diff --git a/src/plugins/platforms/wayland/qwaylandintegration.cpp b/src/plugins/platforms/wayland/qwaylandintegration.cpp
index 3f3ee5e571..b6401f6d06 100644
--- a/src/plugins/platforms/wayland/qwaylandintegration.cpp
+++ b/src/plugins/platforms/wayland/qwaylandintegration.cpp
@@ -44,6 +44,7 @@
#include "qwaylanddisplay.h"
#include "qwaylandshmsurface.h"
#include "qwaylandshmwindow.h"
+#include "qwaylandnativeinterface.h"
#include "qgenericunixfontdatabase.h"
@@ -62,9 +63,15 @@ QWaylandIntegration::QWaylandIntegration(bool useOpenGL)
: mFontDb(new QGenericUnixFontDatabase())
, mDisplay(new QWaylandDisplay())
, mUseOpenGL(useOpenGL)
+ , mNativeInterface(new QWaylandNativeInterface)
{
}
+QPlatformNativeInterface * QWaylandIntegration::nativeInterface() const
+{
+ return mNativeInterface;
+}
+
QList<QPlatformScreen *>
QWaylandIntegration::screens() const
{
diff --git a/src/plugins/platforms/wayland/qwaylandintegration.h b/src/plugins/platforms/wayland/qwaylandintegration.h
index fc9b8d6a6e..71f6d9c7b3 100644
--- a/src/plugins/platforms/wayland/qwaylandintegration.h
+++ b/src/plugins/platforms/wayland/qwaylandintegration.h
@@ -63,12 +63,15 @@ public:
QPlatformFontDatabase *fontDatabase() const;
+ QPlatformNativeInterface *nativeInterface() const;
+
private:
bool hasOpenGL() const;
QPlatformFontDatabase *mFontDb;
QWaylandDisplay *mDisplay;
bool mUseOpenGL;
+ QPlatformNativeInterface *mNativeInterface;
};
QT_END_NAMESPACE
diff --git a/src/plugins/platforms/wayland/qwaylandnativeinterface.cpp b/src/plugins/platforms/wayland/qwaylandnativeinterface.cpp
new file mode 100644
index 0000000000..c3bfba03cc
--- /dev/null
+++ b/src/plugins/platforms/wayland/qwaylandnativeinterface.cpp
@@ -0,0 +1,72 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the plugins of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qwaylandnativeinterface.h"
+
+#include "qwaylanddisplay.h"
+#include "qwaylandwindow.h"
+#include <QtGui/private/qapplication_p.h>
+
+void *QWaylandNativeInterface::nativeResourceForWidget(const QByteArray &resourceString, QWidget *widget)
+{
+ QByteArray lowerCaseResource = resourceString.toLower();
+
+ if (lowerCaseResource == "display")
+ return qPlatformScreenForWidget(widget)->display()->wl_display();
+ if (lowerCaseResource == "surface") {
+ return ((QWaylandWindow *) widget->platformWindow())->wl_surface();
+ }
+
+ return NULL;
+}
+
+
+QWaylandScreen * QWaylandNativeInterface::qPlatformScreenForWidget(QWidget *widget)
+{
+ QWaylandScreen *screen;
+
+ if (widget) {
+ screen = static_cast<QWaylandScreen *>(QPlatformScreen::platformScreenForWidget(widget));
+ } else {
+ screen = static_cast<QWaylandScreen *>(QApplicationPrivate::platformIntegration()->screens()[0]);
+ }
+ return screen;
+}
diff --git a/src/plugins/platforms/wayland/qwaylandnativeinterface.h b/src/plugins/platforms/wayland/qwaylandnativeinterface.h
new file mode 100644
index 0000000000..ac4cdb9a22
--- /dev/null
+++ b/src/plugins/platforms/wayland/qwaylandnativeinterface.h
@@ -0,0 +1,60 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the plugins of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QWAYLANDNATIVEINTERFACE_H
+#define QWAYLANDNATIVEINTERFACE_H
+
+#include "qwaylandscreen.h"
+
+#include <QtGui/QPlatformNativeInterface>
+
+class QWaylandNativeInterface : public QPlatformNativeInterface
+{
+public:
+ void *nativeResourceForWidget(const QByteArray &resourceString,
+ QWidget *widget);
+
+private:
+ static QWaylandScreen *qPlatformScreenForWidget(QWidget *widget);
+};
+
+
+#endif // QWAYLANDNATIVEINTERFACE_H
diff --git a/src/plugins/platforms/wayland/qwaylandwindow.h b/src/plugins/platforms/wayland/qwaylandwindow.h
index 1e605088ad..47d49a70d9 100644
--- a/src/plugins/platforms/wayland/qwaylandwindow.h
+++ b/src/plugins/platforms/wayland/qwaylandwindow.h
@@ -74,6 +74,9 @@ public:
void damage(const QRegion &region);
void waitForFrameSync();
+
+ struct wl_surface *wl_surface() const { return mSurface; }
+
protected:
struct wl_surface *mSurface;
virtual void newSurfaceCreated();
diff --git a/src/plugins/platforms/wayland/wayland.pro b/src/plugins/platforms/wayland/wayland.pro
index 59454384c2..8d2d4b50af 100644
--- a/src/plugins/platforms/wayland/wayland.pro
+++ b/src/plugins/platforms/wayland/wayland.pro
@@ -8,6 +8,7 @@ DEFINES += $$QMAKE_DEFINES_WAYLAND
SOURCES = main.cpp \
qwaylandintegration.cpp \
+ qwaylandnativeinterface.cpp \
qwaylandshmsurface.cpp \
qwaylandinputdevice.cpp \
qwaylandcursor.cpp \
@@ -17,6 +18,7 @@ SOURCES = main.cpp \
qwaylandshmwindow.cpp
HEADERS = qwaylandintegration.h \
+ qwaylandnativeinterface.h \
qwaylandcursor.h \
qwaylanddisplay.h \
qwaylandwindow.h \