Skip to content

Commit

Permalink
Fix bug #464: Cursor style is set in GTK2, GTK3 and xsettingsd
Browse files Browse the repository at this point in the history
  • Loading branch information
selairi authored and agaida committed May 5, 2019
1 parent 302c980 commit e265219
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 15 deletions.
2 changes: 1 addition & 1 deletion liblxqt-config-cursor/selectwnd.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
8 changes: 7 additions & 1 deletion lxqt-config-appearance/configothertoolkits.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand All @@ -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(
Expand All @@ -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)
Expand Down Expand Up @@ -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
);
}

Expand Down
2 changes: 1 addition & 1 deletion lxqt-config-appearance/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down
17 changes: 5 additions & 12 deletions lxqt-config-appearance/styleconfig.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit e265219

Please sign in to comment.