on xenial help sign in
simplify code
b73d337Lukáš Tinkl
plugins/Cursor/Cursor.qml−20
@@ -19,30 +19,10 @@ import Cursor 1.0 // For MousePointer
19
19
20MousePointer {
20MousePointer {
21 id: mousePointer
21 id: mousePointer
22− opacity: cursorVisible ? 1 : 0
23−
24− property bool cursorVisible: visible // initial value, based on shell.hasMouse
25
22
26 Image {
23 Image {
27 x: -mousePointer.hotspotX
24 x: -mousePointer.hotspotX
28 y: -mousePointer.hotspotY
25 y: -mousePointer.hotspotY
29 source: "image://cursor/" + mousePointer.themeName + "/" + mousePointer.cursorName
26 source: "image://cursor/" + mousePointer.themeName + "/" + mousePointer.cursorName
30 }
27 }
31−
32− QtObject {
33− id: d
34− property bool touchDetected: false;
35− }
36−
37− function hideCursor() {
38− d.touchDetected = true;
39− cursorVisible = false;
40− }
41−
42− function revealCursor() {
43− if (d.touchDetected) {
44− d.touchDetected = false;
45− cursorVisible = true;
46− }
47− }
48}
28}
qml/Shell.qml+2−4
@@ -178,7 +178,7 @@ Item {
178
178
179 WindowInputMonitor {
179 WindowInputMonitor {
180 onHomeKeyActivated: { launcher.fadeOut(); shell.showHome(); }
180 onHomeKeyActivated: { launcher.fadeOut(); shell.showHome(); }
181− onTouchBegun: { cursor.hideCursor(); }
181+ onTouchBegun: { cursor.opacity = 0; }
182 onTouchEnded: {
182 onTouchEnded: {
183 // move the (hidden) cursor to the last known touch position
183 // move the (hidden) cursor to the last known touch position
184 cursor.x = pos.x;
184 cursor.x = pos.x;
@@ -683,9 +683,7 @@ Item {
683 }
683 }
684 }
684 }
685
685
686− onMouseMoved: {
686+ onMouseMoved: { cursor.opacity = 1; }
687− cursor.revealCursor();
688− }
689 }
687 }
690
688
691 Rectangle {
689 Rectangle {