Subject: [PATCH] Fix fatal error in getCurrentKeyboardLayout()

FATAL:xkb_keyboard_layout_engine.cc(640)] Keymap file failed to load: dk(polytonic)

Remove unnecessary tokenization of XKB layout.
Parsing of layout configuration is already handled by
XkbKeyboardLayoutEngine::ParseLayoutName().

Fixes: QTBUG-101201
Task-number: QTBUG-92971
Pick-to: 6.2 6.3
Change-Id: Ia4f09ed99eb82064a3b12e14eda69a6e0e12b0dd
Reviewed-by: Peter Varga <pvarga@inf.u-szeged.hu>
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
---
 .../src/core/ozone/ozone_platform_qt.cpp      | 24 ++++---------------
 1 file changed, 5 insertions(+), 19 deletions(-)

diff --git a/qtwebengine/src/core/ozone/ozone_platform_qt.cpp b/qtwebengine/src/core/ozone/ozone_platform_qt.cpp
index 33d7bd992b..543e4bd371 100644
--- a/qtwebengine/src/core/ozone/ozone_platform_qt.cpp
+++ b/qtwebengine/src/core/ozone/ozone_platform_qt.cpp
@@ -184,29 +184,15 @@ static std::string getCurrentKeyboardLayout()
     if (XkbRF_GetNamesProp(dpy, nullptr, &vdr) == 0)
         return std::string();

-    char *layout = strtok(vdr.layout, ",");
-    for (int i = 0; i < state.group; i++) {
-        layout = strtok(nullptr, ",");
-        if (layout == nullptr)
-            return std::string();
-    }
+    if (!vdr.layout)
+        return std::string();

     if (!vdr.variant)
-        return layout;
-
-    char *variant = strtok(vdr.variant, ",");
-    if (!variant)
-        return layout;
-
-    for (int i = 0; i < state.group; i++) {
-        variant = strtok(nullptr, ",");
-        if (variant == nullptr)
-            return layout;
-    }
+        return std::string(vdr.layout);

-    std::string layoutWithVariant = layout;
+    std::string layoutWithVariant = vdr.layout;
     layoutWithVariant = layoutWithVariant.append("-");
-    layoutWithVariant = layoutWithVariant.append(variant);
+    layoutWithVariant = layoutWithVariant.append(vdr.variant);
     return layoutWithVariant;
 }
 #endif // BUILDFLAG(USE_XKBCOMMON)
--
2.35.3