summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLaszlo Agocs <laszlo.agocs@digia.com>2014-09-05 13:46:56 +0200
committerLaszlo Agocs <laszlo.agocs@digia.com>2014-09-06 20:46:57 +0200
commit6d43b06d2b8f101f72d798d10e692fa134963849 (patch)
treef9534a67cab8313c98a5424318ab800957dfa226
parent73151fc07b78a52ee4887fa8325bc4e582320c73 (diff)
Fix window decorations for GL apps
You cannot have rounded corners with an alpha-less config. To make OpenGL applications appearing with the correct decoration, alpha must be enabled. With this fix the OpenGL apps' decoration will now look identical to the SHM apps'. Change-Id: I24431ddab63146f7f697c85277f00f41e5c55e85 Reviewed-by: Shawn Rutledge <shawn.rutledge@digia.com> Reviewed-by: Robin Burchell <robin.burchell@viroteck.net>
-rw-r--r--src/client/qwaylanddisplay.cpp13
-rw-r--r--src/client/qwaylanddisplay_p.h2
-rw-r--r--src/client/qwaylandwindow.cpp6
-rw-r--r--src/hardwareintegration/client/wayland-egl/qwaylandeglwindow.cpp8
-rw-r--r--src/hardwareintegration/client/wayland-egl/qwaylandglcontext.cpp9
5 files changed, 29 insertions, 9 deletions
diff --git a/src/client/qwaylanddisplay.cpp b/src/client/qwaylanddisplay.cpp
index 264528f6c..3eac985f6 100644
--- a/src/client/qwaylanddisplay.cpp
+++ b/src/client/qwaylanddisplay.cpp
@@ -56,6 +56,7 @@
#include "qwaylandwindowmanagerintegration_p.h"
#include "qwaylandshellintegration_p.h"
+#include "qwaylandclientbufferintegration_p.h"
#include "qwaylandextendedoutput_p.h"
#include "qwaylandextendedsurface_p.h"
@@ -335,4 +336,16 @@ QtWayland::xdg_shell *QWaylandDisplay::shellXdg()
return mShellXdg.data();
}
+bool QWaylandDisplay::supportsWindowDecoration() const
+{
+ static bool disabled = qgetenv("QT_WAYLAND_DISABLE_WINDOWDECORATION").toInt();
+ // Stop early when disabled via the environment. Do not try to load the integration in
+ // order to play nice with SHM-only, buffer integration-less systems.
+ if (disabled)
+ return false;
+
+ static bool integrationSupport = clientBufferIntegration() && clientBufferIntegration()->supportsWindowDecoration();
+ return integrationSupport;
+}
+
QT_END_NAMESPACE
diff --git a/src/client/qwaylanddisplay_p.h b/src/client/qwaylanddisplay_p.h
index 64c020546..b0142004e 100644
--- a/src/client/qwaylanddisplay_p.h
+++ b/src/client/qwaylanddisplay_p.h
@@ -156,6 +156,8 @@ public:
void forceRoundTrip();
+ bool supportsWindowDecoration() const;
+
public slots:
void blockingReadEvents();
void flushRequests();
diff --git a/src/client/qwaylandwindow.cpp b/src/client/qwaylandwindow.cpp
index 0905cb3a2..aaef58d99 100644
--- a/src/client/qwaylandwindow.cpp
+++ b/src/client/qwaylandwindow.cpp
@@ -53,7 +53,6 @@
#include "qwaylanddecoration_p.h"
#include "qwaylandwindowmanagerintegration_p.h"
#include "qwaylandnativeinterface_p.h"
-#include "qwaylandclientbufferintegration_p.h"
#include <QtCore/QFileInfo>
#include <QtCore/QPointer>
@@ -484,10 +483,7 @@ bool QWaylandWindow::createDecoration()
}
}
- static bool disableWaylandDecorations = !qgetenv("QT_WAYLAND_DISABLE_WINDOWDECORATION").isEmpty()
- || (mDisplay->clientBufferIntegration() && !mDisplay->clientBufferIntegration()->supportsWindowDecoration());
-
- if (disableWaylandDecorations)
+ if (!mDisplay->supportsWindowDecoration())
return false;
bool decoration = false;
diff --git a/src/hardwareintegration/client/wayland-egl/qwaylandeglwindow.cpp b/src/hardwareintegration/client/wayland-egl/qwaylandeglwindow.cpp
index a9247d4a1..5feed543c 100644
--- a/src/hardwareintegration/client/wayland-egl/qwaylandeglwindow.cpp
+++ b/src/hardwareintegration/client/wayland-egl/qwaylandeglwindow.cpp
@@ -59,11 +59,15 @@ QWaylandEglWindow::QWaylandEglWindow(QWindow *window)
, m_clientBufferIntegration(static_cast<QWaylandEglClientBufferIntegration *>(mDisplay->clientBufferIntegration()))
, m_waylandEglWindow(0)
, m_eglSurface(0)
- , m_eglConfig(q_configFromGLFormat(m_clientBufferIntegration->eglDisplay(), window->requestedFormat()))
, m_contentFBO(0)
, m_resize(false)
- , m_format(q_glFormatFromConfig(m_clientBufferIntegration->eglDisplay(), m_eglConfig))
{
+ QSurfaceFormat fmt = window->requestedFormat();
+ if (mDisplay->supportsWindowDecoration())
+ fmt.setAlphaBufferSize(8);
+ m_eglConfig = q_configFromGLFormat(m_clientBufferIntegration->eglDisplay(), fmt);
+ m_format = q_glFormatFromConfig(m_clientBufferIntegration->eglDisplay(), m_eglConfig);
+
// Do not create anything from here. This platform window may belong to a
// RasterGLSurface window which may have pure raster content. In this case, where the
// window is never actually made current, creating a wl_egl_window and EGL surface
diff --git a/src/hardwareintegration/client/wayland-egl/qwaylandglcontext.cpp b/src/hardwareintegration/client/wayland-egl/qwaylandglcontext.cpp
index a891e7682..b2db1ad0c 100644
--- a/src/hardwareintegration/client/wayland-egl/qwaylandglcontext.cpp
+++ b/src/hardwareintegration/client/wayland-egl/qwaylandglcontext.cpp
@@ -44,12 +44,14 @@
#include <QtWaylandClient/private/qwaylanddisplay_p.h>
#include <QtWaylandClient/private/qwaylandwindow_p.h>
#include <QtWaylandClient/private/qwaylanddecoration_p.h>
+#include <QtWaylandClient/private/qwaylandintegration_p.h>
#include "qwaylandeglwindow.h"
#include <QDebug>
#include <QtPlatformSupport/private/qeglconvenience_p.h>
#include <QtGui/private/qopenglcontext_p.h>
#include <QtGui/private/qopengltexturecache_p.h>
+#include <QtGui/private/qguiapplication_p.h>
#include <qpa/qplatformopenglcontext.h>
#include <QtGui/QSurfaceFormat>
@@ -60,11 +62,14 @@ QT_BEGIN_NAMESPACE
QWaylandGLContext::QWaylandGLContext(EGLDisplay eglDisplay, const QSurfaceFormat &format, QPlatformOpenGLContext *share)
: QPlatformOpenGLContext()
, m_eglDisplay(eglDisplay)
- , m_config(q_configFromGLFormat(m_eglDisplay, format))
- , m_format(q_glFormatFromConfig(m_eglDisplay, m_config))
, m_blitProgram(0)
, mUseNativeDefaultFbo(false)
{
+ QSurfaceFormat fmt = format;
+ if (static_cast<QWaylandIntegration *>(QGuiApplicationPrivate::platformIntegration())->display()->supportsWindowDecoration())
+ fmt.setAlphaBufferSize(8);
+ m_config = q_configFromGLFormat(m_eglDisplay, fmt);
+ m_format = q_glFormatFromConfig(m_eglDisplay, m_config);
m_shareEGLContext = share ? static_cast<QWaylandGLContext *>(share)->eglContext() : EGL_NO_CONTEXT;
switch (m_format.renderableType()) {