xcb: fix cursorTheme update issue
Clear the cache when cursor theme changed. Idealy we should subscribe root window's RESOURCE_MANAGER property to update cursor theme via Xcursor. KDE already has a daemon KDE GTK Configurator to sync KDE settings to GTK. Then we can register the fallback there both for KDE and GTK changes. See also https://invent.kde.org/plasma/kde-gtk-config Fixes: QTBUG-94538 Pick-to: 6.2 6.1 6.0 5.15 Change-Id: Ia4de30930a0dc1dc306c61e1553970c3dab67bd6 Reviewed-by: Liang Qi <liang.qi@qt.io>
This commit is contained in:
parent
fa664e0b2a
commit
7311cdc0d2
@ -534,6 +534,8 @@ bool updateCursorTheme(void *dpy, const QByteArray &theme) {
|
|||||||
Q_UNUSED(screen);
|
Q_UNUSED(screen);
|
||||||
Q_UNUSED(name);
|
Q_UNUSED(name);
|
||||||
QXcbCursor *self = static_cast<QXcbCursor *>(handle);
|
QXcbCursor *self = static_cast<QXcbCursor *>(handle);
|
||||||
|
self->m_cursorHash.clear();
|
||||||
|
|
||||||
updateCursorTheme(self->connection()->xlib_display(),property.toByteArray());
|
updateCursorTheme(self->connection()->xlib_display(),property.toByteArray());
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -559,14 +561,16 @@ xcb_cursor_t QXcbCursor::createFontCursor(int cshape)
|
|||||||
int cursorId = cursorIdForShape(cshape);
|
int cursorId = cursorIdForShape(cshape);
|
||||||
xcb_cursor_t cursor = XCB_NONE;
|
xcb_cursor_t cursor = XCB_NONE;
|
||||||
|
|
||||||
// Try Xcursor first
|
|
||||||
#if QT_CONFIG(xcb_xlib) && QT_CONFIG(library)
|
#if QT_CONFIG(xcb_xlib) && QT_CONFIG(library)
|
||||||
|
if (m_screen->xSettings()->initialized())
|
||||||
|
m_screen->xSettings()->registerCallbackForProperty("Gtk/CursorThemeName",cursorThemePropertyChanged,this);
|
||||||
|
|
||||||
|
// Try Xcursor first
|
||||||
if (cshape >= 0 && cshape <= Qt::LastCursor) {
|
if (cshape >= 0 && cshape <= Qt::LastCursor) {
|
||||||
void *dpy = connection()->xlib_display();
|
void *dpy = connection()->xlib_display();
|
||||||
cursor = loadCursor(dpy, cshape);
|
cursor = loadCursor(dpy, cshape);
|
||||||
if (!cursor && !m_gtkCursorThemeInitialized && m_screen->xSettings()->initialized()) {
|
if (!cursor && !m_gtkCursorThemeInitialized && m_screen->xSettings()->initialized()) {
|
||||||
QByteArray gtkCursorTheme = m_screen->xSettings()->setting("Gtk/CursorThemeName").toByteArray();
|
QByteArray gtkCursorTheme = m_screen->xSettings()->setting("Gtk/CursorThemeName").toByteArray();
|
||||||
m_screen->xSettings()->registerCallbackForProperty("Gtk/CursorThemeName",cursorThemePropertyChanged,this);
|
|
||||||
if (updateCursorTheme(dpy,gtkCursorTheme)) {
|
if (updateCursorTheme(dpy,gtkCursorTheme)) {
|
||||||
cursor = loadCursor(dpy, cshape);
|
cursor = loadCursor(dpy, cshape);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user