on xenial help sign in
Center cursor on screen when it's first shown
400ecadDaniel d'Andrada
qml/Shell.qml+15−1
@@ -221,6 +221,7 @@ StyledItem {
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
@@ -749,6 +750,16 @@ StyledItem {
749 visible: shell.hasMouse
750 visible: shell.hasMouse
750 z: itemGrabber.z + 1
751 z: itemGrabber.z + 1
751
752
753+ property bool mouseNeverMoved: true
754+ Binding {
755+ target: cursor; property: "x"; value: shell.width / 2
756+ when: cursor.mouseNeverMoved && cursor.visible
757+ }
758+ Binding {
759+ target: cursor; property: "y"; value: shell.height / 2
760+ when: cursor.mouseNeverMoved && cursor.visible
761+ }
762+
752 onPushedLeftBoundary: {
763 onPushedLeftBoundary: {
753 if (buttons === Qt.NoButton) {
764 if (buttons === Qt.NoButton) {
754 launcher.pushEdge(amount);
765 launcher.pushEdge(amount);
@@ -762,7 +773,10 @@ StyledItem {
762 }
773 }
763 }
774 }
764
775
776+ onMouseMoved: {
777+ mouseNeverMoved = false;
765− onMouseMoved: { cursor.opacity = 1; }
778+ cursor.opacity = 1;
779+ }
766 }
780 }
767
781
768 // non-visual object
782 // non-visual object