Skip to content

Commit 1447b43

Browse files
committed
feat: Add support for modifying the plugin popup cursor shape via the protocol.
add support in plugin-manager-v1.xml Log: Add support for modifying the plugin popup cursor shape via the protocol.
1 parent 1c3b76a commit 1447b43

4 files changed

Lines changed: 23 additions & 1 deletion

File tree

debian/control

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ Build-Depends:
66
debhelper-compat (= 13),
77
cmake,
88
dde-application-manager-api (>= 1.2.23),
9-
dde-tray-loader-dev (>= 1.99.14),
9+
dde-tray-loader-dev (> 2.0.24),
1010
extra-cmake-modules,
1111
libdtk6core-bin,
1212
libdtk6core-dev,

panels/dock/pluginmanagerextension.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -400,6 +400,12 @@ void PluginPopup::plugin_popup_source_size(Resource *resource, int32_t width, in
400400
}
401401
}
402402

403+
void PluginPopup::plugin_popup_set_cursor(Resource *resource, int32_t cursor_shape)
404+
{
405+
Q_UNUSED(resource);
406+
Q_EMIT cursorShapeRequested(cursor_shape);
407+
}
408+
403409
PluginManager::PluginManager(QWaylandCompositor *compositor)
404410
: QWaylandCompositorExtensionTemplate(compositor)
405411
{

panels/dock/pluginmanagerextension_p.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -255,12 +255,14 @@ class PluginPopup : public QWaylandShellSurfaceTemplate<PluginPopup>, public QtW
255255
virtual void plugin_popup_destroy_resource(Resource *resource) override;
256256
virtual void plugin_popup_destroy(Resource *resource) override;
257257
virtual void plugin_popup_source_size(Resource *resource, int32_t width, int32_t height) override;
258+
virtual void plugin_popup_set_cursor(Resource *resource, int32_t cursor_shape) override;
258259

259260
Q_SIGNALS:
260261
void xChanged();
261262
void yChanged();
262263
void heightChanged();
263264
void widthChanged();
265+
void cursorShapeRequested(int cursorShape);
264266

265267
private:
266268
PluginManager* m_manager;

panels/dock/tray/ShellSurfaceItemProxy.qml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ Item {
1616
property bool inputEventsEnabled: true
1717
property bool hovered: hoverHandler.hovered
1818
property bool pressed: tapHandler.pressed
19+
property int cursorShape: Qt.ArrowCursor
1920

2021
implicitWidth: shellSurface ? shellSurface.width : 10
2122
implicitHeight: shellSurface ? shellSurface.height : 10
@@ -42,6 +43,7 @@ Item {
4243

4344
HoverHandler {
4445
id: hoverHandler
46+
cursorShape: root.cursorShape
4547
}
4648
TapHandler {
4749
id: tapHandler
@@ -111,5 +113,17 @@ Item {
111113
})
112114
})
113115
}
116+
117+
function onCursorShapeRequested(cursorShape)
118+
{
119+
console.log("onCursorShapeRequested:", cursorShape)
120+
// Qt::CursorShape range is 0-21, plus 24 (BitmapCursor) and 25 (CustomCursor).
121+
// We set a default if the value is out of logical bounds.
122+
if (cursorShape < 0 || cursorShape > 25) {
123+
root.cursorShape = Qt.ArrowCursor
124+
} else {
125+
root.cursorShape = cursorShape
126+
}
127+
}
114128
}
115129
}

0 commit comments

Comments
 (0)