diff options
author | Tang Haixiang <tanghaixiang@uniontech.com> | 2021-06-16 10:01:53 +0800 |
---|---|---|
committer | Qt Cherry-pick Bot <cherrypick_bot@qt-project.org> | 2021-06-24 15:42:52 +0000 |
commit | ae71fb7fe99bc66b9ca2fafa28b016065ac3b14d (patch) | |
tree | da627e8ae3125feb40d25ca41237a667bc14b06d /src/plugins | |
parent | 2e00264fe994cfdd8de844f362883aa3a69b63f7 (diff) |
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
Change-Id: Ia4de30930a0dc1dc306c61e1553970c3dab67bd6
Reviewed-by: Liang Qi <liang.qi@qt.io>
(cherry picked from commit 7311cdc0d2c10d47511e5b4850e3b348ea10e0d8)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
Diffstat (limited to 'src/plugins')
-rw-r--r-- | src/plugins/platforms/xcb/qxcbcursor.cpp | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/src/plugins/platforms/xcb/qxcbcursor.cpp b/src/plugins/platforms/xcb/qxcbcursor.cpp index 42c7a52bd4..e58e181e49 100644 --- a/src/plugins/platforms/xcb/qxcbcursor.cpp +++ b/src/plugins/platforms/xcb/qxcbcursor.cpp @@ -534,6 +534,8 @@ bool updateCursorTheme(void *dpy, const QByteArray &theme) { Q_UNUSED(screen); Q_UNUSED(name); QXcbCursor *self = static_cast<QXcbCursor *>(handle); + self->m_cursorHash.clear(); + updateCursorTheme(self->connection()->xlib_display(),property.toByteArray()); } @@ -559,14 +561,16 @@ xcb_cursor_t QXcbCursor::createFontCursor(int cshape) int cursorId = cursorIdForShape(cshape); xcb_cursor_t cursor = XCB_NONE; - // Try Xcursor first #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) { void *dpy = connection()->xlib_display(); cursor = loadCursor(dpy, cshape); if (!cursor && !m_gtkCursorThemeInitialized && m_screen->xSettings()->initialized()) { QByteArray gtkCursorTheme = m_screen->xSettings()->setting("Gtk/CursorThemeName").toByteArray(); - m_screen->xSettings()->registerCallbackForProperty("Gtk/CursorThemeName",cursorThemePropertyChanged,this); if (updateCursorTheme(dpy,gtkCursorTheme)) { cursor = loadCursor(dpy, cshape); } |