Fix cursor size on wayland

This commit is contained in:
Jan Grulich 2019-08-28 12:29:45 +02:00
parent f84706757c
commit f71e1c23c0
2 changed files with 55 additions and 1 deletions

View File

@ -0,0 +1,50 @@
diff --git a/common/gnomehintssettings.cpp b/common/gnomehintssettings.cpp
index 4dfe990..b50bd34 100644
--- a/common/gnomehintssettings.cpp
+++ b/common/gnomehintssettings.cpp
@@ -119,8 +119,10 @@ GnomeHintsSettings::GnomeHintsSettings()
m_hints[QPlatformTheme::IconPixmapSizes] = QVariant::fromValue(QList<int>() << 512 << 256 << 128 << 64 << 32 << 22 << 16 << 8);
m_hints[QPlatformTheme::PasswordMaskCharacter] = QVariant(QChar(0x2022));
+ cursorSizeChanged();
+
// Watch for changes
- QStringList watchList = { "changed::gtk-theme", "changed::icon-theme", "changed::cursor-blink-time", "changed::font-name", "changed::monospace-font-name" };
+ QStringList watchList = { "changed::gtk-theme", "changed::icon-theme", "changed::cursor-blink-time", "changed::font-name", "changed::monospace-font-name", "changed::cursor-size" };
for (const QString &watchedProperty : watchList) {
g_signal_connect(m_settings, watchedProperty.toStdString().c_str(), G_CALLBACK(gsettingPropertyChanged), this);
@@ -174,6 +176,8 @@ void GnomeHintsSettings::gsettingPropertyChanged(GSettings *settings, gchar *key
gnomeHintsSettings->fontChanged();
} else if (changedProperty == QLatin1String("monospace-font-name")) {
gnomeHintsSettings->fontChanged();
+ } else if (changedProperty == QLatin1String("cursor-size")) {
+ gnomeHintsSettings->cursorSizeChanged();
} else {
qCDebug(QGnomePlatform) << "GSetting property change: " << key;
}
@@ -204,6 +208,12 @@ void GnomeHintsSettings::cursorBlinkTimeChanged()
}
}
+void GnomeHintsSettings::cursorSizeChanged()
+{
+ int cursorSize = getSettingsProperty<int>(QStringLiteral("cursor-size"));
+ qputenv("XCURSOR_SIZE", QString::number(cursorSize).toUtf8());
+}
+
void GnomeHintsSettings::fontChanged()
{
const QFont oldSysFont = *m_fonts[QPlatformTheme::SystemFont];
diff --git a/common/gnomehintssettings.h b/common/gnomehintssettings.h
index a1ce4a1..aaaa454 100644
--- a/common/gnomehintssettings.h
+++ b/common/gnomehintssettings.h
@@ -102,6 +102,7 @@ public:
public Q_SLOTS:
void cursorBlinkTimeChanged();
+ void cursorSizeChanged();
void fontChanged();
void iconsChanged();
void themeChanged();

View File

@ -1,7 +1,7 @@
Name: qgnomeplatform
Version: 0.5
Release: 12%{?dist}
Release: 13%{?dist}
Summary: Qt Platform Theme aimed to accommodate Gnome settings
License: LGPLv2+
@ -10,6 +10,7 @@ Source0: https://github.com/MartinBriza/QGnomePlatform/archive/%{version}
# Upstream patches
Patch0: qgnomeplatform-gnome-decorations.patch
Patch1: qgnomeplatform-fix-cursor-size.patch
BuildRequires: pkgconfig(gio-2.0)
BuildRequires: pkgconfig(udev)
@ -58,6 +59,9 @@ make install INSTALL_ROOT=%{buildroot} -C %{_target_platform}
%{_qt5_libdir}/qt5/plugins/wayland-decoration-client/libqgnomeplatformdecoration.so
%changelog
* Wed Aug 28 2019 Jan Grulich <jgrulich@redhat.com> - 0.5-13
- Fix cursor size on wayland
* Thu Aug 15 2019 Jan Grulich <jgrulich@redhat.com> - 0.5-12
- Add Gnome-like wayland decorations
BUG: bz#1732129