From 06b2f437219b5e44aebcff7c13362c062be06273 Mon Sep 17 00:00:00 2001 From: Liang Qi Date: Mon, 13 Dec 2021 13:01:59 +0100 Subject: Client: support high-dpi mode for window icon MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fixes: QTBUG-90530 Change-Id: Ib1f36e1cb89352dfac8a385a7b097cfc0226e813 Reviewed-by: David Edmundson Reviewed-by: Tor Arne Vestbø (cherry picked from commit fc91cd6b1306c6d452cbddab3c2289ccb92218d6) Reviewed-by: Qt Cherry-pick Bot --- src/plugins/decorations/bradient/main.cpp | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/src/plugins/decorations/bradient/main.cpp b/src/plugins/decorations/bradient/main.cpp index 61ec45e0..8b353346 100644 --- a/src/plugins/decorations/bradient/main.cpp +++ b/src/plugins/decorations/bradient/main.cpp @@ -164,13 +164,10 @@ void QWaylandBradientDecoration::paint(QPaintDevice *device) // Window icon QIcon icon = waylandWindow()->windowIcon(); if (!icon.isNull()) { - QPixmap pixmap = icon.pixmap(QSize(128, 128)); - QPixmap scaled = pixmap.scaled(22, 22, Qt::IgnoreAspectRatio, Qt::SmoothTransformation); - QRectF iconRect(0, 0, 22, 22); - p.drawPixmap(iconRect.adjusted(margins().left() + BUTTON_SPACING, 4, - margins().left() + BUTTON_SPACING, 4), - scaled, iconRect); + iconRect.adjust(margins().left() + BUTTON_SPACING, 4, + margins().left() + BUTTON_SPACING, 4), + icon.paint(&p, iconRect.toRect()); } // Window title -- cgit v1.2.1 From d3fb32870778c4e91268ac19583b64c852d0108f Mon Sep 17 00:00:00 2001 From: Weng Xuetian Date: Sat, 18 Dec 2021 23:42:49 -0800 Subject: Set preedit cursor when cursor equals to 0 Change-Id: I832fbb22d973b36ac4ab51570fc53bc2e4c3ed58 Reviewed-by: Liang Qi (cherry picked from commit 719a55be13bdadfa659a732755f280e276a894bd) Reviewed-by: Qt Cherry-pick Bot --- src/shared/qwaylandinputmethodeventbuilder.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/shared/qwaylandinputmethodeventbuilder.cpp b/src/shared/qwaylandinputmethodeventbuilder.cpp index 974fb54f..45769560 100644 --- a/src/shared/qwaylandinputmethodeventbuilder.cpp +++ b/src/shared/qwaylandinputmethodeventbuilder.cpp @@ -151,7 +151,7 @@ QInputMethodEvent QWaylandInputMethodEventBuilder::buildPreedit(const QString &t { QList attributes; - if (m_preeditCursor < 0) { + if (m_preeditCursor <= 0) { attributes.append(QInputMethodEvent::Attribute(QInputMethodEvent::Cursor, 0, 0, QVariant())); } else if (m_preeditCursor > 0) { attributes.append(QInputMethodEvent::Attribute(QInputMethodEvent::Cursor, indexFromWayland(text, m_preeditCursor), 1, QVariant())); -- cgit v1.2.1 From 32a93b483dba6435d514d820c151ad0325e3854d Mon Sep 17 00:00:00 2001 From: Eskil Abrahamsen Blomfeldt Date: Tue, 9 Nov 2021 13:23:41 +0100 Subject: Fix missing update when toggling client-side decorations When CSD is toggled while a window is showing, it would change the size and recreate the buffers, but since the widget area remained the same size, we would not trigger a redraw. The result was that when you got any update to the window, it would redraw the widgets that had changed, and the rest would be transparent. Since this is a fairly specialized case, we fix it the simple way, by just issuing an extra update when it happens. This also required an update to the surface test, since there is an additional buffer commit in the beginning of the sequence now. Fixes: QTBUG-95032 Change-Id: Ic4bdb9c66a2ea76546926dd622f2d2dac5dce10c Reviewed-by: Qt CI Bot Reviewed-by: Liang Qi (cherry picked from commit af7b60ade5c4be81cbc58eb18307c017d5594071) Reviewed-by: Qt Cherry-pick Bot --- src/client/qwaylandwindow.cpp | 7 +++++++ tests/auto/client/surface/tst_surface.cpp | 4 ++++ 2 files changed, 11 insertions(+) diff --git a/src/client/qwaylandwindow.cpp b/src/client/qwaylandwindow.cpp index 6033f612..14fbe995 100644 --- a/src/client/qwaylandwindow.cpp +++ b/src/client/qwaylandwindow.cpp @@ -868,6 +868,13 @@ bool QWaylandWindow::createDecoration() subsurf->set_position(pos.x() + m.left(), pos.y() + m.top()); } sendExposeEvent(QRect(QPoint(), geometry().size())); + + // This is a special case where the buffer is recreated, but since + // the content rect remains the same, the widgets remain the same + // size and are not redrawn, leaving the new buffer empty. As a simple + // work-around, we trigger a full extra update whenever the client-side + // window decorations are toggled while the window is showing. + window()->requestUpdate(); } return mWindowDecoration; diff --git a/tests/auto/client/surface/tst_surface.cpp b/tests/auto/client/surface/tst_surface.cpp index 95e4e609..60c672ce 100644 --- a/tests/auto/client/surface/tst_surface.cpp +++ b/tests/auto/client/surface/tst_surface.cpp @@ -129,6 +129,10 @@ void tst_surface::waitForFrameCallbackGl() // Make sure we follow frame callbacks for some frames for (int i = 0; i < 5; ++i) { xdgPingAndWaitForPong(); // Make sure things have happened on the client + if (!qEnvironmentVariableIntValue("QT_WAYLAND_DISABLE_WINDOWDECORATION") && i == 0) { + QCOMPARE(bufferSpy.count(), 1); + bufferSpy.removeFirst(); + } exec([&] { QVERIFY(bufferSpy.empty()); // Make sure no extra buffers have arrived QVERIFY(!xdgToplevel()->surface()->m_waitingFrameCallbacks.empty()); -- cgit v1.2.1 From f7e1a50b9e72d5e1f03df686c6a96bf7e6d1870d Mon Sep 17 00:00:00 2001 From: Tarja Sundqvist Date: Fri, 31 Dec 2021 15:31:53 +0200 Subject: Bump version --- .qmake.conf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.qmake.conf b/.qmake.conf index e95d63bc..e1cc185f 100644 --- a/.qmake.conf +++ b/.qmake.conf @@ -4,4 +4,4 @@ DEFINES += QT_NO_FOREACH DEFINES += QT_NO_JAVA_STYLE_ITERATORS DEFINES += QT_NO_LINKED_LIST -MODULE_VERSION = 5.15.8 +MODULE_VERSION = 5.15.9 -- cgit v1.2.1 From cf44bcd9ff11e77a0979ded91848bf0f9f2d5832 Mon Sep 17 00:00:00 2001 From: Tang Haixiang Date: Thu, 13 Jan 2022 15:09:46 +0800 Subject: wayland touch event to add key modifier Add touch event keyboard modifier for wayland, which is done in qpa xcb, which is very convenient on tablets with keyboards. Change-Id: I4e6ed369f3444da41d06f9a9a83addf7de0a4e91 Reviewed-by: Povilas Kanapickas Reviewed-by: David Edmundson (cherry picked from commit a2dd5efbaa4b63782261664ca9a1aa9973db976e) Reviewed-by: Liang Qi --- src/client/qwaylandinputdevice.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/client/qwaylandinputdevice.cpp b/src/client/qwaylandinputdevice.cpp index 9490a66d..7fad67ca 100644 --- a/src/client/qwaylandinputdevice.cpp +++ b/src/client/qwaylandinputdevice.cpp @@ -1483,7 +1483,7 @@ void QWaylandInputDevice::Touch::touch_frame() return; } - QWindowSystemInterface::handleTouchEvent(window, mParent->mTouchDevice, mPendingTouchPoints); + QWindowSystemInterface::handleTouchEvent(window, mParent->mTouchDevice, mPendingTouchPoints, mParent->modifiers()); // Prepare state for next frame const auto prevTouchPoints = mPendingTouchPoints; -- cgit v1.2.1 From 7ce31f7f65f8d79c1f8763eb75b3ea238b727654 Mon Sep 17 00:00:00 2001 From: Seokha Ko Date: Mon, 24 Jan 2022 15:48:58 +0900 Subject: Fix wayland touch event to use time stamp from wayland compositor Touch events may be ignored if we set time stamp in handleTouchEvent() when handling touch events queued in wayland socket in main thread. So use time stamp from wayland compositor. Task-number: QTBUG-100150 Change-Id: I14fd3791b4d29177c71662d1cf26c0eed0abb767 Reviewed-by: Shawn Rutledge Reviewed-by: Seokha Ko Reviewed-by: Eskil Abrahamsen Blomfeldt (cherry picked from commit 2419064c3532e2efd3bcf2f23c9c690b0a0fdd00) --- src/client/qwaylandinputdevice.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/client/qwaylandinputdevice.cpp b/src/client/qwaylandinputdevice.cpp index 7fad67ca..51c64957 100644 --- a/src/client/qwaylandinputdevice.cpp +++ b/src/client/qwaylandinputdevice.cpp @@ -1364,7 +1364,7 @@ void QWaylandInputDevice::Touch::touch_down(uint32_t serial, void QWaylandInputDevice::Touch::touch_up(uint32_t serial, uint32_t time, int32_t id) { Q_UNUSED(serial); - Q_UNUSED(time); + mParent->mTime = time; mParent->handleTouchPoint(id, Qt::TouchPointReleased); if (allTouchPointsReleased()) { @@ -1383,8 +1383,8 @@ void QWaylandInputDevice::Touch::touch_up(uint32_t serial, uint32_t time, int32_ void QWaylandInputDevice::Touch::touch_motion(uint32_t time, int32_t id, wl_fixed_t x, wl_fixed_t y) { - Q_UNUSED(time); QPointF position(wl_fixed_to_double(x), wl_fixed_to_double(y)); + mParent->mTime = time; mParent->handleTouchPoint(id, Qt::TouchPointMoved, position); } @@ -1483,7 +1483,7 @@ void QWaylandInputDevice::Touch::touch_frame() return; } - QWindowSystemInterface::handleTouchEvent(window, mParent->mTouchDevice, mPendingTouchPoints, mParent->modifiers()); + QWindowSystemInterface::handleTouchEvent(window, mParent->mTime, mParent->mTouchDevice, mPendingTouchPoints, mParent->modifiers()); // Prepare state for next frame const auto prevTouchPoints = mPendingTouchPoints; -- cgit v1.2.1 From e3a8c19de733617ea40b6520c3b65e0faf52f578 Mon Sep 17 00:00:00 2001 From: Liang Qi Date: Tue, 25 Jan 2022 19:53:07 +0100 Subject: Fix build with -no-feature-tabletevent Fixes: QTBUG-99965 Change-Id: Ib7fcf92973b4e559713ae27ad0c7f843f9122daf Reviewed-by: Eskil Abrahamsen Blomfeldt Reviewed-by: Alexandru Croitor (cherry picked from commit ba82ba66eb8dc3580e67683783a410a254984def) --- src/client/client.pro | 7 +++++-- src/client/qwaylanddisplay.cpp | 4 ++++ src/client/qwaylanddisplay_p.h | 6 ++++++ src/client/qwaylandinputdevice.cpp | 4 ++++ src/client/qwaylandinputdevice_p.h | 6 ++++++ 5 files changed, 25 insertions(+), 2 deletions(-) diff --git a/src/client/client.pro b/src/client/client.pro index 793a4418..e7b1dad5 100644 --- a/src/client/client.pro +++ b/src/client/client.pro @@ -53,7 +53,6 @@ SOURCES += qwaylandintegration.cpp \ qwaylandextendedsurface.cpp \ qwaylandsubsurface.cpp \ qwaylandsurface.cpp \ - qwaylandtabletv2.cpp \ qwaylandtouch.cpp \ qwaylandqtkey.cpp \ ../shared/qwaylandmimehelper.cpp \ @@ -79,7 +78,6 @@ HEADERS += qwaylandintegration_p.h \ qwaylandextendedsurface_p.h \ qwaylandsubsurface_p.h \ qwaylandsurface_p.h \ - qwaylandtabletv2_p.h \ qwaylandtouch_p.h \ qwaylandqtkey_p.h \ qwaylandabstractdecoration_p.h \ @@ -99,6 +97,11 @@ qtConfig(clipboard) { SOURCES += qwaylandclipboard.cpp } +qtConfig(tabletevent) { + HEADERS += qwaylandtabletv2_p.h + SOURCES += qwaylandtabletv2.cpp +} + include(hardwareintegration/hardwareintegration.pri) include(shellintegration/shellintegration.pri) include(inputdeviceintegration/inputdeviceintegration.pri) diff --git a/src/client/qwaylanddisplay.cpp b/src/client/qwaylanddisplay.cpp index 39e84ad2..666a8557 100644 --- a/src/client/qwaylanddisplay.cpp +++ b/src/client/qwaylanddisplay.cpp @@ -69,7 +69,9 @@ #include "qwaylandextendedsurface_p.h" #include "qwaylandsubsurface_p.h" #include "qwaylandtouch_p.h" +#if QT_CONFIG(tabletevent) #include "qwaylandtabletv2_p.h" +#endif #include "qwaylandqtkey_p.h" #include @@ -364,8 +366,10 @@ void QWaylandDisplay::registry_global(uint32_t id, const QString &interface, uin mTouchExtension.reset(new QWaylandTouchExtension(this, id)); } else if (interface == QStringLiteral("zqt_key_v1")) { mQtKeyExtension.reset(new QWaylandQtKeyExtension(this, id)); +#if QT_CONFIG(tabletevent) } else if (interface == QStringLiteral("zwp_tablet_manager_v2")) { mTabletManager.reset(new QWaylandTabletManagerV2(this, id, qMin(1, int(version)))); +#endif #if QT_CONFIG(wayland_client_primary_selection) } else if (interface == QStringLiteral("zwp_primary_selection_device_manager_v1")) { mPrimarySelectionManager.reset(new QWaylandPrimarySelectionDeviceManagerV1(this, id, 1)); diff --git a/src/client/qwaylanddisplay_p.h b/src/client/qwaylanddisplay_p.h index 6b5f5641..d8f3dd48 100644 --- a/src/client/qwaylanddisplay_p.h +++ b/src/client/qwaylanddisplay_p.h @@ -99,7 +99,9 @@ class QWaylandDataDeviceManager; #if QT_CONFIG(wayland_client_primary_selection) class QWaylandPrimarySelectionDeviceManagerV1; #endif +#if QT_CONFIG(tabletevent) class QWaylandTabletManagerV2; +#endif class QWaylandTouchExtension; class QWaylandQtKeyExtension; class QWaylandWindow; @@ -169,7 +171,9 @@ public: QWaylandPrimarySelectionDeviceManagerV1 *primarySelectionManager() const { return mPrimarySelectionManager.data(); } #endif QtWayland::qt_surface_extension *windowExtension() const { return mWindowExtension.data(); } +#if QT_CONFIG(tabletevent) QWaylandTabletManagerV2 *tabletManager() const { return mTabletManager.data(); } +#endif QWaylandTouchExtension *touchExtension() const { return mTouchExtension.data(); } QtWayland::zwp_text_input_manager_v2 *textInputManager() const { return mTextInputManager.data(); } QWaylandHardwareIntegration *hardwareIntegration() const { return mHardwareIntegration.data(); } @@ -257,7 +261,9 @@ private: QScopedPointer mTouchExtension; QScopedPointer mQtKeyExtension; QScopedPointer mWindowManagerIntegration; +#if QT_CONFIG(tabletevent) QScopedPointer mTabletManager; +#endif #if QT_CONFIG(wayland_client_primary_selection) QScopedPointer mPrimarySelectionManager; #endif diff --git a/src/client/qwaylandinputdevice.cpp b/src/client/qwaylandinputdevice.cpp index 51c64957..871e0d3f 100644 --- a/src/client/qwaylandinputdevice.cpp +++ b/src/client/qwaylandinputdevice.cpp @@ -50,7 +50,9 @@ #if QT_CONFIG(wayland_client_primary_selection) #include "qwaylandprimaryselectionv1_p.h" #endif +#if QT_CONFIG(tabletevent) #include "qwaylandtabletv2_p.h" +#endif #include "qwaylandtouch_p.h" #include "qwaylandscreen_p.h" #include "qwaylandcursor_p.h" @@ -419,8 +421,10 @@ QWaylandInputDevice::QWaylandInputDevice(QWaylandDisplay *display, int version, if (mQDisplay->textInputManager()) mTextInput.reset(new QWaylandTextInput(mQDisplay, mQDisplay->textInputManager()->get_text_input(wl_seat()))); +#if QT_CONFIG(tabletevent) if (auto *tm = mQDisplay->tabletManager()) mTabletSeat.reset(new QWaylandTabletSeatV2(tm, this)); +#endif } QWaylandInputDevice::~QWaylandInputDevice() diff --git a/src/client/qwaylandinputdevice_p.h b/src/client/qwaylandinputdevice_p.h index aebff248..042eb285 100644 --- a/src/client/qwaylandinputdevice_p.h +++ b/src/client/qwaylandinputdevice_p.h @@ -89,7 +89,9 @@ class QWaylandDisplay; #if QT_CONFIG(wayland_client_primary_selection) class QWaylandPrimarySelectionDeviceV1; #endif +#if QT_CONFIG(tabletevent) class QWaylandTabletSeatV2; +#endif class QWaylandTextInput; #if QT_CONFIG(cursor) class QWaylandCursorTheme; @@ -128,8 +130,10 @@ public: QWaylandPrimarySelectionDeviceV1 *primarySelectionDevice() const; #endif +#if QT_CONFIG(tabletevent) void setTabletSeat(QWaylandTabletSeatV2 *tabletSeat); QWaylandTabletSeatV2* tabletSeat() const; +#endif void setTextInput(QWaylandTextInput *textInput); QWaylandTextInput *textInput() const; @@ -187,7 +191,9 @@ private: Touch *mTouch = nullptr; QScopedPointer mTextInput; +#if QT_CONFIG(tabletevent) QScopedPointer mTabletSeat; +#endif uint32_t mTime = 0; uint32_t mSerial = 0; -- cgit v1.2.1 From c034c91ed3e3610e54a2eada1ca73c790a6127f8 Mon Sep 17 00:00:00 2001 From: Joni Poikelin Date: Thu, 3 Feb 2022 14:01:50 +0200 Subject: Fix crash if no input method module could be loaded Change-Id: I8f346def616606a6c5540856bd08a84ee7ed5ca2 Reviewed-by: David Edmundson (cherry picked from commit 49fb7248f6ab7de046e2179c7861951ea1169e9b) Reviewed-by: Qt Cherry-pick Bot --- src/client/qwaylandintegration.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/client/qwaylandintegration.cpp b/src/client/qwaylandintegration.cpp index 7c1f6480..6a9956db 100644 --- a/src/client/qwaylandintegration.cpp +++ b/src/client/qwaylandintegration.cpp @@ -479,7 +479,7 @@ void QWaylandIntegration::reconfigureInputContext() } #endif - qCDebug(lcQpaWayland) << "using input method:" << inputContext()->metaObject()->className(); + qCDebug(lcQpaWayland) << "using input method:" << (inputContext() ? inputContext()->metaObject()->className() : ""); } QWaylandShellIntegration *QWaylandIntegration::createShellIntegration(const QString &integrationName) -- cgit v1.2.1 From e0d6f3cec32b3ce9666ff768cf98ee9c1bd2de79 Mon Sep 17 00:00:00 2001 From: Inho Lee Date: Fri, 4 Feb 2022 10:32:29 +0100 Subject: Update the window geometry when changing decorations Windows' geometries should be updated when changing decorations. Fixes: QTBUG-100467 Change-Id: I5ec9968aa48422776d184a8fa2f5d86ecc3ca5c3 Reviewed-by: Eskil Abrahamsen Blomfeldt Reviewed-by: Liang Qi (cherry picked from commit 37e3789cf932ff665b8bd9325e64524c10c16489) Reviewed-by: Qt Cherry-pick Bot --- src/client/qwaylandwindow.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/client/qwaylandwindow.cpp b/src/client/qwaylandwindow.cpp index 14fbe995..a16a6807 100644 --- a/src/client/qwaylandwindow.cpp +++ b/src/client/qwaylandwindow.cpp @@ -867,7 +867,7 @@ bool QWaylandWindow::createDecoration() QMargins m = frameMargins(); subsurf->set_position(pos.x() + m.left(), pos.y() + m.top()); } - sendExposeEvent(QRect(QPoint(), geometry().size())); + setGeometry(geometry()); // This is a special case where the buffer is recreated, but since // the content rect remains the same, the widgets remain the same -- cgit v1.2.1 From 3d0c2db1673c2d594014712030ed3f5217969872 Mon Sep 17 00:00:00 2001 From: Inho Lee Date: Fri, 5 Nov 2021 13:35:55 +0100 Subject: Don't keep eglConfig in hardwareintegration There is no reason to keep eglConfig value as a member variable. Even this can result in creating wrong surface from the current surface. And it makes no sense to change alpha bits of the surface format by supporting decorations. Task-number: QTBUG-97916 Change-Id: Iaa395d36e83373ea197dc5e14424fcb62cd2cd8b (cherry picked from commit af884d4aac18e5155649f8a916ea272c11542b7e) Reviewed-by: Qt CI Bot Reviewed-by: Seokha Ko Reviewed-by: Eskil Abrahamsen Blomfeldt --- .../client/brcm-egl/qwaylandbrcmeglwindow.cpp | 8 ++++---- .../client/brcm-egl/qwaylandbrcmeglwindow.h | 2 -- .../client/wayland-egl/qwaylandeglwindow.cpp | 19 ++++++++----------- .../client/wayland-egl/qwaylandeglwindow.h | 1 - .../xcomposite-egl/qwaylandxcompositeeglwindow.cpp | 7 ++++--- .../xcomposite-egl/qwaylandxcompositeeglwindow.h | 1 - .../xcomposite-glx/qwaylandxcompositeglxwindow.cpp | 4 ++-- .../xcomposite-glx/qwaylandxcompositeglxwindow.h | 1 - 8 files changed, 18 insertions(+), 25 deletions(-) diff --git a/src/hardwareintegration/client/brcm-egl/qwaylandbrcmeglwindow.cpp b/src/hardwareintegration/client/brcm-egl/qwaylandbrcmeglwindow.cpp index ab32ed02..feb15583 100644 --- a/src/hardwareintegration/client/brcm-egl/qwaylandbrcmeglwindow.cpp +++ b/src/hardwareintegration/client/brcm-egl/qwaylandbrcmeglwindow.cpp @@ -185,14 +185,14 @@ void QWaylandBrcmEglWindow::createEglSurfaces() m_count = window()->format().swapBehavior() == QSurfaceFormat::TripleBuffer ? 3 : 2; - m_eglConfig = q_configFromGLFormat(m_eglIntegration->eglDisplay(), brcmFixFormat(window()->format()), true, EGL_PIXMAP_BIT); + EGLConfig eglConfig = q_configFromGLFormat(m_eglIntegration->eglDisplay(), brcmFixFormat(window()->format()), true, EGL_PIXMAP_BIT); - m_format = q_glFormatFromConfig(m_eglIntegration->eglDisplay(), m_eglConfig); + m_format = q_glFormatFromConfig(m_eglIntegration->eglDisplay(), eglConfig); EGLint pixel_format = EGL_PIXEL_FORMAT_ARGB_8888_BRCM; EGLint rt; - eglGetConfigAttrib(m_eglIntegration->eglDisplay(), m_eglConfig, EGL_RENDERABLE_TYPE, &rt); + eglGetConfigAttrib(m_eglIntegration->eglDisplay(), eglConfig, EGL_RENDERABLE_TYPE, &rt); if (rt & EGL_OPENGL_ES_BIT) { pixel_format |= EGL_PIXEL_FORMAT_RENDER_GLES_BRCM; @@ -228,7 +228,7 @@ void QWaylandBrcmEglWindow::createEglSurfaces() EGL_NONE }; - m_eglSurfaces[i] = eglCreatePixmapSurface(m_eglIntegration->eglDisplay(), m_eglConfig, (EGLNativePixmapType)&m_globalImages[5*i], attrs); + m_eglSurfaces[i] = eglCreatePixmapSurface(m_eglIntegration->eglDisplay(), eglConfig, (EGLNativePixmapType)&m_globalImages[5*i], attrs); if (m_eglSurfaces[i] == EGL_NO_SURFACE) qFatal("eglCreatePixmapSurface failed: %x, global image id: %d %d\n", eglGetError(), m_globalImages[5*i], m_globalImages[5*i+1]); m_buffers[i] = new QWaylandBrcmBuffer(mDisplay, m_eglIntegration->waylandBrcm(), size, &m_globalImages[5*i], 5, m_eventQueue); diff --git a/src/hardwareintegration/client/brcm-egl/qwaylandbrcmeglwindow.h b/src/hardwareintegration/client/brcm-egl/qwaylandbrcmeglwindow.h index aa4f91bd..401cb16a 100644 --- a/src/hardwareintegration/client/brcm-egl/qwaylandbrcmeglwindow.h +++ b/src/hardwareintegration/client/brcm-egl/qwaylandbrcmeglwindow.h @@ -77,8 +77,6 @@ private: const QWaylandWindow *m_parentWindow = nullptr; - EGLConfig m_eglConfig = 0; - EGLint m_globalImages[3*5]; EGLSurface m_eglSurfaces[3]; diff --git a/src/hardwareintegration/client/wayland-egl/qwaylandeglwindow.cpp b/src/hardwareintegration/client/wayland-egl/qwaylandeglwindow.cpp index e269061c..70bc0043 100644 --- a/src/hardwareintegration/client/wayland-egl/qwaylandeglwindow.cpp +++ b/src/hardwareintegration/client/wayland-egl/qwaylandeglwindow.cpp @@ -57,17 +57,8 @@ namespace QtWaylandClient { QWaylandEglWindow::QWaylandEglWindow(QWindow *window, QWaylandDisplay *display) : QWaylandWindow(window, display) , m_clientBufferIntegration(static_cast(mDisplay->clientBufferIntegration())) + , m_format(window->requestedFormat()) { - 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, fmt); - - // 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 - // should be avoided. } QWaylandEglWindow::~QWaylandEglWindow() @@ -143,7 +134,13 @@ void QWaylandEglWindow::updateSurface(bool create) if (!m_eglSurface && m_waylandEglWindow && create) { EGLNativeWindowType eglw = (EGLNativeWindowType) m_waylandEglWindow; - m_eglSurface = eglCreateWindowSurface(m_clientBufferIntegration->eglDisplay(), m_eglConfig, eglw, 0); + QSurfaceFormat fmt = window()->requestedFormat(); + + if (mDisplay->supportsWindowDecoration()) + fmt.setAlphaBufferSize(8); + EGLConfig eglConfig = q_configFromGLFormat(m_clientBufferIntegration->eglDisplay(), fmt); + m_format = q_glFormatFromConfig(m_clientBufferIntegration->eglDisplay(), eglConfig); + m_eglSurface = eglCreateWindowSurface(m_clientBufferIntegration->eglDisplay(), eglConfig, eglw, 0); if (Q_UNLIKELY(m_eglSurface == EGL_NO_SURFACE)) qCWarning(lcQpaWayland, "Could not create EGL surface (EGL error 0x%x)\n", eglGetError()); } diff --git a/src/hardwareintegration/client/wayland-egl/qwaylandeglwindow.h b/src/hardwareintegration/client/wayland-egl/qwaylandeglwindow.h index aa3aa279..9727f534 100644 --- a/src/hardwareintegration/client/wayland-egl/qwaylandeglwindow.h +++ b/src/hardwareintegration/client/wayland-egl/qwaylandeglwindow.h @@ -83,7 +83,6 @@ private: const QWaylandWindow *m_parentWindow = nullptr; EGLSurface m_eglSurface = EGL_NO_SURFACE; - EGLConfig m_eglConfig; mutable bool m_resize = false; mutable QOpenGLFramebufferObject *m_contentFBO = nullptr; diff --git a/src/hardwareintegration/client/xcomposite-egl/qwaylandxcompositeeglwindow.cpp b/src/hardwareintegration/client/xcomposite-egl/qwaylandxcompositeeglwindow.cpp index b6895ba4..7b5b40d4 100644 --- a/src/hardwareintegration/client/xcomposite-egl/qwaylandxcompositeeglwindow.cpp +++ b/src/hardwareintegration/client/xcomposite-egl/qwaylandxcompositeeglwindow.cpp @@ -57,7 +57,6 @@ namespace QtWaylandClient { QWaylandXCompositeEGLWindow::QWaylandXCompositeEGLWindow(QWindow *window, QWaylandXCompositeEGLClientBufferIntegration *glxIntegration) : QWaylandWindow(window, glxIntegration->waylandDisplay()) , m_glxIntegration(glxIntegration) - , m_config(q_configFromGLFormat(glxIntegration->eglDisplay(), window->format(), true, EGL_WINDOW_BIT | EGL_PIXMAP_BIT)) { } @@ -98,7 +97,9 @@ void QWaylandXCompositeEGLWindow::createEglSurface() XDestroyWindow(m_glxIntegration->xDisplay(), m_xWindow); } - VisualID visualId = QXlibEglIntegration::getCompatibleVisualId(m_glxIntegration->xDisplay(), m_glxIntegration->eglDisplay(), m_config); + EGLConfig eglConfig = q_configFromGLFormat(m_glxIntegration->eglDisplay(), window()->format(), true, EGL_WINDOW_BIT | EGL_PIXMAP_BIT); + + VisualID visualId = QXlibEglIntegration::getCompatibleVisualId(m_glxIntegration->xDisplay(), m_glxIntegration->eglDisplay(), eglConfig); XVisualInfo visualInfoTemplate; memset(&visualInfoTemplate, 0, sizeof(XVisualInfo)); @@ -118,7 +119,7 @@ void QWaylandXCompositeEGLWindow::createEglSurface() XCompositeRedirectWindow(m_glxIntegration->xDisplay(), m_xWindow, CompositeRedirectManual); XMapWindow(m_glxIntegration->xDisplay(), m_xWindow); - m_surface = eglCreateWindowSurface(m_glxIntegration->eglDisplay(), m_config, reinterpret_cast(m_xWindow), nullptr); + m_surface = eglCreateWindowSurface(m_glxIntegration->eglDisplay(), eglConfig, reinterpret_cast(m_xWindow), nullptr); if (m_surface == EGL_NO_SURFACE) { qFatal("Could not make eglsurface"); } diff --git a/src/hardwareintegration/client/xcomposite-egl/qwaylandxcompositeeglwindow.h b/src/hardwareintegration/client/xcomposite-egl/qwaylandxcompositeeglwindow.h index 6afbf721..76928193 100644 --- a/src/hardwareintegration/client/xcomposite-egl/qwaylandxcompositeeglwindow.h +++ b/src/hardwareintegration/client/xcomposite-egl/qwaylandxcompositeeglwindow.h @@ -69,7 +69,6 @@ private: QWaylandBuffer *m_buffer = nullptr; Window m_xWindow = 0; - EGLConfig m_config; EGLSurface m_surface = EGL_NO_SURFACE; }; diff --git a/src/hardwareintegration/client/xcomposite-glx/qwaylandxcompositeglxwindow.cpp b/src/hardwareintegration/client/xcomposite-glx/qwaylandxcompositeglxwindow.cpp index e76bc940..4e7d9f13 100644 --- a/src/hardwareintegration/client/xcomposite-glx/qwaylandxcompositeglxwindow.cpp +++ b/src/hardwareintegration/client/xcomposite-glx/qwaylandxcompositeglxwindow.cpp @@ -54,7 +54,6 @@ namespace QtWaylandClient { QWaylandXCompositeGLXWindow::QWaylandXCompositeGLXWindow(QWindow *window, QWaylandXCompositeGLXIntegration *glxIntegration) : QWaylandWindow(window, glxIntegration->waylandDisplay()) , m_glxIntegration(glxIntegration) - , m_config(qglx_findConfig(glxIntegration->xDisplay(), glxIntegration->screen(), window->format(), GLX_WINDOW_BIT | GLX_PIXMAP_BIT)) { } @@ -95,7 +94,8 @@ void QWaylandXCompositeGLXWindow::createSurface() return; } - XVisualInfo *visualInfo = glXGetVisualFromFBConfig(m_glxIntegration->xDisplay(), m_config); + GLXFBConfig glxConfig = qglx_findConfig(m_glxIntegration->xDisplay(), m_glxIntegration->screen(), window()->format(), GLX_WINDOW_BIT | GLX_PIXMAP_BIT); + XVisualInfo *visualInfo = glXGetVisualFromFBConfig(m_glxIntegration->xDisplay(), glxConfig); Colormap cmap = XCreateColormap(m_glxIntegration->xDisplay(), m_glxIntegration->rootWindow(), visualInfo->visual, AllocNone); diff --git a/src/hardwareintegration/client/xcomposite-glx/qwaylandxcompositeglxwindow.h b/src/hardwareintegration/client/xcomposite-glx/qwaylandxcompositeglxwindow.h index edd08f8a..18510828 100644 --- a/src/hardwareintegration/client/xcomposite-glx/qwaylandxcompositeglxwindow.h +++ b/src/hardwareintegration/client/xcomposite-glx/qwaylandxcompositeglxwindow.h @@ -70,7 +70,6 @@ private: QWaylandXCompositeGLXIntegration *m_glxIntegration = nullptr; Window m_xWindow = 0; - GLXFBConfig m_config; QWaylandBuffer *mBuffer = nullptr; }; -- cgit v1.2.1 From 9e39ccd5772e5a386b60be90094acb1a7640ef24 Mon Sep 17 00:00:00 2001 From: Weng Xuetian Date: Wed, 22 Dec 2021 10:42:38 -0800 Subject: Update the preedit styling mapping - None mapping to no style. - Default/Underline mapping to underline. - Highlight/Selection mapping to background color/text color with highlight/highlight text with underline. - Active/Inactive mapping to bold text with underline. - Incorrect mapping to red wave underline. Change-Id: Iab51d671b8f83aece8596f7f7610de19343fcceb Reviewed-by: Aleix Pol Gonzalez (cherry picked from commit f1fb5d9e568a24e213ee41e82a1142cef56f1098) Reviewed-by: Qt Cherry-pick Bot --- src/shared/qwaylandinputmethodeventbuilder.cpp | 31 +++++++++++++++++--------- 1 file changed, 20 insertions(+), 11 deletions(-) diff --git a/src/shared/qwaylandinputmethodeventbuilder.cpp b/src/shared/qwaylandinputmethodeventbuilder.cpp index 45769560..54e5c8a1 100644 --- a/src/shared/qwaylandinputmethodeventbuilder.cpp +++ b/src/shared/qwaylandinputmethodeventbuilder.cpp @@ -39,7 +39,10 @@ #include "qwaylandinputmethodeventbuilder_p.h" +#include +#include #include +#include #include #ifdef QT_BUILD_WAYLANDCOMPOSITOR_LIB @@ -81,32 +84,38 @@ void QWaylandInputMethodEventBuilder::addPreeditStyling(uint32_t index, uint32_t QTextCharFormat format; switch (style) { - case 0: - case 1: + case ZWP_TEXT_INPUT_V2_PREEDIT_STYLE_NONE: + break; + case ZWP_TEXT_INPUT_V2_PREEDIT_STYLE_DEFAULT: + case ZWP_TEXT_INPUT_V2_PREEDIT_STYLE_UNDERLINE: format.setFontUnderline(true); format.setUnderlineStyle(QTextCharFormat::SingleUnderline); m_preeditStyles.append(QInputMethodEvent::Attribute(QInputMethodEvent::TextFormat, index, length, format)); break; - case 2: - case 3: + case ZWP_TEXT_INPUT_V2_PREEDIT_STYLE_ACTIVE: + case ZWP_TEXT_INPUT_V2_PREEDIT_STYLE_INACTIVE: format.setFontWeight(QFont::Bold); format.setFontUnderline(true); format.setUnderlineStyle(QTextCharFormat::SingleUnderline); m_preeditStyles.append(QInputMethodEvent::Attribute(QInputMethodEvent::TextFormat, index, length, format)); break; - case 4: - format.setFontUnderline(true); - format.setUnderlineStyle(QTextCharFormat::SingleUnderline); - m_preeditStyles.append(QInputMethodEvent::Attribute(QInputMethodEvent::TextFormat, index, length, format)); + case ZWP_TEXT_INPUT_V2_PREEDIT_STYLE_HIGHLIGHT: + case ZWP_TEXT_INPUT_V2_PREEDIT_STYLE_SELECTION: + { + format.setFontUnderline(true); + format.setUnderlineStyle(QTextCharFormat::SingleUnderline); + QPalette palette = qApp->palette(); + format.setBackground(QBrush(palette.color(QPalette::Active, QPalette::Highlight))); + format.setForeground(QBrush(palette.color(QPalette::Active, QPalette::HighlightedText))); + m_preeditStyles.append(QInputMethodEvent::Attribute(QInputMethodEvent::TextFormat, index, length, format)); + } break; - case 5: + case ZWP_TEXT_INPUT_V2_PREEDIT_STYLE_INCORRECT: format.setFontUnderline(true); format.setUnderlineStyle(QTextCharFormat::WaveUnderline); format.setUnderlineColor(QColor(Qt::red)); m_preeditStyles.append(QInputMethodEvent::Attribute(QInputMethodEvent::TextFormat, index, length, format)); break; -// case QtWayland::wl_text_input::preedit_style_selection: -// case QtWayland::wl_text_input::preedit_style_none: default: break; } -- cgit v1.2.1 From 9e972ccac4b0c27c54c154117e72d3a7c74fc7db Mon Sep 17 00:00:00 2001 From: Weng Xuetian Date: Tue, 8 Feb 2022 07:11:25 -0800 Subject: Cursor position == 0 should still show the cursor Otherwise the cursor would be hidden even if preedit is empty. Amends 719a55be13bdadfa659a732755f280e276a894bd Change-Id: I320733b917779b7b51aa4a28eaea411fdb10a318 Reviewed-by: Liang Qi (cherry picked from commit 31ae194e295651d9ece03408630d2358acd4f7b4) Reviewed-by: Qt Cherry-pick Bot --- src/shared/qwaylandinputmethodeventbuilder.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/shared/qwaylandinputmethodeventbuilder.cpp b/src/shared/qwaylandinputmethodeventbuilder.cpp index 54e5c8a1..2bf276e4 100644 --- a/src/shared/qwaylandinputmethodeventbuilder.cpp +++ b/src/shared/qwaylandinputmethodeventbuilder.cpp @@ -160,9 +160,9 @@ QInputMethodEvent QWaylandInputMethodEventBuilder::buildPreedit(const QString &t { QList attributes; - if (m_preeditCursor <= 0) { + if (m_preeditCursor < 0) { attributes.append(QInputMethodEvent::Attribute(QInputMethodEvent::Cursor, 0, 0, QVariant())); - } else if (m_preeditCursor > 0) { + } else { attributes.append(QInputMethodEvent::Attribute(QInputMethodEvent::Cursor, indexFromWayland(text, m_preeditCursor), 1, QVariant())); } -- cgit v1.2.1 From f86cb448645a409b9bb62683e8a76d066d920df4 Mon Sep 17 00:00:00 2001 From: Liang Qi Date: Tue, 4 Jan 2022 12:30:36 +0100 Subject: client: set_constraint_adjustment() for popups in xdg See also https://cgit.freedesktop.org/wayland/wayland-protocols/tree/stable/xdg-shell/xdg-shell.xml#n234 . Kudos to Greg V for his original patch in jira. Fixes: QTBUG-87303 Done-with: Greg V Change-Id: I57df9aedea7cc6f0b6fa142a6fc6c3bdc98324c8 Reviewed-by: David Edmundson (cherry picked from commit 59a5fe99e1569421b920d99c5b20cdafcdcf43a9) Reviewed-by: Qt Cherry-pick Bot --- src/plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp b/src/plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp index 9d419a90..ac5d50a1 100644 --- a/src/plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp +++ b/src/plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp @@ -414,6 +414,10 @@ void QWaylandXdgSurface::setPopup(QWaylandWindow *parent) positioner->set_anchor(QtWayland::xdg_positioner::anchor_top_left); positioner->set_gravity(QtWayland::xdg_positioner::gravity_bottom_right); positioner->set_size(m_window->geometry().width(), m_window->geometry().height()); + positioner->set_constraint_adjustment(QtWayland::xdg_positioner::constraint_adjustment_slide_x + | QtWayland::xdg_positioner::constraint_adjustment_slide_y + | QtWayland::xdg_positioner::constraint_adjustment_flip_x + | QtWayland::xdg_positioner::constraint_adjustment_flip_y); m_popup = new Popup(this, parentXdgSurface, positioner); positioner->destroy(); delete positioner; -- cgit v1.2.1 From 5288fc2c68bc1097a0c4853364d1f297188e5d9d Mon Sep 17 00:00:00 2001 From: Liang Qi Date: Wed, 9 Mar 2022 10:47:42 +0100 Subject: client: update button state and etc in pointer_leave() The cleanup work needs to be done even the surface is null, for example, a window was closed in mouse press handler, then will not get a mouse release. Fixes: QTBUG-100942 Change-Id: I637a6744909ddbe62bdeba6b21494e5a6ae7fa9f Reviewed-by: Tang Haixiang Reviewed-by: David Edmundson (cherry picked from commit 409d1080f25b653b3ff3f57c9776c5c390912206) Reviewed-by: Qt Cherry-pick Bot --- src/client/qwaylandinputdevice.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/client/qwaylandinputdevice.cpp b/src/client/qwaylandinputdevice.cpp index 871e0d3f..75056868 100644 --- a/src/client/qwaylandinputdevice.cpp +++ b/src/client/qwaylandinputdevice.cpp @@ -689,6 +689,11 @@ public: void QWaylandInputDevice::Pointer::pointer_leave(uint32_t time, struct wl_surface *surface) { + invalidateFocus(); + mButtons = Qt::NoButton; + + mParent->mTime = time; + // The event may arrive after destroying the window, indicated by // a null surface. if (!surface) @@ -700,11 +705,6 @@ void QWaylandInputDevice::Pointer::pointer_leave(uint32_t time, struct wl_surfac if (!QWaylandWindow::mouseGrab()) setFrameEvent(new LeaveEvent(window, mSurfacePos, mGlobalPos)); - - invalidateFocus(); - mButtons = Qt::NoButton; - - mParent->mTime = time; } class MotionEvent : public QWaylandPointerEvent -- cgit v1.2.1