Skip to content

Conversation

@mhduiy
Copy link
Contributor

@mhduiy mhduiy commented Dec 3, 2025

  1. Added cursor theme size property listener alongside existing cursor theme name listener
  2. Modified cursorThemePropertyChanged function to directly handle cursor updates instead of queued invocation
  3. Added explicit cursor cache clearing and context reinitialization for all screens
  4. Removed queued connection to ensure immediate cursor updates when theme properties change

The changes address the need for real-time cursor updates when both cursor theme name and size change. Previously, only theme name changes were monitored, and cursor updates were queued which could cause delays. Now the function directly clears cursor caches, reinitializes cursor contexts, and updates all window cursors immediately. This ensures consistent cursor appearance across all windows when theme properties are modified.

Log: Added cursor theme size change listener for real-time cursor updates

Influence:

  1. Test cursor theme changes by modifying both theme name and size settings
  2. Verify cursor updates immediately across all application windows
  3. Test with multiple screens to ensure proper cursor context reinitialization
  4. Verify cursor cache is properly cleared when theme properties change
  5. Test application behavior during theme property changes to ensure no crashes or memory leaks

fix: 增加光标大小监听并优化光标主题处理

  1. 在现有光标主题名称监听的基础上,新增光标主题大小属性监听
  2. 修改cursorThemePropertyChanged函数,直接处理光标更新而非排队调用
  3. 为所有屏幕添加显式的光标缓存清理和上下文重新初始化
  4. 移除排队连接,确保主题属性变化时立即更新光标

这些更改解决了光标主题名称和大小变化时需要实时更新光标的问题。之前仅监听
了主题名称变化,且光标更新被排队处理可能导致延迟。现在函数直接清理光标缓
存、重新初始化光标上下文并立即更新所有窗口光标。这确保了主题属性修改时所
有窗口的光标外观保持一致。

Log: 新增光标主题大小变化监听,实现实时光标更新

Influence:

  1. 测试修改主题名称和大小设置时的光标变化
  2. 验证所有应用程序窗口的光标立即更新
  3. 使用多屏幕测试,确保正确重新初始化光标上下文
  4. 验证主题属性变化时正确清理光标缓存
  5. 测试主题属性变化期间的应用程序行为,确保无崩溃或内存泄漏

deepin-ci-robot added a commit to linuxdeepin/qt6platform-plugins that referenced this pull request Dec 3, 2025
Synchronize source files from linuxdeepin/qt5platform-plugins.

Source-pull-request: linuxdeepin/qt5platform-plugins#311
deepin-ci-robot added a commit to linuxdeepin/qt6platform-plugins that referenced this pull request Dec 3, 2025
Synchronize source files from linuxdeepin/qt5platform-plugins.

Source-pull-request: linuxdeepin/qt5platform-plugins#311
deepin-ci-robot added a commit to linuxdeepin/qt6platform-plugins that referenced this pull request Dec 3, 2025
Synchronize source files from linuxdeepin/qt5platform-plugins.

Source-pull-request: linuxdeepin/qt5platform-plugins#311
@mhduiy mhduiy requested review from BLumia and zccrs December 3, 2025 03:48
deepin-ci-robot added a commit to linuxdeepin/qt6platform-plugins that referenced this pull request Dec 3, 2025
Synchronize source files from linuxdeepin/qt5platform-plugins.

Source-pull-request: linuxdeepin/qt5platform-plugins#311
@deepin-ci-robot
Copy link
Contributor

deepin pr auto review

我来对这个 diff 进行详细审查:

  1. 语法逻辑:
  • 代码语法正确,没有明显的语法错误
  • 代码逻辑清晰,主要是在处理光标主题变化时的更新逻辑
  1. 代码质量:
  • 优点:

    • 添加了详细的注释说明 TODO 事项和 bug 链接
    • 代码结构清晰,分离了屏幕和窗口的处理逻辑
    • 添加了空指针检查,提高了代码健壮性
  • 需要改进的地方:

    • for 循环中的变量声明可以改为 const 引用以避免不必要的拷贝:
      for (const QScreen *screen : qApp->screens())
    • 同样地:
      for (const auto window : qApp->allWindows())
  1. 代码性能:
  • 主要的性能影响在于:

    • 遍历所有屏幕和窗口来更新光标,这在窗口数量较多时可能会有性能影响
    • 清除并重建光标上下文的操作比较重
  • 建议优化:

    • 可以考虑缓存需要更新的窗口列表,避免每次都遍历所有窗口
    • 可以添加一个标记位,只在真正需要时才重建光标上下文
  1. 代码安全:
  • 优点:

    • 添加了适当的空指针检查
    • 使用了安全的方式进行类型转换
  • 需要注意:

    • xcb_cursor_context_new 的错误处理已经实现,这是好的
    • 建议在调用 overrideChangeCursor 之前也添加对 window 参数的空指针检查
  1. 其他建议:
  • 考虑将光标上下文更新逻辑封装成一个单独的函数,提高代码复用性
  • 可以添加日志记录,方便调试和追踪问题
  • 建议在代码中添加更多关于为什么需要这样做的注释,帮助其他开发者理解代码的意图
  1. 关于新增的 Gtk/CursorThemeSize 监听:
  • 这是一个很好的改进,确保了光标大小变化时也能正确更新
  • 建议在注释中说明为什么需要同时监听这两个属性

总体来说,这个修改解决了实际问题,代码质量较好,但还有一些可以优化的地方。建议在后续版本中考虑这些改进建议。

@deepin-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: BLumia, mhduiy

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

1. Added cursor theme size property listener alongside existing cursor
theme name listener
2. Modified cursorThemePropertyChanged function to directly handle
cursor updates instead of queued invocation
3. Added explicit cursor cache clearing and context reinitialization for
all screens
4. Removed queued connection to ensure immediate cursor updates when
theme properties change

The changes address the need for real-time cursor updates when both
cursor theme name and size change. Previously, only theme name changes
were monitored, and cursor updates were queued which could cause delays.
Now the function directly clears cursor caches, reinitializes cursor
contexts, and updates all window cursors immediately. This ensures
consistent cursor appearance across all windows when theme properties
are modified.

Log: Added cursor theme size change listener for real-time cursor
updates

Influence:
1. Test cursor theme changes by modifying both theme name and size
settings
2. Verify cursor updates immediately across all application windows
3. Test with multiple screens to ensure proper cursor context
reinitialization
4. Verify cursor cache is properly cleared when theme properties change
5. Test application behavior during theme property changes to ensure no
crashes or memory leaks

fix: 增加光标大小监听并优化光标主题处理

1. 在现有光标主题名称监听的基础上,新增光标主题大小属性监听
2. 修改cursorThemePropertyChanged函数,直接处理光标更新而非排队调用
3. 为所有屏幕添加显式的光标缓存清理和上下文重新初始化
4. 移除排队连接,确保主题属性变化时立即更新光标

这些更改解决了光标主题名称和大小变化时需要实时更新光标的问题。之前仅监听
了主题名称变化,且光标更新被排队处理可能导致延迟。现在函数直接清理光标缓
存、重新初始化光标上下文并立即更新所有窗口光标。这确保了主题属性修改时所
有窗口的光标外观保持一致。

Log: 新增光标主题大小变化监听,实现实时光标更新

Influence:
1. 测试修改主题名称和大小设置时的光标变化
2. 验证所有应用程序窗口的光标立即更新
3. 使用多屏幕测试,确保正确重新初始化光标上下文
4. 验证主题属性变化时正确清理光标缓存
5. 测试主题属性变化期间的应用程序行为,确保无崩溃或内存泄漏

pms: STORY-39797
deepin-ci-robot added a commit to linuxdeepin/qt6platform-plugins that referenced this pull request Dec 4, 2025
Synchronize source files from linuxdeepin/qt5platform-plugins.

Source-pull-request: linuxdeepin/qt5platform-plugins#311
@mhduiy
Copy link
Contributor Author

mhduiy commented Dec 4, 2025

/forcemerge

@deepin-bot
Copy link
Contributor

deepin-bot bot commented Dec 4, 2025

This pr force merged! (status: unstable)

mhduiy pushed a commit to linuxdeepin/qt6platform-plugins that referenced this pull request Dec 4, 2025
Synchronize source files from linuxdeepin/qt5platform-plugins.

Source-pull-request: linuxdeepin/qt5platform-plugins#311
@deepin-bot deepin-bot bot merged commit b54ebf9 into linuxdeepin:master Dec 4, 2025
17 of 18 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants