52 lines
2.0 KiB
Diff
52 lines
2.0 KiB
Diff
From f9d7c6b4157046a06f4ce04726e743d43ab711a2 Mon Sep 17 00:00:00 2001
|
|
From: Jan Grulich <jgrulich@redhat.com>
|
|
Date: Wed, 26 Jul 2023 15:38:38 +0200
|
|
Subject: [PATCH 05/15] Gtk3Theme: set XCURSOR_SIZE and XCURSOR_THEME for
|
|
wayland sessions
|
|
|
|
GNOME doesn't set these for Wayland session and without those env
|
|
variables set users might experience broken cursor with Qt apps
|
|
as QWayland reads them to setup QWaylandInputDevice.
|
|
|
|
There is no cursor protocol available on Wayland yet, see also
|
|
https://gitlab.freedesktop.org/wayland/wayland-protocols/-/issues/58
|
|
|
|
Qt Wayland QPA plugin still tries to load from those two envs.
|
|
---
|
|
src/plugins/platformthemes/gtk3/qgtk3theme.cpp | 15 +++++++++++++++
|
|
1 file changed, 15 insertions(+)
|
|
|
|
diff --git a/src/plugins/platformthemes/gtk3/qgtk3theme.cpp b/src/plugins/platformthemes/gtk3/qgtk3theme.cpp
|
|
index 67fdf7d3..c7ac7804 100644
|
|
--- a/src/plugins/platformthemes/gtk3/qgtk3theme.cpp
|
|
+++ b/src/plugins/platformthemes/gtk3/qgtk3theme.cpp
|
|
@@ -41,6 +41,7 @@
|
|
#include "qgtk3dialoghelpers.h"
|
|
#include "qgtk3menu.h"
|
|
#include "qpa/qwindowsysteminterface.h"
|
|
+#include <QGuiApplication>
|
|
#include <QVariant>
|
|
#include <QGuiApplication>
|
|
|
|
@@ -129,6 +130,20 @@ QGtk3Theme::QGtk3Theme()
|
|
SETTING_CONNECT("gtk-application-prefer-dark-theme");
|
|
SETTING_CONNECT("gtk-theme-name");
|
|
#undef SETTING_CONNECT
|
|
+
|
|
+ /* Set XCURSOR_SIZE and XCURSOR_THEME for Wayland sessions */
|
|
+ if (QGuiApplication::platformName().startsWith("wayland")) {
|
|
+ if (qEnvironmentVariableIsEmpty("XCURSOR_SIZE")) {
|
|
+ const int cursorSize = gtkSetting<gint>("gtk-cursor-theme-size");
|
|
+ if (cursorSize > 0)
|
|
+ qputenv("XCURSOR_SIZE", QString::number(cursorSize).toUtf8());
|
|
+ }
|
|
+ if (qEnvironmentVariableIsEmpty("XCURSOR_THEME")) {
|
|
+ const QString cursorTheme = gtkSetting("gtk-cursor-theme-name");
|
|
+ if (!cursorTheme.isEmpty())
|
|
+ qputenv("XCURSOR_THEME", cursorTheme.toUtf8());
|
|
+ }
|
|
+ }
|
|
}
|
|
|
|
static inline QVariant gtkGetLongPressTime()
|