Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: after setting the cursor theme, it will not update in real-time. #268

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions xcb/dplatformintegration.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1011,6 +1011,21 @@ static void startDrag(QXcbDrag *drag)
xcb_flush(drag->xcb_connection());
}

static void cursorThemePropertyChanged(xcb_connection_t *connection, const QByteArray &name, const QVariant &property, void *handle)
{
Q_UNUSED(connection);
Q_UNUSED(name);
Q_UNUSED(property);
Q_UNUSED(handle)

QMetaObject::invokeMethod(qApp, [](){
for (const auto window : qApp->allWindows()) {
auto cursor = window->cursor();
VtableHook::callOriginalFun( window->screen()->handle()->cursor(), &QPlatformCursor::changeCursor, &cursor, window);
}
}, Qt::QueuedConnection);
}

void DPlatformIntegration::initialize()
{
// 由于Qt很多代码中写死了是xcb,所以只能伪装成是xcb
Expand Down Expand Up @@ -1131,6 +1146,8 @@ void DPlatformIntegration::initialize()
});
}
}

xSettings()->registerCallbackForProperty("Gtk/CursorThemeName", cursorThemePropertyChanged, nullptr);
}

#ifdef Q_OS_LINUX
Expand Down
Loading