-
Notifications
You must be signed in to change notification settings - Fork 31
feat: Add support for modifying the plugin popup cursor shape via the… #424
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
base: master
Are you sure you want to change the base?
Conversation
Reviewer's GuideAdds Wayland protocol and plumbing to allow plugins to request cursor shape changes for popup widgets, wiring widget cursor changes through PluginPopup to the plugin-manager-v1 set_cursor request. Sequence diagram for plugin popup cursor shape change flowsequenceDiagram
actor User
participant PopupWidget
participant EventFilter
participant PluginPopup
participant PluginPopupSurface
participant PluginManagerV1
participant WaylandCompositor
User->>PopupWidget: Move pointer over popup
PopupWidget->>EventFilter: QEvent::CursorChange
EventFilter->>EventFilter: handleCursorChange(widget)
EventFilter->>PluginPopup: requestSetCursor(cursorShape)
PluginPopup->>PluginPopupSurface: signal requestSetCursor(cursorShape)
PluginPopupSurface->>PluginPopupSurface: set_cursor(cursorShape)
PluginPopupSurface->>PluginManagerV1: request set_cursor(cursor_shape)
PluginManagerV1->>WaylandCompositor: set_cursor(cursor_shape)
WaylandCompositor-->>User: Updated cursor shape
Class diagram for updated PluginPopup and EventFilter cursor handlingclassDiagram
class QObject
class QWidget
class QWindow
class QEvent
class QHelpEvent
class QTimer
class EventFilter {
+bool eventFilter(QObject watched, QEvent event)
-void updateToolTipPosition(QPoint globalPos)
-void handleCursorChange(QWidget widget)
}
class PluginPopup {
-QWindow window
+int x()
+int y()
+void xChanged()
+void yChanged()
+void pluginPosChanged(QPoint point)
+void requestSetCursor(int cursorShape)
-PluginPopup(QWindow window)
+static PluginPopup getWithoutCreating(QWindow window)
}
class PluginPopupSurface {
-PluginManagerIntegration manager
-QtWaylandClientShellSurface shellSurface
-PluginPopup popup
-QTimer m_dirtyTimer
+PluginPopupSurface(PluginManagerIntegration manager, QtWaylandClientShellSurface shellSurface, PluginPopup popup)
+~PluginPopupSurface()
-void set_position(int x, int y)
-void set_cursor(int cursorShape)
}
QObject <|-- EventFilter
QObject <|-- PluginPopup
QWidget <|-- PopupWidget
QWindow <.. PluginPopup
PluginPopupSurface o-- PluginPopup
PluginPopupSurface o-- QTimer
EventFilter ..> QWidget : handleCursorChange
EventFilter ..> PluginPopup : getWithoutCreating
EventFilter ..> PluginPopup : requestSetCursor
PluginPopupSurface ..> PluginPopup : requestSetCursor signal
PluginPopupSurface ..> QTimer : timeout connection
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey - I've left some high level feedback:
- The
handleCursorChangepath assumes anyQEvent::CursorChangeshould be forwarded; consider validating that the cursor shape actually changed from the last sent value to avoid spammingset_cursorrequests during rapid cursor updates. - Since the protocol now relies on integer values matching
Qt::CursorShape, it may be safer to introduce an explicit mapping/validation layer (e.g. a small switch or helper) rather than sendingstatic_cast<int>(cursorShape)directly, to guard against enum changes or unexpected values.
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- The `handleCursorChange` path assumes any `QEvent::CursorChange` should be forwarded; consider validating that the cursor shape actually changed from the last sent value to avoid spamming `set_cursor` requests during rapid cursor updates.
- Since the protocol now relies on integer values matching `Qt::CursorShape`, it may be safer to introduce an explicit mapping/validation layer (e.g. a small switch or helper) rather than sending `static_cast<int>(cursorShape)` directly, to guard against enum changes or unexpected values.Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
fe7b51c to
6667e22
Compare
6667e22 to
c34962d
Compare
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: 18202781743, yixinshark 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 |
|
TAG Bot New tag: 2.0.25 |
… protocol. add support in plugin-manager-v1.xml Log: Add support for modifying the plugin popup cursor shape via the protocol.
c34962d to
ceb6fcf
Compare
deepin pr auto review这段代码的diff主要实现了在Wayland环境下,当插件弹窗内的鼠标光标形状发生变化时,将其同步到合成器的功能。以下是对这段代码的审查意见,分为语法逻辑、代码质量、代码性能和代码安全四个方面: 1. 语法逻辑
2. 代码质量
3. 代码性能
4. 代码安全
改进建议总结
总体来说,这段代码逻辑清晰,实现了功能需求,但在协议层的类型安全和边界检查上可以进一步加强。 |
… protocol.
add support in plugin-manager-v1.xml
Log: Add support for modifying the plugin popup cursor shape via the protocol.
Summary by Sourcery
Add support for changing the plugin popup cursor shape via the Wayland plugin manager protocol and integrate it with widget event handling.
New Features:
Enhancements: