on xenial help sign in
Center cursor on screen when it's first shown
commit400ecad250a353f9aee7b2e96fa1ef3313f38c4f authorDaniel d'Andrada <daniel.dandrada@canonical.com> dateFri 17 Jun 2016, 01:17 (10 years ago) parentd8ebc06e78d482
1 file changed+15−1
qml/Shell.qml+15−1
qml/Shell.qml+15−1
@@ -221,6 +221,7 @@ StyledItem {
221221 var mappedCoords = mapFromItem(null, pos.x, pos.y);
222222 cursor.x = mappedCoords.x;
223223 cursor.y = mappedCoords.y;
224+ cursor.mouseNeverMoved = false;
224225 }
225226 }
226227
@@ -749,6 +750,16 @@ StyledItem {
749750 visible: shell.hasMouse
750751 z: itemGrabber.z + 1
751752
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+
752763 onPushedLeftBoundary: {
753764 if (buttons === Qt.NoButton) {
754765 launcher.pushEdge(amount);
@@ -762,7 +773,10 @@ StyledItem {
762773 }
763774 }
764775
765− onMouseMoved: { cursor.opacity = 1; }
776+ onMouseMoved: {
777+ mouseNeverMoved = false;
778+ cursor.opacity = 1;
779+ }
766780 }
767781
768782 // non-visual object