From 170b1b13d03ac867287ba19f7b19fb998a421e20 Mon Sep 17 00:00:00 2001 From: rewine Date: Tue, 12 Dec 2023 15:34:07 +0800 Subject: [PATCH] feat: support basic drag-and-drop operations log: https://github.com/vioken/waylib/pull/211 --- src/treeland/quick/qml/Main.qml | 1 + src/treeland/quick/qml/OutputDelegate.qml | 12 +++++++++++- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/src/treeland/quick/qml/Main.qml b/src/treeland/quick/qml/Main.qml index 386b03ed..fa9b7440 100644 --- a/src/treeland/quick/qml/Main.qml +++ b/src/treeland/quick/qml/Main.qml @@ -276,6 +276,7 @@ Item { OutputDelegate { property real topMargin: topbar.height + waylandCursor: cursor1 } } } diff --git a/src/treeland/quick/qml/OutputDelegate.qml b/src/treeland/quick/qml/OutputDelegate.qml index c385950b..aa0a2e36 100644 --- a/src/treeland/quick/qml/OutputDelegate.qml +++ b/src/treeland/quick/qml/OutputDelegate.qml @@ -9,6 +9,7 @@ OutputItem { id: rootOutputItem required property WaylandOutput waylandOutput property OutputViewport onscreenViewport: outputViewport + property Cursor waylandCursor output: waylandOutput devicePixelRatio: waylandOutput.scale @@ -19,6 +20,7 @@ OutputItem { visible: cursor.visible && !cursor.isHardwareCursor Image { + id: cursorImage source: cursor.imageSource x: -cursor.hotspot.x y: -cursor.hotspot.y @@ -27,6 +29,14 @@ OutputItem { height: cursor.size.height sourceClipRect: cursor.sourceRect } + + SurfaceItem { + id: dragIcon + z: cursorImage.z - 1 + flags: SurfaceItem.DontCacheLastBuffer + visible: waylandCursor.dragSurface !== null + surface: waylandCursor.dragSurface + } } OutputViewport { @@ -78,7 +88,7 @@ OutputItem { Image { id: background - source: "file:///usr/share/wallpapers/deepin/desktop.jpg" + source: "file:///run/current-system/sw/share/wallpapers/Altai/contents/images/1080x1920.png" fillMode: Image.PreserveAspectCrop asynchronous: true anchors.fill: parent