on xenial help sign in
Center cursor on screen when it's first shown
c95d02aDaniel d'Andrada
qml/Shell.qml+13−1
@@ -221,6 +221,7 @@ Item {
221 var mappedCoords = mapFromItem(null, pos.x, pos.y);
221 var mappedCoords = mapFromItem(null, pos.x, pos.y);
222 cursor.x = mappedCoords.x;
222 cursor.x = mappedCoords.x;
223 cursor.y = mappedCoords.y;
223 cursor.y = mappedCoords.y;
224+ cursor.mouseNeverMoved = false;
224 }
225 }
225 }
226 }
226
227
@@ -716,6 +717,14 @@ Item {
716 visible: shell.hasMouse
717 visible: shell.hasMouse
717 z: screenGrabber.z + 1
718 z: screenGrabber.z + 1
718
719
720+ property bool mouseNeverMoved: true
721+ Binding {
722+ target: cursor; property: "x"; value: shell.width / 2; when: mouseNeverMoved && visible
723+ }
724+ Binding {
725+ target: cursor; property: "y"; value: shell.height / 2; when: mouseNeverMoved && visible
726+ }
727+
719 onPushedLeftBoundary: {
728 onPushedLeftBoundary: {
720 if (buttons === Qt.NoButton) {
729 if (buttons === Qt.NoButton) {
721 launcher.pushEdge(amount);
730 launcher.pushEdge(amount);
@@ -729,7 +738,10 @@ Item {
729 }
738 }
730 }
739 }
731
740
741+ onMouseMoved: {
742+ mouseNeverMoved = false;
732− onMouseMoved: { cursor.opacity = 1; }
743+ cursor.opacity = 1;
744+ }
733 }
745 }
734
746
735 // non-visual object
747 // non-visual object