From a92a519e799939e9d76d5b32b7f77eb8e9c8d578 Mon Sep 17 00:00:00 2001 From: Tasuku Suzuki Date: Sat, 17 Jun 2017 15:28:49 +0900 Subject: [PATCH 1/4] Translucent background support Change-Id: I6e7b5869097f579020c7a4439441a63a0771e955 Task-number: QTBUG-55956 Reviewed-by: Laszlo Agocs --- .../platforms/wayland/qwaylandshmbackingstore.cpp | 10 +++++++++- .../platforms/wayland/qwaylandshmbackingstore_p.h | 2 +- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/src/plugins/platforms/wayland/qwaylandshmbackingstore.cpp b/src/plugins/platforms/wayland/qwaylandshmbackingstore.cpp index 0afdda4c0c3..045748a16c2 100644 --- a/src/plugins/platforms/wayland/qwaylandshmbackingstore.cpp +++ b/src/plugins/platforms/wayland/qwaylandshmbackingstore.cpp @@ -171,12 +171,20 @@ QPaintDevice *QWaylandShmBackingStore::paintDevice() return contentSurface(); } -void QWaylandShmBackingStore::beginPaint(const QRegion &) +void QWaylandShmBackingStore::beginPaint(const QRegion ®ion) { mPainting = true; ensureSize(); waylandWindow()->setCanResize(false); + + if (mBackBuffer->image()->hasAlphaChannel()) { + QPainter p(paintDevice()); + p.setCompositionMode(QPainter::CompositionMode_Source); + const QColor blank = Qt::transparent; + for (const QRect &rect : region) + p.fillRect(rect, blank); + } } void QWaylandShmBackingStore::endPaint() diff --git a/src/plugins/platforms/wayland/qwaylandshmbackingstore_p.h b/src/plugins/platforms/wayland/qwaylandshmbackingstore_p.h index 8564cc9d223..251368efd47 100644 --- a/src/plugins/platforms/wayland/qwaylandshmbackingstore_p.h +++ b/src/plugins/platforms/wayland/qwaylandshmbackingstore_p.h @@ -94,7 +94,7 @@ public: void flush(QWindow *window, const QRegion ®ion, const QPoint &offset) override; void resize(const QSize &size, const QRegion &staticContents) override; void resize(const QSize &size); - void beginPaint(const QRegion &) override; + void beginPaint(const QRegion ®ion) override; void endPaint() override; QWaylandAbstractDecoration *windowDecoration() const; From d6e47a81c2afdb7c9ed5575415b486611f28cdf9 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Fri, 2 Jun 2017 21:22:42 -0700 Subject: [PATCH 2/4] Fix all the warnings about deprecated qLoadPlugin1 qLoadPlugin is variadic and can take one argument to the plugin loader, so just use that. Change-Id: Ia3e896da908f42939148fffd14c481e367fdb128 Reviewed-by: Jan Arne Petersen Reviewed-by: Johan Helsing --- .../qwaylandclientbufferintegrationfactory.cpp | 4 ++-- .../qwaylandserverbufferintegrationfactory.cpp | 4 ++-- .../qwaylandinputdeviceintegrationfactory.cpp | 4 ++-- src/plugins/platforms/wayland/qwaylanddecorationfactory.cpp | 4 ++-- .../shellintegration/qwaylandshellintegrationfactory.cpp | 4 ++-- 5 files changed, 10 insertions(+), 10 deletions(-) diff --git a/src/plugins/platforms/wayland/hardwareintegration/qwaylandclientbufferintegrationfactory.cpp b/src/plugins/platforms/wayland/hardwareintegration/qwaylandclientbufferintegrationfactory.cpp index 4e7e7ee5cac..eebd69a8703 100644 --- a/src/plugins/platforms/wayland/hardwareintegration/qwaylandclientbufferintegrationfactory.cpp +++ b/src/plugins/platforms/wayland/hardwareintegration/qwaylandclientbufferintegrationfactory.cpp @@ -84,10 +84,10 @@ QWaylandClientBufferIntegration *QWaylandClientBufferIntegrationFactory::create( // Try loading the plugin from platformPluginPath first: if (!pluginPath.isEmpty()) { QCoreApplication::addLibraryPath(pluginPath); - if (QWaylandClientBufferIntegration *ret = qLoadPlugin1(directLoader(), name, args)) + if (QWaylandClientBufferIntegration *ret = qLoadPlugin(directLoader(), name, args)) return ret; } - if (QWaylandClientBufferIntegration *ret = qLoadPlugin1(loader(), name, args)) + if (QWaylandClientBufferIntegration *ret = qLoadPlugin(loader(), name, args)) return ret; #endif return 0; diff --git a/src/plugins/platforms/wayland/hardwareintegration/qwaylandserverbufferintegrationfactory.cpp b/src/plugins/platforms/wayland/hardwareintegration/qwaylandserverbufferintegrationfactory.cpp index 527dc571a2e..aa2f54cb7d5 100644 --- a/src/plugins/platforms/wayland/hardwareintegration/qwaylandserverbufferintegrationfactory.cpp +++ b/src/plugins/platforms/wayland/hardwareintegration/qwaylandserverbufferintegrationfactory.cpp @@ -84,10 +84,10 @@ QWaylandServerBufferIntegration *QWaylandServerBufferIntegrationFactory::create( // Try loading the plugin from platformPluginPath first: if (!pluginPath.isEmpty()) { QCoreApplication::addLibraryPath(pluginPath); - if (QWaylandServerBufferIntegration *ret = qLoadPlugin1(directLoader(), name, args)) + if (QWaylandServerBufferIntegration *ret = qLoadPlugin(directLoader(), name, args)) return ret; } - if (QWaylandServerBufferIntegration *ret = qLoadPlugin1(loader(), name, args)) + if (QWaylandServerBufferIntegration *ret = qLoadPlugin(loader(), name, args)) return ret; #endif return 0; diff --git a/src/plugins/platforms/wayland/inputdeviceintegration/qwaylandinputdeviceintegrationfactory.cpp b/src/plugins/platforms/wayland/inputdeviceintegration/qwaylandinputdeviceintegrationfactory.cpp index c069a3645a4..94eca326296 100644 --- a/src/plugins/platforms/wayland/inputdeviceintegration/qwaylandinputdeviceintegrationfactory.cpp +++ b/src/plugins/platforms/wayland/inputdeviceintegration/qwaylandinputdeviceintegrationfactory.cpp @@ -84,10 +84,10 @@ QWaylandInputDeviceIntegration *QWaylandInputDeviceIntegrationFactory::create(co // Try loading the plugin from platformPluginPath first: if (!pluginPath.isEmpty()) { QCoreApplication::addLibraryPath(pluginPath); - if (QWaylandInputDeviceIntegration *ret = qLoadPlugin1(directLoader(), name, args)) + if (QWaylandInputDeviceIntegration *ret = qLoadPlugin(directLoader(), name, args)) return ret; } - if (QWaylandInputDeviceIntegration *ret = qLoadPlugin1(loader(), name, args)) + if (QWaylandInputDeviceIntegration *ret = qLoadPlugin(loader(), name, args)) return ret; #endif return Q_NULLPTR; diff --git a/src/plugins/platforms/wayland/qwaylanddecorationfactory.cpp b/src/plugins/platforms/wayland/qwaylanddecorationfactory.cpp index 1279e3039f6..ccf2c806c3a 100644 --- a/src/plugins/platforms/wayland/qwaylanddecorationfactory.cpp +++ b/src/plugins/platforms/wayland/qwaylanddecorationfactory.cpp @@ -84,10 +84,10 @@ QWaylandAbstractDecoration *QWaylandDecorationFactory::create(const QString &nam // Try loading the plugin from platformPluginPath first: if (!pluginPath.isEmpty()) { QCoreApplication::addLibraryPath(pluginPath); - if (QWaylandAbstractDecoration *ret = qLoadPlugin1(directLoader(), name, args)) + if (QWaylandAbstractDecoration *ret = qLoadPlugin(directLoader(), name, args)) return ret; } - if (QWaylandAbstractDecoration *ret = qLoadPlugin1(loader(), name, args)) + if (QWaylandAbstractDecoration *ret = qLoadPlugin(loader(), name, args)) return ret; #endif diff --git a/src/plugins/platforms/wayland/shellintegration/qwaylandshellintegrationfactory.cpp b/src/plugins/platforms/wayland/shellintegration/qwaylandshellintegrationfactory.cpp index 8bee45c748f..09c62339b62 100644 --- a/src/plugins/platforms/wayland/shellintegration/qwaylandshellintegrationfactory.cpp +++ b/src/plugins/platforms/wayland/shellintegration/qwaylandshellintegrationfactory.cpp @@ -84,10 +84,10 @@ QWaylandShellIntegration *QWaylandShellIntegrationFactory::create(const QString // Try loading the plugin from platformPluginPath first: if (!pluginPath.isEmpty()) { QCoreApplication::addLibraryPath(pluginPath); - if (QWaylandShellIntegration *ret = qLoadPlugin1(directLoader(), name, args)) + if (QWaylandShellIntegration *ret = qLoadPlugin(directLoader(), name, args)) return ret; } - if (QWaylandShellIntegration *ret = qLoadPlugin1(loader(), name, args)) + if (QWaylandShellIntegration *ret = qLoadPlugin(loader(), name, args)) return ret; #endif return Q_NULLPTR; From 177c1ae57e16152b44b6481a4ec7fedb72007f47 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Fri, 2 Jun 2017 20:56:21 -0700 Subject: [PATCH 3/4] Disable the GCC warning about missing initializers New fields are appended to the structure, so we can't initialize them as we would lose compatibility with earlier versions of libwayland. So just disable the warning. Change-Id: Ia3e896da908f42939148fffd14c4806ce3468e56 Reviewed-by: Johan Helsing --- src/tools/qtwaylandscanner/qtwaylandscanner.cpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/tools/qtwaylandscanner/qtwaylandscanner.cpp b/src/tools/qtwaylandscanner/qtwaylandscanner.cpp index 5b9707a5a99..01dfa92157f 100644 --- a/src/tools/qtwaylandscanner/qtwaylandscanner.cpp +++ b/src/tools/qtwaylandscanner/qtwaylandscanner.cpp @@ -392,6 +392,8 @@ void process(QXmlStreamReader &xml, const QByteArray &headerPath, const QByteArr printf("\n"); printf("QT_BEGIN_NAMESPACE\n"); + printf("QT_WARNING_PUSH\n"); + printf("QT_WARNING_DISABLE_GCC(\"-Wmissing-field-initializers\")\n"); QByteArray serverExport; if (headerPath.size()) { serverExport = QByteArray("Q_WAYLAND_SERVER_") + preProcessorProtocolName + "_EXPORT"; @@ -533,6 +535,7 @@ void process(QXmlStreamReader &xml, const QByteArray &headerPath, const QByteArr printf("}\n"); printf("\n"); + printf("QT_WARNING_POP\n"); printf("QT_END_NAMESPACE\n"); printf("\n"); printf("#endif\n"); @@ -545,6 +548,8 @@ void process(QXmlStreamReader &xml, const QByteArray &headerPath, const QByteArr printf("#include <%s/qwayland-server-%s.h>\n", headerPath.constData(), QByteArray(protocolName).replace('_', '-').constData()); printf("\n"); printf("QT_BEGIN_NAMESPACE\n"); + printf("QT_WARNING_PUSH\n"); + printf("QT_WARNING_DISABLE_GCC(\"-Wmissing-field-initializers\")\n"); printf("\n"); printf("namespace QtWaylandServer {\n"); @@ -827,6 +832,7 @@ void process(QXmlStreamReader &xml, const QByteArray &headerPath, const QByteArr } printf("}\n"); printf("\n"); + printf("QT_WARNING_POP\n"); printf("QT_END_NAMESPACE\n"); } @@ -843,6 +849,8 @@ void process(QXmlStreamReader &xml, const QByteArray &headerPath, const QByteArr printf("#include \n"); printf("\n"); printf("QT_BEGIN_NAMESPACE\n"); + printf("QT_WARNING_PUSH\n"); + printf("QT_WARNING_DISABLE_GCC(\"-Wmissing-field-initializers\")\n"); QByteArray clientExport; @@ -940,6 +948,7 @@ void process(QXmlStreamReader &xml, const QByteArray &headerPath, const QByteArr } printf("}\n"); printf("\n"); + printf("QT_WARNING_POP\n"); printf("QT_END_NAMESPACE\n"); printf("\n"); printf("#endif\n"); @@ -952,6 +961,8 @@ void process(QXmlStreamReader &xml, const QByteArray &headerPath, const QByteArr printf("#include <%s/qwayland-%s.h>\n", headerPath.constData(), QByteArray(protocolName).replace('_', '-').constData()); printf("\n"); printf("QT_BEGIN_NAMESPACE\n"); + printf("QT_WARNING_PUSH\n"); + printf("QT_WARNING_DISABLE_GCC(\"-Wmissing-field-initializers\")\n"); printf("\n"); printf("namespace QtWayland {\n"); for (int j = 0; j < interfaces.size(); ++j) { @@ -1134,6 +1145,7 @@ void process(QXmlStreamReader &xml, const QByteArray &headerPath, const QByteArr } printf("}\n"); printf("\n"); + printf("QT_WARNING_POP\n"); printf("QT_END_NAMESPACE\n"); } } From 8618b4227f59726cd246996d0a837ccef1c400e3 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Fri, 2 Jun 2017 20:44:24 -0700 Subject: [PATCH 4/4] Add missing break Found by GCC 7 qwaylandinputmethodeventbuilder.cpp:110:51: warning: this statement may fall through [-Wimplicit-fallthrough=] Change-Id: Ia3e896da908f42939148fffd14c47fc6058b0933 Reviewed-by: Jan Arne Petersen Reviewed-by: Johan Helsing --- .../platforms/wayland/shared/qwaylandinputmethodeventbuilder.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/plugins/platforms/wayland/shared/qwaylandinputmethodeventbuilder.cpp b/src/plugins/platforms/wayland/shared/qwaylandinputmethodeventbuilder.cpp index 0e2d1a406b3..6acf312ed59 100644 --- a/src/plugins/platforms/wayland/shared/qwaylandinputmethodeventbuilder.cpp +++ b/src/plugins/platforms/wayland/shared/qwaylandinputmethodeventbuilder.cpp @@ -108,6 +108,7 @@ void QWaylandInputMethodEventBuilder::addPreeditStyling(uint32_t index, uint32_t format.setFontUnderline(true); format.setUnderlineStyle(QTextCharFormat::SingleUnderline); m_preeditStyles.append(QInputMethodEvent::Attribute(QInputMethodEvent::TextFormat, index, length, format)); + break; case 5: format.setFontUnderline(true); format.setUnderlineStyle(QTextCharFormat::WaveUnderline);