on xenial help sign in
simplify code
commitb73d337c5bcb8e171886ae4eacae2d9aad66f3b7 authorLukáš Tinkl <lukas.tinkl@canonical.com> dateThu 3 Dec 2015, 16:00 (11 years ago) parent5d64150
2 files changed+2−24
plugins/Cursor/Cursor.qml−20 qml/Shell.qml+2−4
plugins/Cursor/Cursor.qml−20
@@ -19,30 +19,10 @@ import Cursor 1.0 // For MousePointer
1919
2020MousePointer {
2121 id: mousePointer
22− opacity: cursorVisible ? 1 : 0
23−
24− property bool cursorVisible: visible // initial value, based on shell.hasMouse
2522
2623 Image {
2724 x: -mousePointer.hotspotX
2825 y: -mousePointer.hotspotY
2926 source: "image://cursor/" + mousePointer.themeName + "/" + mousePointer.cursorName
3027 }
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− }
4828}
qml/Shell.qml+2−4
@@ -178,7 +178,7 @@ Item {
178178
179179 WindowInputMonitor {
180180 onHomeKeyActivated: { launcher.fadeOut(); shell.showHome(); }
181− onTouchBegun: { cursor.hideCursor(); }
181+ onTouchBegun: { cursor.opacity = 0; }
182182 onTouchEnded: {
183183 // move the (hidden) cursor to the last known touch position
184184 cursor.x = pos.x;
@@ -683,9 +683,7 @@ Item {
683683 }
684684 }
685685
686− onMouseMoved: {
687− cursor.revealCursor();
688− }
686+ onMouseMoved: { cursor.opacity = 1; }
689687 }
690688
691689 Rectangle {