summaryrefslogtreecommitdiffstats
path: root/src/plugins
diff options
context:
space:
mode:
authorAndy Nichols <andy.nichols@digia.com>2013-03-20 12:57:46 +0100
committerJørgen Lind <jorgen.lind@digia.com>2013-04-05 10:35:33 +0200
commit076673dfe3d967e42c8d92b08165e2ac0e166b9b (patch)
tree14e47471563ea69d22842837a23a3ffc4ad4b908 /src/plugins
parent77248e2765e4db5cd7fe6e53e07a612d75b91011 (diff)
Fix window decorations to be thread safe
Rather than have window decorations that paint directly to the paint device representing the window surface, window decorations are now generated on demand into a backing store based on their current state, and then are rendered to a surface when needed. There is still a problem with resizing though that needs to be addressed. Change-Id: I7516628239eb0f9ae46d49bcb4bb2cb94ec6a617 Reviewed-by: Jørgen Lind <jorgen.lind@digia.com>
Diffstat (limited to 'src/plugins')
-rw-r--r--src/plugins/platforms/qwayland-egl/qwayland-egl.pro2
-rw-r--r--src/plugins/platforms/qwayland-egl/qwaylandegldecoration.cpp67
-rw-r--r--src/plugins/platforms/qwayland-egl/qwaylandegldecoration.h63
-rw-r--r--src/plugins/platforms/qwayland-egl/qwaylandeglwindow.cpp12
-rw-r--r--src/plugins/platforms/qwayland-egl/qwaylandeglwindow.h6
-rw-r--r--src/plugins/platforms/qwayland-egl/qwaylandglcontext.cpp46
-rw-r--r--src/plugins/platforms/qwayland-egl/qwaylandglcontext.h3
-rw-r--r--src/plugins/platforms/wayland_common/qwaylanddecoration.cpp23
-rw-r--r--src/plugins/platforms/wayland_common/qwaylanddecoration.h13
-rw-r--r--src/plugins/platforms/wayland_common/qwaylanddisplay.cpp11
-rw-r--r--src/plugins/platforms/wayland_common/qwaylanddisplay.h1
-rw-r--r--src/plugins/platforms/wayland_common/qwaylandshmbackingstore.cpp38
-rw-r--r--src/plugins/platforms/wayland_common/qwaylandshmbackingstore.h2
-rw-r--r--src/plugins/platforms/wayland_common/qwaylandshmdecoration.cpp65
-rw-r--r--src/plugins/platforms/wayland_common/qwaylandshmdecoration.h63
-rw-r--r--src/plugins/platforms/wayland_common/qwaylandshmwindow.cpp7
-rw-r--r--src/plugins/platforms/wayland_common/qwaylandshmwindow.h3
-rw-r--r--src/plugins/platforms/wayland_common/qwaylandwindow.cpp18
-rw-r--r--src/plugins/platforms/wayland_common/qwaylandwindow.h4
-rw-r--r--src/plugins/platforms/wayland_common/wayland_common.pro2
20 files changed, 122 insertions, 327 deletions
diff --git a/src/plugins/platforms/qwayland-egl/qwayland-egl.pro b/src/plugins/platforms/qwayland-egl/qwayland-egl.pro
index cdebf9bbc..339f94616 100644
--- a/src/plugins/platforms/qwayland-egl/qwayland-egl.pro
+++ b/src/plugins/platforms/qwayland-egl/qwayland-egl.pro
@@ -16,11 +16,9 @@ OTHER_FILES += \
SOURCES += qwaylandeglintegration.cpp \
qwaylandglcontext.cpp \
qwaylandeglwindow.cpp \
- qwaylandegldecoration.cpp \
main.cpp
HEADERS += qwaylandeglintegration.h \
qwaylandglcontext.h \
qwaylandeglwindow.h \
- qwaylandegldecoration.h \
qwaylandeglinclude.h
diff --git a/src/plugins/platforms/qwayland-egl/qwaylandegldecoration.cpp b/src/plugins/platforms/qwayland-egl/qwaylandegldecoration.cpp
deleted file mode 100644
index 7724f2833..000000000
--- a/src/plugins/platforms/qwayland-egl/qwaylandegldecoration.cpp
+++ /dev/null
@@ -1,67 +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 plugins of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qwaylandegldecoration.h"
-
-#include "qwaylandeglwindow.h"
-
-#include <QtGui/QPainter>
-#include <QtGui/QOpenGLPaintDevice>
-
-QT_USE_NAMESPACE
-
-QWaylandEglDecoration::QWaylandEglDecoration(QWaylandEglWindow *window)
- : QWaylandDecoration(window)
-{
-}
-
-QWaylandEglDecoration::~QWaylandEglDecoration()
-{
-}
-
-void QWaylandEglDecoration::paintDecoration()
-{
- glClearColor(backgroundColor().redF(), backgroundColor().greenF(), backgroundColor().blueF(), backgroundColor().alphaF());
- glClear(GL_COLOR_BUFFER_BIT);
-
- QOpenGLPaintDevice device(window()->frameGeometry().size());
- paint(&device);
-}
diff --git a/src/plugins/platforms/qwayland-egl/qwaylandegldecoration.h b/src/plugins/platforms/qwayland-egl/qwaylandegldecoration.h
deleted file mode 100644
index 3039b7285..000000000
--- a/src/plugins/platforms/qwayland-egl/qwaylandegldecoration.h
+++ /dev/null
@@ -1,63 +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 plugins of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QWAYLANDEGLDECORATION_H
-#define QWAYLANDEGLDECORATION_H
-
-#include "qwaylanddecoration.h"
-
-QT_BEGIN_NAMESPACE
-
-class QWaylandEglWindow;
-
-class QWaylandEglDecoration : public QWaylandDecoration
-{
-public:
- QWaylandEglDecoration(QWaylandEglWindow *window);
- ~QWaylandEglDecoration();
-
- void paintDecoration();
-
-};
-
-QT_END_NAMESPACE
-
-#endif // QWAYLANDEGLDECORATION_H
diff --git a/src/plugins/platforms/qwayland-egl/qwaylandeglwindow.cpp b/src/plugins/platforms/qwayland-egl/qwaylandeglwindow.cpp
index 6edf74832..162d9316c 100644
--- a/src/plugins/platforms/qwayland-egl/qwaylandeglwindow.cpp
+++ b/src/plugins/platforms/qwayland-egl/qwaylandeglwindow.cpp
@@ -43,7 +43,6 @@
#include "qwaylandscreen.h"
#include "qwaylandglcontext.h"
-#include "qwaylandegldecoration.h"
#include <QtPlatformSupport/private/qeglconvenience_p.h>
@@ -89,11 +88,11 @@ QWaylandWindow::WindowType QWaylandEglWindow::windowType() const
return QWaylandWindow::Egl;
}
-void QWaylandEglWindow::redraw()
+void QWaylandEglWindow::setGeometry(const QRect &rect)
{
createDecoration();
QMargins margins = frameMargins();
- QSize sizeWithMargins = geometry().size() + QSize(margins.left() + margins.right(), margins.top() + margins.bottom());
+ QSize sizeWithMargins = rect.size() + QSize(margins.left() + margins.right(), margins.top() + margins.bottom());
if (m_waylandEglWindow) {
int current_width, current_height;
@@ -108,6 +107,8 @@ void QWaylandEglWindow::redraw()
} else {
m_waylandEglWindow = wl_egl_window_create(mSurface, sizeWithMargins.width(), sizeWithMargins.height());
}
+
+ QWaylandWindow::setGeometry(rect);
}
QRect QWaylandEglWindow::contentsRect() const
@@ -170,8 +171,3 @@ void QWaylandEglWindow::bindContentFBO()
m_contentFBO->bind();
}
}
-
-void QWaylandEglWindow::createDecorationInstance()
-{
- new QWaylandEglDecoration(this);
-}
diff --git a/src/plugins/platforms/qwayland-egl/qwaylandeglwindow.h b/src/plugins/platforms/qwayland-egl/qwaylandeglwindow.h
index dfc5a26d9..f973547a7 100644
--- a/src/plugins/platforms/qwayland-egl/qwaylandeglwindow.h
+++ b/src/plugins/platforms/qwayland-egl/qwaylandeglwindow.h
@@ -58,6 +58,7 @@ public:
~QWaylandEglWindow();
WindowType windowType() const;
+ virtual void setGeometry(const QRect &rect);
QRect contentsRect() const;
EGLSurface eglSurface() const;
@@ -68,11 +69,6 @@ public:
void bindContentFBO();
- void redraw();
-
-protected:
- void createDecorationInstance();
-
private:
QWaylandEglIntegration *m_eglIntegration;
mutable struct wl_egl_window *m_waylandEglWindow;
diff --git a/src/plugins/platforms/qwayland-egl/qwaylandglcontext.cpp b/src/plugins/platforms/qwayland-egl/qwaylandglcontext.cpp
index 4d8017dc2..a0024745e 100644
--- a/src/plugins/platforms/qwayland-egl/qwaylandglcontext.cpp
+++ b/src/plugins/platforms/qwayland-egl/qwaylandglcontext.cpp
@@ -49,6 +49,7 @@
#include <QDebug>
#include <QtPlatformSupport/private/qeglconvenience_p.h>
#include <QtGui/private/qopenglcontext_p.h>
+#include <QtGui/private/qopengltexturecache_p.h>
#include <qpa/qplatformopenglcontext.h>
#include <QtGui/QSurfaceFormat>
@@ -62,6 +63,7 @@ QWaylandGLContext::QWaylandGLContext(EGLDisplay eglDisplay, const QSurfaceFormat
, m_config(q_configFromGLFormat(m_eglDisplay, format, true))
, m_format(q_glFormatFromConfig(m_eglDisplay, m_config))
, m_blitProgram(0)
+ , m_textureCache(0)
{
m_shareEGLContext = share ? static_cast<QWaylandGLContext *>(share)->eglContext() : EGL_NO_CONTEXT;
@@ -83,6 +85,7 @@ QWaylandGLContext::QWaylandGLContext(EGLDisplay eglDisplay, const QSurfaceFormat
QWaylandGLContext::~QWaylandGLContext()
{
delete m_blitProgram;
+ delete m_textureCache;
eglDestroyContext(m_eglDisplay, m_context);
}
@@ -137,23 +140,28 @@ void QWaylandGLContext::swapBuffers(QPlatformSurface *surface)
}
}
+ if (!m_textureCache) {
+ m_textureCache = new QOpenGLTextureCache(this->context());
+ }
+
glDisable(GL_DEPTH_TEST);
+ glDisable(GL_BLEND);
glBindFramebuffer(GL_FRAMEBUFFER, 0);
- if (window->decoration())
- window->decoration()->paintDecoration();
-
- glActiveTexture(GL_TEXTURE0);
- glBindTexture(GL_TEXTURE_2D, window->contentTexture());
- QRect r = window->contentsRect();
- glViewport(r.x(), r.y(), r.width(), r.height());
-
static const GLfloat squareVertices[] = {
-1.f, -1.f,
1.0f, -1.f,
-1.f, 1.0f,
- 1.0f, 1.0f,
+ 1.0f, 1.0f
+ };
+
+ static const GLfloat inverseSquareVertices[] = {
+ -1.f, 1.f,
+ 1.f, 1.f,
+ -1.f, -1.f,
+ 1.f, -1.f
};
+
static const GLfloat textureVertices[] = {
0.0f, 0.0f,
1.0f, 0.0f,
@@ -161,19 +169,33 @@ void QWaylandGLContext::swapBuffers(QPlatformSurface *surface)
1.0f, 1.0f,
};
- m_blitProgram->bind();
-
m_blitProgram->setUniformValue("texture", 0);
m_blitProgram->enableAttributeArray("position");
m_blitProgram->enableAttributeArray("texCoords");
- m_blitProgram->setAttributeArray("position", squareVertices, 2);
m_blitProgram->setAttributeArray("texCoords", textureVertices, 2);
m_blitProgram->bind();
+ glActiveTexture(GL_TEXTURE0);
+ //Draw Decoration
+ m_blitProgram->setAttributeArray("position", inverseSquareVertices, 2);
+ QImage decorationImage = window->decoration()->contentImage();
+ 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);
+ QRect windowRect = window->window()->frameGeometry();
+ glViewport(0, 0, windowRect.width(), windowRect.height());
+ glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
+
+ //Draw Content
+ m_blitProgram->setAttributeArray("position", squareVertices, 2);
+ glBindTexture(GL_TEXTURE_2D, window->contentTexture());
+ QRect r = window->contentsRect();
+ glViewport(r.x(), r.y(), r.width(), r.height());
glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
+ //Cleanup
m_blitProgram->disableAttributeArray("position");
m_blitProgram->disableAttributeArray("texCoords");
m_blitProgram->release();
diff --git a/src/plugins/platforms/qwayland-egl/qwaylandglcontext.h b/src/plugins/platforms/qwayland-egl/qwaylandglcontext.h
index 696a0b918..f6909a74c 100644
--- a/src/plugins/platforms/qwayland-egl/qwaylandglcontext.h
+++ b/src/plugins/platforms/qwayland-egl/qwaylandglcontext.h
@@ -53,6 +53,7 @@ QT_BEGIN_NAMESPACE
class QWaylandWindow;
class QWaylandGLWindowSurface;
class QOpenGLShaderProgram;
+class QOpenGLTextureCache;
class QWaylandGLContext : public QPlatformOpenGLContext {
public:
@@ -84,6 +85,8 @@ private:
EGLConfig m_config;
QSurfaceFormat m_format;
QOpenGLShaderProgram *m_blitProgram;
+ QOpenGLTextureCache *m_textureCache;
+
};
QT_END_NAMESPACE
diff --git a/src/plugins/platforms/wayland_common/qwaylanddecoration.cpp b/src/plugins/platforms/wayland_common/qwaylanddecoration.cpp
index 11baeeb67..f5f79ae67 100644
--- a/src/plugins/platforms/wayland_common/qwaylanddecoration.cpp
+++ b/src/plugins/platforms/wayland_common/qwaylanddecoration.cpp
@@ -46,6 +46,7 @@
#include "qwaylandinputdevice.h"
#include <QtGui/QGuiApplication>
+#include <QtGui/QImage>
#include <QtGui/QCursor>
#include <QtGui/QPainter>
#include <QtGui/QPalette>
@@ -124,6 +125,8 @@ static const char * const qt_normalizeup_xpm[] = {
QWaylandDecoration::QWaylandDecoration(QWaylandWindow *window)
: m_window(window->window())
, m_wayland_window(window)
+ , m_isDirty(true)
+ , m_decorationContentImage(0)
, m_margins(3,30,3,3)
, m_hasSetCursor(false)
, m_mouseButtons(Qt::NoButton)
@@ -144,6 +147,26 @@ QWaylandDecoration::~QWaylandDecoration()
m_wayland_window->setDecoration(0);
}
+const QImage &QWaylandDecoration::contentImage()
+{
+ if (m_isDirty) {
+ //Update the decoration backingstore
+
+ m_decorationContentImage = QImage(window()->frameGeometry().size(), QImage::Format_ARGB32_Premultiplied);
+ m_decorationContentImage.fill(Qt::transparent);
+ this->paint(&m_decorationContentImage);
+
+ m_isDirty = false;
+ }
+
+ return m_decorationContentImage;
+}
+
+void QWaylandDecoration::update()
+{
+ m_isDirty = true;
+}
+
void QWaylandDecoration::paint(QPaintDevice *device)
{
QRect surfaceRect(QPoint(), window()->frameGeometry().size());
diff --git a/src/plugins/platforms/wayland_common/qwaylanddecoration.h b/src/plugins/platforms/wayland_common/qwaylanddecoration.h
index 0ad9b0305..14755699d 100644
--- a/src/plugins/platforms/wayland_common/qwaylanddecoration.h
+++ b/src/plugins/platforms/wayland_common/qwaylanddecoration.h
@@ -48,6 +48,7 @@
#include <QtGui/QCursor>
#include <QtGui/QColor>
#include <QtGui/QStaticText>
+#include <QtGui/QImage>
#include <wayland-client.h>
@@ -68,7 +69,8 @@ public:
QWaylandDecoration(QWaylandWindow *window);
virtual ~QWaylandDecoration();
- virtual void paintDecoration() = 0;
+ void update();
+ bool isDirty() const;
bool handleMouse(QWaylandInputDevice *inputDevice, const QPointF &local, const QPointF &global,Qt::MouseButtons b,Qt::KeyboardModifiers mods);
void restoreMouseCursor();
@@ -79,6 +81,7 @@ public:
QMargins margins() const;
QWindow *window() const;
QWaylandWindow *waylandWindow() const;
+ const QImage &contentImage();
void setForegroundColor(const QColor &c);
inline QColor foregroundColor() const;
@@ -107,6 +110,9 @@ private:
QWindow *m_window;
QWaylandWindow *m_wayland_window;
+ bool m_isDirty;
+ QImage m_decorationContentImage;
+
QMargins m_margins;
bool m_hasSetCursor;
Qt::CursorShape m_cursorShape;
@@ -117,6 +123,11 @@ private:
QStaticText m_windowTitle;
};
+inline bool QWaylandDecoration::isDirty() const
+{
+ return m_isDirty;
+}
+
inline QMargins QWaylandDecoration::margins() const
{
return m_margins;
diff --git a/src/plugins/platforms/wayland_common/qwaylanddisplay.cpp b/src/plugins/platforms/wayland_common/qwaylanddisplay.cpp
index 0e4fb588d..dbe214119 100644
--- a/src/plugins/platforms/wayland_common/qwaylanddisplay.cpp
+++ b/src/plugins/platforms/wayland_common/qwaylanddisplay.cpp
@@ -176,21 +176,10 @@ void QWaylandDisplay::createNewScreen(struct wl_output *output)
mScreens.append(waylandScreen);
}
-void QWaylandDisplay::scheduleRedraw(QWaylandWindow *window)
-{
- if (!mWindows.contains(window))
- mWindows << window;
-}
-
void QWaylandDisplay::flushRequests()
{
wl_display_dispatch_queue_pending(mDisplay, mEventQueue);
wl_display_flush(mDisplay);
-
- foreach (QWaylandWindow *w, mWindows) {
- w->redraw();
- }
- mWindows.clear();
}
void QWaylandDisplay::blockingReadEvents()
diff --git a/src/plugins/platforms/wayland_common/qwaylanddisplay.h b/src/plugins/platforms/wayland_common/qwaylanddisplay.h
index 637e05b90..40da74f1a 100644
--- a/src/plugins/platforms/wayland_common/qwaylanddisplay.h
+++ b/src/plugins/platforms/wayland_common/qwaylanddisplay.h
@@ -156,7 +156,6 @@ private:
QList<QPlatformScreen *> mScreens;
QList<QWaylandInputDevice *> mInputDevices;
QList<Listener> mRegistryListeners;
- QList<QWaylandWindow *> mWindows;
QWaylandInputDevice *mLastKeyboardFocusInputDevice;
QWaylandDataDeviceManager *mDndSelectionHandler;
QWaylandSurfaceExtension *mWindowExtension;
diff --git a/src/plugins/platforms/wayland_common/qwaylandshmbackingstore.cpp b/src/plugins/platforms/wayland_common/qwaylandshmbackingstore.cpp
index decf34a77..4af9a073a 100644
--- a/src/plugins/platforms/wayland_common/qwaylandshmbackingstore.cpp
+++ b/src/plugins/platforms/wayland_common/qwaylandshmbackingstore.cpp
@@ -192,6 +192,9 @@ void QWaylandShmBackingStore::flush(QWindow *window, const QRegion &region, cons
Q_UNUSED(offset);
Q_ASSERT(waylandWindow()->windowType() == QWaylandWindow::Shm);
+ if (windowDecoration() && windowDecoration()->isDirty())
+ updateDecorations();
+
mFrontBuffer = mBackBuffer;
if (mFrameCallback) {
@@ -245,8 +248,8 @@ void QWaylandShmBackingStore::resize(const QSize &size)
mBackBuffer = new QWaylandShmBuffer(mDisplay, sizeWithMargins, format);
- if (windowDecoration())
- windowDecoration()->paintDecoration();
+ if (windowDecoration() && window()->isVisible())
+ windowDecoration()->update();
}
QImage *QWaylandShmBackingStore::entireSurface() const
@@ -254,6 +257,36 @@ QImage *QWaylandShmBackingStore::entireSurface() const
return mBackBuffer->image();
}
+void QWaylandShmBackingStore::updateDecorations()
+{
+ QPainter decorationPainter(entireSurface());
+ decorationPainter.setCompositionMode(QPainter::CompositionMode_Source);
+ QImage sourceImage = windowDecoration()->contentImage();
+ QRect target;
+ //Top
+ target.setX(0);
+ target.setY(0);
+ target.setWidth(sourceImage.width());
+ target.setHeight(windowDecorationMargins().top());
+ decorationPainter.drawImage(target, sourceImage, target);
+
+ //Left
+ target.setWidth(windowDecorationMargins().left());
+ target.setHeight(sourceImage.height());
+ decorationPainter.drawImage(target, sourceImage, target);
+
+ //Right
+ target.setX(sourceImage.width() - windowDecorationMargins().right());
+ decorationPainter.drawImage(target, sourceImage, target);
+
+ //Bottom
+ target.setX(0);
+ target.setY(sourceImage.height() - windowDecorationMargins().bottom());
+ target.setWidth(sourceImage.width());
+ target.setHeight(windowDecorationMargins().bottom());
+ decorationPainter.drawImage(target, sourceImage, target);
+}
+
void QWaylandShmBackingStore::done(void *data, wl_callback *callback, uint32_t time)
{
Q_UNUSED(time);
@@ -284,3 +317,4 @@ const struct wl_callback_listener QWaylandShmBackingStore::frameCallbackListener
};
QT_END_NAMESPACE
+
diff --git a/src/plugins/platforms/wayland_common/qwaylandshmbackingstore.h b/src/plugins/platforms/wayland_common/qwaylandshmbackingstore.h
index 1eadb5ed7..601173420 100644
--- a/src/plugins/platforms/wayland_common/qwaylandshmbackingstore.h
+++ b/src/plugins/platforms/wayland_common/qwaylandshmbackingstore.h
@@ -94,6 +94,8 @@ public:
void iterateBuffer();
private:
+ void updateDecorations();
+
QWaylandDisplay *mDisplay;
QWaylandShmBuffer *mFrontBuffer;
QWaylandShmBuffer *mBackBuffer;
diff --git a/src/plugins/platforms/wayland_common/qwaylandshmdecoration.cpp b/src/plugins/platforms/wayland_common/qwaylandshmdecoration.cpp
deleted file mode 100644
index e6af4ab41..000000000
--- a/src/plugins/platforms/wayland_common/qwaylandshmdecoration.cpp
+++ /dev/null
@@ -1,65 +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 plugins of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qwaylandshmdecoration.h"
-
-#include "qwaylandshmwindow.h"
-#include "qwaylandshmbackingstore.h"
-
-QT_USE_NAMESPACE
-
-QWaylandShmDecoration::QWaylandShmDecoration(QWaylandShmWindow *window)
- : QWaylandDecoration(window)
-{
-
-}
-
-QWaylandShmDecoration::~QWaylandShmDecoration()
-{
-}
-
-void QWaylandShmDecoration::paintDecoration()
-{
- QWaylandShmBackingStore *bs = static_cast<QWaylandShmWindow *>(waylandWindow())->backingStore();
- if (bs) {
- paint(bs->entireSurface());
- }
-}
diff --git a/src/plugins/platforms/wayland_common/qwaylandshmdecoration.h b/src/plugins/platforms/wayland_common/qwaylandshmdecoration.h
deleted file mode 100644
index 567e8755d..000000000
--- a/src/plugins/platforms/wayland_common/qwaylandshmdecoration.h
+++ /dev/null
@@ -1,63 +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 plugins of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QWAYLANDSHMDECORATION_H
-#define QWAYLANDSHMDECORATION_H
-
-#include "qwaylanddecoration.h"
-
-QT_BEGIN_NAMESPACE
-
-class QWaylandShmWindow;
-
-class QWaylandShmDecoration : public QWaylandDecoration
-{
-public:
- QWaylandShmDecoration(QWaylandShmWindow *window);
- ~QWaylandShmDecoration();
-
- void paintDecoration();
-
-};
-
-QT_END_NAMESPACE
-
-#endif // QWAYLANDSHMDECORATION_H
diff --git a/src/plugins/platforms/wayland_common/qwaylandshmwindow.cpp b/src/plugins/platforms/wayland_common/qwaylandshmwindow.cpp
index ad2fd9a23..f4a0ede0c 100644
--- a/src/plugins/platforms/wayland_common/qwaylandshmwindow.cpp
+++ b/src/plugins/platforms/wayland_common/qwaylandshmwindow.cpp
@@ -42,7 +42,6 @@
#include "qwaylandshmwindow.h"
#include "qwaylandbuffer.h"
-#include "qwaylandshmdecoration.h"
#include <QtCore/QVector>
@@ -70,9 +69,3 @@ void QWaylandShmWindow::setBackingStore(QWaylandShmBackingStore *backingStore)
{
mBackingStore = backingStore;
}
-
-void QWaylandShmWindow::createDecorationInstance()
-{
- new QWaylandShmDecoration(this);
-}
-
diff --git a/src/plugins/platforms/wayland_common/qwaylandshmwindow.h b/src/plugins/platforms/wayland_common/qwaylandshmwindow.h
index f28e1d503..ffd11c948 100644
--- a/src/plugins/platforms/wayland_common/qwaylandshmwindow.h
+++ b/src/plugins/platforms/wayland_common/qwaylandshmwindow.h
@@ -61,9 +61,6 @@ public:
void setBackingStore(QWaylandShmBackingStore *backingStore);
QWaylandShmBackingStore *backingStore() const;
-protected:
- void createDecorationInstance();
-
private:
QWaylandShmBackingStore *mBackingStore;
};
diff --git a/src/plugins/platforms/wayland_common/qwaylandwindow.cpp b/src/plugins/platforms/wayland_common/qwaylandwindow.cpp
index 7b0e939fb..f42d38bc3 100644
--- a/src/plugins/platforms/wayland_common/qwaylandwindow.cpp
+++ b/src/plugins/platforms/wayland_common/qwaylandwindow.cpp
@@ -146,9 +146,9 @@ void QWaylandWindow::setWindowTitle(const QString &title)
QByteArray titleUtf8 = title.toUtf8();
mShellSurface->setTitle(titleUtf8.constData());
}
- if (mWindowDecoration && window()->isVisible()) {
- mWindowDecoration->paintDecoration();
- }
+
+ if (mWindowDecoration && window()->isVisible())
+ mWindowDecoration->update();
}
void QWaylandWindow::setWindowIcon(const QIcon &icon)
@@ -156,7 +156,7 @@ void QWaylandWindow::setWindowIcon(const QIcon &icon)
mWindowIcon = icon;
if (mWindowDecoration && window()->isVisible())
- mWindowDecoration->paintDecoration();
+ mWindowDecoration->update();
}
void QWaylandWindow::setGeometry(const QRect &rect)
@@ -166,7 +166,8 @@ void QWaylandWindow::setGeometry(const QRect &rect)
if (shellSurface() && window()->transientParent())
shellSurface()->updateTransientParent(window()->transientParent());
- mDisplay->scheduleRedraw(this);
+ if (mWindowDecoration && window()->isVisible())
+ mWindowDecoration->update();
}
void QWaylandWindow::setVisible(bool visible)
@@ -234,11 +235,6 @@ void QWaylandWindow::configure(uint32_t edges, int32_t width, int32_t height)
QWindowSystemInterface::flushWindowSystemEvents();
}
-void QWaylandWindow::redraw()
-{
-
-}
-
void QWaylandWindow::attach(QWaylandBuffer *buffer, int x, int y)
{
mBuffer = buffer;
@@ -384,7 +380,7 @@ bool QWaylandWindow::createDecoration()
if (decoration) {
if (!mWindowDecoration) {
- createDecorationInstance();
+ mWindowDecoration = new QWaylandDecoration(this);
}
} else {
delete mWindowDecoration;
diff --git a/src/plugins/platforms/wayland_common/qwaylandwindow.h b/src/plugins/platforms/wayland_common/qwaylandwindow.h
index 258c58b9a..63ce3f39c 100644
--- a/src/plugins/platforms/wayland_common/qwaylandwindow.h
+++ b/src/plugins/platforms/wayland_common/qwaylandwindow.h
@@ -124,14 +124,10 @@ public:
bool createDecoration();
- virtual void redraw();
-
inline bool isMaximized() const { return mState == Qt::WindowMaximized; }
inline bool isFullscreen() const { return mState == Qt::WindowFullScreen; }
protected:
- virtual void createDecorationInstance() {}
-
QWaylandDisplay *mDisplay;
struct wl_surface *mSurface;
QWaylandShellSurface *mShellSurface;
diff --git a/src/plugins/platforms/wayland_common/wayland_common.pro b/src/plugins/platforms/wayland_common/wayland_common.pro
index 5c992b3cb..381b7bda6 100644
--- a/src/plugins/platforms/wayland_common/wayland_common.pro
+++ b/src/plugins/platforms/wayland_common/wayland_common.pro
@@ -40,7 +40,6 @@ SOURCES += qwaylandintegration.cpp \
qwaylandqtkey.cpp \
../../../shared/qwaylandmimehelper.cpp \
qwaylanddecoration.cpp \
- qwaylandshmdecoration.cpp \
qwaylandeventthread.cpp
HEADERS += qwaylandintegration.h \
@@ -67,7 +66,6 @@ HEADERS += qwaylandintegration.h \
qwaylandqtkey.h \
../../../shared/qwaylandmimehelper.h \
qwaylanddecoration.h \
- qwaylandshmdecoration.h \
qwaylandeventthread.h
contains(DEFINES, QT_WAYLAND_GL_SUPPORT) {