From e265219437568c58485242c5083325670962703b Mon Sep 17 00:00:00 2001 From: "P.L. Lucas" Date: Sun, 5 May 2019 10:09:30 +0200 Subject: [PATCH] Fix bug #464: Cursor style is set in GTK2, GTK3 and xsettingsd --- liblxqt-config-cursor/selectwnd.cpp | 2 +- lxqt-config-appearance/configothertoolkits.cpp | 8 +++++++- lxqt-config-appearance/main.cpp | 2 +- lxqt-config-appearance/styleconfig.cpp | 17 +++++------------ 4 files changed, 14 insertions(+), 15 deletions(-) diff --git a/liblxqt-config-cursor/selectwnd.cpp b/liblxqt-config-cursor/selectwnd.cpp index d666f53a6..83cb75eb1 100644 --- a/liblxqt-config-cursor/selectwnd.cpp +++ b/liblxqt-config-cursor/selectwnd.cpp @@ -181,7 +181,7 @@ void SelectWnd::applyCusorTheme() mSettings->setValue("cursor_theme", theme->name()); mSettings->endGroup(); - // The XCURSOR_THEME environment varialbe does not work sometimes. + // The XCURSOR_THEME environment variable does not work sometimes. // Besides, XDefaults values are not used by Qt. // So, let's write the new theme name to ~/.icons/default/index.theme. // This is the most reliable way. diff --git a/lxqt-config-appearance/configothertoolkits.cpp b/lxqt-config-appearance/configothertoolkits.cpp index 590e8d297..72566fc54 100644 --- a/lxqt-config-appearance/configothertoolkits.cpp +++ b/lxqt-config-appearance/configothertoolkits.cpp @@ -47,6 +47,7 @@ gtk-font-name = "%3" gtk-button-images = %4 gtk-menu-images = %4 gtk-toolbar-style = %5 +gtk-cursor-theme-name = %6 )GTK2_CONFIG"; static const char *GTK3_CONFIG = R"GTK3_CONFIG( @@ -59,6 +60,7 @@ gtk-font-name = %3 gtk-menu-images = %4 gtk-button-images = %4 gtk-toolbar-style = %5 +gtk-cursor-theme-name = %6 )GTK3_CONFIG"; static const char *XSETTINGS_CONFIG = R"XSETTINGS_CONFIG( @@ -69,6 +71,7 @@ Gtk/FontName "%3" Gtk/MenuImages %4 Gtk/ButtonImages %4 Gtk/ToolbarStyle "%5" +Gtk/CursorThemeName "%6" )XSETTINGS_CONFIG"; ConfigOtherToolKits::ConfigOtherToolKits(LXQt::Settings *settings, LXQt::Settings *configAppearanceSettings, QObject *parent) : QObject(parent) @@ -202,9 +205,12 @@ void ConfigOtherToolKits::setGTKConfig(QString version, QString theme) QString ConfigOtherToolKits::getConfig(const char *configString) { + LXQt::Settings* sessionSettings = new LXQt::Settings("session"); + QString mouseStyle = sessionSettings->value("Mouse/cursor_theme").toString(); + delete sessionSettings; return QString(configString).arg(mConfig.styleTheme, mConfig.iconTheme, mConfig.fontName, mConfig.buttonStyle==0 ? "0":"1", - mConfig.toolButtonStyle + mConfig.toolButtonStyle, mouseStyle ); } diff --git a/lxqt-config-appearance/main.cpp b/lxqt-config-appearance/main.cpp index b205f8e0e..b6fc509d8 100644 --- a/lxqt-config-appearance/main.cpp +++ b/lxqt-config-appearance/main.cpp @@ -112,11 +112,11 @@ int main (int argc, char **argv) QObject::connect(dialog, &LXQt::ConfigDialog::clicked, [=] (QDialogButtonBox::StandardButton btn) { if (btn == QDialogButtonBox::Apply) { - stylePage->applyStyle(); iconPage->applyIconTheme(); themePage->applyLxqtTheme(); fontsPage->updateQtFont(); cursorPage->applyCusorTheme(); + stylePage->applyStyle(); // Cursor and font have to be set before style // disable Apply button after changes are applied dialog->enableButton(btn, false); } diff --git a/lxqt-config-appearance/styleconfig.cpp b/lxqt-config-appearance/styleconfig.cpp index 6871fa23a..85a71f2e4 100644 --- a/lxqt-config-appearance/styleconfig.cpp +++ b/lxqt-config-appearance/styleconfig.cpp @@ -144,22 +144,15 @@ void StyleConfig::applyStyle() } // GTK3 - bool setXSettings = false; themeName = ui->gtk3ComboBox->currentText(); - if(themeName != mConfigOtherToolKits->getGTKThemeFromRCFile("3.0")) { - mConfigOtherToolKits->setGTKConfig("3.0", themeName); - setXSettings = true; - } + mConfigOtherToolKits->setGTKConfig("3.0", themeName); // GTK2 themeName = ui->gtk2ComboBox->currentText(); - if(themeName != mConfigOtherToolKits->getGTKThemeFromRCFile("2.0")) { - mConfigOtherToolKits->setGTKConfig("2.0", themeName); - setXSettings = true; - } - - if(setXSettings) - mConfigOtherToolKits->setXSettingsConfig(); + mConfigOtherToolKits->setGTKConfig("2.0", themeName); + + // Update xsettingsd + mConfigOtherToolKits->setXSettingsConfig(); } void StyleConfig::showAdvancedOptions(bool on)