summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGunnar Sletta <gunnar.sletta@jollamobile.com>2014-03-25 10:32:45 +0100
committerGunnar Sletta <gunnar.sletta@jollamobile.com>2014-03-25 10:32:45 +0100
commit8b1109a0d5214f63d9cff2653e3bbf8648ad4ad4 (patch)
treeb3f07ec39b36040d4bbd403bbb68aaef0f3a4e0a
parent63b0fef9eb1fe6e65333b03418b9c9a2fb33dfbc (diff)
parenta07bf91a15fe176f5b25e96aeea5b1b40fff947b (diff)
Merge branch 'stable' into dev
Conflicts: src/compositor/compositor_api/qwaylandsurfaceitem.cpp src/compositor/wayland_wrapper/qwlcompositor.cpp Change-Id: Ibbed140c7694ea7fd1882ebb0139b376546b8b50
-rw-r--r--README28
-rw-r--r--config.tests/wayland/main.cpp10
-rw-r--r--examples/examples.pro4
-rw-r--r--examples/qml-compositor/main.cpp13
-rw-r--r--examples/qwidget-compositor/main.cpp398
-rw-r--r--examples/qwidget-compositor/qwidget-compositor.pro23
-rw-r--r--examples/qwidget-compositor/qwidget-compositor.qrc5
-rw-r--r--examples/qwidget-compositor/textureblitter.cpp158
-rw-r--r--examples/qwidget-compositor/textureblitter.h68
-rw-r--r--examples/qwindow-compositor/qwindowcompositor.cpp17
-rw-r--r--examples/qwindow-compositor/qwindowcompositor.h4
-rw-r--r--examples/server-buffer/client/main.cpp4
-rw-r--r--examples/server-buffer/client/serverbufferrenderer.cpp4
-rw-r--r--examples/server-buffer/client/serverbufferrenderer.h4
-rw-r--r--examples/server-buffer/compositor/compositor.pro3
-rw-r--r--examples/server-buffer/compositor/main.cpp11
-rw-r--r--qtwayland.pro2
-rw-r--r--src/3rdparty/protocol/wayland.xml105
-rw-r--r--src/client/hardwareintegration/qwaylandclientbufferintegration_p.h1
-rw-r--r--src/compositor/compositor_api/qwaylandcompositor.cpp21
-rw-r--r--src/compositor/compositor_api/qwaylandcompositor.h4
-rw-r--r--src/compositor/compositor_api/qwaylandinput.cpp17
-rw-r--r--src/compositor/compositor_api/qwaylandinput.h22
-rw-r--r--src/compositor/compositor_api/qwaylandsurface.cpp10
-rw-r--r--src/compositor/compositor_api/qwaylandsurface.h7
-rw-r--r--src/compositor/compositor_api/qwaylandsurfaceitem.cpp6
-rw-r--r--src/compositor/compositor_api/qwaylandsurfaceitem.h2
-rw-r--r--src/compositor/wayland_wrapper/qwlcompositor.cpp21
-rw-r--r--src/compositor/wayland_wrapper/qwlcompositor_p.h5
-rw-r--r--src/compositor/wayland_wrapper/qwlkeyboard.cpp68
-rw-r--r--src/compositor/wayland_wrapper/qwlkeyboard_p.h11
-rw-r--r--src/compositor/wayland_wrapper/qwlsurface.cpp181
-rw-r--r--src/compositor/wayland_wrapper/qwlsurface_p.h23
-rw-r--r--src/compositor/wayland_wrapper/qwlsurfacebuffer.cpp13
-rw-r--r--src/compositor/wayland_wrapper/qwlsurfacebuffer_p.h4
-rw-r--r--src/hardwareintegration/client/wayland-egl/qwaylandeglwindow.cpp10
-rw-r--r--src/hardwareintegration/client/wayland-egl/qwaylandeglwindow.h2
-rw-r--r--src/hardwareintegration/client/wayland-egl/qwaylandglcontext.cpp4
-rw-r--r--src/hardwareintegration/client/xcomposite-egl/qwaylandxcompositeeglclientbufferintegration.cpp5
-rw-r--r--src/hardwareintegration/client/xcomposite-egl/qwaylandxcompositeeglclientbufferintegration.h1
-rw-r--r--src/hardwareintegration/client/xcomposite-egl/qwaylandxcompositeeglcontext.cpp2
-rw-r--r--src/hardwareintegration/client/xcomposite-glx/qwaylandxcompositeglxintegration.cpp4
-rw-r--r--src/hardwareintegration/client/xcomposite-glx/qwaylandxcompositeglxintegration.h7
-rw-r--r--src/hardwareintegration/client/xcomposite-glx/qwaylandxcompositeglxwindow.cpp5
-rw-r--r--src/hardwareintegration/client/xcomposite-glx/qwaylandxcompositeglxwindow.h4
-rw-r--r--src/hardwareintegration/compositor/xcomposite-glx/xcompositeglxintegration.cpp4
-rw-r--r--src/plugins/hardwareintegration/client/brcm-egl/brcm-egl.json2
-rw-r--r--src/plugins/hardwareintegration/client/brcm-egl/main.cpp18
-rw-r--r--src/plugins/hardwareintegration/client/drm-egl-server/main.cpp18
-rw-r--r--src/plugins/hardwareintegration/client/wayland-egl/main.cpp18
-rw-r--r--src/plugins/hardwareintegration/client/xcomposite-egl/main.cpp18
-rw-r--r--src/plugins/hardwareintegration/client/xcomposite-egl/xcomposite-egl.json2
-rw-r--r--src/plugins/hardwareintegration/client/xcomposite-glx/main.cpp18
-rw-r--r--src/plugins/hardwareintegration/client/xcomposite-glx/xcomposite-glx.json2
-rw-r--r--src/plugins/hardwareintegration/compositor/brcm-egl/brcm-egl.json2
-rw-r--r--src/plugins/hardwareintegration/compositor/brcm-egl/main.cpp16
-rw-r--r--src/plugins/hardwareintegration/compositor/drm-egl-server/main.cpp16
-rw-r--r--src/plugins/hardwareintegration/compositor/wayland-egl/main.cpp16
-rw-r--r--src/plugins/hardwareintegration/compositor/xcomposite-egl/main.cpp16
-rw-r--r--src/plugins/hardwareintegration/compositor/xcomposite-egl/xcomposite-egl.json2
-rw-r--r--src/plugins/hardwareintegration/compositor/xcomposite-glx/main.cpp16
-rw-r--r--src/plugins/hardwareintegration/compositor/xcomposite-glx/xcomposite-glx.json2
-rw-r--r--src/plugins/platforms/qwayland-brcm-egl/main.cpp11
-rw-r--r--src/plugins/platforms/qwayland-egl/main.cpp18
-rw-r--r--src/plugins/platforms/qwayland-generic/main.cpp18
-rw-r--r--src/plugins/platforms/qwayland-xcomposite-egl/main.cpp18
-rw-r--r--src/plugins/platforms/qwayland-xcomposite-egl/qwayland-xcomposite-egl.json2
-rw-r--r--src/plugins/platforms/qwayland-xcomposite-glx/main.cpp20
-rw-r--r--src/plugins/platforms/qwayland-xcomposite-glx/qwayland-xcomposite-glx.pro2
-rw-r--r--src/plugins/platforms/qwayland-xcomposite-glx/qwaylandxcompositeglxplatformintegration.h15
-rw-r--r--src/qtwaylandscanner/qtwaylandscanner.cpp23
-rw-r--r--tests/auto/compositor/tst_compositor.cpp2
72 files changed, 465 insertions, 1171 deletions
diff --git a/README b/README
index dcfb09ce9..f26089766 100644
--- a/README
+++ b/README
@@ -15,9 +15,35 @@ include "wayland-compositor" when building the QtWayland module:
qmake CONFIG+=wayland-compositor
make
+Note: make sure the source tree is clean before running those commands. If in
+doubt, run git clean -f -d -x.
+
To build the QtWayland module you need the external dependencies:
xkbcommon 0.2.0 - http://xkbcommon.org/
-wayland 1.3.0 - http://wayland.freedesktop.org/
+wayland 1.2.0 - http://wayland.freedesktop.org/
+
+QtCompositor supports loading client buffer integrations that don't use the
+wayland-egl interfaces. These client buffer integrations are picked up by
+QtCompositor as plugins. To specify what plugin to load use the environment
+variable QT_WAYLAND_CLIENT_BUFFER_INTEGRATION in the environment where the
+compositor is started. The compositor will broadcast to the clients which
+hardware integration to load when using the generic platformplugin "wayland". If
+no client buffer integration is specifided, then the wayland-egl plugin will be
+loaded. Please note that no Weston clients will work if the non standard
+wayland-egl client buffer integration is used.
+
+To start the qwindow-compositor with the xcomposite-egl integration then start
+the compositor as follows:
+QT_WAYLAND_CLIENT_BUFFER_INTEGRATION=xcomposite-egl ./qwindow-compositor
+
+Now it should be possible to start an application in a separate terminal. ie:
+$QTBASEDIR/examples/opengl/hellowindow/hellowindow -platform wayland --single
+
+Available client buffer integrations are:
+wayland-egl (this is the default)
+brcm
+xcomposite-egl
+xcomposite-glx
We hang out at #qt-labs and #qt-lighthouse on freenode if you have any questions
diff --git a/config.tests/wayland/main.cpp b/config.tests/wayland/main.cpp
index fb9915305..6094f0883 100644
--- a/config.tests/wayland/main.cpp
+++ b/config.tests/wayland/main.cpp
@@ -43,15 +43,15 @@
int main()
{
#if WAYLAND_VERSION_MAJOR < 1
-# error Wayland 1.3.0 or higher required
+# error Wayland 1.2.0 or higher required
#endif
#if WAYLAND_VERSION_MAJOR == 1
-# if WAYLAND_VERSION_MINOR < 3
-# error Wayland 1.3.0 or higher required
+# if WAYLAND_VERSION_MINOR < 2
+# error Wayland 1.2.0 or higher required
# endif
-# if WAYLAND_VERSION_MINOR == 3
+# if WAYLAND_VERSION_MINOR == 2
# if WAYLAND_VERSION_MICRO < 0
-# error Wayland 1.3.0 or higher required
+# error Wayland 1.2.0 or higher required
# endif
# endif
#endif
diff --git a/examples/examples.pro b/examples/examples.pro
index 2d4cd1bb3..d633fb924 100644
--- a/examples/examples.pro
+++ b/examples/examples.pro
@@ -5,10 +5,6 @@ TEMPLATE=subdirs
contains(CONFIG, wayland-compositor) {
SUBDIRS += qwindow-compositor
- qtHaveModule(widgets) {
- SUBDIRS += qwidget-compositor
- }
-
qtHaveModule(quick) {
SUBDIRS += qml-compositor
}
diff --git a/examples/qml-compositor/main.cpp b/examples/qml-compositor/main.cpp
index 88bab787a..93b23c0e3 100644
--- a/examples/qml-compositor/main.cpp
+++ b/examples/qml-compositor/main.cpp
@@ -67,7 +67,8 @@ public:
setColor(Qt::black);
winId();
- connect(this, SIGNAL(frameSwapped()), this, SLOT(frameSwappedSlot()));
+ connect(this, SIGNAL(beforeSynchronizing()), this, SLOT(startFrame()), Qt::DirectConnection);
+ connect(this, SIGNAL(afterRendering()), this, SLOT(sendCallbacks()));
}
QWaylandSurface *fullscreenSurface() const
@@ -130,8 +131,14 @@ private slots:
emit windowDestroyed(QVariant::fromValue(item));
}
- void frameSwappedSlot() {
- frameFinished(m_fullscreenSurface);
+ void sendCallbacks() {
+ if (m_fullscreenSurface)
+ sendFrameCallbacks(QList<QWaylandSurface *>() << m_fullscreenSurface);
+ else
+ sendFrameCallbacks(surfaces());
+ }
+ void startFrame() {
+ frameStarted();
}
protected:
diff --git a/examples/qwidget-compositor/main.cpp b/examples/qwidget-compositor/main.cpp
deleted file mode 100644
index 1badb06ac..000000000
--- a/examples/qwidget-compositor/main.cpp
+++ /dev/null
@@ -1,398 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the Qt Compositor.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** You may use this file under the terms of the BSD license as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
-** of its contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qwaylandcompositor.h"
-
-#include "qwaylandsurface.h"
-#include <QtCompositor/qwaylandinput.h>
-
-#include <QApplication>
-#include <QWidget>
-#include <QTimer>
-#include <QPainter>
-#include <QMouseEvent>
-#include <QtCore/QLinkedList>
-
-#ifdef QT_COMPOSITOR_WAYLAND_GL
-#include <QOpenGLContext>
-#include <QGLWidget>
-#include <QtGui/private/qopengltexturecache_p.h>
-#include "textureblitter.h"
-#include <QOpenGLFunctions>
-#endif
-
-#include <QDebug>
-
-#ifdef QT_COMPOSITOR_WAYLAND_GL
-class QWidgetCompositor : public QGLWidget, public QWaylandCompositor
-#else
-class QWidgetCompositor : public QWidget, public WaylandCompositor
-#endif
-{
- Q_OBJECT
-public:
- QWidgetCompositor()
- : QWaylandCompositor(windowHandle(), 0, DefaultExtensions | SubSurfaceExtension)
-#ifdef QT_COMPOSITOR_WAYLAND_GL
- , m_surfaceCompositorFbo(0)
- , m_textureBlitter(0)
- , m_textureCache(0)
-#endif
- , m_moveSurface(0)
- , m_dragSourceSurface(0)
- , m_cursorSurface(0)
- {
- setMouseTracking(true);
- setRetainedSelectionEnabled(true);
- m_background = QImage(QLatin1String(":/background.jpg"));
- //make sure we get the window id and create the glcontext
- //so that clients can successfully initialize egl
- winId();
- }
-
-private slots:
- void surfaceDestroyed(QObject *object) {
- QWaylandSurface *surface = static_cast<QWaylandSurface *>(object);
- m_surfaces.removeAll(surface);
- update();
- }
-
- void surfaceMapped() {
- QWaylandSurface *surface = qobject_cast<QWaylandSurface *>(sender());
- QPoint pos;
- if (!m_surfaces.contains(surface)) {
- uint px = 1 + (qrand() % (width() - surface->size().width() - 2));
- uint py = 1 + (qrand() % (height() - surface->size().height() - 2));
- pos = QPoint(px, py);
- surface->setPos(pos);
- if (surface->hasShellSurface())
- m_surfaces.append(surface);
- }
- if (surface->hasShellSurface())
- defaultInputDevice()->setKeyboardFocus(surface);
- update();
- }
-
- void surfaceDamaged(const QRect &rect) {
- QWaylandSurface *surface = qobject_cast<QWaylandSurface *>(sender());
- surfaceDamaged(surface, rect);
- }
-
-protected:
- void surfaceDamaged(QWaylandSurface *surface, const QRect &rect)
- {
-#ifdef QT_COMPOSITOR_WAYLAND_GL
- Q_UNUSED(surface);
- Q_UNUSED(rect);
- update();
-#else
- update(rect.translated(surface->geometry().topLeft()));
-#endif
- }
-
- void surfaceCreated(QWaylandSurface *surface) {
- connect(surface, SIGNAL(destroyed(QObject *)), this, SLOT(surfaceDestroyed(QObject *)));
- connect(surface, SIGNAL(mapped()), this, SLOT(surfaceMapped()));
- connect(surface, SIGNAL(damaged(const QRect &)), this, SLOT(surfaceDamaged(const QRect &)));
- update();
- }
-
-#ifdef QT_COMPOSITOR_WAYLAND_GL
- GLuint composeSurface(QWaylandSurface *surface) {
- GLuint texture = 0;
- QOpenGLFunctions *functions = QOpenGLContext::currentContext()->functions();
-
- QSize windowSize = surface->size();
- surface->advanceBufferQueue();
-
- if (!m_surfaceCompositorFbo)
- functions->glGenFramebuffers(1,&m_surfaceCompositorFbo);
-
- functions->glBindFramebuffer(GL_FRAMEBUFFER, m_surfaceCompositorFbo);
-
- if (surface->type() == QWaylandSurface::Shm) {
- texture = m_textureCache->bindTexture(context()->contextHandle(), surface->image());
- } else {
- texture = surface->texture();
- }
-
- functions->glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0,
- GL_TEXTURE_2D, texture, 0);
- paintChildren(surface,surface,windowSize);
- functions->glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0,
- GL_TEXTURE_2D, 0, 0);
-
- functions->glBindFramebuffer(GL_FRAMEBUFFER, 0);
- return texture;
- }
-
- void paintChildren(QWaylandSurface *surface, QWaylandSurface *window, const QSize &windowSize) {
-
- if (surface->subSurfaces().size() == 0)
- return;
-
- QLinkedListIterator<QWaylandSurface *> i(surface->subSurfaces());
- while (i.hasNext()) {
- QWaylandSurface *subSurface = i.next();
- QPointF p = subSurface->mapTo(window,QPoint(0,0));
- QSize size = subSurface->size();
- subSurface->advanceBufferQueue();
- if (size.isValid()) {
- GLuint texture = 0;
- if (subSurface->type() == QWaylandSurface::Texture) {
- texture = subSurface->texture();
- } else if (surface->type() == QWaylandSurface::Shm ) {
- texture = m_textureCache->bindTexture(context()->contextHandle(), surface->image());
- }
- m_textureBlitter->drawTexture(texture,QRect(p.toPoint(),size),windowSize,0,window->isYInverted(),subSurface->isYInverted());
- }
- paintChildren(subSurface,window,windowSize);
- }
- }
-#else //hmmm, this is actually untested :(
- QImage composeSurface(WaylandSurface *surface)
- {
- Q_ASSER(surface->type() == WaylandSurface::Shm);
- QImage img = surface->image();
- QPainter p(&img);
- paintChildren(surface,p,surface);
-
- return img;
- }
-
- void paintChildren(WaylandSurface *surface, QPainter *painter, WaylandSurface *window) {
- if (surface->subSurfaces().size() == 0)
- return;
-
- QLinkedListIterator<WaylandSurface *> i(surface->subSurfaces());
- while (i.hasNext()) {
- WaylandSurface *subSurface = i.next();
- QPoint p = subSurface->mapTo(window,QPoint(0,0));
- QRect geo = subSurface->geometry();
- geo.moveTo(p);
- if (geo.isValid()) {
- painter->drawImage(p,subSurface->image());
- }
- paintChildren(subSurface,painter,window);
- }
- }
-#endif //QT_COMPOSITOR_WAYLAND_GL
-
-
-
- void paintEvent(QPaintEvent *) {
- QPainter p(this);
-
- if (!m_background.isNull())
- p.drawPixmap(rect(), m_backgroundScaled);
-
-#ifdef QT_COMPOSITOR_WAYLAND_GL
- cleanupGraphicsResources();
- if (!m_textureCache) {
- m_textureCache = new QOpenGLTextureCache(context()->contextHandle());
- }
- if (!m_textureBlitter) {
- m_textureBlitter = new TextureBlitter();
- }
- m_textureBlitter->bind();
-#endif
- for (int i = 0; i < m_surfaces.size(); ++i) {
-#ifdef QT_COMPOSITOR_WAYLAND_GL
- GLuint texture = composeSurface(m_surfaces.at(i));
- QWaylandSurface *surface = m_surfaces.at(i);
- QRect geo(surface->pos().toPoint(),surface->size());
- m_textureBlitter->drawTexture(texture,geo,size(),0,false,m_surfaces.at(i)->isYInverted());
-#else
- QImage img = composeSurface(m_surfaces.at(i));
- p.drawImage(m_surfaces.at(i)->geometry().topLeft(),img);
-#endif //QT_COMPOSITOR_WAYLAND_GL
- }
-
- frameFinished();
-
-#ifdef QT_COMPOSITOR_WAYLAND_GL
- //jl:FIX FIX FIX:)
-// update();
- m_textureBlitter->release();
-#endif
- }
-
- void resizeEvent(QResizeEvent *)
- {
- if (!m_background.isNull()) {
- m_backgroundScaled = QPixmap::fromImage(m_background.scaled(size(),
- Qt::IgnoreAspectRatio, Qt::SmoothTransformation));
- }
- }
-
- void raise(QWaylandSurface *surface) {
- defaultInputDevice()->setKeyboardFocus(surface);
- surfaceDamaged(surface, QRect(QPoint(), surface->size()));
- m_surfaces.removeOne(surface);
- m_surfaces.append(surface);
- }
-
- void mousePressEvent(QMouseEvent *e) {
- m_cursorPos = e->pos();
- QPointF local;
- if (QWaylandSurface *surface = surfaceAt(e->pos(), &local)) {
- raise(surface);
- if (e->modifiers() & Qt::ControlModifier) {
- m_moveSurface = surface;
- m_moveOffset = local;
- } else {
- defaultInputDevice()->sendMousePressEvent(e->button(), local.toPoint(),e->pos());
- }
- }
- }
-
- void mouseMoveEvent(QMouseEvent *e) {
- m_cursorPos = e->pos();
- if (isDragging()) {
- QPoint global = e->pos(); // "global" here means the window of the compositor
- QPointF local;
- QWaylandSurface *surface = surfaceAt(e->pos(), &local);
- if (surface) {
- if (!m_dragSourceSurface)
- m_dragSourceSurface = surface;
- if (m_dragSourceSurface == surface)
- m_lastDragSourcePos = local;
- raise(surface);
- }
- //this should go away when draggin is reimplemented
- sendDragMoveEvent(global, local.toPoint(), surface);
- return;
- }
- if (m_moveSurface) {
- m_moveSurface->setPos(e->localPos() - m_moveOffset);
- update();
- return;
- }
- QPointF local;
- if (surfaceAt(e->pos(), &local))
- defaultInputDevice()->sendMouseMoveEvent(local.toPoint(),pos());
- }
-
- void mouseReleaseEvent(QMouseEvent *e) {
- if (isDragging()) {
- sendDragEndEvent();
- if (m_dragSourceSurface) {
- // Must send a release event to the source too, no matter where the cursor is now.
- // This is a hack and should go away when we reimplement draging
- defaultInputDevice()->sendMouseReleaseEvent(e->button(), m_lastDragSourcePos.toPoint(), e->pos());
- m_dragSourceSurface = 0;
- }
- }
- if (m_moveSurface) {
- m_moveSurface = 0;
- return;
- }
- QPointF local;
- if (surfaceAt(e->pos(), &local))
- defaultInputDevice()->sendMouseReleaseEvent(e->button(), local.toPoint(), e->pos());
- }
-
- void keyPressEvent(QKeyEvent *event)
- {
- defaultInputDevice()->sendKeyPressEvent(event->nativeScanCode());
- }
-
- void keyReleaseEvent(QKeyEvent *event)
- {
- defaultInputDevice()->sendKeyReleaseEvent(event->nativeScanCode());
- }
-
- QWaylandSurface *surfaceAt(const QPointF &point, QPointF *local = 0) {
- for (int i = m_surfaces.size() - 1; i >= 0; --i) {
- QWaylandSurface *surface = m_surfaces.at(i);
- QRect geo(surface->pos().toPoint(),surface->size());
- if (geo.contains(point.toPoint())) {
- if (local)
- *local = point - surface->pos();
- return surface;
- }
- }
- return 0;
- }
-
- void setCursorSurface(QWaylandSurface *surface, int hotspotX, int hotspotY) {
- m_cursorSurface = surface;
- m_cursorHotspot = QPoint(hotspotX, hotspotY);
- update();
- }
-
-private:
- QImage m_background;
- QPixmap m_backgroundScaled;
-
- QList<QWaylandSurface *> m_surfaces;
-
-#ifdef QT_COMPOSITOR_WAYLAND_GL
- GLuint m_surfaceCompositorFbo;
- TextureBlitter *m_textureBlitter;
- QOpenGLTextureCache *m_textureCache;
-#endif
-
- QWaylandSurface *m_moveSurface;
- QPointF m_moveOffset;
- QWaylandSurface *m_dragSourceSurface;
- QPointF m_lastDragSourcePos;
-
- QWaylandSurface* m_cursorSurface;
- QPoint m_cursorPos;
- QPoint m_cursorHotspot;
-
- friend class TouchObserver;
-};
-
-int main(int argc, char *argv[])
-{
- QApplication app(argc, argv);
-
- QWidgetCompositor compositor;
- compositor.resize(800, 600);
- compositor.show();
-
-// QTouchScreenHandlerThread t(QString(), new TouchObserver(&compositor));
-
- return app.exec();
-}
-
-#include "main.moc"
diff --git a/examples/qwidget-compositor/qwidget-compositor.pro b/examples/qwidget-compositor/qwidget-compositor.pro
deleted file mode 100644
index 688175b9f..000000000
--- a/examples/qwidget-compositor/qwidget-compositor.pro
+++ /dev/null
@@ -1,23 +0,0 @@
-# if you want to compile QtCompositor as part of the application
-# instead of linking to it, remove the QT += compositor and uncomment
-# the following line
-#include (../../src/qt-compositor/qt-compositor.pri)
-
-# to make QtCompositor/... style includes working without installing
-INCLUDEPATH += $$PWD/../../include
-
-HEADERS += \
- textureblitter.h
-
-SOURCES += \
- main.cpp \
- textureblitter.cpp
-
-QT += core-private gui-private widgets widgets-private opengl opengl-private compositor
-
-RESOURCES += qwidget-compositor.qrc
-
-target.path = $$[QT_INSTALL_EXAMPLES]/qtwayland/qwidget-compositor
-sources.files = $$SOURCES $$HEADERS $$RESOURCES $$FORMS qwidget-compositor.pro
-sources.path = $$[QT_INSTALL_EXAMPLES]/qtwayland/qwidget-compositor
-INSTALLS += target sources
diff --git a/examples/qwidget-compositor/qwidget-compositor.qrc b/examples/qwidget-compositor/qwidget-compositor.qrc
deleted file mode 100644
index 20dd10a53..000000000
--- a/examples/qwidget-compositor/qwidget-compositor.qrc
+++ /dev/null
@@ -1,5 +0,0 @@
-<RCC>
- <qresource prefix="/">
- <file alias="background.jpg">../qml-compositor/background.jpg</file>
- </qresource>
-</RCC>
diff --git a/examples/qwidget-compositor/textureblitter.cpp b/examples/qwidget-compositor/textureblitter.cpp
deleted file mode 100644
index 5607274b2..000000000
--- a/examples/qwidget-compositor/textureblitter.cpp
+++ /dev/null
@@ -1,158 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the Qt Compositor.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** You may use this file under the terms of the BSD license as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
-** of its contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "textureblitter.h"
-
-#include <QtGui/QOpenGLShaderProgram>
-#include <QtGui/QOpenGLContext>
-#include <QtGui/QOpenGLFunctions>
-
-TextureBlitter::TextureBlitter()
- : m_shaderProgram(new QOpenGLShaderProgram())
-{
- static const char *textureVertexProgram =
- "uniform highp mat4 matrix;\n"
- "attribute highp vec3 vertexCoordEntry;\n"
- "attribute highp vec2 textureCoordEntry;\n"
- "varying highp vec2 textureCoord;\n"
- "void main() {\n"
- " textureCoord = textureCoordEntry;\n"
- " gl_Position = matrix * vec4(vertexCoordEntry, 1);\n"
- "}\n";
-
- static const char *textureFragmentProgram =
- "uniform sampler2D texture;\n"
- "varying highp vec2 textureCoord;\n"
- "void main() {\n"
- " gl_FragColor = texture2D(texture, textureCoord);\n"
- "}\n";
-
- //Enable transparent windows
- glEnable(GL_BLEND);
- glBlendFunc (GL_ONE,GL_ONE_MINUS_SRC_ALPHA);
-
- m_shaderProgram->addShaderFromSourceCode(QOpenGLShader::Vertex, textureVertexProgram);
- m_shaderProgram->addShaderFromSourceCode(QOpenGLShader::Fragment, textureFragmentProgram);
- m_shaderProgram->link();
-}
-
-
-void TextureBlitter::bind()
-{
-
- m_shaderProgram->bind();
-
- m_vertexCoordEntry = m_shaderProgram->attributeLocation("vertexCoordEntry");
- m_textureCoordEntry = m_shaderProgram->attributeLocation("textureCoordEntry");
- m_matrixLocation = m_shaderProgram->uniformLocation("matrix");
-}
-
-void TextureBlitter::release()
-{
- m_shaderProgram->release();
-}
-
-void TextureBlitter::drawTexture(int textureId, const QRectF &targetRect, const QSize &targetSize, int depth, bool targethasInvertedY, bool sourceHasInvertedY)
-{
-
- glViewport(0,0,targetSize.width(),targetSize.height());
- GLfloat zValue = depth / 1000.0f;
- //Set Texture and Vertex coordinates
- const GLfloat textureCoordinates[] = {
- 0, 0,
- 1, 0,
- 1, 1,
- 0, 1
- };
-
- GLfloat x1 = targetRect.left();
- GLfloat x2 = targetRect.right();
- GLfloat y1, y2;
- if (targethasInvertedY) {
- if (sourceHasInvertedY) {
- y1 = targetRect.top();
- y2 = targetRect.bottom();
- } else {
- y1 = targetRect.bottom();
- y2 = targetRect.top();
- }
- } else {
- if (sourceHasInvertedY) {
- y1 = targetSize.height() - targetRect.top();
- y2 = targetSize.height() - targetRect.bottom();
- } else {
- y1 = targetSize.height() - targetRect.bottom();
- y2 = targetSize.height() - targetRect.top();
- }
- }
-
- const GLfloat vertexCoordinates[] = {
- GLfloat(x1), GLfloat(y1), zValue,
- GLfloat(x2), GLfloat(y1), zValue,
- GLfloat(x2), GLfloat(y2), zValue,
- GLfloat(x1), GLfloat(y2), zValue
- };
-
- //Set matrix to transfrom geometry values into gl coordinate space.
- m_transformMatrix.setToIdentity();
- m_transformMatrix.scale( 2.0f / targetSize.width(), 2.0f / targetSize.height() );
- m_transformMatrix.translate(-targetSize.width() / 2.0f, -targetSize.height() / 2.0f);
-
- //attach the data!
- QOpenGLContext *currentContext = QOpenGLContext::currentContext();
- currentContext->functions()->glEnableVertexAttribArray(m_vertexCoordEntry);
- currentContext->functions()->glEnableVertexAttribArray(m_textureCoordEntry);
-
- currentContext->functions()->glVertexAttribPointer(m_vertexCoordEntry, 3, GL_FLOAT, GL_FALSE, 0, vertexCoordinates);
- currentContext->functions()->glVertexAttribPointer(m_textureCoordEntry, 2, GL_FLOAT, GL_FALSE, 0, textureCoordinates);
- m_shaderProgram->setUniformValue(m_matrixLocation, m_transformMatrix);
-
- glBindTexture(GL_TEXTURE_2D, textureId);
-
- glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
- glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
-
- glDrawArrays(GL_TRIANGLE_FAN, 0, 4);
-
- glBindTexture(GL_TEXTURE_2D, 0);
-
- currentContext->functions()->glDisableVertexAttribArray(m_vertexCoordEntry);
- currentContext->functions()->glDisableVertexAttribArray(m_textureCoordEntry);
-}
diff --git a/examples/qwidget-compositor/textureblitter.h b/examples/qwidget-compositor/textureblitter.h
deleted file mode 100644
index 9a6ce59ef..000000000
--- a/examples/qwidget-compositor/textureblitter.h
+++ /dev/null
@@ -1,68 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the Qt Compositor.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** You may use this file under the terms of the BSD license as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
-** of its contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef TEXTUREBLITTER_H
-#define TEXTUREBLITTER_H
-
-#include <QtGui/QMatrix4x4>
-
-#include <QtGui/qopengl.h>
-
-class QOpenGLShaderProgram;
-class TextureBlitter
-{
-public:
- TextureBlitter();
- void bind();
- void release();
- void drawTexture(int textureId, const QRectF &sourceGeometry,
- const QSize &targetRect, int depth,
- bool targethasInvertedY, bool sourceHasInvertedY);
-
-private:
- QOpenGLShaderProgram *m_shaderProgram;
- QMatrix4x4 m_transformMatrix;
-
- int m_matrixLocation;
- int m_vertexCoordEntry;
- int m_textureCoordEntry;
-};
-
-#endif // TEXTUREBLITTER_H
diff --git a/examples/qwindow-compositor/qwindowcompositor.cpp b/examples/qwindow-compositor/qwindowcompositor.cpp
index 19f7ce5ec..e0f213aa4 100644
--- a/examples/qwindow-compositor/qwindowcompositor.cpp
+++ b/examples/qwindow-compositor/qwindowcompositor.cpp
@@ -159,10 +159,10 @@ void QWindowCompositor::surfaceUnmapped()
ensureKeyboardFocusSurface(surface);
}
-void QWindowCompositor::surfaceDamaged(const QRect &rect)
+void QWindowCompositor::surfaceCommitted()
{
QWaylandSurface *surface = qobject_cast<QWaylandSurface *>(sender());
- surfaceDamaged(surface, rect);
+ surfaceCommitted(surface);
}
void QWindowCompositor::surfacePosChanged()
@@ -170,10 +170,9 @@ void QWindowCompositor::surfacePosChanged()
m_renderScheduler.start(0);
}
-void QWindowCompositor::surfaceDamaged(QWaylandSurface *surface, const QRect &rect)
+void QWindowCompositor::surfaceCommitted(QWaylandSurface *surface)
{
Q_UNUSED(surface)
- Q_UNUSED(rect)
m_renderScheduler.start(0);
}
@@ -182,7 +181,7 @@ void QWindowCompositor::surfaceCreated(QWaylandSurface *surface)
connect(surface, SIGNAL(destroyed(QObject *)), this, SLOT(surfaceDestroyed(QObject *)));
connect(surface, SIGNAL(mapped()), this, SLOT(surfaceMapped()));
connect(surface, SIGNAL(unmapped()), this, SLOT(surfaceUnmapped()));
- connect(surface, SIGNAL(damaged(const QRect &)), this, SLOT(surfaceDamaged(const QRect &)));
+ connect(surface, SIGNAL(committed()), this, SLOT(surfaceCommitted()));
connect(surface, SIGNAL(extendedSurfaceReady()), this, SLOT(sendExpose()));
connect(surface, SIGNAL(posChanged()), this, SLOT(surfacePosChanged()));
m_renderScheduler.start(0);
@@ -253,7 +252,7 @@ GLuint QWindowCompositor::composeSurface(QWaylandSurface *surface, bool *texture
GLuint texture = 0;
QSize windowSize = surface->size();
- surface->advanceBufferQueue();
+ surface->swapBuffers();
QOpenGLFunctions *functions = QOpenGLContext::currentContext()->functions();
functions->glBindFramebuffer(GL_FRAMEBUFFER, m_surface_fbo);
@@ -288,7 +287,7 @@ void QWindowCompositor::paintChildren(QWaylandSurface *surface, QWaylandSurface
QWaylandSurface *subSurface = i.next();
QPointF p = subSurface->mapTo(window,QPointF(0,0));
QSize subSize = subSurface->size();
- subSurface->advanceBufferQueue();
+ subSurface->swapBuffers();
if (subSize.isValid()) {
GLuint texture = 0;
if (subSurface->type() == QWaylandSurface::Texture) {
@@ -310,6 +309,7 @@ void QWindowCompositor::paintChildren(QWaylandSurface *surface, QWaylandSurface
void QWindowCompositor::render()
{
m_window->makeCurrent();
+ frameStarted();
cleanupGraphicsResources();
@@ -335,7 +335,8 @@ void QWindowCompositor::render()
}
m_textureBlitter->release();
- frameFinished();
+ sendFrameCallbacks(surfaces());
+
// N.B. Never call glFinish() here as the busylooping with vsync 'feature' of the nvidia binary driver is not desirable.
m_window->swapBuffers();
}
diff --git a/examples/qwindow-compositor/qwindowcompositor.h b/examples/qwindow-compositor/qwindowcompositor.h
index c58c0d571..e26a09ebc 100644
--- a/examples/qwindow-compositor/qwindowcompositor.h
+++ b/examples/qwindow-compositor/qwindowcompositor.h
@@ -61,12 +61,12 @@ private slots:
void surfaceDestroyed(QObject *object);
void surfaceMapped();
void surfaceUnmapped();
- void surfaceDamaged(const QRect &rect);
+ void surfaceCommitted();
void surfacePosChanged();
void render();
protected:
- void surfaceDamaged(QWaylandSurface *surface, const QRect &rect);
+ void surfaceCommitted(QWaylandSurface *surface);
void surfaceCreated(QWaylandSurface *surface);
QWaylandSurface* surfaceAt(const QPointF &point, QPointF *local = 0);
diff --git a/examples/server-buffer/client/main.cpp b/examples/server-buffer/client/main.cpp
index 1880f2160..ce705b6a7 100644
--- a/examples/server-buffer/client/main.cpp
+++ b/examples/server-buffer/client/main.cpp
@@ -112,8 +112,8 @@ public slots:
}
m_context->makeCurrent(this);
-
- glBindFramebuffer(GL_FRAMEBUFFER, m_context->defaultFramebufferObject());
+ QOpenGLFunctions *funcs = m_context->functions();
+ funcs->glBindFramebuffer(GL_FRAMEBUFFER, m_context->defaultFramebufferObject());
glViewport(0, 0, width() * devicePixelRatio(), height() * devicePixelRatio());
glClearColor(0.f, 0.f, 0.0f, 1.f);
diff --git a/examples/server-buffer/client/serverbufferrenderer.cpp b/examples/server-buffer/client/serverbufferrenderer.cpp
index 9eafddd63..2f0d204d3 100644
--- a/examples/server-buffer/client/serverbufferrenderer.cpp
+++ b/examples/server-buffer/client/serverbufferrenderer.cpp
@@ -42,6 +42,7 @@
#include <QtGui/QOpenGLVertexArrayObject>
#include <QtGui/QOpenGLShaderProgram>
+
static const GLfloat uv_coords[] = {
0,0,
0,1,
@@ -74,7 +75,8 @@ static const char fragment_shader[] =
"}";
ServerBufferRenderer::ServerBufferRenderer(QWaylandServerBuffer *serverBuffer)
- : m_server_buffer(serverBuffer)
+ : QOpenGLFunctions(QOpenGLContext::currentContext())
+ , m_server_buffer(serverBuffer)
, m_texture(0)
, m_vao(new QOpenGLVertexArrayObject())
, m_program(new QOpenGLShaderProgram())
diff --git a/examples/server-buffer/client/serverbufferrenderer.h b/examples/server-buffer/client/serverbufferrenderer.h
index 58f0c7040..7e8999b1c 100644
--- a/examples/server-buffer/client/serverbufferrenderer.h
+++ b/examples/server-buffer/client/serverbufferrenderer.h
@@ -42,14 +42,14 @@
#define SERVERBUFFERRENDERER_H
#include <QtWaylandClient/private/qwaylandserverbufferintegration_p.h>
-
+#include <QtGui/QOpenGLFunctions>
#include <QMatrix4x4>
QT_BEGIN_NAMESPACE
class QOpenGLVertexArrayObject;
class QOpenGLShaderProgram;
-class ServerBufferRenderer
+class ServerBufferRenderer : public QOpenGLFunctions
{
public:
ServerBufferRenderer(QWaylandServerBuffer *serverBuffer);
diff --git a/examples/server-buffer/compositor/compositor.pro b/examples/server-buffer/compositor/compositor.pro
index 8d7f48820..9f7751a09 100644
--- a/examples/server-buffer/compositor/compositor.pro
+++ b/examples/server-buffer/compositor/compositor.pro
@@ -17,4 +17,7 @@ RESOURCES += compositor.qrc
CONFIG +=wayland-scanner
WAYLANDSERVERSOURCES += ../share-buffer.xml
+CONFIG += link_pkgconfig
+PKGCONFIG += wayland-server
+
DEFINES += QT_COMPOSITOR_QUICK
diff --git a/examples/server-buffer/compositor/main.cpp b/examples/server-buffer/compositor/main.cpp
index 68aaea67e..ff375a8c6 100644
--- a/examples/server-buffer/compositor/main.cpp
+++ b/examples/server-buffer/compositor/main.cpp
@@ -83,7 +83,8 @@ public:
create();
grabWindow();
- connect(this, SIGNAL(frameSwapped()), this, SLOT(frameSwappedSlot()));
+ connect(this, SIGNAL(beforeSynchronizing()), this, SLOT(startFrame()), Qt::DirectConnection);
+ connect(this, SIGNAL(afterRendering()), this, SLOT(sendCallbacks()));
connect(this, SIGNAL(sceneGraphInitialized()), this, SLOT(initiateServerBuffer()),Qt::DirectConnection);
connect(this, SIGNAL(serverBuffersCreated()), this, SLOT(createServerBufferItems()));
@@ -127,8 +128,12 @@ private slots:
emit windowDestroyed(QVariant::fromValue(item));
}
- void frameSwappedSlot() {
- frameFinished();
+ void startFrame() {
+ frameStarted();
+ }
+
+ void sendCallbacks() {
+ sendFrameCallbacks(surfaces());
}
void initiateServerBuffer()
diff --git a/qtwayland.pro b/qtwayland.pro
index d6971baae..497483bd3 100644
--- a/qtwayland.pro
+++ b/qtwayland.pro
@@ -13,7 +13,7 @@ qtCompileTest(drm_egl_server)
load(qt_parts)
!config_wayland {
- warning("QtWayland requires Wayland 1.1.0 or higher")
+ warning("QtWayland requires Wayland 1.2.0 or higher")
SUBDIRS =
}
diff --git a/src/3rdparty/protocol/wayland.xml b/src/3rdparty/protocol/wayland.xml
index a1df007d0..1442b6a03 100644
--- a/src/3rdparty/protocol/wayland.xml
+++ b/src/3rdparty/protocol/wayland.xml
@@ -38,7 +38,7 @@
The sync request asks the server to emit the 'done' event
on the returned wl_callback object. Since requests are
handled in-order and events are delivered in-order, this can
- be used as a barrier to ensure all previous requests and the
+ used as a barrier to ensure all previous requests and the
resulting events have been handled.
The object returned by this request will be destroyed by the
@@ -274,73 +274,10 @@
<enum name="format">
<description summary="pixel formats">
- This describes the memory layout of an individual pixel.
-
- All renderers should support argb8888 and xrgb8888 but any other
- formats are optional and may not be supported by the particular
- renderer in use.
+ This describes the memory layout of an individual pixel.
</description>
<entry name="argb8888" value="0" summary="32-bit ARGB format"/>
<entry name="xrgb8888" value="1" summary="32-bit RGB format"/>
- <!-- The drm format codes match the #defines in drm_fourcc.h.
- The formats actually supported by the compositor will be
- reported by the format event. -->
- <entry name="c8" value="0x20203843"/>
- <entry name="rgb332" value="0x38424752"/>
- <entry name="bgr233" value="0x38524742"/>
- <entry name="xrgb4444" value="0x32315258"/>
- <entry name="xbgr4444" value="0x32314258"/>
- <entry name="rgbx4444" value="0x32315852"/>
- <entry name="bgrx4444" value="0x32315842"/>
- <entry name="argb4444" value="0x32315241"/>
- <entry name="abgr4444" value="0x32314241"/>
- <entry name="rgba4444" value="0x32314152"/>
- <entry name="bgra4444" value="0x32314142"/>
- <entry name="xrgb1555" value="0x35315258"/>
- <entry name="xbgr1555" value="0x35314258"/>
- <entry name="rgbx5551" value="0x35315852"/>
- <entry name="bgrx5551" value="0x35315842"/>
- <entry name="argb1555" value="0x35315241"/>
- <entry name="abgr1555" value="0x35314241"/>
- <entry name="rgba5551" value="0x35314152"/>
- <entry name="bgra5551" value="0x35314142"/>
- <entry name="rgb565" value="0x36314752"/>
- <entry name="bgr565" value="0x36314742"/>
- <entry name="rgb888" value="0x34324752"/>
- <entry name="bgr888" value="0x34324742"/>
- <entry name="xbgr8888" value="0x34324258"/>
- <entry name="rgbx8888" value="0x34325852"/>
- <entry name="bgrx8888" value="0x34325842"/>
- <entry name="abgr8888" value="0x34324241"/>
- <entry name="rgba8888" value="0x34324152"/>
- <entry name="bgra8888" value="0x34324142"/>
- <entry name="xrgb2101010" value="0x30335258"/>
- <entry name="xbgr2101010" value="0x30334258"/>
- <entry name="rgbx1010102" value="0x30335852"/>
- <entry name="bgrx1010102" value="0x30335842"/>
- <entry name="argb2101010" value="0x30335241"/>
- <entry name="abgr2101010" value="0x30334241"/>
- <entry name="rgba1010102" value="0x30334152"/>
- <entry name="bgra1010102" value="0x30334142"/>
- <entry name="yuyv" value="0x56595559"/>
- <entry name="yvyu" value="0x55595659"/>
- <entry name="uyvy" value="0x59565955"/>
- <entry name="vyuy" value="0x59555956"/>
- <entry name="ayuv" value="0x56555941"/>
- <entry name="nv12" value="0x3231564e"/>
- <entry name="nv21" value="0x3132564e"/>
- <entry name="nv16" value="0x3631564e"/>
- <entry name="nv61" value="0x3136564e"/>
- <entry name="yuv410" value="0x39565559"/>
- <entry name="yvu410" value="0x39555659"/>
- <entry name="yuv411" value="0x31315559"/>
- <entry name="yvu411" value="0x31315659"/>
- <entry name="yuv420" value="0x32315559"/>
- <entry name="yvu420" value="0x32315659"/>
- <entry name="yuv422" value="0x36315559"/>
- <entry name="yvu422" value="0x36315659"/>
- <entry name="yuv444" value="0x34325559"/>
- <entry name="yvu444" value="0x34325659"/>
</enum>
<request name="create_pool">
@@ -584,7 +521,7 @@
<description summary="initiate drag-and-drop session">
This event is sent when an active drag-and-drop pointer enters
a surface owned by the client. The position of the pointer at
- enter time is provided by the x and y arguments, in surface
+ enter time is provided by the x an y arguments, in surface
local coordinates.
</description>
@@ -607,7 +544,7 @@
<description summary="drag-and-drop session motion">
This event is sent when the drag-and-drop pointer moves within
the currently focused surface. The new position of the pointer
- is provided by the x and y arguments, in surface local
+ is provided by the x an y arguments, in surface local
coordinates.
</description>
<arg name="time" type="uint" summary="timestamp with millisecond granularity"/>
@@ -640,7 +577,7 @@
<interface name="wl_data_device_manager" version="1">
<description summary="data transfer interface">
- The wl_data_device_manager is a singleton global object that
+ The wl_data_device_manager is a a singleton global object that
provides access to inter-client data transfer mechanisms such as
copy-and-paste and drag-and-drop. These mechanisms are tied to
a wl_seat and this interface lets a client get a wl_data_device
@@ -909,9 +846,9 @@
Set a class for the surface.
The surface class identifies the general class of applications
- to which the surface belongs. A common convention is to use the
- file name (or the full path if it is a non-standard location) of
- the application's .desktop file as the class.
+ to which the surface belongs. A common convention is to use
+ the file name (full path if non-standard location) of the
+ applications .desktop file as the class.
</description>
<arg name="class_" type="string"/>
</request>
@@ -953,7 +890,7 @@
<event name="popup_done">
<description summary="popup interaction is done">
The popup_done event is sent out when a popup grab is broken,
- that is, when the user clicks a surface that doesn't belong
+ that is, when the users clicks a surface that doesn't belong
to the client owning the popup surface.
</description>
</event>
@@ -1015,10 +952,10 @@
Destroying the wl_buffer after wl_buffer.release does not change
the surface contents. However, if the client destroys the
- wl_buffer before receiving the wl_buffer.release event, the surface
+ wl_buffer before receiving wl_buffer.release, the surface
contents become undefined immediately.
- If wl_surface.attach is sent with a NULL wl_buffer, the
+ Only if wl_surface.attach is sent with a NULL wl_buffer, the
following wl_surface.commit will remove the surface content.
</description>
@@ -1235,7 +1172,7 @@
</request>
</interface>
- <interface name="wl_seat" version="3">
+ <interface name="wl_seat" version="2">
<description summary="group of input devices">
A seat is a group of keyboards, pointer and touch devices. This
object is published as a global during start up, or when such a
@@ -1308,7 +1245,7 @@
</interface>
- <interface name="wl_pointer" version="3">
+ <interface name="wl_pointer" version="1">
<description summary="pointer input device">
The wl_pointer interface represents one or more input devices,
such as mice, which control the pointer location and pointer_focus
@@ -1357,10 +1294,6 @@
<arg name="hotspot_y" type="int" summary="y coordinate in surface-relative coordinates"/>
</request>
- <request name="release" type="destructor" since="3">
- <description summary="release the pointer object"/>
- </request>
-
<event name="enter">
<description summary="enter event">
Notification that this seat's pointer is focused on a certain
@@ -1460,16 +1393,12 @@
</event>
</interface>
- <interface name="wl_keyboard" version="3">
+ <interface name="wl_keyboard" version="1">
<description summary="keyboard input device">
The wl_keyboard interface represents one or more keyboards
associated with a seat.
</description>
- <request name="release" type="destructor" since="3">
- <description summary="release the keyboard object"/>
- </request>
-
<enum name="keymap_format">
<description summary="keyboard mapping format">
This specifies the format of the keymap provided to the
@@ -1547,7 +1476,7 @@
</event>
</interface>
- <interface name="wl_touch" version="3">
+ <interface name="wl_touch" version="1">
<description summary="touchscreen input device">
The wl_touch interface represents a touchscreen
associated with a seat.
@@ -1559,10 +1488,6 @@
contact point can be identified by the ID of the sequence.
</description>
- <request name="release" type="destructor" since="3">
- <description summary="release the touch object"/>
- </request>
-
<event name="down">
<description summary="touch down event and beginning of a touch sequence">
A new touch point has appeared on the surface. This touch point is
diff --git a/src/client/hardwareintegration/qwaylandclientbufferintegration_p.h b/src/client/hardwareintegration/qwaylandclientbufferintegration_p.h
index 153b3f591..7d79f3263 100644
--- a/src/client/hardwareintegration/qwaylandclientbufferintegration_p.h
+++ b/src/client/hardwareintegration/qwaylandclientbufferintegration_p.h
@@ -61,7 +61,6 @@ public:
virtual ~QWaylandClientBufferIntegration();
virtual void initialize(QWaylandDisplay *display) = 0;
- virtual bool waitingForEvents() { return false; }
virtual bool supportsThreadedOpenGL() const { return false; }
diff --git a/src/compositor/compositor_api/qwaylandcompositor.cpp b/src/compositor/compositor_api/qwaylandcompositor.cpp
index 1de0056c4..342dce510 100644
--- a/src/compositor/compositor_api/qwaylandcompositor.cpp
+++ b/src/compositor/compositor_api/qwaylandcompositor.cpp
@@ -93,10 +93,16 @@ struct wl_display *QWaylandCompositor::waylandDisplay() const
{
return m_compositor->wl_display();
}
-void QWaylandCompositor::frameFinished(QWaylandSurface *surface)
+
+void QWaylandCompositor::sendFrameCallbacks(QList<QWaylandSurface *> visibleSurfaces)
+{
+ m_compositor->sendFrameCallbacks(visibleSurfaces);
+}
+
+void QWaylandCompositor::frameStarted()
{
- QtWayland::Surface *surfaceImpl = surface? surface->handle():0;
- m_compositor->frameFinished(surfaceImpl);
+ for (QtWayland::Surface *surf: m_compositor->surfaces())
+ surf->frameStarted();
}
void QWaylandCompositor::destroyClientForSurface(QWaylandSurface *surface)
@@ -126,6 +132,15 @@ QList<QWaylandSurface *> QWaylandCompositor::surfacesForClient(WaylandClient* c)
return result;
}
+QList<QWaylandSurface *> QWaylandCompositor::surfaces() const
+{
+ QList<QtWayland::Surface *> surfaces = m_compositor->surfaces();
+ QList<QWaylandSurface *> surfs;
+ foreach (QtWayland::Surface *s, surfaces)
+ surfs << s->waylandSurface();
+ return surfs;
+}
+
QWindow * QWaylandCompositor::window() const
{
return m_toplevel_window;
diff --git a/src/compositor/compositor_api/qwaylandcompositor.h b/src/compositor/compositor_api/qwaylandcompositor.h
index 639ddd6cf..9009f4caa 100644
--- a/src/compositor/compositor_api/qwaylandcompositor.h
+++ b/src/compositor/compositor_api/qwaylandcompositor.h
@@ -84,12 +84,14 @@ public:
struct wl_display *waylandDisplay() const;
- void frameFinished(QWaylandSurface *surface = 0);
+ void frameStarted();
+ void sendFrameCallbacks(QList<QWaylandSurface *> visibleSurfaces);
void destroyClientForSurface(QWaylandSurface *surface);
void destroyClient(WaylandClient *client);
QList<QWaylandSurface *> surfacesForClient(WaylandClient* client) const;
+ QList<QWaylandSurface *> surfaces() const;
QWindow *window()const;
diff --git a/src/compositor/compositor_api/qwaylandinput.cpp b/src/compositor/compositor_api/qwaylandinput.cpp
index c2b7c5108..14c3221f7 100644
--- a/src/compositor/compositor_api/qwaylandinput.cpp
+++ b/src/compositor/compositor_api/qwaylandinput.cpp
@@ -48,6 +48,17 @@
QT_BEGIN_NAMESPACE
+QWaylandKeymap::QWaylandKeymap(const QString &layout, const QString &variant, const QString &options, const QString &model, const QString &rules)
+ : m_layout(layout)
+ , m_variant(variant)
+ , m_options(options)
+ , m_rules(rules)
+ , m_model(model)
+{
+}
+
+
+
QWaylandInputDevice::QWaylandInputDevice(QWaylandCompositor *compositor)
: d(new QtWayland::InputDevice(this,compositor->handle()))
{
@@ -141,6 +152,12 @@ bool QWaylandInputDevice::setKeyboardFocus(QWaylandSurface *surface)
return d->setKeyboardFocus(wlsurface);
}
+void QWaylandInputDevice::setKeymap(const QWaylandKeymap &keymap)
+{
+ if (handle()->keyboardDevice())
+ handle()->keyboardDevice()->setKeymap(keymap);
+}
+
QWaylandSurface *QWaylandInputDevice::mouseFocus() const
{
QtWayland::Surface *wlsurface = d->mouseFocus();
diff --git a/src/compositor/compositor_api/qwaylandinput.h b/src/compositor/compositor_api/qwaylandinput.h
index 8e453af4e..92255518a 100644
--- a/src/compositor/compositor_api/qwaylandinput.h
+++ b/src/compositor/compositor_api/qwaylandinput.h
@@ -43,6 +43,7 @@
#include <QtCore/qnamespace.h>
#include <QtCore/QPoint>
+#include <QtCore/QString>
#include <QtCompositor/qwaylandexport.h>
@@ -57,6 +58,26 @@ namespace QtWayland {
class InputDevice;
}
+class Q_COMPOSITOR_EXPORT QWaylandKeymap
+{
+public:
+ QWaylandKeymap(const QString &layout = QLatin1String("us"), const QString &variant = QString(), const QString &options = QString(),
+ const QString &model = QLatin1String("pc105"), const QString &rules = QLatin1String("evdev"));
+
+ inline QString layout() const { return m_layout; }
+ inline QString variant() const { return m_variant; }
+ inline QString options() const { return m_options; }
+ inline QString rules() const { return m_rules; }
+ inline QString model() const { return m_model; }
+
+private:
+ QString m_layout;
+ QString m_variant;
+ QString m_options;
+ QString m_rules;
+ QString m_model;
+};
+
class Q_COMPOSITOR_EXPORT QWaylandInputDevice
{
public:
@@ -83,6 +104,7 @@ public:
QWaylandSurface *keyboardFocus() const;
bool setKeyboardFocus(QWaylandSurface *surface);
+ void setKeymap(const QWaylandKeymap &keymap);
QWaylandSurface *mouseFocus() const;
void setMouseFocus(QWaylandSurface *surface, const QPointF &local_pos, const QPointF &global_pos = QPointF());
diff --git a/src/compositor/compositor_api/qwaylandsurface.cpp b/src/compositor/compositor_api/qwaylandsurface.cpp
index 87d13caa0..2b7d713c8 100644
--- a/src/compositor/compositor_api/qwaylandsurface.cpp
+++ b/src/compositor/compositor_api/qwaylandsurface.cpp
@@ -104,10 +104,10 @@ QWaylandSurface::QWaylandSurface(QtWayland::Surface *surface)
#endif
}
-void QWaylandSurface::advanceBufferQueue()
+void QWaylandSurface::swapBuffers()
{
Q_D(const QWaylandSurface);
- d->surface->advanceBufferQueue();
+ d->surface->swapBuffers();
}
WaylandClient *QWaylandSurface::client() const
@@ -310,12 +310,6 @@ QWaylandCompositor *QWaylandSurface::compositor() const
return d->surface->compositor()->waylandCompositor();
}
-void QWaylandSurface::frameFinished()
-{
- Q_D(QWaylandSurface);
- d->surface->frameFinished();
-}
-
QWaylandSurface *QWaylandSurface::transientParent() const
{
Q_D(const QWaylandSurface);
diff --git a/src/compositor/compositor_api/qwaylandsurface.h b/src/compositor/compositor_api/qwaylandsurface.h
index 9c10a4df2..2f7b70ce8 100644
--- a/src/compositor/compositor_api/qwaylandsurface.h
+++ b/src/compositor/compositor_api/qwaylandsurface.h
@@ -145,8 +145,6 @@ public:
void setVisibility(QWindow::Visibility visibility);
Q_INVOKABLE void sendOnScreenVisibilityChange(bool visible); // Compat
- void frameFinished();
-
QWaylandSurface *transientParent() const;
QtWayland::Surface *handle() const;
@@ -181,7 +179,7 @@ public:
Q_INVOKABLE void destroySurfaceByForce();
Q_INVOKABLE void ping();
- void advanceBufferQueue();
+ void swapBuffers();
public slots:
void updateSelection();
@@ -189,7 +187,8 @@ public slots:
signals:
void mapped();
void unmapped();
- void damaged(const QRect &rect);
+ void damaged(const QRegion &rect);
+ void committed();
void parentChanged(QWaylandSurface *newParent, QWaylandSurface *oldParent);
void sizeChanged();
void posChanged();
diff --git a/src/compositor/compositor_api/qwaylandsurfaceitem.cpp b/src/compositor/compositor_api/qwaylandsurfaceitem.cpp
index 5ac2a5e92..57e5c2906 100644
--- a/src/compositor/compositor_api/qwaylandsurfaceitem.cpp
+++ b/src/compositor/compositor_api/qwaylandsurfaceitem.cpp
@@ -145,6 +145,7 @@ void QWaylandSurfaceItem::init(QWaylandSurface *surface)
connect(surface, &QWaylandSurface::unmapped, this, &QWaylandSurfaceItem::surfaceUnmapped);
connect(surface, &QWaylandSurface::destroyed, this, &QWaylandSurfaceItem::surfaceDestroyed);
connect(surface, &QWaylandSurface::damaged, this, &QWaylandSurfaceItem::surfaceDamaged);
+ connect(surface, &QWaylandSurface::committed, this, &QQuickItem::update);
connect(surface, &QWaylandSurface::parentChanged, this, &QWaylandSurfaceItem::parentChanged);
connect(surface, &QWaylandSurface::sizeChanged, this, &QWaylandSurfaceItem::updateSize);
connect(surface, &QWaylandSurface::posChanged, this, &QWaylandSurfaceItem::updatePosition);
@@ -294,7 +295,7 @@ void QWaylandSurfaceItem::setDamagedFlag(bool on)
}
-void QWaylandSurfaceItem::surfaceDamaged(const QRect &)
+void QWaylandSurfaceItem::surfaceDamaged(const QRegion &)
{
m_damaged = true;
if (m_surface) {
@@ -305,7 +306,6 @@ void QWaylandSurfaceItem::surfaceDamaged(const QRect &)
}
}
emit textureChanged();
- update();
}
void QWaylandSurfaceItem::parentChanged(QWaylandSurface *newParent, QWaylandSurface *oldParent)
@@ -386,7 +386,7 @@ QSGNode *QWaylandSurfaceItem::updatePaintNode(QSGNode *oldNode, UpdatePaintNodeD
// Order here is important, as the state of visible is that of the pending
// buffer but will be replaced after we advance the buffer queue.
bool mapped = m_surface->isMapped();
- surface()->advanceBufferQueue();
+ surface()->swapBuffers();
if (mapped)
updateTexture();
diff --git a/src/compositor/compositor_api/qwaylandsurfaceitem.h b/src/compositor/compositor_api/qwaylandsurfaceitem.h
index 24590c59c..8abd4bf2d 100644
--- a/src/compositor/compositor_api/qwaylandsurfaceitem.h
+++ b/src/compositor/compositor_api/qwaylandsurfaceitem.h
@@ -112,7 +112,7 @@ private slots:
void surfaceMapped();
void surfaceUnmapped();
void surfaceDestroyed(QObject *object);
- void surfaceDamaged(const QRect &);
+ void surfaceDamaged(const QRegion &);
void parentChanged(QWaylandSurface *newParent, QWaylandSurface *oldParent);
void updateSize();
void updateSurfaceSize();
diff --git a/src/compositor/wayland_wrapper/qwlcompositor.cpp b/src/compositor/wayland_wrapper/qwlcompositor.cpp
index 731d8840a..da67c3cd2 100644
--- a/src/compositor/wayland_wrapper/qwlcompositor.cpp
+++ b/src/compositor/wayland_wrapper/qwlcompositor.cpp
@@ -193,17 +193,12 @@ Compositor::~Compositor()
delete m_display;
}
-void Compositor::frameFinished(Surface *surface)
-{
- if (surface && m_dirty_surfaces.contains(surface)) {
- m_dirty_surfaces.remove(surface);
- surface->sendFrameCallback();
- } else if (!surface) {
- QSet<Surface *> dirty = m_dirty_surfaces;
- m_dirty_surfaces.clear();
- foreach (Surface *surface, dirty)
- surface->sendFrameCallback();
+void Compositor::sendFrameCallbacks(QList<QWaylandSurface *> visibleSurfaces)
+{
+ foreach (QWaylandSurface *surface, visibleSurfaces) {
+ surface->handle()->sendFrameCallback();
}
+ wl_display_flush_clients(m_display->handle());
}
uint Compositor::currentTimeMsecs() const
@@ -236,7 +231,6 @@ void Compositor::destroySurface(Surface *surface)
dev->setKeyboardFocus(0);
m_surfaces.removeOne(surface);
- m_dirty_surfaces.remove(surface);
waylandCompositor()->surfaceAboutToBeDestroyed(surface->waylandSurface());
@@ -268,11 +262,6 @@ void Compositor::compositor_create_region(Resource *resource, uint32_t id)
new Region(resource->client(), id);
}
-void Compositor::markSurfaceAsDirty(QtWayland::Surface *surface)
-{
- m_dirty_surfaces.insert(surface);
-}
-
void Compositor::destroyClient(WaylandClient *c)
{
wl_client *client = static_cast<wl_client *>(c);
diff --git a/src/compositor/wayland_wrapper/qwlcompositor_p.h b/src/compositor/wayland_wrapper/qwlcompositor_p.h
index 91697a29d..450ee23ed 100644
--- a/src/compositor/wayland_wrapper/qwlcompositor_p.h
+++ b/src/compositor/wayland_wrapper/qwlcompositor_p.h
@@ -61,6 +61,7 @@ class QWaylandInputDevice;
class WindowManagerServerIntegration;
class QMimeData;
class QPlatformScreenBuffer;
+class QWaylandSurface;
namespace QtWayland {
@@ -89,12 +90,11 @@ public:
Compositor(QWaylandCompositor *qt_compositor, QWaylandCompositor::ExtensionFlags extensions);
~Compositor();
- void frameFinished(Surface *surface = 0);
+ void sendFrameCallbacks(QList<QWaylandSurface *> visibleSurfaces);
InputDevice *defaultInputDevice(); //we just have 1 default device for now (since QPA doesn't give us anything else)
void destroySurface(Surface *surface);
- void markSurfaceAsDirty(Surface *surface);
void destroyClient(WaylandClient *client);
@@ -186,7 +186,6 @@ private:
QElapsedTimer m_timer;
QList<Surface *> m_surfaces;
- QSet<Surface *> m_dirty_surfaces;
QSet<Surface *> m_destroyed_surfaces;
QSet<SurfaceBuffer *> m_destroyed_buffers;
diff --git a/src/compositor/wayland_wrapper/qwlkeyboard.cpp b/src/compositor/wayland_wrapper/qwlkeyboard.cpp
index 8e74a779b..29c192cb0 100644
--- a/src/compositor/wayland_wrapper/qwlkeyboard.cpp
+++ b/src/compositor/wayland_wrapper/qwlkeyboard.cpp
@@ -67,6 +67,8 @@ Keyboard::Keyboard(Compositor *compositor, InputDevice *seat)
, m_modsLatched()
, m_modsLocked()
, m_group()
+ , m_pendingKeymap(false)
+ , m_state(0)
{
#ifndef QT_NO_WAYLAND_XKB
initXKB();
@@ -79,6 +81,7 @@ Keyboard::~Keyboard()
if (m_keymap_area)
munmap(m_keymap_area, m_keymap_size);
close(m_keymap_fd);
+ xkb_context_unref(m_context);
xkb_state_unref(m_state);
#endif
}
@@ -95,7 +98,7 @@ void Keyboard::setFocus(Surface *surface)
if (resource && (m_focus != surface || m_focusResource != resource)) {
uint32_t serial = wl_display_next_serial(m_compositor->wl_display());
send_modifiers(resource->handle, serial, m_modsDepressed, m_modsLatched, m_modsLocked, m_group);
- send_enter(resource->handle, serial, surface->resource()->handle, m_keys);
+ send_enter(resource->handle, serial, surface->resource()->handle, QByteArray::fromRawData((char *)m_keys.data(), m_keys.size() * sizeof(uint32_t)));
}
m_focusResource = resource;
@@ -103,6 +106,12 @@ void Keyboard::setFocus(Surface *surface)
Q_EMIT focusChanged(m_focus);
}
+void Keyboard::setKeymap(const QWaylandKeymap &keymap)
+{
+ m_keymap = keymap;
+ m_pendingKeymap = true;
+}
+
void Keyboard::sendKeyModifiers(wl_keyboard::Resource *resource, uint32_t serial)
{
send_modifiers(resource->handle, serial, m_modsDepressed, m_modsLatched, m_modsLocked, m_group);
@@ -149,10 +158,24 @@ void Keyboard::keyboard_destroy_resource(wl_keyboard::Resource *resource)
void Keyboard::sendKeyEvent(uint code, uint32_t state)
{
+ // There must be no keys pressed when changing the keymap,
+ // see http://lists.freedesktop.org/archives/wayland-devel/2013-October/011395.html
+ if (m_pendingKeymap && m_keys.isEmpty())
+ updateKeymap();
if (m_focusResource) {
uint32_t time = m_compositor->currentTimeMsecs();
uint32_t serial = wl_display_next_serial(m_compositor->wl_display());
- send_key(m_focusResource->handle, serial, time, code - 8, state);
+ uint key = code - 8;
+ send_key(m_focusResource->handle, serial, time, key, state);
+ if (state == WL_KEYBOARD_KEY_STATE_PRESSED) {
+ m_keys << key;
+ } else {
+ for (int i = 0; i < m_keys.size(); ++i) {
+ if (m_keys.at(i) == key) {
+ m_keys.remove(i);
+ }
+ }
+ }
}
updateModifierState(code, state);
}
@@ -164,7 +187,7 @@ void Keyboard::updateModifierState(uint code, uint32_t state)
uint32_t modsDepressed = xkb_state_serialize_mods(m_state, (xkb_state_component)XKB_STATE_DEPRESSED);
uint32_t modsLatched = xkb_state_serialize_mods(m_state, (xkb_state_component)XKB_STATE_LATCHED);
- uint32_t modsLocked = xkb_state_serialize_mods(m_state, (xkb_state_component)XKB_STATE_LATCHED);
+ uint32_t modsLocked = xkb_state_serialize_mods(m_state, (xkb_state_component)XKB_STATE_LOCKED);
uint32_t group = xkb_state_serialize_group(m_state, (xkb_state_component)XKB_STATE_EFFECTIVE);
if (modsDepressed == m_modsDepressed
@@ -186,6 +209,21 @@ void Keyboard::updateModifierState(uint code, uint32_t state)
#endif
}
+void Keyboard::updateKeymap()
+{
+ m_pendingKeymap = false;
+#ifndef QT_NO_WAYLAND_XKB
+ createXKBKeymap();
+ foreach (Resource *res, resourceMap()) {
+ send_keymap(res->handle, WL_KEYBOARD_KEYMAP_FORMAT_XKB_V1, m_keymap_fd, m_keymap_size);
+ }
+
+ xkb_state_update_mask(m_state, 0, m_modsLatched, m_modsLocked, 0, 0, 0);
+ if (m_focusResource)
+ sendKeyModifiers(m_focusResource, wl_display_next_serial(m_compositor->wl_display()));
+#endif
+}
+
#ifndef QT_NO_WAYLAND_XKB
static int createAnonymousFile(size_t size)
{
@@ -217,10 +255,21 @@ static int createAnonymousFile(size_t size)
void Keyboard::initXKB()
{
- struct xkb_context *context = xkb_context_new(static_cast<xkb_context_flags>(0));
+ m_context = xkb_context_new(static_cast<xkb_context_flags>(0));
+ createXKBKeymap();
+}
+
+void Keyboard::createXKBKeymap()
+{
+ if (m_state)
+ xkb_state_unref(m_state);
- struct xkb_rule_names rule_names = {0, 0, 0, 0, 0};
- struct xkb_keymap *keymap = xkb_keymap_new_from_names(context, &rule_names, static_cast<xkb_keymap_compile_flags>(0));
+ struct xkb_rule_names rule_names = { strdup(qPrintable(m_keymap.rules())),
+ strdup(qPrintable(m_keymap.model())),
+ strdup(qPrintable(m_keymap.layout())),
+ strdup(qPrintable(m_keymap.variant())),
+ strdup(qPrintable(m_keymap.options())) };
+ struct xkb_keymap *keymap = xkb_keymap_new_from_names(m_context, &rule_names, static_cast<xkb_keymap_compile_flags>(0));
char *keymap_str = xkb_keymap_get_as_string(keymap, XKB_KEYMAP_FORMAT_TEXT_V1);
if (!keymap_str)
@@ -242,7 +291,12 @@ void Keyboard::initXKB()
m_state = xkb_state_new(keymap);
xkb_keymap_unref(keymap);
- xkb_context_unref(context);
+
+ free((char *)rule_names.rules);
+ free((char *)rule_names.model);
+ free((char *)rule_names.layout);
+ free((char *)rule_names.variant);
+ free((char *)rule_names.options);
}
#endif
diff --git a/src/compositor/wayland_wrapper/qwlkeyboard_p.h b/src/compositor/wayland_wrapper/qwlkeyboard_p.h
index 4d783f77e..b20fa97f7 100644
--- a/src/compositor/wayland_wrapper/qwlkeyboard_p.h
+++ b/src/compositor/wayland_wrapper/qwlkeyboard_p.h
@@ -43,11 +43,12 @@
#define QTWAYLAND_QWLKEYBOARD_P_H
#include <QtCompositor/qwaylandexport.h>
+#include <QtCompositor/qwaylandinput.h>
#include <QObject>
#include <QtCompositor/private/qwayland-server-wayland.h>
-#include <QtCore/QByteArray>
+#include <QtCore/QVector>
#ifndef QT_NO_WAYLAND_XKB
#include <xkbcommon/xkbcommon.h>
@@ -70,6 +71,7 @@ public:
~Keyboard();
void setFocus(Surface *surface);
+ void setKeymap(const QWaylandKeymap &keymap);
void sendKeyModifiers(Resource *resource, uint32_t serial);
void sendKeyPressEvent(uint code);
@@ -88,9 +90,11 @@ protected:
private:
void sendKeyEvent(uint code, uint32_t state);
void updateModifierState(uint code, uint32_t state);
+ void updateKeymap();
#ifndef QT_NO_WAYLAND_XKB
void initXKB();
+ void createXKBKeymap();
#endif
Compositor *m_compositor;
@@ -99,16 +103,19 @@ private:
Surface *m_focus;
Resource *m_focusResource;
- QByteArray m_keys;
+ QVector<uint32_t> m_keys;
uint32_t m_modsDepressed;
uint32_t m_modsLatched;
uint32_t m_modsLocked;
uint32_t m_group;
+ QWaylandKeymap m_keymap;
+ bool m_pendingKeymap;
#ifndef QT_NO_WAYLAND_XKB
size_t m_keymap_size;
int m_keymap_fd;
char *m_keymap_area;
+ struct xkb_context *m_context;
struct xkb_state *m_state;
#endif
};
diff --git a/src/compositor/wayland_wrapper/qwlsurface.cpp b/src/compositor/wayland_wrapper/qwlsurface.cpp
index 4af4dc80c..7ca58341f 100644
--- a/src/compositor/wayland_wrapper/qwlsurface.cpp
+++ b/src/compositor/wayland_wrapper/qwlsurface.cpp
@@ -73,6 +73,50 @@ namespace QtWayland {
static bool QT_WAYLAND_PRINT_BUFFERING_WARNINGS = qEnvironmentVariableIsSet("QT_WAYLAND_PRINT_BUFFERING_WARNINGS");
+class FrameCallback {
+public:
+ FrameCallback(Surface *surf, wl_resource *res)
+ : surface(surf)
+ , resource(res)
+ , canSend(false)
+ {
+#if WAYLAND_VERSION_MAJOR < 1 || (WAYLAND_VERSION_MAJOR == 1 && WAYLAND_VERSION_MINOR <= 2)
+ res->data = this;
+ res->destroy = destroyCallback;
+#else
+ wl_resource_set_implementation(res, 0, this, destroyCallback);
+#endif
+ }
+ ~FrameCallback()
+ {
+ }
+ void destroy()
+ {
+ if (resource)
+ wl_resource_destroy(resource);
+ else
+ delete this;
+ }
+ void send(uint time)
+ {
+ wl_callback_send_done(resource, time);
+ wl_resource_destroy(resource);
+ }
+ static void destroyCallback(wl_resource *res)
+ {
+#if WAYLAND_VERSION_MAJOR < 1 || (WAYLAND_VERSION_MAJOR == 1 && WAYLAND_VERSION_MINOR <= 2)
+ FrameCallback *_this = static_cast<FrameCallback *>(res->data);
+#else
+ FrameCallback *_this = static_cast<FrameCallback *>(wl_resource_get_user_data(res));
+#endif
+ _this->surface->removeFrameCallback(_this);
+ delete _this;
+ }
+ Surface *surface;
+ wl_resource *resource;
+ bool canSend;
+};
+
Surface::Surface(struct wl_client *client, uint32_t id, Compositor *compositor)
: QtWaylandServer::wl_surface(client, id)
, m_compositor(compositor)
@@ -87,7 +131,8 @@ Surface::Surface(struct wl_client *client, uint32_t id, Compositor *compositor)
, m_transientInactive(false)
, m_isCursorSurface(false)
{
- wl_list_init(&m_frame_callback_list);
+ m_pending.buffer = 0;
+ m_pending.newlyAttached = false;
}
Surface::~Surface()
@@ -97,6 +142,11 @@ Surface::~Surface()
for (int i = 0; i < m_bufferPool.size(); i++)
delete m_bufferPool[i];
+
+ foreach (FrameCallback *c, m_pendingFrameCallbacks)
+ c->destroy();
+ foreach (FrameCallback *c, m_frameCallbacks)
+ c->destroy();
}
void Surface::releaseSurfaces()
@@ -146,7 +196,6 @@ bool Surface::isYInverted() const
bool Surface::mapped() const
{
-
SurfaceBuffer *surfacebuffer = currentSurfaceBuffer();
return surfacebuffer ? bool(surfacebuffer->waylandBufferHandle()) : false;
}
@@ -222,17 +271,18 @@ GLuint Surface::textureId() const
void Surface::sendFrameCallback()
{
uint time = m_compositor->currentTimeMsecs();
- struct wl_resource *frame_callback, *next;
- wl_list_for_each_safe(frame_callback, next, &m_frame_callback_list, link) {
- wl_callback_send_done(frame_callback, time);
- wl_resource_destroy(frame_callback);
+ foreach (FrameCallback *callback, m_frameCallbacks) {
+ if (callback->canSend) {
+ callback->send(time);
+ m_frameCallbacks.removeOne(callback);
+ }
}
- wl_list_init(&m_frame_callback_list);
}
-void Surface::frameFinished()
+void Surface::removeFrameCallback(FrameCallback *callback)
{
- m_compositor->frameFinished(this);
+ m_pendingFrameCallbacks.removeOne(callback);
+ m_frameCallbacks.removeOne(callback);
}
QWaylandSurface * Surface::waylandSurface() const
@@ -292,7 +342,7 @@ Compositor *Surface::compositor() const
return m_compositor;
}
-void Surface::advanceBufferQueue()
+void Surface::swapBuffers()
{
SurfaceBuffer *front = m_frontBuffer;
@@ -306,16 +356,6 @@ void Surface::advanceBufferQueue()
m_backBuffer = 0;
}
- // Set a new back buffer if there is something in the queue.
- if (m_bufferQueue.size() && m_bufferQueue.first()->isComitted()) {
- SurfaceBuffer *next = m_bufferQueue.takeFirst();
- while (next && next->isDestroyed()) {
- next->disown();
- next = m_bufferQueue.size() ? m_bufferQueue.takeFirst() : 0;
- }
- setBackBuffer(next);
- }
-
// Release the old front buffer if we changed it.
if (front && front != m_frontBuffer)
front->disown();
@@ -323,7 +363,7 @@ void Surface::advanceBufferQueue()
/*!
* Sets the backbuffer for this surface. The back buffer is not yet on
- * screen and will become live during the next advanceBufferQueue().
+ * screen and will become live during the next swapBuffers().
*
* The backbuffer represents the current state of the surface for the
* purpose of GUI-thread accessible properties such as size and visibility.
@@ -344,8 +384,8 @@ void Surface::setBackBuffer(SurfaceBuffer *buffer)
emit m_waylandSurface->unmapped();
}
- m_compositor->markSurfaceAsDirty(this);
- emit m_waylandSurface->damaged(m_backBuffer->damageRect());
+ m_damage = m_damage.intersected(QRect(QPoint(), m_size));
+ emit m_waylandSurface->damaged(m_damage);
} else {
InputDevice *inputDevice = m_compositor->defaultInputDevice();
if (inputDevice->keyboardFocus() == this)
@@ -353,6 +393,7 @@ void Surface::setBackBuffer(SurfaceBuffer *buffer)
if (inputDevice->mouseFocus() == this)
inputDevice->setMouseFocus(0, QPointF(), QPointF());
}
+ m_damage = QRegion();
}
SurfaceBuffer *Surface::createSurfaceBuffer(struct ::wl_resource *buffer)
@@ -377,41 +418,6 @@ SurfaceBuffer *Surface::createSurfaceBuffer(struct ::wl_resource *buffer)
return newBuffer;
}
-void Surface::attach(struct ::wl_resource *buffer)
-{
- SurfaceBuffer *last = m_bufferQueue.size()?m_bufferQueue.last():0;
- if (last) {
- if (last->waylandBufferHandle() == buffer) {
- if (QT_WAYLAND_PRINT_BUFFERING_WARNINGS)
- qWarning() << "attaching already attached buffer";
- return;
- }
- if (!last->damageRect().isValid() || !last->isComitted() || isCursorSurface() ){
- last->disown();
- m_bufferQueue.takeLast();
- }
- }
-
- SurfaceBuffer *surfBuf = createSurfaceBuffer(buffer);
- m_bufferQueue << surfBuf;
-}
-
-void Surface::damage(const QRect &rect)
-{
- if (m_bufferQueue.empty()) {
- if (QT_WAYLAND_PRINT_BUFFERING_WARNINGS)
- qWarning() << "Surface::damage() null buffer";
- return;
- }
- SurfaceBuffer *surfaceBuffer = m_bufferQueue.last();
- if (surfaceBuffer->isComitted()) {
- if (QT_WAYLAND_PRINT_BUFFERING_WARNINGS)
- qWarning("Surface::damage() on a committed surface");
- } else{
- surfaceBuffer->setDamage(rect);
- }
-}
-
void Surface::surface_destroy_resource(Resource *)
{
compositor()->destroySurface(this);
@@ -424,21 +430,22 @@ void Surface::surface_destroy(Resource *resource)
void Surface::surface_attach(Resource *, struct wl_resource *buffer, int x, int y)
{
- Q_UNUSED(x);
- Q_UNUSED(y);
-
- attach(buffer);
+ if (m_pending.buffer)
+ m_pending.buffer->disown();
+ m_pending.buffer = createSurfaceBuffer(buffer);
+ m_pending.offset = QPoint(x, y);
+ m_pending.newlyAttached = true;
}
void Surface::surface_damage(Resource *, int32_t x, int32_t y, int32_t width, int32_t height)
{
- damage(QRect(x, y, width, height));
+ m_pending.damage = m_pending.damage.united(QRect(x, y, width, height));
}
void Surface::surface_frame(Resource *resource, uint32_t callback)
{
struct wl_resource *frame_callback = wl_resource_create(resource->client(), &wl_callback_interface, wl_callback_interface.version, callback);
- wl_list_insert(&m_frame_callback_list, &frame_callback->link);
+ m_pendingFrameCallbacks << new FrameCallback(this, frame_callback);
}
void Surface::surface_set_opaque_region(Resource *, struct wl_resource *region)
@@ -453,27 +460,37 @@ void Surface::surface_set_input_region(Resource *, struct wl_resource *region)
void Surface::surface_commit(Resource *)
{
- if (m_bufferQueue.empty()) {
- if (QT_WAYLAND_PRINT_BUFFERING_WARNINGS)
- qWarning("Commit on invalid surface");
- return;
- }
+ m_damage = m_pending.damage;
- SurfaceBuffer *surfaceBuffer = m_bufferQueue.last();
- if (surfaceBuffer->isComitted()) {
- if (QT_WAYLAND_PRINT_BUFFERING_WARNINGS)
- qWarning("Committing buffer that has already been committed");
- } else {
- surfaceBuffer->setCommitted();
- }
+ if (m_pending.buffer || m_pending.newlyAttached) {
+ if (m_backBuffer && m_backBuffer != m_pending.buffer)
+ m_backBuffer->disown();
- // A new buffer was added to the queue, so we set it as the current
- // back buffer. Second and third buffers, if the come, will be handled
- // in advanceBufferQueue().
- if (!m_backBuffer && m_bufferQueue.size() == 1) {
- setBackBuffer(surfaceBuffer);
- m_bufferQueue.takeFirst();
+ setBackBuffer(m_pending.buffer);
+ if (!m_backBuffer && m_surfaceMapped) {
+ m_surfaceMapped = false;
+ emit m_waylandSurface->unmapped();
+ }
}
+
+ m_pending.buffer = 0;
+ m_pending.offset = QPoint();
+ m_pending.newlyAttached = false;
+ m_pending.damage = QRegion();
+
+ if (m_backBuffer)
+ m_backBuffer->setCommitted();
+
+ m_frameCallbacks << m_pendingFrameCallbacks;
+ m_pendingFrameCallbacks.clear();
+
+ emit m_waylandSurface->committed();
+}
+
+void Surface::frameStarted()
+{
+ foreach (FrameCallback *c, m_frameCallbacks)
+ c->canSend = true;
}
void Surface::setClassName(const QString &className)
diff --git a/src/compositor/wayland_wrapper/qwlsurface_p.h b/src/compositor/wayland_wrapper/qwlsurface_p.h
index ba4a8af95..6d911e915 100644
--- a/src/compositor/wayland_wrapper/qwlsurface_p.h
+++ b/src/compositor/wayland_wrapper/qwlsurface_p.h
@@ -48,6 +48,7 @@
#include <QtCore/QVector>
#include <QtCore/QRect>
+#include <QtGui/QRegion>
#include <QtGui/QImage>
#include <QtCore/QTextStream>
@@ -73,6 +74,7 @@ class ExtendedSurface;
class InputPanelSurface;
class SubSurface;
class ShellSurface;
+class FrameCallback;
class Q_COMPOSITOR_EXPORT Surface : public QtWaylandServer::wl_surface
{
@@ -106,8 +108,7 @@ public:
#endif
void sendFrameCallback();
-
- void frameFinished();
+ void removeFrameCallback(FrameCallback *callback);
QWaylandSurface *waylandSurface() const;
@@ -139,8 +140,9 @@ public:
bool isCursorSurface() const { return m_isCursorSurface; }
void setCursorSurface(bool isCursor) { m_isCursorSurface = isCursor; }
- void advanceBufferQueue();
+ void swapBuffers();
void releaseSurfaces();
+ void frameStarted();
private:
Q_DISABLE_COPY(Surface)
@@ -149,14 +151,22 @@ private:
QWaylandSurface *m_waylandSurface;
SurfaceBuffer *m_backBuffer;
+ QRegion m_damage;
SurfaceBuffer *m_frontBuffer;
- QList<SurfaceBuffer *> m_bufferQueue;
bool m_surfaceMapped;
+ struct {
+ SurfaceBuffer *buffer;
+ QRegion damage;
+ QPoint offset;
+ bool newlyAttached;
+ } m_pending;
+
QPoint m_lastLocalMousePos;
QPoint m_lastGlobalMousePos;
- struct wl_list m_frame_callback_list;
+ QList<FrameCallback *> m_pendingFrameCallbacks;
+ QList<FrameCallback *> m_frameCallbacks;
ExtendedSurface *m_extendedSurface;
SubSurface *m_subSurface;
@@ -176,12 +186,9 @@ private:
bool m_isCursorSurface;
inline SurfaceBuffer *currentSurfaceBuffer() const;
- void damage(const QRect &rect);
void setBackBuffer(SurfaceBuffer *buffer);
SurfaceBuffer *createSurfaceBuffer(struct ::wl_resource *buffer);
- void attach(struct ::wl_resource *buffer);
-
void surface_destroy_resource(Resource *resource) Q_DECL_OVERRIDE;
void surface_destroy(Resource *resource) Q_DECL_OVERRIDE;
diff --git a/src/compositor/wayland_wrapper/qwlsurfacebuffer.cpp b/src/compositor/wayland_wrapper/qwlsurfacebuffer.cpp
index 1d919cdfb..b0e67e1fa 100644
--- a/src/compositor/wayland_wrapper/qwlsurfacebuffer.cpp
+++ b/src/compositor/wayland_wrapper/qwlsurfacebuffer.cpp
@@ -96,7 +96,6 @@ void SurfaceBuffer::initialize(struct ::wl_resource *buffer)
m_destroy_listener.listener.notify = destroy_listener_callback;
if (buffer)
wl_signal_add(&buffer->destroy_signal, &m_destroy_listener.listener);
- m_damageRect = QRect();
}
void SurfaceBuffer::destructBufferState()
@@ -171,18 +170,6 @@ void SurfaceBuffer::disown()
void SurfaceBuffer::setDisplayed()
{
m_is_displayed = true;
- m_damageRect = QRect();
-}
-
-void SurfaceBuffer::setDamage(const QRect &rect)
-{
- if (m_damageRect.isValid()) {
- m_damageRect = m_damageRect.united(rect);
- } else {
- m_damageRect = rect;
- }
- m_image = QImage();
-
}
void SurfaceBuffer::destroyTexture()
diff --git a/src/compositor/wayland_wrapper/qwlsurfacebuffer_p.h b/src/compositor/wayland_wrapper/qwlsurfacebuffer_p.h
index 257c82462..c2c39253a 100644
--- a/src/compositor/wayland_wrapper/qwlsurfacebuffer_p.h
+++ b/src/compositor/wayland_wrapper/qwlsurfacebuffer_p.h
@@ -87,9 +87,6 @@ public:
inline void setCommitted() { m_committed = true; }
inline bool isDisplayed() const { return m_is_displayed; }
- inline QRect damageRect() const { return m_damageRect; }
- void setDamage(const QRect &rect);
-
inline bool textureCreated() const { return m_texture; }
bool isDestroyed() { return m_destroyed; }
@@ -112,7 +109,6 @@ private:
Compositor *m_compositor;
struct ::wl_resource *m_buffer;
struct surface_buffer_destroy_listener m_destroy_listener;
- QRect m_damageRect;
bool m_committed;
bool m_is_registered_for_buffer;
bool m_surface_has_buffer;
diff --git a/src/hardwareintegration/client/wayland-egl/qwaylandeglwindow.cpp b/src/hardwareintegration/client/wayland-egl/qwaylandeglwindow.cpp
index dc5bbc3ba..30f649263 100644
--- a/src/hardwareintegration/client/wayland-egl/qwaylandeglwindow.cpp
+++ b/src/hardwareintegration/client/wayland-egl/qwaylandeglwindow.cpp
@@ -59,12 +59,15 @@ QWaylandEglWindow::QWaylandEglWindow(QWindow *window)
, m_clientBufferIntegration(static_cast<QWaylandEglClientBufferIntegration *>(mDisplay->clientBufferIntegration()))
, m_waylandEglWindow(0)
, m_eglSurface(0)
- , m_eglConfig(0)
+ , m_eglConfig(q_configFromGLFormat(m_clientBufferIntegration->eglDisplay(), window->requestedFormat(), true))
, m_contentFBO(0)
, m_resize(false)
- , m_format(window->requestedFormat())
+ , m_format(q_glFormatFromConfig(m_clientBufferIntegration->eglDisplay(), m_eglConfig))
{
setGeometry(window->geometry());
+
+ EGLNativeWindowType eglw = (EGLNativeWindowType) m_waylandEglWindow;
+ m_eglSurface = eglCreateWindowSurface(m_clientBufferIntegration->eglDisplay(), m_eglConfig, eglw, 0);
}
QWaylandEglWindow::~QWaylandEglWindow()
@@ -129,9 +132,6 @@ EGLSurface QWaylandEglWindow::eglSurface() const
}
if (!m_eglSurface) {
- m_eglConfig = q_configFromGLFormat(m_clientBufferIntegration->eglDisplay(), window()->format(), true);
- const_cast<QWaylandEglWindow *>(this)->m_format = q_glFormatFromConfig(m_clientBufferIntegration->eglDisplay(),m_eglConfig);
-
EGLNativeWindowType window = (EGLNativeWindowType) m_waylandEglWindow;
m_eglSurface = eglCreateWindowSurface(m_clientBufferIntegration->eglDisplay(), m_eglConfig, window, 0);
}
diff --git a/src/hardwareintegration/client/wayland-egl/qwaylandeglwindow.h b/src/hardwareintegration/client/wayland-egl/qwaylandeglwindow.h
index 9f08559d1..d6708a342 100644
--- a/src/hardwareintegration/client/wayland-egl/qwaylandeglwindow.h
+++ b/src/hardwareintegration/client/wayland-egl/qwaylandeglwindow.h
@@ -76,7 +76,7 @@ private:
const QWaylandWindow *m_parentWindow;
mutable EGLSurface m_eglSurface;
- mutable EGLConfig m_eglConfig;
+ EGLConfig m_eglConfig;
mutable QOpenGLFramebufferObject *m_contentFBO;
mutable bool m_resize;
diff --git a/src/hardwareintegration/client/wayland-egl/qwaylandglcontext.cpp b/src/hardwareintegration/client/wayland-egl/qwaylandglcontext.cpp
index 3bc1ff2b1..e7a4b5a2b 100644
--- a/src/hardwareintegration/client/wayland-egl/qwaylandglcontext.cpp
+++ b/src/hardwareintegration/client/wayland-egl/qwaylandglcontext.cpp
@@ -210,6 +210,10 @@ void QWaylandGLContext::swapBuffers(QPlatformSurface *surface)
m_textureCache->bindTexture(context(), decorationImage);
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
+ if (!context()->functions()->hasOpenGLFeature(QOpenGLFunctions::NPOTTextureRepeat)) {
+ glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
+ glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
+ }
glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
//Draw Content
diff --git a/src/hardwareintegration/client/xcomposite-egl/qwaylandxcompositeeglclientbufferintegration.cpp b/src/hardwareintegration/client/xcomposite-egl/qwaylandxcompositeeglclientbufferintegration.cpp
index 12ab0a47d..c26ebd6ae 100644
--- a/src/hardwareintegration/client/xcomposite-egl/qwaylandxcompositeeglclientbufferintegration.cpp
+++ b/src/hardwareintegration/client/xcomposite-egl/qwaylandxcompositeeglclientbufferintegration.cpp
@@ -52,6 +52,7 @@ QT_BEGIN_NAMESPACE
QWaylandXCompositeEGLClientBufferIntegration::QWaylandXCompositeEGLClientBufferIntegration()
: QWaylandClientBufferIntegration()
, mWaylandDisplay(0)
+ , mDisplay(0)
{
qDebug() << "Using XComposite-EGL";
}
@@ -65,6 +66,10 @@ void QWaylandXCompositeEGLClientBufferIntegration::initialize(QWaylandDisplay *d
{
mWaylandDisplay = display;
mWaylandDisplay->addRegistryListener(&wlDisplayHandleGlobal, this);
+ while (!mDisplay) {
+ display->flushRequests();
+ display->blockingReadEvents();
+ }
}
QWaylandWindow * QWaylandXCompositeEGLClientBufferIntegration::createEglWindow(QWindow *window)
diff --git a/src/hardwareintegration/client/xcomposite-egl/qwaylandxcompositeeglclientbufferintegration.h b/src/hardwareintegration/client/xcomposite-egl/qwaylandxcompositeeglclientbufferintegration.h
index 9cf19e1c7..cce0e91bf 100644
--- a/src/hardwareintegration/client/xcomposite-egl/qwaylandxcompositeeglclientbufferintegration.h
+++ b/src/hardwareintegration/client/xcomposite-egl/qwaylandxcompositeeglclientbufferintegration.h
@@ -75,7 +75,6 @@ public:
~QWaylandXCompositeEGLClientBufferIntegration();
void initialize(QWaylandDisplay *dispaly) Q_DECL_OVERRIDE;
- bool waitingForEvents() Q_DECL_OVERRIDE { return !mDisplay; }
QWaylandWindow *createEglWindow(QWindow *window) Q_DECL_OVERRIDE;
QPlatformOpenGLContext *createPlatformOpenGLContext(const QSurfaceFormat &glFormat, QPlatformOpenGLContext *share) const Q_DECL_OVERRIDE;
diff --git a/src/hardwareintegration/client/xcomposite-egl/qwaylandxcompositeeglcontext.cpp b/src/hardwareintegration/client/xcomposite-egl/qwaylandxcompositeeglcontext.cpp
index 1ebcdde13..b9a2bb445 100644
--- a/src/hardwareintegration/client/xcomposite-egl/qwaylandxcompositeeglcontext.cpp
+++ b/src/hardwareintegration/client/xcomposite-egl/qwaylandxcompositeeglcontext.cpp
@@ -51,7 +51,7 @@
QT_BEGIN_NAMESPACE
QWaylandXCompositeEGLContext::QWaylandXCompositeEGLContext(const QSurfaceFormat &format, QPlatformOpenGLContext *share, EGLDisplay display)
- : QEGLPlatformContext(format, share, display, q_configFromGLFormat(display, format, true, EGL_WINDOW_BIT | EGL_PIXMAP_BIT), EGL_OPENGL_ES_API)
+ : QEGLPlatformContext(format, share, display, q_configFromGLFormat(display, format, true, EGL_WINDOW_BIT | EGL_PIXMAP_BIT))
{
}
diff --git a/src/hardwareintegration/client/xcomposite-glx/qwaylandxcompositeglxintegration.cpp b/src/hardwareintegration/client/xcomposite-glx/qwaylandxcompositeglxintegration.cpp
index b2c0dd5d3..f08f8dcb5 100644
--- a/src/hardwareintegration/client/xcomposite-glx/qwaylandxcompositeglxintegration.cpp
+++ b/src/hardwareintegration/client/xcomposite-glx/qwaylandxcompositeglxintegration.cpp
@@ -68,6 +68,10 @@ void QWaylandXCompositeGLXIntegration::initialize(QWaylandDisplay *display)
{
mWaylandDisplay = display;
mWaylandDisplay->addRegistryListener(QWaylandXCompositeGLXIntegration::wlDisplayHandleGlobal, this);
+ while (!mDisplay) {
+ display->flushRequests();
+ display->blockingReadEvents();
+ }
}
QWaylandWindow * QWaylandXCompositeGLXIntegration::createEglWindow(QWindow *window)
diff --git a/src/hardwareintegration/client/xcomposite-glx/qwaylandxcompositeglxintegration.h b/src/hardwareintegration/client/xcomposite-glx/qwaylandxcompositeglxintegration.h
index 174629159..1751f775f 100644
--- a/src/hardwareintegration/client/xcomposite-glx/qwaylandxcompositeglxintegration.h
+++ b/src/hardwareintegration/client/xcomposite-glx/qwaylandxcompositeglxintegration.h
@@ -69,11 +69,10 @@ public:
QWaylandXCompositeGLXIntegration();
~QWaylandXCompositeGLXIntegration();
- void initialize(QWaylandDisplay *display);
- bool waitingForEvents() { return !mDisplay; }
+ void initialize(QWaylandDisplay *display) Q_DECL_OVERRIDE;
- QWaylandWindow *createEglWindow(QWindow *window);
- QPlatformOpenGLContext *createPlatformOpenGLContext(const QSurfaceFormat &glFormat, QPlatformOpenGLContext *share) const;
+ QWaylandWindow *createEglWindow(QWindow *window) Q_DECL_OVERRIDE;
+ QPlatformOpenGLContext *createPlatformOpenGLContext(const QSurfaceFormat &glFormat, QPlatformOpenGLContext *share) const Q_DECL_OVERRIDE;
QWaylandDisplay *waylandDisplay() const;
struct qt_xcomposite *waylandXComposite() const;
diff --git a/src/hardwareintegration/client/xcomposite-glx/qwaylandxcompositeglxwindow.cpp b/src/hardwareintegration/client/xcomposite-glx/qwaylandxcompositeglxwindow.cpp
index f33790f33..899ed7649 100644
--- a/src/hardwareintegration/client/xcomposite-glx/qwaylandxcompositeglxwindow.cpp
+++ b/src/hardwareintegration/client/xcomposite-glx/qwaylandxcompositeglxwindow.cpp
@@ -56,7 +56,6 @@ QWaylandXCompositeGLXWindow::QWaylandXCompositeGLXWindow(QWindow *window, QWayla
, m_glxIntegration(glxIntegration)
, m_xWindow(0)
, m_config(qglx_findConfig(glxIntegration->xDisplay(), glxIntegration->screen(), window->format(), GLX_WINDOW_BIT | GLX_PIXMAP_BIT))
- , m_buffer(0)
{
}
@@ -71,8 +70,6 @@ void QWaylandXCompositeGLXWindow::setGeometry(const QRect &rect)
QWaylandWindow::setGeometry(rect);
if (m_xWindow) {
- delete m_buffer;
-
XDestroyWindow(m_glxIntegration->xDisplay(), m_xWindow);
m_xWindow = 0;
}
@@ -115,7 +112,7 @@ void QWaylandXCompositeGLXWindow::createSurface()
XMapWindow(m_glxIntegration->xDisplay(), m_xWindow);
XSync(m_glxIntegration->xDisplay(), False);
- m_buffer = new QWaylandXCompositeBuffer(m_glxIntegration->waylandXComposite(),
+ mBuffer = new QWaylandXCompositeBuffer(m_glxIntegration->waylandXComposite(),
(uint32_t)m_xWindow,
size);
}
diff --git a/src/hardwareintegration/client/xcomposite-glx/qwaylandxcompositeglxwindow.h b/src/hardwareintegration/client/xcomposite-glx/qwaylandxcompositeglxwindow.h
index 9866ad039..6fe99466d 100644
--- a/src/hardwareintegration/client/xcomposite-glx/qwaylandxcompositeglxwindow.h
+++ b/src/hardwareintegration/client/xcomposite-glx/qwaylandxcompositeglxwindow.h
@@ -62,7 +62,7 @@ public:
Window xWindow() const;
- QWaylandBuffer *buffer() { return m_buffer; }
+ QWaylandBuffer *buffer() { return mBuffer; }
private:
void createSurface();
@@ -71,8 +71,6 @@ private:
Window m_xWindow;
GLXFBConfig m_config;
-
- QWaylandBuffer *m_buffer;
};
QT_END_NAMESPACE
diff --git a/src/hardwareintegration/compositor/xcomposite-glx/xcompositeglxintegration.cpp b/src/hardwareintegration/compositor/xcomposite-glx/xcompositeglxintegration.cpp
index dce1fdc31..bd5ddef9a 100644
--- a/src/hardwareintegration/compositor/xcomposite-glx/xcompositeglxintegration.cpp
+++ b/src/hardwareintegration/compositor/xcomposite-glx/xcompositeglxintegration.cpp
@@ -76,6 +76,7 @@ XCompositeGLXClientBufferIntegration::XCompositeGLXClientBufferIntegration()
, mDisplay(0)
, mHandler(0)
{
+ qDebug() << "Loading GLX integration";
}
XCompositeGLXClientBufferIntegration::~XCompositeGLXClientBufferIntegration()
@@ -85,6 +86,7 @@ XCompositeGLXClientBufferIntegration::~XCompositeGLXClientBufferIntegration()
void XCompositeGLXClientBufferIntegration::initializeHardware(QtWayland::Display *)
{
+ qDebug() << "Initializing GLX integration";
QPlatformNativeInterface *nativeInterface = QGuiApplicationPrivate::platformIntegration()->nativeInterface();
if (nativeInterface) {
mDisplay = static_cast<Display *>(nativeInterface->nativeResourceForWindow("Display",m_compositor->window()));
@@ -112,7 +114,7 @@ void XCompositeGLXClientBufferIntegration::initializeHardware(QtWayland::Display
delete glContext;
}
-void XCompositeGLXClientBufferIntegration::updateTextureFromBuffer(struct ::wl_resource *buffer)
+void XCompositeGLXClientBufferIntegration::bindTextureToBuffer(struct ::wl_resource *buffer)
{
XCompositeBuffer *compositorBuffer = XCompositeBuffer::fromResource(buffer);
Pixmap pixmap = XCompositeNameWindowPixmap(mDisplay, compositorBuffer->window());
diff --git a/src/plugins/hardwareintegration/client/brcm-egl/brcm-egl.json b/src/plugins/hardwareintegration/client/brcm-egl/brcm-egl.json
index 48611c6ab..3a659a87b 100644
--- a/src/plugins/hardwareintegration/client/brcm-egl/brcm-egl.json
+++ b/src/plugins/hardwareintegration/client/brcm-egl/brcm-egl.json
@@ -1,3 +1,3 @@
{
- "Keys": [ "wayland-brcm" ]
+ "Keys": [ "brcm" ]
}
diff --git a/src/plugins/hardwareintegration/client/brcm-egl/main.cpp b/src/plugins/hardwareintegration/client/brcm-egl/main.cpp
index f77b41ef0..c023332eb 100644
--- a/src/plugins/hardwareintegration/client/brcm-egl/main.cpp
+++ b/src/plugins/hardwareintegration/client/brcm-egl/main.cpp
@@ -47,26 +47,16 @@ QT_BEGIN_NAMESPACE
class QWaylandBrcmEglClientBufferPlugin : public QWaylandClientBufferIntegrationPlugin
{
Q_OBJECT
- Q_PLUGIN_METADATA(IID "org.qt-project.Qt.WaylandClient.QWaylandClientBufferIntegrationFactoryInterface.5.3" FILE "brcm-egl.json")
+ Q_PLUGIN_METADATA(IID QWaylandClientBufferIntegrationFactoryInterface_iid FILE "brcm-egl.json")
public:
- QStringList keys() const;
- QWaylandClientBufferIntegration *create(const QString&, const QStringList&);
+ QWaylandClientBufferIntegration *create(const QString&, const QStringList&) Q_DECL_OVERRIDE;
};
-QStringList QWaylandBrcmEglClientBufferPlugin::keys() const
-{
- QStringList list;
- list << "wayland-brcm";
- return list;
-}
-
QWaylandClientBufferIntegration *QWaylandBrcmEglClientBufferPlugin::create(const QString& system, const QStringList& paramList)
{
Q_UNUSED(paramList);
- if (system.toLower() == "wayland-brcm")
- return new QWaylandBrcmEglIntegration();
-
- return 0;
+ Q_UNUSED(system);
+ return new QWaylandBrcmEglIntegration();
}
QT_END_NAMESPACE
diff --git a/src/plugins/hardwareintegration/client/drm-egl-server/main.cpp b/src/plugins/hardwareintegration/client/drm-egl-server/main.cpp
index 33b8b4b29..6a3df4431 100644
--- a/src/plugins/hardwareintegration/client/drm-egl-server/main.cpp
+++ b/src/plugins/hardwareintegration/client/drm-egl-server/main.cpp
@@ -47,26 +47,16 @@ QT_BEGIN_NAMESPACE
class DrmEglServerBufferPlugin : public QWaylandServerBufferIntegrationPlugin
{
Q_OBJECT
- Q_PLUGIN_METADATA(IID "org.qt-project.Qt.WaylandClient.QWaylandServerBufferIntegrationFactoryInterface.5.3" FILE "drm-egl-server.json")
+ Q_PLUGIN_METADATA(IID QWaylandServerBufferIntegrationFactoryInterface_iid FILE "drm-egl-server.json")
public:
- QStringList keys() const;
- QWaylandServerBufferIntegration *create(const QString&, const QStringList&);
+ QWaylandServerBufferIntegration *create(const QString&, const QStringList&) Q_DECL_OVERRIDE;
};
-QStringList DrmEglServerBufferPlugin::keys() const
-{
- QStringList list;
- list << "drm-egl-server";
- return list;
-}
-
QWaylandServerBufferIntegration *DrmEglServerBufferPlugin::create(const QString& system, const QStringList& paramList)
{
Q_UNUSED(paramList);
- if (system.toLower() == "drm-egl-server")
- return new DrmEglServerBufferIntegration();
-
- return 0;
+ Q_UNUSED(system);
+ return new DrmEglServerBufferIntegration();
}
QT_END_NAMESPACE
diff --git a/src/plugins/hardwareintegration/client/wayland-egl/main.cpp b/src/plugins/hardwareintegration/client/wayland-egl/main.cpp
index 50e956644..e4cd8c1f0 100644
--- a/src/plugins/hardwareintegration/client/wayland-egl/main.cpp
+++ b/src/plugins/hardwareintegration/client/wayland-egl/main.cpp
@@ -47,26 +47,16 @@ QT_BEGIN_NAMESPACE
class QWaylandEglClientBufferPlugin : public QWaylandClientBufferIntegrationPlugin
{
Q_OBJECT
- Q_PLUGIN_METADATA(IID "org.qt-project.Qt.WaylandClient.QWaylandClientBufferIntegrationFactoryInterface.5.3" FILE "wayland-egl.json")
+ Q_PLUGIN_METADATA(IID QWaylandClientBufferIntegrationFactoryInterface_iid FILE "wayland-egl.json")
public:
- QStringList keys() const;
- QWaylandClientBufferIntegration *create(const QString&, const QStringList&);
+ QWaylandClientBufferIntegration *create(const QString&, const QStringList&) Q_DECL_OVERRIDE;
};
-QStringList QWaylandEglClientBufferPlugin::keys() const
-{
- QStringList list;
- list << "wayland-egl";
- return list;
-}
-
QWaylandClientBufferIntegration *QWaylandEglClientBufferPlugin::create(const QString& system, const QStringList& paramList)
{
Q_UNUSED(paramList);
- if (system.toLower() == "wayland-egl")
- return new QWaylandEglClientBufferIntegration();
-
- return 0;
+ Q_UNUSED(system);
+ return new QWaylandEglClientBufferIntegration();
}
QT_END_NAMESPACE
diff --git a/src/plugins/hardwareintegration/client/xcomposite-egl/main.cpp b/src/plugins/hardwareintegration/client/xcomposite-egl/main.cpp
index 46e3eda4e..4b9835f1d 100644
--- a/src/plugins/hardwareintegration/client/xcomposite-egl/main.cpp
+++ b/src/plugins/hardwareintegration/client/xcomposite-egl/main.cpp
@@ -47,26 +47,16 @@ QT_BEGIN_NAMESPACE
class QWaylandXCompositeEglClientBufferIntegrationPlugin : public QWaylandClientBufferIntegrationPlugin
{
Q_OBJECT
- Q_PLUGIN_METADATA(IID "org.qt-project.Qt.WaylandClient.QWaylandClientBufferIntegrationFactoryInterface.5.3" FILE "xcomposite-egl.json")
+ Q_PLUGIN_METADATA(IID QWaylandClientBufferIntegrationFactoryInterface_iid FILE "xcomposite-egl.json")
public:
- QStringList keys() const;
- QWaylandClientBufferIntegration *create(const QString&, const QStringList&);
+ QWaylandClientBufferIntegration *create(const QString&, const QStringList&) Q_DECL_OVERRIDE;
};
-QStringList QWaylandXCompositeEglClientBufferIntegrationPlugin::keys() const
-{
- QStringList list;
- list << "xcomposite" << "xcomposite-egl";
- return list;
-}
-
QWaylandClientBufferIntegration *QWaylandXCompositeEglClientBufferIntegrationPlugin::create(const QString& system, const QStringList& paramList)
{
Q_UNUSED(paramList);
- if (system.toLower() == "xcomposite" || system.toLower() == "xcomposite-egl")
- return new QWaylandXCompositeEGLClientBufferIntegration();
-
- return 0;
+ Q_UNUSED(system);
+ return new QWaylandXCompositeEGLClientBufferIntegration();
}
QT_END_NAMESPACE
diff --git a/src/plugins/hardwareintegration/client/xcomposite-egl/xcomposite-egl.json b/src/plugins/hardwareintegration/client/xcomposite-egl/xcomposite-egl.json
index 8ccd5b46b..0d119ff85 100644
--- a/src/plugins/hardwareintegration/client/xcomposite-egl/xcomposite-egl.json
+++ b/src/plugins/hardwareintegration/client/xcomposite-egl/xcomposite-egl.json
@@ -1,3 +1,3 @@
{
- "Keys": [ "wayland-xcomposite" ]
+ "Keys": [ "xcomposite-egl" ]
}
diff --git a/src/plugins/hardwareintegration/client/xcomposite-glx/main.cpp b/src/plugins/hardwareintegration/client/xcomposite-glx/main.cpp
index f53caf03a..2c6f0fde8 100644
--- a/src/plugins/hardwareintegration/client/xcomposite-glx/main.cpp
+++ b/src/plugins/hardwareintegration/client/xcomposite-glx/main.cpp
@@ -47,26 +47,16 @@ QT_BEGIN_NAMESPACE
class QWaylandXCompositeGlxClientBufferIntegrationPlugin : public QWaylandClientBufferIntegrationPlugin
{
Q_OBJECT
- Q_PLUGIN_METADATA(IID "org.qt-project.Qt.WaylandClient.QWaylandClientBufferIntegrationFactoryInterface.5.3" FILE "xcomposite-glx.json")
+ Q_PLUGIN_METADATA(IID QWaylandClientBufferIntegrationFactoryInterface_iid FILE "xcomposite-glx.json")
public:
- QStringList keys() const;
- QWaylandClientBufferIntegration *create(const QString&, const QStringList&);
+ QWaylandClientBufferIntegration *create(const QString&, const QStringList&) Q_DECL_OVERRIDE;
};
-QStringList QWaylandXCompositeGlxClientBufferIntegrationPlugin::keys() const
-{
- QStringList list;
- list << "xcomposite-glx";
- return list;
-}
-
QWaylandClientBufferIntegration *QWaylandXCompositeGlxClientBufferIntegrationPlugin::create(const QString& system, const QStringList& paramList)
{
Q_UNUSED(paramList);
- if (system.toLower() == "xcomposite-glx")
- return new QWaylandXCompositeGLXIntegration();
-
- return 0;
+ Q_UNUSED(system);
+ return new QWaylandXCompositeGLXIntegration();
}
QT_END_NAMESPACE
diff --git a/src/plugins/hardwareintegration/client/xcomposite-glx/xcomposite-glx.json b/src/plugins/hardwareintegration/client/xcomposite-glx/xcomposite-glx.json
index 0f4a3bf69..e2c4cecd6 100644
--- a/src/plugins/hardwareintegration/client/xcomposite-glx/xcomposite-glx.json
+++ b/src/plugins/hardwareintegration/client/xcomposite-glx/xcomposite-glx.json
@@ -1,3 +1,3 @@
{
- "Keys": [ "wayland-xcomposite-glx" ]
+ "Keys": [ "xcomposite-glx" ]
}
diff --git a/src/plugins/hardwareintegration/compositor/brcm-egl/brcm-egl.json b/src/plugins/hardwareintegration/compositor/brcm-egl/brcm-egl.json
index 48611c6ab..3a659a87b 100644
--- a/src/plugins/hardwareintegration/compositor/brcm-egl/brcm-egl.json
+++ b/src/plugins/hardwareintegration/compositor/brcm-egl/brcm-egl.json
@@ -1,3 +1,3 @@
{
- "Keys": [ "wayland-brcm" ]
+ "Keys": [ "brcm" ]
}
diff --git a/src/plugins/hardwareintegration/compositor/brcm-egl/main.cpp b/src/plugins/hardwareintegration/compositor/brcm-egl/main.cpp
index 53a3f3c3e..f6bb717bc 100644
--- a/src/plugins/hardwareintegration/compositor/brcm-egl/main.cpp
+++ b/src/plugins/hardwareintegration/compositor/brcm-egl/main.cpp
@@ -49,24 +49,14 @@ class QWaylandBrcmClientBufferIntegration : public QtWayland::ClientBufferIntegr
Q_OBJECT
Q_PLUGIN_METADATA(IID QtWaylandClientBufferIntegrationFactoryInterface_iid FILE "brcm-egl.json")
public:
- QStringList keys() const;
- QtWayland::ClientBufferIntegration *create(const QString&, const QStringList&);
+ QtWayland::ClientBufferIntegration *create(const QString&, const QStringList&) Q_DECL_OVERRIDE;
};
-QStringList QWaylandBrcmClientBufferIntegration::keys() const
-{
- QStringList list;
- list << "wayland-brcm";
- return list;
-}
-
QtWayland::ClientBufferIntegration *QWaylandBrcmClientBufferIntegration::create(const QString& system, const QStringList& paramList)
{
Q_UNUSED(paramList);
- if (system.toLower() == "wayland-brcm")
- return new BrcmEglIntegration();
-
- return 0;
+ Q_UNUSED(system);
+ return new BrcmEglIntegration();
}
QT_END_NAMESPACE
diff --git a/src/plugins/hardwareintegration/compositor/drm-egl-server/main.cpp b/src/plugins/hardwareintegration/compositor/drm-egl-server/main.cpp
index 4bfc1b483..e85f93009 100644
--- a/src/plugins/hardwareintegration/compositor/drm-egl-server/main.cpp
+++ b/src/plugins/hardwareintegration/compositor/drm-egl-server/main.cpp
@@ -49,24 +49,14 @@ class DrmEglServerBufferIntegrationPlugin : public QtWayland::ServerBufferIntegr
Q_OBJECT
Q_PLUGIN_METADATA(IID QtWaylandServerBufferIntegrationFactoryInterface_iid FILE "drm-egl-server.json")
public:
- QStringList keys() const;
- QtWayland::ServerBufferIntegration *create(const QString&, const QStringList&);
+ QtWayland::ServerBufferIntegration *create(const QString&, const QStringList&) Q_DECL_OVERRIDE;
};
-QStringList DrmEglServerBufferIntegrationPlugin::keys() const
-{
- QStringList list;
- list << "drm-egl-server";
- return list;
-}
-
QtWayland::ServerBufferIntegration *DrmEglServerBufferIntegrationPlugin::create(const QString& system, const QStringList& paramList)
{
Q_UNUSED(paramList);
- if (system.toLower() == "drm-egl-server")
- return new DrmEglServerBufferIntegration();
-
- return 0;
+ Q_UNUSED(system);
+ return new DrmEglServerBufferIntegration();
}
QT_END_NAMESPACE
diff --git a/src/plugins/hardwareintegration/compositor/wayland-egl/main.cpp b/src/plugins/hardwareintegration/compositor/wayland-egl/main.cpp
index 274dff1e6..3a7984f0a 100644
--- a/src/plugins/hardwareintegration/compositor/wayland-egl/main.cpp
+++ b/src/plugins/hardwareintegration/compositor/wayland-egl/main.cpp
@@ -50,24 +50,14 @@ class QWaylandIntegrationPlugin : public QtWayland::ClientBufferIntegrationPlugi
Q_OBJECT
Q_PLUGIN_METADATA(IID QtWaylandClientBufferIntegrationFactoryInterface_iid FILE "wayland-egl.json")
public:
- QStringList keys() const;
- QtWayland::ClientBufferIntegration *create(const QString&, const QStringList&);
+ QtWayland::ClientBufferIntegration *create(const QString&, const QStringList&) Q_DECL_OVERRIDE;
};
-QStringList QWaylandIntegrationPlugin::keys() const
-{
- QStringList list;
- list << "wayland-egl";
- return list;
-}
-
QtWayland::ClientBufferIntegration *QWaylandIntegrationPlugin::create(const QString& system, const QStringList& paramList)
{
Q_UNUSED(paramList);
- if (system.toLower() == "wayland-egl")
- return new WaylandEglClientBufferIntegration();
-
- return 0;
+ Q_UNUSED(system);
+ return new WaylandEglClientBufferIntegration();
}
QT_END_NAMESPACE
diff --git a/src/plugins/hardwareintegration/compositor/xcomposite-egl/main.cpp b/src/plugins/hardwareintegration/compositor/xcomposite-egl/main.cpp
index 4ae206fa2..f0bbedaa7 100644
--- a/src/plugins/hardwareintegration/compositor/xcomposite-egl/main.cpp
+++ b/src/plugins/hardwareintegration/compositor/xcomposite-egl/main.cpp
@@ -49,24 +49,14 @@ class QWaylandXCompositeClientBufferIntegration : public QtWayland::ClientBuffer
Q_OBJECT
Q_PLUGIN_METADATA(IID QtWaylandClientBufferIntegrationFactoryInterface_iid FILE "xcomposite-egl.json")
public:
- QStringList keys() const;
- QtWayland::ClientBufferIntegration *create(const QString&, const QStringList&);
+ QtWayland::ClientBufferIntegration *create(const QString&, const QStringList&) Q_DECL_OVERRIDE;
};
-QStringList QWaylandXCompositeClientBufferIntegration::keys() const
-{
- QStringList list;
- list << "wayland-xcomposite";
- return list;
-}
-
QtWayland::ClientBufferIntegration *QWaylandXCompositeClientBufferIntegration::create(const QString& system, const QStringList& paramList)
{
Q_UNUSED(paramList);
- if (system.toLower() == "wayland-xcomposite")
- return new XCompositeEglClientBufferIntegration();
-
- return 0;
+ Q_UNUSED(system);
+ return new XCompositeEglClientBufferIntegration();
}
QT_END_NAMESPACE
diff --git a/src/plugins/hardwareintegration/compositor/xcomposite-egl/xcomposite-egl.json b/src/plugins/hardwareintegration/compositor/xcomposite-egl/xcomposite-egl.json
index 8ccd5b46b..0d119ff85 100644
--- a/src/plugins/hardwareintegration/compositor/xcomposite-egl/xcomposite-egl.json
+++ b/src/plugins/hardwareintegration/compositor/xcomposite-egl/xcomposite-egl.json
@@ -1,3 +1,3 @@
{
- "Keys": [ "wayland-xcomposite" ]
+ "Keys": [ "xcomposite-egl" ]
}
diff --git a/src/plugins/hardwareintegration/compositor/xcomposite-glx/main.cpp b/src/plugins/hardwareintegration/compositor/xcomposite-glx/main.cpp
index 4dcd9136f..37602bcc9 100644
--- a/src/plugins/hardwareintegration/compositor/xcomposite-glx/main.cpp
+++ b/src/plugins/hardwareintegration/compositor/xcomposite-glx/main.cpp
@@ -49,24 +49,14 @@ class QWaylandXCompositeClientBufferIntegration : public QtWayland::ClientBuffer
Q_OBJECT
Q_PLUGIN_METADATA(IID QtWaylandClientBufferIntegrationFactoryInterface_iid FILE "xcomposite-glx.json")
public:
- QStringList keys() const;
- QtWayland::ClientBufferIntegration *create(const QString&, const QStringList&);
+ QtWayland::ClientBufferIntegration *create(const QString&, const QStringList&) Q_DECL_OVERRIDE;
};
-QStringList QWaylandXCompositeClientBufferIntegration::keys() const
-{
- QStringList list;
- list << "wayland-xcomposite-glx";
- return list;
-}
-
QtWayland::ClientBufferIntegration *QWaylandXCompositeClientBufferIntegration::create(const QString& system, const QStringList& paramList)
{
Q_UNUSED(paramList);
- if (system.toLower() == "wayland-xcomposite-glx")
- return new XCompositeGLXClientBufferIntegration();
-
- return 0;
+ Q_UNUSED(system);
+ return new XCompositeGLXClientBufferIntegration();
}
QT_END_NAMESPACE
diff --git a/src/plugins/hardwareintegration/compositor/xcomposite-glx/xcomposite-glx.json b/src/plugins/hardwareintegration/compositor/xcomposite-glx/xcomposite-glx.json
index 8ccd5b46b..e2c4cecd6 100644
--- a/src/plugins/hardwareintegration/compositor/xcomposite-glx/xcomposite-glx.json
+++ b/src/plugins/hardwareintegration/compositor/xcomposite-glx/xcomposite-glx.json
@@ -1,3 +1,3 @@
{
- "Keys": [ "wayland-xcomposite" ]
+ "Keys": [ "xcomposite-glx" ]
}
diff --git a/src/plugins/platforms/qwayland-brcm-egl/main.cpp b/src/plugins/platforms/qwayland-brcm-egl/main.cpp
index c8c4eef12..bd167f618 100644
--- a/src/plugins/platforms/qwayland-brcm-egl/main.cpp
+++ b/src/plugins/platforms/qwayland-brcm-egl/main.cpp
@@ -47,10 +47,9 @@ QT_BEGIN_NAMESPACE
class QWaylandIntegrationPlugin : public QPlatformIntegrationPlugin
{
Q_OBJECT
- Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QPA.QPlatformIntegrationFactoryInterface.5.2" FILE "qwayland-brcm-egl.json")
+ Q_PLUGIN_METADATA(IID QPlatformIntegrationFactoryInterface_iid FILE "qwayland-brcm-egl.json")
public:
- QStringList keys() const;
- QPlatformIntegration *create(const QString&, const QStringList&);
+ QPlatformIntegration *create(const QString&, const QStringList&) Q_DECL_OVERRIDE;
};
QStringList QWaylandIntegrationPlugin::keys() const
@@ -63,10 +62,8 @@ QStringList QWaylandIntegrationPlugin::keys() const
QPlatformIntegration *QWaylandIntegrationPlugin::create(const QString& system, const QStringList& paramList)
{
Q_UNUSED(paramList);
- if (system.toLower() == "wayland-brcm")
- return new QWaylandBrcmEglPlatformIntegration();
-
- return 0;
+ Q_UNUSED(system);
+ return new QWaylandBrcmEglPlatformIntegration();
}
QT_END_NAMESPACE
diff --git a/src/plugins/platforms/qwayland-egl/main.cpp b/src/plugins/platforms/qwayland-egl/main.cpp
index 6f790a14a..010a23e25 100644
--- a/src/plugins/platforms/qwayland-egl/main.cpp
+++ b/src/plugins/platforms/qwayland-egl/main.cpp
@@ -47,26 +47,16 @@ QT_BEGIN_NAMESPACE
class QWaylandIntegrationPlugin : public QPlatformIntegrationPlugin
{
Q_OBJECT
- Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QPA.QPlatformIntegrationFactoryInterface.5.2" FILE "qwayland-egl.json")
+ Q_PLUGIN_METADATA(IID QPlatformIntegrationFactoryInterface_iid FILE "qwayland-egl.json")
public:
- QStringList keys() const;
- QPlatformIntegration *create(const QString&, const QStringList&);
+ QPlatformIntegration *create(const QString&, const QStringList&) Q_DECL_OVERRIDE;
};
-QStringList QWaylandIntegrationPlugin::keys() const
-{
- QStringList list;
- list << "wayland-egl";
- return list;
-}
-
QPlatformIntegration *QWaylandIntegrationPlugin::create(const QString& system, const QStringList& paramList)
{
Q_UNUSED(paramList);
- if (system.toLower() == "wayland-egl")
- return new QWaylandEglPlatformIntegration();
-
- return 0;
+ Q_UNUSED(system);
+ return new QWaylandEglPlatformIntegration();
}
QT_END_NAMESPACE
diff --git a/src/plugins/platforms/qwayland-generic/main.cpp b/src/plugins/platforms/qwayland-generic/main.cpp
index 0575d0dc2..e1761d8e8 100644
--- a/src/plugins/platforms/qwayland-generic/main.cpp
+++ b/src/plugins/platforms/qwayland-generic/main.cpp
@@ -47,26 +47,16 @@ QT_BEGIN_NAMESPACE
class QWaylandIntegrationPlugin : public QPlatformIntegrationPlugin
{
Q_OBJECT
- Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QPA.QPlatformIntegrationFactoryInterface.5.2" FILE "qwayland-generic.json")
+ Q_PLUGIN_METADATA(IID QPlatformIntegrationFactoryInterface_iid FILE "qwayland-generic.json")
public:
- QStringList keys() const;
- QPlatformIntegration *create(const QString&, const QStringList&);
+ QPlatformIntegration *create(const QString&, const QStringList&) Q_DECL_OVERRIDE;
};
-QStringList QWaylandIntegrationPlugin::keys() const
-{
- QStringList list;
- list << "wayland";
- return list;
-}
-
QPlatformIntegration *QWaylandIntegrationPlugin::create(const QString& system, const QStringList& paramList)
{
Q_UNUSED(paramList);
- if (system.toLower() == "wayland")
- return new QWaylandIntegration();
-
- return 0;
+ Q_UNUSED(system);
+ return new QWaylandIntegration();
}
QT_END_NAMESPACE
diff --git a/src/plugins/platforms/qwayland-xcomposite-egl/main.cpp b/src/plugins/platforms/qwayland-xcomposite-egl/main.cpp
index b065a4659..d3f5a0b54 100644
--- a/src/plugins/platforms/qwayland-xcomposite-egl/main.cpp
+++ b/src/plugins/platforms/qwayland-xcomposite-egl/main.cpp
@@ -47,26 +47,16 @@ QT_BEGIN_NAMESPACE
class QWaylandIntegrationPlugin : public QPlatformIntegrationPlugin
{
Q_OBJECT
- Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QPA.QPlatformIntegrationFactoryInterface.5.2" FILE "qwayland-xcomposite-egl.json")
+ Q_PLUGIN_METADATA(IID QPlatformIntegrationFactoryInterface_iid FILE "qwayland-xcomposite-egl.json")
public:
- QStringList keys() const;
- QPlatformIntegration *create(const QString&, const QStringList&);
+ QPlatformIntegration *create(const QString&, const QStringList&) Q_DECL_OVERRIDE;
};
-QStringList QWaylandIntegrationPlugin::keys() const
-{
- QStringList list;
- list << "wayland-xcomposite" << "wayland-xcomposite-egl";
- return list;
-}
-
QPlatformIntegration *QWaylandIntegrationPlugin::create(const QString& system, const QStringList& paramList)
{
Q_UNUSED(paramList);
- if (system.toLower() == "wayland-xcomposite" || system.toLower() == "wayland-xcomposite-egl")
- return new QWaylandXCompositeEglPlatformIntegration();
-
- return 0;
+ Q_UNUSED(system);
+ return new QWaylandXCompositeEglPlatformIntegration();
}
QT_END_NAMESPACE
diff --git a/src/plugins/platforms/qwayland-xcomposite-egl/qwayland-xcomposite-egl.json b/src/plugins/platforms/qwayland-xcomposite-egl/qwayland-xcomposite-egl.json
index 8ccd5b46b..03dac08bb 100644
--- a/src/plugins/platforms/qwayland-xcomposite-egl/qwayland-xcomposite-egl.json
+++ b/src/plugins/platforms/qwayland-xcomposite-egl/qwayland-xcomposite-egl.json
@@ -1,3 +1,3 @@
{
- "Keys": [ "wayland-xcomposite" ]
+ "Keys": [ "wayland-xcomposite-egl" ]
}
diff --git a/src/plugins/platforms/qwayland-xcomposite-glx/main.cpp b/src/plugins/platforms/qwayland-xcomposite-glx/main.cpp
index 17b20f987..fb2b1414e 100644
--- a/src/plugins/platforms/qwayland-xcomposite-glx/main.cpp
+++ b/src/plugins/platforms/qwayland-xcomposite-glx/main.cpp
@@ -40,33 +40,25 @@
****************************************************************************/
#include <qpa/qplatformintegrationplugin.h>
-#include "qwaylandintegration.h"
+#include <QtWaylandClient/private/qwaylandintegration_p.h>
+
+#include "qwaylandxcompositeglxplatformintegration.h"
QT_BEGIN_NAMESPACE
class QWaylandIntegrationPlugin : public QPlatformIntegrationPlugin
{
Q_OBJECT
- Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QPA.QPlatformIntegrationFactoryInterface.5.2" FILE "qwayland-xcomposite-glx.json")
+ Q_PLUGIN_METADATA(IID QPlatformIntegrationFactoryInterface_iid FILE "qwayland-xcomposite-glx.json")
public:
- QStringList keys() const;
QPlatformIntegration *create(const QString&, const QStringList&);
};
-QStringList QWaylandIntegrationPlugin::keys() const
-{
- QStringList list;
- list << "wayland-xcomposite-glx";
- return list;
-}
-
QPlatformIntegration *QWaylandIntegrationPlugin::create(const QString& system, const QStringList& paramList)
{
Q_UNUSED(paramList);
- if (system.toLower() == "wayland-xcomposite-glx")
- return new QWaylandXCompositeGlxPlatformIntegration();
-
- return 0;
+ Q_UNUSED(system);
+ return new QWaylandXCompositeGlxPlatformIntegration();
}
QT_END_NAMESPACE
diff --git a/src/plugins/platforms/qwayland-xcomposite-glx/qwayland-xcomposite-glx.pro b/src/plugins/platforms/qwayland-xcomposite-glx/qwayland-xcomposite-glx.pro
index dcf2e1b67..307ad5ed6 100644
--- a/src/plugins/platforms/qwayland-xcomposite-glx/qwayland-xcomposite-glx.pro
+++ b/src/plugins/platforms/qwayland-xcomposite-glx/qwayland-xcomposite-glx.pro
@@ -10,3 +10,5 @@ OTHER_FILES += qwayland-xcomposite-glx.json
SOURCES += \
main.cpp
+HEADERS += \
+ qwaylandxcompositeglxplatformintegration.h
diff --git a/src/plugins/platforms/qwayland-xcomposite-glx/qwaylandxcompositeglxplatformintegration.h b/src/plugins/platforms/qwayland-xcomposite-glx/qwaylandxcompositeglxplatformintegration.h
index fe8c5b7c5..a7308f643 100644
--- a/src/plugins/platforms/qwayland-xcomposite-glx/qwaylandxcompositeglxplatformintegration.h
+++ b/src/plugins/platforms/qwayland-xcomposite-glx/qwaylandxcompositeglxplatformintegration.h
@@ -42,7 +42,8 @@
#ifndef QWAYLANDXCOMPOSITEGLXPLATFORMINTEGRATION_H
#define QWAYLANDXCOMPOSITEGLXPLATFORMINTEGRATION_H
-#include <QtWaylandClient/qwaylandintegration.h>
+#include <QtWaylandClient/private/qwaylandintegration_p.h>
+#include <QtWaylandClient/private/qwaylanddisplay_p.h>
#include "qwaylandxcompositeglxintegration.h"
@@ -51,14 +52,16 @@ class QWaylandXCompositeGlxPlatformIntegration : public QWaylandIntegration
public:
QWaylandXCompositeGlxPlatformIntegration()
: QWaylandIntegration()
- , m_gl_integration(new QWaylandXCompositeGLXIntegration(display()))
- { }
+ , m_client_buffer_integration(new QWaylandXCompositeGLXIntegration())
+ {
+ m_client_buffer_integration->initialize(display());
+ }
- QWaylandGLIntegration *glIntegration() const Q_DECL_OVERRIDE
- { return m_gl_integration; }
+ QWaylandClientBufferIntegration *clientBufferIntegration() const Q_DECL_OVERRIDE
+ { return m_client_buffer_integration; }
private:
- QWaylandGLIntegration *m_gl_integration;
+ QWaylandClientBufferIntegration *m_client_buffer_integration;
};
#endif
diff --git a/src/qtwaylandscanner/qtwaylandscanner.cpp b/src/qtwaylandscanner/qtwaylandscanner.cpp
index df751a8cb..097813f3c 100644
--- a/src/qtwaylandscanner/qtwaylandscanner.cpp
+++ b/src/qtwaylandscanner/qtwaylandscanner.cpp
@@ -313,8 +313,10 @@ void printEnums(const QList<WaylandEnum> &enums)
}
}
-QByteArray stripInterfaceName(const QByteArray &name)
+QByteArray stripInterfaceName(const QByteArray &name, const QByteArray &prefix)
{
+ if (!prefix.isEmpty() && name.startsWith(prefix))
+ return name.mid(prefix.size());
if (name.startsWith("qt_") || name.startsWith("wl_"))
return name.mid(3);
@@ -327,7 +329,7 @@ bool ignoreInterface(const QByteArray &name)
|| (isServerSide() && name == "wl_registry");
}
-void process(QXmlStreamReader &xml, const QByteArray &headerPath)
+void process(QXmlStreamReader &xml, const QByteArray &headerPath, const QByteArray &prefix)
{
if (!xml.readNextStartElement())
return;
@@ -409,7 +411,7 @@ void process(QXmlStreamReader &xml, const QByteArray &headerPath)
const char *interfaceName = interface.name.constData();
- QByteArray stripped = stripInterfaceName(interface.name);
+ QByteArray stripped = stripInterfaceName(interface.name, prefix);
const char *interfaceNameStripped = stripped.constData();
printf(" class %s %s\n {\n", serverExport.constData(), interfaceName);
@@ -546,7 +548,7 @@ void process(QXmlStreamReader &xml, const QByteArray &headerPath)
const char *interfaceName = interface.name.constData();
- QByteArray stripped = stripInterfaceName(interface.name);
+ QByteArray stripped = stripInterfaceName(interface.name, prefix);
const char *interfaceNameStripped = stripped.constData();
printf(" %s::%s(struct ::wl_client *client, int id)\n", interfaceName, interfaceName);
@@ -815,7 +817,7 @@ void process(QXmlStreamReader &xml, const QByteArray &headerPath)
const char *interfaceName = interface.name.constData();
- QByteArray stripped = stripInterfaceName(interface.name);
+ QByteArray stripped = stripInterfaceName(interface.name, prefix);
const char *interfaceNameStripped = stripped.constData();
printf(" class %s %s\n {\n", clientExport.constData(), interfaceName);
@@ -901,7 +903,7 @@ void process(QXmlStreamReader &xml, const QByteArray &headerPath)
const char *interfaceName = interface.name.constData();
- QByteArray stripped = stripInterfaceName(interface.name);
+ QByteArray stripped = stripInterfaceName(interface.name, prefix);
const char *interfaceNameStripped = stripped.constData();
bool hasEvents = !interface.events.isEmpty();
@@ -1065,15 +1067,18 @@ void process(QXmlStreamReader &xml, const QByteArray &headerPath)
int main(int argc, char **argv)
{
if (argc <= 2 || !parseOption(argv[1], &option)) {
- fprintf(stderr, "Usage: %s [client-header|server-header|client-code|server-code] specfile [header-path]\n", argv[0]);
+ fprintf(stderr, "Usage: %s [client-header|server-header|client-code|server-code] specfile [header-path] [prefix]\n", argv[0]);
return 1;
}
QCoreApplication app(argc, argv);
QByteArray headerPath;
- if (argc == 4)
+ if (argc >= 4)
headerPath = QByteArray(argv[3]);
+ QByteArray prefix;
+ if (argc == 5)
+ prefix = QByteArray(argv[4]);
QFile file(argv[2]);
if (!file.open(QIODevice::ReadOnly | QIODevice::Text)) {
fprintf(stderr, "Unable to open file %s\n", argv[2]);
@@ -1081,7 +1086,7 @@ int main(int argc, char **argv)
}
QXmlStreamReader xml(&file);
- process(xml, headerPath);
+ process(xml, headerPath, prefix);
if (xml.hasError()) {
fprintf(stderr, "XML error: %s\nLine %lld, column %lld\n", xml.errorString().toLocal8Bit().constData(), xml.lineNumber(), xml.columnNumber());
diff --git a/tests/auto/compositor/tst_compositor.cpp b/tests/auto/compositor/tst_compositor.cpp
index 8656338ef..44fb2ff96 100644
--- a/tests/auto/compositor/tst_compositor.cpp
+++ b/tests/auto/compositor/tst_compositor.cpp
@@ -210,7 +210,7 @@ void tst_WaylandCompositor::frameCallback()
QTRY_COMPARE(damagedSpy.count(), i + 1);
QCOMPARE(waylandSurface->image(), buffer.image);
- waylandSurface->frameFinished();
+ compositor.sendFrameCallbacks(QList<QWaylandSurface *>() << waylandSurface);
QTRY_COMPARE(frameCounter, i + 1);
}