sync: from linuxdeepin/qt5platform-plugins#108
Merged
Conversation
11f8ee7 to
3682f75
Compare
Contributor
Author
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: deepin-ci-robot The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
1 similar comment
Contributor
Author
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: deepin-ci-robot The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
ad0533a to
16c33f8
Compare
Synchronize source files from linuxdeepin/qt5platform-plugins. Source-pull-request: linuxdeepin/qt5platform-plugins#311
16c33f8 to
28f37d8
Compare
Contributor
Author
deepin pr auto review我来对这个代码变更进行审查:
改进建议:
static bool isValidScreenCursor(QScreen* screen) {
return screen && screen->handle() && screen->handle()->cursor();
}
static void updateCursorContext(QScreen* screen) {
if (!isValidScreenCursor(screen)) return;
QXcbCursor* xcb_cursor = static_cast<QXcbCursor*>(screen->handle()->cursor());
if (!xcb_cursor) return;
xcb_cursor->m_cursorHash.clear();
if (xcb_cursor->m_cursorContext) {
xcb_cursor_context_free(xcb_cursor->m_cursorContext);
}
xcb_cursor->m_cursorContext = nullptr;
xcb_connection_t* conn = xcb_cursor->xcb_connection();
if (xcb_cursor_context_new(conn, xcb_cursor->m_screen->screen(), &xcb_cursor->m_cursorContext) < 0) {
qWarning() << "Failed to create cursor context for screen" << screen;
xcb_cursor->m_cursorContext = nullptr;
}
}
// 在类中添加信号
signals:
void cursorThemeChanged();
// 在initialize中连接
connect(this, &DPlatformIntegration::cursorThemeChanged,
this, &DPlatformIntegration::handleCursorThemeChange, Qt::QueuedConnection);
// 修改回调函数
static void cursorThemePropertyChanged(xcb_connection_t* connection, const QByteArray& property, const QVariant& value, void* handle) {
Q_UNUSED(connection);
Q_UNUSED(property);
Q_UNUSED(value);
Q_UNUSED(handle);
QMetaObject::invokeMethod(qApp, [](){
emit static_cast<DPlatformIntegration*>(qApp)->cursorThemeChanged();
}, Qt::QueuedConnection);
}
if (xcb_cursor_context_new(conn, xcb_cursor->m_screen->screen(), &xcb_cursor->m_cursorContext) < 0) {
qWarning() << "Failed to create new cursor context for screen" << screen
<< "Error:" << strerror(errno);
xcb_cursor->m_cursorContext = nullptr;
}这些改进可以:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Synchronize source files from linuxdeepin/qt5platform-plugins.
Source-pull-request: linuxdeepin/qt5platform-plugins#311