on xenial help sign in
Cursor: Let AnimatedSprite run only on animated cursors and while the display is on
aafa415Daniel d'Andrada
plugins/Cursor/Cursor.qml+26−11
@@ -16,6 +16,7 @@
16
16
17import QtQuick 2.4
17import QtQuick 2.4
18import Cursor 1.1
18import Cursor 1.1
19+import Powerd 0.1
19
20
20MousePointer {
21MousePointer {
21 id: mousePointer
22 id: mousePointer
@@ -26,19 +27,33 @@ MousePointer {
26 cursorName: mousePointer.cursorName
27 cursorName: mousePointer.cursorName
27 }
28 }
28
29
30+ Loader {
31+ active: mousePointer.visible && imageInfo.frameCount > 1
29− AnimatedSprite {
32+ sourceComponent: AnimatedSprite {
30− x: -imageInfo.hotspot.x
33+ x: -imageInfo.hotspot.x
31− y: -imageInfo.hotspot.y
34+ y: -imageInfo.hotspot.y
32− source: "image://cursor/" + mousePointer.themeName + "/" + mousePointer.cursorName
35+ source: "image://cursor/" + mousePointer.themeName + "/" + mousePointer.cursorName
33
36
34− interpolate: false
37+ interpolate: false
35
38
36− width: imageInfo.frameWidth
39+ width: imageInfo.frameWidth
37− height: imageInfo.frameHeight
40+ height: imageInfo.frameHeight
38
41
39− frameCount: imageInfo.frameCount
42+ frameCount: imageInfo.frameCount
40− frameDuration: imageInfo.frameDuration
43+ frameDuration: imageInfo.frameDuration
41− frameWidth: imageInfo.frameWidth
44+ frameWidth: imageInfo.frameWidth
42− frameHeight: imageInfo.frameHeight
45+ frameHeight: imageInfo.frameHeight
46+
47+ running: Powerd.status === Powerd.On
48+ }
49+ }
50+
51+ Loader {
52+ active: mousePointer.visible && imageInfo.frameCount === 1
53+ sourceComponent: Image {
54+ x: -imageInfo.hotspot.x
55+ y: -imageInfo.hotspot.y
56+ source: "image://cursor/" + mousePointer.themeName + "/" + mousePointer.cursorName
57+ }
43 }
58 }
44}
59}