Skip to content
Open
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion debian/control
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ Build-Depends:
debhelper-compat (= 13),
cmake,
dde-application-manager-api (>= 1.2.23),
dde-tray-loader-dev (>= 1.99.14),
dde-tray-loader-dev (> 2.0.24),
extra-cmake-modules,
libdtk6core-bin,
libdtk6core-dev,
Expand Down
6 changes: 6 additions & 0 deletions panels/dock/pluginmanagerextension.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -400,6 +400,12 @@ void PluginPopup::plugin_popup_source_size(Resource *resource, int32_t width, in
}
}

void PluginPopup::plugin_popup_set_cursor(Resource *resource, int32_t cursor_shape)
{
Q_UNUSED(resource);
Q_EMIT cursorShapeRequested(cursor_shape);
}

PluginManager::PluginManager(QWaylandCompositor *compositor)
: QWaylandCompositorExtensionTemplate(compositor)
{
Expand Down
2 changes: 2 additions & 0 deletions panels/dock/pluginmanagerextension_p.h
Original file line number Diff line number Diff line change
Expand Up @@ -255,12 +255,14 @@ class PluginPopup : public QWaylandShellSurfaceTemplate<PluginPopup>, public QtW
virtual void plugin_popup_destroy_resource(Resource *resource) override;
virtual void plugin_popup_destroy(Resource *resource) override;
virtual void plugin_popup_source_size(Resource *resource, int32_t width, int32_t height) override;
virtual void plugin_popup_set_cursor(Resource *resource, int32_t cursor_shape) override;

Q_SIGNALS:
void xChanged();
void yChanged();
void heightChanged();
void widthChanged();
void cursorShapeRequested(int cursorShape);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这里要不要再加个cursorShape属性,导出到qml中,


private:
PluginManager* m_manager;
Expand Down
14 changes: 14 additions & 0 deletions panels/dock/tray/ShellSurfaceItemProxy.qml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ Item {
property bool inputEventsEnabled: true
property bool hovered: hoverHandler.hovered
property bool pressed: tapHandler.pressed
property int cursorShape: Qt.ArrowCursor

implicitWidth: shellSurface ? shellSurface.width : 10
implicitHeight: shellSurface ? shellSurface.height : 10
Expand All @@ -42,6 +43,7 @@ Item {

HoverHandler {
id: hoverHandler
cursorShape: root.cursorShape
}
TapHandler {
id: tapHandler
Expand Down Expand Up @@ -111,5 +113,17 @@ Item {
})
})
}

function onCursorShapeRequested(cursorShape)
{
console.log("onCursorShapeRequested:", cursorShape)
// Qt::CursorShape range is 0-21, plus 24 (BitmapCursor) and 25 (CustomCursor).
// We set a default if the value is out of logical bounds.
if (cursorShape < 0 || cursorShape > 25) {
root.cursorShape = Qt.ArrowCursor
} else {
root.cursorShape = cursorShape
}
Comment on lines +122 to +126
Copy link

Copilot AI Feb 5, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The validation logic allows cursor shape values 22 and 23, which are not valid Qt cursor shapes. According to the comment on line 120-121, Qt::CursorShape has values 0-21, then 24-25, with a gap at 22-23. The validation should explicitly exclude these invalid values to prevent potential rendering issues. Consider checking if the value is in the valid ranges: (cursorShape >= 0 && cursorShape <= 21) || cursorShape == 24 || cursorShape == 25.

Copilot uses AI. Check for mistakes.
}
}
}