Script 'mail_helper' called by obssrc
Hello community,

here is the log from the commit of package qt6-wayland for openSUSE:Factory 
checked in at 2024-06-24 20:49:56
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/qt6-wayland (Old)
 and      /work/SRC/openSUSE:Factory/.qt6-wayland.new.18349 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "qt6-wayland"

Mon Jun 24 20:49:56 2024 rev:34 rq:1182618 version:6.7.2

Changes:
--------
--- /work/SRC/openSUSE:Factory/qt6-wayland/qt6-wayland.changes  2024-05-27 
11:46:58.066249122 +0200
+++ /work/SRC/openSUSE:Factory/.qt6-wayland.new.18349/qt6-wayland.changes       
2024-06-24 20:50:20.205820761 +0200
@@ -1,0 +2,6 @@
+Wed Jun 19 07:26:06 UTC 2024 - Christophe Marin <christo...@krop.fr>
+
+- Update to 6.7.2:
+  * https://www.qt.io/blog/qt-6.7.2-released
+
+-------------------------------------------------------------------

Old:
----
  qtwayland-everywhere-src-6.7.1.tar.xz

New:
----
  qtwayland-everywhere-src-6.7.2.tar.xz

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ qt6-wayland.spec ++++++
--- /var/tmp/diff_new_pack.ocSNEu/_old  2024-06-24 20:50:20.785842024 +0200
+++ /var/tmp/diff_new_pack.ocSNEu/_new  2024-06-24 20:50:20.789842171 +0200
@@ -16,7 +16,7 @@
 #
 
 
-%define real_version 6.7.1
+%define real_version 6.7.2
 %define short_version 6.7
 %define tar_name qtwayland-everywhere-src
 %define tar_suffix %{nil}
@@ -30,7 +30,7 @@
 %global with_opengl 1
 %endif
 Name:           qt6-wayland%{?pkg_suffix}
-Version:        6.7.1
+Version:        6.7.2
 Release:        0
 Summary:        Qt 6 Wayland libraries and tools
 # The wayland compositor files are GPL-3.0-or-later

++++++ qtwayland-everywhere-src-6.7.1.tar.xz -> 
qtwayland-everywhere-src-6.7.2.tar.xz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/qtwayland-everywhere-src-6.7.1/.cmake.conf 
new/qtwayland-everywhere-src-6.7.2/.cmake.conf
--- old/qtwayland-everywhere-src-6.7.1/.cmake.conf      2024-05-09 
01:15:10.000000000 +0200
+++ new/qtwayland-everywhere-src-6.7.2/.cmake.conf      2024-06-08 
01:54:39.000000000 +0200
@@ -1,4 +1,4 @@
-set(QT_REPO_MODULE_VERSION "6.7.1")
+set(QT_REPO_MODULE_VERSION "6.7.2")
 set(QT_REPO_MODULE_PRERELEASE_VERSION_SEGMENT "alpha1")
 set(QT_EXTRA_INTERNAL_TARGET_DEFINES "QT_NO_AS_CONST=1")
 list(APPEND QT_EXTRA_INTERNAL_TARGET_DEFINES "QT_NO_FOREACH=1")
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/qtwayland-everywhere-src-6.7.1/.tag 
new/qtwayland-everywhere-src-6.7.2/.tag
--- old/qtwayland-everywhere-src-6.7.1/.tag     2024-05-09 01:15:10.000000000 
+0200
+++ new/qtwayland-everywhere-src-6.7.2/.tag     2024-06-08 01:54:39.000000000 
+0200
@@ -1 +1 @@
-c898ccb3d1596cf8448995c9cd5e93ffe2027c5e
+3bd7a58abdf80df376697bace45cc1dc4860401e
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/qtwayland-everywhere-src-6.7.1/dependencies.yaml 
new/qtwayland-everywhere-src-6.7.2/dependencies.yaml
--- old/qtwayland-everywhere-src-6.7.1/dependencies.yaml        2024-05-09 
01:15:10.000000000 +0200
+++ new/qtwayland-everywhere-src-6.7.2/dependencies.yaml        2024-06-08 
01:54:39.000000000 +0200
@@ -1,7 +1,7 @@
 dependencies:
   ../qtbase:
-    ref: c195fe7d33decbd5ddd47ae46dbf8e0d9c20ba85
+    ref: b5fbe0923cfc566036b83c3d968f225b26117efc
     required: true
   ../qtdeclarative:
-    ref: 734849e4577b75e85420b08ddb55974482bbd063
+    ref: 12533cc0bd83a2076efb4af0bc1832b0db9568fc
     required: false
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/qtwayland-everywhere-src-6.7.1/licenseRule.json 
new/qtwayland-everywhere-src-6.7.2/licenseRule.json
--- old/qtwayland-everywhere-src-6.7.1/licenseRule.json 1970-01-01 
01:00:00.000000000 +0100
+++ new/qtwayland-everywhere-src-6.7.2/licenseRule.json 2024-06-08 
01:54:39.000000000 +0200
@@ -0,0 +1,124 @@
+[
+    {
+        "comment" : ["file_pattern_ending: strings matched against the end of 
a file name.",
+                     "location keys: regular expression matched against the 
beginning of",
+                     "the file path (relative to the git submodule root).",
+                     "spdx: list of SPDX-License-Expression's allowed in the 
matching files.",
+                     "-------------------------------------------------------",
+                     "Files with the following endings are Build System 
licensed,",
+                     "unless they are examples",
+                     "Files with other endings can also be build system files"
+                     ],
+        "file_pattern_ending" : ["CMakeLists.txt", ".cmake", ".pro", ".pri", 
".prf",
+                     "configure", "configure.bat", "cmake.in", "plist.in", 
"CMakeLists.txt.in"],
+        "location" : {
+            "" : {
+                "comment" : "Default",
+                "file type" : "build system",
+                "spdx"      : ["BSD-3-Clause"]
+            },
+            "(.*)(examples/|snippets/)" : {
+                "comment" : "Example takes precedence",
+                "file type" : "examples and snippets",
+                "spdx" : ["LicenseRef-Qt-Commercial OR BSD-3-Clause"]
+            }
+        }
+    },
+    {
+        "comments" : ["Files with the following endings are Tool licensed,",
+                      "unless they are examples.",
+                      "Files with other endings can also be tool files."],
+        "file_pattern_ending" : [".sh", ".py", ".pl", ".bat", ".ps1"],
+        "location" :{
+            "" : {
+                "comment" : "Default",
+                "file type" : "tools and utils",
+                "spdx"      : ["LicenseRef-Qt-Commercial OR GPL-3.0-only WITH 
Qt-GPL-exception-1.0"]
+            },
+            "(.*)(examples/|snippets/)" : {
+                "comment" : "Example takes precedence",
+                "file type" : "examples and snippets",
+                "spdx" : ["LicenseRef-Qt-Commercial OR BSD-3-Clause"]
+            }
+        }
+    },
+    {
+        "comment" : "Files with the following endings are Documentation 
licensed.",
+        "file_pattern_ending" : [".qdoc", ".qdocinc" , ".qdocconf", ".txt", 
"README", "qt_attribution.json"],
+        "location" :{
+            "" : {
+                "comment" : "",
+                "file type" : "documentation",
+                "spdx"      : ["LicenseRef-Qt-Commercial OR 
GFDL-1.3-no-invariants-only"]
+            }
+        }
+    },
+    {
+        "comment" : ["All other files",
+                     "The licensing is defined only by the file location in 
the Qt module repository.",
+                     "NO <file_pattern_ending> key for this case!",
+                     "This needs to be the last entry of the file."],
+        "location" : {
+            "" : {
+                "comment" : "Default",
+                "file type" : "module and plugin",
+                "spdx"      : ["LicenseRef-Qt-Commercial OR GPL-3.0-only"]
+            },
+            "src/" : {
+                "comment" : "Default",
+                "file type" : "module and plugin",
+                "spdx"      : ["LicenseRef-Qt-Commercial OR GPL-3.0-only"]
+            },
+            "src/plugins/" : {
+                "comment" : "Default",
+                "file type" : "module and plugin",
+                "spdx"      : ["LicenseRef-Qt-Commercial OR LGPL-3.0-only OR 
GPL-2.0-only OR GPL-3.0-only"]
+            },
+            "src/plugins/hardwareintegration/compositor/" : {
+                "comment" : "Default",
+                "file type" : "module and plugin",
+                "spdx"      : ["LicenseRef-Qt-Commercial OR GPL-3.0-only"]
+            },
+            "src/shared/" : {
+                "comment" : "Default",
+                "file type" : "module and plugin",
+                "spdx"      : ["LicenseRef-Qt-Commercial OR LGPL-3.0-only OR 
GPL-2.0-only OR GPL-3.0-only"]
+            },
+            "src/imports/texture-sharing" : {
+                "comment" : "Default",
+                "file type" : "module and plugin",
+                "spdx"      : ["LicenseRef-Qt-Commercial OR LGPL-3.0-only OR 
GPL-2.0-only OR GPL-3.0-only"]
+            },
+            "src/qtwaylandscanner/qtwaylandscanner\\.cpp" : {
+                "comment" : "Default",
+                "file type" : "tools and utils",
+                "spdx"      : ["LicenseRef-Qt-Commercial OR GPL-3.0-only WITH 
Qt-GPL-exception-1.0"]
+            },
+            "src/client/" : {
+                "comment" : "Default",
+                "file type" : "module and plugin",
+                "spdx"      : ["LicenseRef-Qt-Commercial OR LGPL-3.0-only OR 
GPL-2.0-only OR GPL-3.0-only"]
+            },
+            "src/hardwareintegration/client/" : {
+                "comment" : "Default",
+                "file type" : "module and plugin",
+                "spdx"      : ["LicenseRef-Qt-Commercial OR LGPL-3.0-only OR 
GPL-2.0-only OR GPL-3.0-only"]
+            },
+            "tests/" : {
+                "comment" : "Default",
+                "file type" : "test",
+                "spdx" : ["LicenseRef-Qt-Commercial OR GPL-3.0-only"]
+            },
+            "(.*)(examples/|snippets/)" : {
+                "comment" : "Default",
+                "file type" : "examples and snippets",
+                "spdx" : ["LicenseRef-Qt-Commercial OR BSD-3-Clause"]
+            },
+            "config\\.tests/" : {
+                "comment" : "Default",
+                "file type" : "build system",
+                "spdx" : ["BSD-3-Clause"]
+            }
+        }
+    }
+]
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/qtwayland-everywhere-src-6.7.1/src/client/qwaylandinputdevice.cpp 
new/qtwayland-everywhere-src-6.7.2/src/client/qwaylandinputdevice.cpp
--- old/qtwayland-everywhere-src-6.7.1/src/client/qwaylandinputdevice.cpp       
2024-05-09 01:15:10.000000000 +0200
+++ new/qtwayland-everywhere-src-6.7.2/src/client/qwaylandinputdevice.cpp       
2024-06-08 01:54:39.000000000 +0200
@@ -887,8 +887,10 @@
     WheelEvent(QWaylandWindow *surface, Qt::ScrollPhase phase, ulong 
timestamp, const QPointF &local,
                const QPointF &global, const QPoint &pixelDelta, const QPoint 
&angleDelta,
                Qt::MouseEventSource source, Qt::KeyboardModifiers modifiers, 
bool inverted)
-        : QWaylandPointerEvent(QEvent::Wheel, phase, surface, timestamp,
-                               local, global, pixelDelta, angleDelta, source, 
modifiers, inverted)
+        : QWaylandPointerEvent(QEvent::Wheel, phase, surface, timestamp, 
local, global,
+                               modifiers & Qt::AltModifier ? 
pixelDelta.transposed() : pixelDelta,
+                               modifiers & Qt::AltModifier ? 
angleDelta.transposed() : angleDelta,
+                               source, modifiers, inverted)
     {
     }
 };
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/qtwayland-everywhere-src-6.7.1/src/client/qwaylandsurface.cpp 
new/qtwayland-everywhere-src-6.7.2/src/client/qwaylandsurface.cpp
--- old/qtwayland-everywhere-src-6.7.1/src/client/qwaylandsurface.cpp   
2024-05-09 01:15:10.000000000 +0200
+++ new/qtwayland-everywhere-src-6.7.2/src/client/qwaylandsurface.cpp   
2024-06-08 01:54:39.000000000 +0200
@@ -15,6 +15,7 @@
     : wl_surface(display->createSurface(this))
 {
     connect(qApp, &QGuiApplication::screenRemoved, this, 
&QWaylandSurface::handleScreenRemoved);
+    connect(qApp, &QGuiApplication::screenAdded, this, 
&QWaylandSurface::screensChanged);
 }
 
 QWaylandSurface::~QWaylandSurface()
@@ -24,7 +25,14 @@
 
 QWaylandScreen *QWaylandSurface::oldestEnteredScreen()
 {
-    return m_screens.value(0, nullptr);
+    for (auto *screen : std::as_const(m_screens)) {
+        // only report valid screens
+        // we can have some ouptuts waiting for xdg output information
+        // that are valid QPlatformScreens, but not valid QScreens
+        if (screen->screen())
+            return screen;
+    }
+    return nullptr;
 }
 
 QWaylandSurface *QWaylandSurface::fromWlSurface(::wl_surface *surface)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/qtwayland-everywhere-src-6.7.1/src/client/qwaylandtextinputv3.cpp 
new/qtwayland-everywhere-src-6.7.2/src/client/qwaylandtextinputv3.cpp
--- old/qtwayland-everywhere-src-6.7.1/src/client/qwaylandtextinputv3.cpp       
2024-05-09 01:15:10.000000000 +0200
+++ new/qtwayland-everywhere-src-6.7.2/src/client/qwaylandtextinputv3.cpp       
2024-06-08 01:54:39.000000000 +0200
@@ -80,8 +80,8 @@
         return;
 
     m_pendingPreeditString.text = text;
-    m_pendingPreeditString.cursorBegin = cursorBegin;
-    m_pendingPreeditString.cursorEnd = cursorEnd;
+    m_pendingPreeditString.cursorBegin = 
QWaylandInputMethodEventBuilder::indexFromWayland(text, cursorBegin);
+    m_pendingPreeditString.cursorEnd = 
QWaylandInputMethodEventBuilder::indexFromWayland(text, cursorEnd);
 }
 
 void QWaylandTextInputv3::zwp_text_input_v3_commit_string(const QString &text)
@@ -101,8 +101,8 @@
     if (!QGuiApplication::focusObject())
         return;
 
-    m_pendingDeleteBeforeText = 
QWaylandInputMethodEventBuilder::indexFromWayland(m_surroundingText, 
beforeText);
-    m_pendingDeleteAfterText = 
QWaylandInputMethodEventBuilder::indexFromWayland(m_surroundingText, afterText);
+    m_pendingDeleteBeforeText = beforeText;
+    m_pendingDeleteAfterText = afterText;
 }
 
 void QWaylandTextInputv3::zwp_text_input_v3_done(uint32_t serial)
@@ -157,14 +157,26 @@
     qCDebug(qLcQpaWaylandTextInput) << Q_FUNC_INFO << "DELETE" << 
m_pendingDeleteBeforeText << m_pendingDeleteAfterText;
     qCDebug(qLcQpaWaylandTextInput) << Q_FUNC_INFO << "COMMIT" << 
m_pendingCommitString;
 
-    // A workaround for reselection
-    // It will disable redundant commit after reselection
-    if (m_pendingDeleteBeforeText != 0 || m_pendingDeleteAfterText != 0)
+    int replaceFrom = 0;
+    int replaceLength = 0;
+    if (m_pendingDeleteBeforeText != 0 || m_pendingDeleteAfterText != 0) {
+        // A workaround for reselection
+        // It will disable redundant commit after reselection
         m_condReselection = true;
+        const QByteArray &utf8 = QStringView{m_surroundingText}.toUtf8();
+        if (m_cursorPos < int(m_pendingDeleteBeforeText)) {
+            replaceFrom = 
-QString::fromUtf8(QByteArrayView{utf8}.first(m_pendingDeleteBeforeText)).size();
+            replaceLength = 
QString::fromUtf8(QByteArrayView{utf8}.first(m_pendingDeleteBeforeText + 
m_pendingDeleteAfterText)).size();
+        } else {
+            replaceFrom = 
-QString::fromUtf8(QByteArrayView{utf8}.sliced(m_cursorPos - 
m_pendingDeleteBeforeText, m_pendingDeleteBeforeText)).size();
+            replaceLength = 
QString::fromUtf8(QByteArrayView{utf8}.sliced(m_cursorPos - 
m_pendingDeleteBeforeText, m_pendingDeleteBeforeText + 
m_pendingDeleteAfterText)).size();
+        }
+    }
 
+    qCDebug(qLcQpaWaylandTextInput) << Q_FUNC_INFO << "DELETE from " << 
replaceFrom << " length " << replaceLength;
     event.setCommitString(m_pendingCommitString,
-                          -m_pendingDeleteBeforeText,
-                          m_pendingDeleteBeforeText + 
m_pendingDeleteAfterText);
+                          replaceFrom,
+                          replaceLength);
     m_currentPreeditString = m_pendingPreeditString;
     m_pendingPreeditString.clear();
     m_pendingCommitString.clear();
@@ -235,54 +247,63 @@
         int cursor = event.value(Qt::ImCursorPosition).toInt();
         int anchor = event.value(Qt::ImAnchorPosition).toInt();
 
-        qCDebug(qLcQpaWaylandTextInput) << "Orginal surrounding_text from 
InputMethodQuery: " << text << cursor << anchor;
+        qCDebug(qLcQpaWaylandTextInput) << "Original surrounding_text from 
InputMethodQuery: " << text << cursor << anchor;
 
         // Make sure text is not too big
         // surround_text cannot exceed 4000byte in wayland protocol
         // The worst case will be supposed here.
         const int MAX_MESSAGE_SIZE = 4000;
 
-        if (text.toUtf8().size() > MAX_MESSAGE_SIZE) {
-            const int selectionStart = 
QWaylandInputMethodEventBuilder::indexToWayland(text, qMin(cursor, anchor));
-            const int selectionEnd = 
QWaylandInputMethodEventBuilder::indexToWayland(text, qMax(cursor, anchor));
+        const int textSize = text.toUtf8().size();
+        if (textSize > MAX_MESSAGE_SIZE) {
+            qCDebug(qLcQpaWaylandTextInput) << "SurroundText size is over "
+                                            << MAX_MESSAGE_SIZE
+                                            << " byte, some text will be 
clipped.";
+            const int selectionStart = qMin(cursor, anchor);
+            const int selectionEnd = qMax(cursor, anchor);
             const int selectionLength = selectionEnd - selectionStart;
+            const int selectionSize = QStringView{text}.sliced(selectionStart, 
selectionLength).toUtf8().size();
             // If selection is bigger than 4000 byte, it is fixed to 4000 byte.
             // anchor will be moved in the 4000 byte boundary.
-            if (selectionLength > MAX_MESSAGE_SIZE) {
+            if (selectionSize > MAX_MESSAGE_SIZE) {
                 if (anchor > cursor) {
-                    const int length = MAX_MESSAGE_SIZE;
-                    anchor = 
QWaylandInputMethodEventBuilder::trimmedIndexFromWayland(text, length, cursor);
-                    anchor -= cursor;
-                    text = text.mid(cursor, anchor);
                     cursor = 0;
+                    anchor = MAX_MESSAGE_SIZE;
+                    text = text.sliced(selectionStart, selectionLength);
                 } else {
-                    const int length = -MAX_MESSAGE_SIZE;
-                    anchor = 
QWaylandInputMethodEventBuilder::trimmedIndexFromWayland(text, length, cursor);
-                    cursor -= anchor;
-                    text = text.mid(anchor, cursor);
                     anchor = 0;
+                    cursor = MAX_MESSAGE_SIZE;
+                    text = text.sliced(selectionEnd - selectionLength, 
selectionLength);
                 }
             } else {
-                const int offset = (MAX_MESSAGE_SIZE - selectionLength) / 2;
-
-                int textStart = 
QWaylandInputMethodEventBuilder::trimmedIndexFromWayland(text, -offset, 
qMin(cursor, anchor));
-                int textEnd = 
QWaylandInputMethodEventBuilder::trimmedIndexFromWayland(text, 
MAX_MESSAGE_SIZE, textStart);
-
-                anchor -= textStart;
-                cursor -= textStart;
-                text = text.mid(textStart, textEnd - textStart);
+                // This is not optimal in some cases.
+                // For examples, if the cursor position and
+                // the selectionEnd are close to the end of the surround text,
+                // the tail of the text might always be clipped.
+                // However all the cases of over 4000 byte are just exceptions.
+                int selEndSize = 
QStringView{text}.first(selectionEnd).toUtf8().size();
+                cursor = QWaylandInputMethodEventBuilder::indexToWayland(text, 
cursor);
+                anchor = QWaylandInputMethodEventBuilder::indexToWayland(text, 
anchor);
+                if (selEndSize < MAX_MESSAGE_SIZE) {
+                    text = 
QString::fromUtf8(QByteArrayView{text.toUtf8()}.first(MAX_MESSAGE_SIZE));
+                } else {
+                    const int startOffset = selEndSize - MAX_MESSAGE_SIZE;
+                    text = 
QString::fromUtf8(QByteArrayView{text.toUtf8()}.sliced(startOffset, 
MAX_MESSAGE_SIZE));
+                    cursor -= startOffset;
+                    anchor -= startOffset;
+                }
             }
+        } else {
+            cursor = QWaylandInputMethodEventBuilder::indexToWayland(text, 
cursor);
+            anchor = QWaylandInputMethodEventBuilder::indexToWayland(text, 
anchor);
         }
         qCDebug(qLcQpaWaylandTextInput) << "Modified surrounding_text: " << 
text << cursor << anchor;
 
-        const int cursorPos = 
QWaylandInputMethodEventBuilder::indexToWayland(text, cursor);
-        const int anchorPos = 
QWaylandInputMethodEventBuilder::indexToWayland(text, anchor);
-
-        if (m_surroundingText != text || m_cursorPos != cursorPos || 
m_anchorPos != anchorPos) {
+        if (m_surroundingText != text || m_cursorPos != cursor || m_anchorPos 
!= anchor) {
             qCDebug(qLcQpaWaylandTextInput) << "Current surrounding_text: " << 
m_surroundingText << m_cursorPos << m_anchorPos;
-            qCDebug(qLcQpaWaylandTextInput) << "New surrounding_text: " << 
text << cursorPos << anchorPos;
+            qCDebug(qLcQpaWaylandTextInput) << "New surrounding_text: " << 
text << cursor << anchor;
 
-            set_surrounding_text(text, cursorPos, anchorPos);
+            set_surrounding_text(text, cursor, anchor);
 
             // A workaround in the case of reselection
             // It will work when re-clicking a preedit text
@@ -294,8 +315,8 @@
             }
 
             m_surroundingText = text;
-            m_cursorPos = cursorPos;
-            m_anchorPos = anchorPos;
+            m_cursorPos = cursor;
+            m_anchorPos = anchor;
             m_cursor = cursor;
         }
     }
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/qtwayland-everywhere-src-6.7.1/src/client/qwaylandtextinputv3_p.h 
new/qtwayland-everywhere-src-6.7.2/src/client/qwaylandtextinputv3_p.h
--- old/qtwayland-everywhere-src-6.7.1/src/client/qwaylandtextinputv3_p.h       
2024-05-09 01:15:10.000000000 +0200
+++ new/qtwayland-everywhere-src-6.7.2/src/client/qwaylandtextinputv3_p.h       
2024-06-08 01:54:39.000000000 +0200
@@ -17,7 +17,6 @@
 
 #include "qwaylandtextinputinterface_p.h"
 #include <QtWaylandClient/private/qwayland-text-input-unstable-v3.h>
-#include <qwaylandinputmethodeventbuilder_p.h>
 #include <QLoggingCategory>
 
 struct wl_callback;
@@ -63,8 +62,6 @@
     void zwp_text_input_v3_done(uint32_t serial) override;
 
 private:
-    QWaylandInputMethodEventBuilder m_builder;
-
     ::wl_surface *m_surface = nullptr; // ### Here for debugging purposes
 
     struct PreeditInfo {
@@ -82,8 +79,8 @@
     PreeditInfo m_pendingPreeditString;
     PreeditInfo m_currentPreeditString;
     QString m_pendingCommitString;
-    uint m_pendingDeleteBeforeText = 0;
-    uint m_pendingDeleteAfterText = 0;
+    uint m_pendingDeleteBeforeText = 0; // byte length
+    uint m_pendingDeleteAfterText = 0;  // byte length
 
     QString m_surroundingText;
     int m_cursor; // cursor position in QString
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/qtwayland-everywhere-src-6.7.1/src/client/qwaylandwindow.cpp 
new/qtwayland-everywhere-src-6.7.2/src/client/qwaylandwindow.cpp
--- old/qtwayland-everywhere-src-6.7.1/src/client/qwaylandwindow.cpp    
2024-05-09 01:15:10.000000000 +0200
+++ new/qtwayland-everywhere-src-6.7.2/src/client/qwaylandwindow.cpp    
2024-06-08 01:54:39.000000000 +0200
@@ -57,8 +57,6 @@
             mFrameCallbackTimeout = frameCallbackTimeout;
     }
 
-    mScale = waylandScreen() ? waylandScreen()->scale() : 1; // fallback to 1 
if we don't have a real screen
-
     static WId id = 1;
     mWindowId = id++;
     initializeWlSurface();
@@ -317,6 +315,7 @@
     mWaitingToApplyConfigure = false;
     mCanResize = true;
     mResizeDirty = false;
+    mScale = std::nullopt;
 
     mOpaqueArea = QRegion();
     mMask = QRegion();
@@ -548,7 +547,6 @@
         if (auto *screen = mSurface->oldestEnteredScreen())
             return screen;
     }
-
     return QPlatformWindow::screen();
 }
 
@@ -878,6 +876,7 @@
 void QWaylandWindow::setCustomMargins(const QMargins &margins) {
     const QMargins oldMargins = mCustomMargins;
     mCustomMargins = margins;
+    propagateSizeHints();
     setGeometry(geometry().marginsRemoved(oldMargins).marginsAdded(margins));
 }
 
@@ -1153,8 +1152,13 @@
     if (auto transientParent = 
closestShellSurfaceWindow(window()->transientParent()))
         return transientParent;
 
-    if (QGuiApplication::focusWindow() && (window()->type() == Qt::ToolTip || 
window()->type() == Qt::Popup))
-        return closestShellSurfaceWindow(QGuiApplication::focusWindow());
+    if (window()->type() == Qt::Popup) {
+        if (mTopPopup)
+            return mTopPopup;
+    }
+
+    if (window()->type() == Qt::ToolTip || window()->type() == Qt::Popup)
+        return display()->lastInputWindow();
 
     return nullptr;
 }
@@ -1401,14 +1405,11 @@
 {
     QPlatformScreen *newScreen = calculateScreenFromSurfaceEvents();
 
-    if (newScreen == mLastReportedScreen)
+    if (newScreen->screen() == window()->screen())
         return;
 
-    if (!newScreen->isPlaceholder() && !newScreen->QPlatformScreen::screen())
-        mDisplay->forceRoundTrip();
     QWindowSystemInterface::handleWindowScreenChanged(window(), 
newScreen->QPlatformScreen::screen());
 
-    mLastReportedScreen = newScreen;
     if (fixedToplevelPositions && !QPlatformWindow::parent() && 
window()->type() != Qt::Popup
         && window()->type() != Qt::ToolTip
         && geometry().topLeft() != newScreen->geometry().topLeft()) {
@@ -1438,13 +1439,13 @@
         return;
     }
 
-    int scale = mLastReportedScreen->isPlaceholder() ? 1 : 
static_cast<QWaylandScreen *>(mLastReportedScreen)->scale();
+    int scale = screen()->isPlaceholder() ? 1 : static_cast<QWaylandScreen 
*>(screen())->scale();
     setScale(scale);
 }
 
 void QWaylandWindow::setScale(qreal newScale)
 {
-    if (qFuzzyCompare(mScale, newScale))
+    if (mScale.has_value() && qFuzzyCompare(mScale.value(), newScale))
         return;
     mScale = newScale;
 
@@ -1453,7 +1454,7 @@
         if (mViewport)
             updateViewport();
         else if (mSurface->version() >= 3)
-            mSurface->set_buffer_scale(std::ceil(mScale));
+            mSurface->set_buffer_scale(std::ceil(newScale));
     }
     ensureSize();
 
@@ -1515,7 +1516,7 @@
 
 qreal QWaylandWindow::devicePixelRatio() const
 {
-    return qreal(mScale);
+    return mScale.value_or(waylandScreen() ? waylandScreen()->scale() : 1);
 }
 
 bool QWaylandWindow::setMouseGrabEnabled(bool grab)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/qtwayland-everywhere-src-6.7.1/src/client/qwaylandwindow_p.h 
new/qtwayland-everywhere-src-6.7.2/src/client/qwaylandwindow_p.h
--- old/qtwayland-everywhere-src-6.7.1/src/client/qwaylandwindow_p.h    
2024-05-09 01:15:10.000000000 +0200
+++ new/qtwayland-everywhere-src-6.7.2/src/client/qwaylandwindow_p.h    
2024-06-08 01:54:39.000000000 +0200
@@ -310,8 +310,7 @@
 
     bool mSentInitialResize = false;
     QPoint mOffset;
-    qreal mScale = 1;
-    QPlatformScreen *mLastReportedScreen = nullptr;
+    std::optional<qreal> mScale = std::nullopt;
 
     QString mWindowTitle;
     QIcon mWindowIcon;
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/qtwayland-everywhere-src-6.7.1/src/compositor/extensions/qwaylandtextinputmanagerv3.cpp
 
new/qtwayland-everywhere-src-6.7.2/src/compositor/extensions/qwaylandtextinputmanagerv3.cpp
--- 
old/qtwayland-everywhere-src-6.7.1/src/compositor/extensions/qwaylandtextinputmanagerv3.cpp
 2024-05-09 01:15:10.000000000 +0200
+++ 
new/qtwayland-everywhere-src-6.7.2/src/compositor/extensions/qwaylandtextinputmanagerv3.cpp
 2024-06-08 01:54:39.000000000 +0200
@@ -1,5 +1,5 @@
 // Copyright (C) 2021 The Qt Company Ltd.
-// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR 
GPL-2.0-only OR GPL-3.0-only
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
 
 #include "qwaylandtextinputmanagerv3.h"
 #include "qwaylandtextinputmanagerv3_p.h"
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/qtwayland-everywhere-src-6.7.1/src/compositor/extensions/qwaylandtextinputmanagerv3.h
 
new/qtwayland-everywhere-src-6.7.2/src/compositor/extensions/qwaylandtextinputmanagerv3.h
--- 
old/qtwayland-everywhere-src-6.7.1/src/compositor/extensions/qwaylandtextinputmanagerv3.h
   2024-05-09 01:15:10.000000000 +0200
+++ 
new/qtwayland-everywhere-src-6.7.2/src/compositor/extensions/qwaylandtextinputmanagerv3.h
   2024-06-08 01:54:39.000000000 +0200
@@ -1,5 +1,5 @@
 // Copyright (C) 2021 The Qt Company Ltd.
-// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR 
GPL-2.0-only OR GPL-3.0-only
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
 
 #ifndef QWAYLANDTEXTINPUTMANAGERV3_H
 #define QWAYLANDTEXTINPUTMANAGERV3_H
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/qtwayland-everywhere-src-6.7.1/src/compositor/extensions/qwaylandtextinputmanagerv3_p.h
 
new/qtwayland-everywhere-src-6.7.2/src/compositor/extensions/qwaylandtextinputmanagerv3_p.h
--- 
old/qtwayland-everywhere-src-6.7.1/src/compositor/extensions/qwaylandtextinputmanagerv3_p.h
 2024-05-09 01:15:10.000000000 +0200
+++ 
new/qtwayland-everywhere-src-6.7.2/src/compositor/extensions/qwaylandtextinputmanagerv3_p.h
 2024-06-08 01:54:39.000000000 +0200
@@ -1,5 +1,5 @@
 // Copyright (C) 2021 The Qt Company Ltd.
-// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR 
GPL-2.0-only OR GPL-3.0-only
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
 
 #ifndef QWAYLANDTEXTINPUTMANAGERV3_P_H
 #define QWAYLANDTEXTINPUTMANAGERV3_P_H
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/qtwayland-everywhere-src-6.7.1/src/compositor/extensions/qwaylandtextinputv3.cpp
 
new/qtwayland-everywhere-src-6.7.2/src/compositor/extensions/qwaylandtextinputv3.cpp
--- 
old/qtwayland-everywhere-src-6.7.1/src/compositor/extensions/qwaylandtextinputv3.cpp
        2024-05-09 01:15:10.000000000 +0200
+++ 
new/qtwayland-everywhere-src-6.7.2/src/compositor/extensions/qwaylandtextinputv3.cpp
        2024-06-08 01:54:39.000000000 +0200
@@ -1,5 +1,5 @@
 // Copyright (C) 2021 The Qt Company Ltd.
-// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR 
GPL-2.0-only OR GPL-3.0-only
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
 
 #include "qwaylandtextinputv3.h"
 #include "qwaylandtextinputv3_p.h"
@@ -99,20 +99,40 @@
 
     // Current cursor shape is only line. It means both cursorBegin
     // and cursorEnd will be the same values.
-    int32_t preeditCursorPos = newPreeditString.length();
+    int32_t preeditCursorPos = newPreeditString.toUtf8().size();
 
-    if (event->replacementLength() > 0 || event->replacementStart() < 0) {
-        if (event->replacementStart() <= 0 && (event->replacementLength() >= 
-event->replacementStart())) {
-            const int selectionStart = qMin(currentState->cursorPosition, 
currentState->anchorPosition);
-            const int selectionEnd = qMax(currentState->cursorPosition, 
currentState->anchorPosition);
-            const int before = 
QWaylandInputMethodEventBuilder::indexToWayland(currentState->surroundingText, 
-event->replacementStart(), selectionStart + event->replacementStart());
-            const int after = 
QWaylandInputMethodEventBuilder::indexToWayland(currentState->surroundingText, 
event->replacementLength() + event->replacementStart(), selectionEnd);
-            send_delete_surrounding_text(focusResource->handle, before, after);
-            needsDone = true;
-        } else {
-            qCWarning(qLcWaylandCompositorTextInput) << "Not yet supported 
case of replacement. Start:" << event->replacementStart() << "length:" << 
event->replacementLength();
+    if (event->replacementLength() > 0) {
+        int replacementStart = event->replacementStart();
+        int replacementLength = event->replacementLength();
+        const int cursorPos = currentState->cursorPosition;
+        if (currentState->cursorPosition < -event->replacementStart()) {
+            qCWarning(qLcWaylandCompositorTextInput)
+                << Q_FUNC_INFO
+                << "Invalid replacementStart :" << replacementStart
+                << "on the cursorPosition :" << cursorPos;
+            replacementStart = -cursorPos;
         }
-        preeditCursorPos = event->replacementStart() + 
event->replacementLength();
+        auto targetText = 
QStringView{currentState->surroundingText}.sliced(cursorPos + replacementStart);
+        if (targetText.length() < replacementLength) {
+            qCWarning(qLcWaylandCompositorTextInput)
+                << Q_FUNC_INFO
+                << "Invalid replacementLength :" << replacementLength
+                << "for the surrounding text :" << targetText;
+            replacementLength = targetText.length();
+        }
+        const int before = targetText.first(-replacementStart).toUtf8().size();
+        const int after = targetText.first(replacementLength).toUtf8().size() 
- before;
+
+        send_delete_surrounding_text(focusResource->handle, before, after);
+        needsDone = true;
+
+        // The commit will also be applied here
+        currentState->surroundingText.replace(cursorPos + replacementStart,
+                                              replacementLength,
+                                              event->commitString());
+        currentState->cursorPosition = cursorPos + replacementStart + 
event->commitString().length();
+        currentState->anchorPosition = cursorPos + replacementStart + 
event->commitString().length();
+        qApp->inputMethod()->update(Qt::ImSurroundingText | 
Qt::ImCursorPosition | Qt::ImAnchorPosition);
     }
 
     if (currentPreeditString != newPreeditString) {
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/qtwayland-everywhere-src-6.7.1/src/compositor/extensions/qwaylandtextinputv3.h
 
new/qtwayland-everywhere-src-6.7.2/src/compositor/extensions/qwaylandtextinputv3.h
--- 
old/qtwayland-everywhere-src-6.7.1/src/compositor/extensions/qwaylandtextinputv3.h
  2024-05-09 01:15:10.000000000 +0200
+++ 
new/qtwayland-everywhere-src-6.7.2/src/compositor/extensions/qwaylandtextinputv3.h
  2024-06-08 01:54:39.000000000 +0200
@@ -1,5 +1,5 @@
 // Copyright (C) 2021 The Qt Company Ltd.
-// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR 
GPL-2.0-only OR GPL-3.0-only
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
 
 #ifndef QWAYLANDTEXTINPUTV3_H
 #define QWAYLANDTEXTINPUTV3_H
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/qtwayland-everywhere-src-6.7.1/src/compositor/extensions/qwaylandtextinputv3_p.h
 
new/qtwayland-everywhere-src-6.7.2/src/compositor/extensions/qwaylandtextinputv3_p.h
--- 
old/qtwayland-everywhere-src-6.7.1/src/compositor/extensions/qwaylandtextinputv3_p.h
        2024-05-09 01:15:10.000000000 +0200
+++ 
new/qtwayland-everywhere-src-6.7.2/src/compositor/extensions/qwaylandtextinputv3_p.h
        2024-06-08 01:54:39.000000000 +0200
@@ -1,5 +1,5 @@
 // Copyright (C) 2021 The Qt Company Ltd.
-// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR 
GPL-2.0-only OR GPL-3.0-only
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
 
 #ifndef QWAYLANDTEXTINPUTV3_P_H
 #define QWAYLANDTEXTINPUTV3_P_H
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/qtwayland-everywhere-src-6.7.1/src/qtwaylandscanner/qtwaylandscanner.cpp 
new/qtwayland-everywhere-src-6.7.2/src/qtwaylandscanner/qtwaylandscanner.cpp
--- 
old/qtwayland-everywhere-src-6.7.1/src/qtwaylandscanner/qtwaylandscanner.cpp    
    2024-05-09 01:15:10.000000000 +0200
+++ 
new/qtwayland-everywhere-src-6.7.2/src/qtwaylandscanner/qtwaylandscanner.cpp    
    2024-06-08 01:54:39.000000000 +0200
@@ -1,5 +1,5 @@
 // Copyright (C) 2016 The Qt Company Ltd.
-// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR 
GPL-2.0-only OR GPL-3.0-only
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH 
Qt-GPL-exception-1.0
 
 #include <QCoreApplication>
 #include <QFile>
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/qtwayland-everywhere-src-6.7.1/src/shared/qwaylandinputmethodeventbuilder.cpp
 
new/qtwayland-everywhere-src-6.7.2/src/shared/qwaylandinputmethodeventbuilder.cpp
--- 
old/qtwayland-everywhere-src-6.7.1/src/shared/qwaylandinputmethodeventbuilder.cpp
   2024-05-09 01:15:10.000000000 +0200
+++ 
new/qtwayland-everywhere-src-6.7.2/src/shared/qwaylandinputmethodeventbuilder.cpp
   2024-06-08 01:54:39.000000000 +0200
@@ -278,10 +278,10 @@
 
     if (length < 0) {
         const QByteArray &utf8 = QStringView{text}.left(base).toUtf8();
-        return QString::fromUtf8(utf8.left(qMax(utf8.size() + length, 
0))).size();
+        return QString::fromUtf8(utf8.first(qMax(utf8.size() + length, 
0))).size();
     } else {
         const QByteArray &utf8 = QStringView{text}.mid(base).toUtf8();
-        return QString::fromUtf8(utf8.left(length)).size() + base;
+        return QString::fromUtf8(utf8.first(qMin(length, utf8.size()))).size() 
+ base;
     }
 }
 

Reply via email to