kdeui: do not change the cursor theme from KGlobalSettings

in full Katana session it is done by the input KCM and even by the
`startkde` script (so that cursor theme applies for any error messages
shown via `xmessage`). as for changing after startup it is again done by
the input KCM (via `XFixesChangeCursorByName()` calls and other stuff), the
change even applies when not in Katana session (i.e. `systemsettings`
changes the cursor theme even if not in Katana session) so it is redundant
to do it from KGlobalSettings and only the notification signal has to be
emitted

on a side note style and palette are applied by the platform plugin (see
kde-workspace/qguiplatformplugin_kde/qguiplatformplugin_kde.cpp) when in
full Katana session meaning style and palette also do not have to
applied by KGlobalSettings but that is for another commit because there
are some other things to take in account (such as style override via
command line argument and initializing plugin paths early, before
KApplication is constructed)

Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
This commit is contained in:
Ivailo Monev 2023-08-21 16:26:51 +03:00
parent 73717efd83
commit a68302abc1

View file

@ -79,22 +79,8 @@ class KGlobalSettings::Private
void kdisplaySetPalette();
void kdisplaySetStyle();
void kdisplaySetFont();
void kdisplaySetCursor();
void applyGUIStyle();
/**
* @internal
*
* Ensures that cursors are loaded from the theme KDE is configured
* to use. Note that calling this function doesn't cause existing
* cursors to be reloaded. Reloading already created cursors is
* handled by the KCM when a cursor theme is applied.
*
* It is not necessary to call this function when KGlobalSettings
* is initialized.
*/
void applyCursorTheme();
KGlobalSettings *q;
bool activated;
bool paletteCreated;
@ -132,7 +118,6 @@ void KGlobalSettings::activate(ActivateOptions options)
if (options & ApplySettings) {
d->kdisplaySetStyle(); // implies palette setup
d->kdisplaySetFont();
d->kdisplaySetCursor();
d->propagateQtSettings();
}
}
@ -504,7 +489,7 @@ void KGlobalSettings::Private::_k_slotNotifyChange(int changeType, int arg)
break;
}
case CursorChanged: {
applyCursorTheme();
emit q->cursorChanged();
break;
}
case BlockShortcuts: {
@ -644,15 +629,6 @@ void KGlobalSettings::Private::kdisplaySetFont()
emit q->appearanceChanged();
}
void KGlobalSettings::Private::kdisplaySetCursor()
{
if (!kdeFullSession) {
return;
}
applyCursorTheme();
}
void KGlobalSettings::Private::kdisplaySetStyle()
{
if (qApp->type() == KAPPLICATION_GUI_TYPE) {
@ -663,32 +639,6 @@ void KGlobalSettings::Private::kdisplaySetStyle()
}
}
void KGlobalSettings::Private::applyCursorTheme()
{
#if defined(Q_WS_X11) && defined(HAVE_XCURSOR)
KConfig config("kcminputrc");
KConfigGroup g = config.group("Mouse");
QByteArray theme = g.readEntry("cursorTheme", QByteArray(KDE_DEFAULT_CURSOR_THEME));
int size = g.readEntry("cursorSize", -1);
// Default cursor size is 16 points
if (size == -1) {
size = qApp->desktop()->screen(0)->logicalDpiY() * 16 / 72;
}
// Note that in X11R7.1 and earlier, calling XcursorSetTheme()
// with a NULL theme would cause Xcursor to use "default", but
// in 7.2 and later it will cause it to revert to the theme that
// was configured when the application was started.
XcursorSetTheme(QX11Info::display(), theme.constData());
XcursorSetDefaultSize(QX11Info::display(), size);
emit q->cursorChanged();
#endif
}
void KGlobalSettings::Private::propagateQtSettings()
{
KConfigGroup cg( KGlobal::config(), "KDE" );