on xenial help sign in
Use a timer to avoid showing the "grabbing" cursor on a double click. A similar solution is used in unity7 too.
a6afc09Andrea Azzarone
qml/Stages/WindowDecoration.qml+10−1
@@ -50,21 +50,30 @@ MouseArea {
50 property bool dragging
50 property bool dragging
51 }
51 }
52
52
53+ Timer {
54+ id: mouseDownTimer
55+ interval: 175
56+ onTriggered: Mir.cursorName = "grabbing";
57+ }
58+
53 onPressedChanged: {
59 onPressedChanged: {
54 if (pressed && pressedButtons == Qt.LeftButton) {
60 if (pressed && pressedButtons == Qt.LeftButton) {
55 var pos = mapToItem(root.target, mouseX, mouseY);
61 var pos = mapToItem(root.target, mouseX, mouseY);
56 priv.distanceX = pos.x;
62 priv.distanceX = pos.x;
57 priv.distanceY = pos.y;
63 priv.distanceY = pos.y;
58 priv.dragging = true;
64 priv.dragging = true;
59− Mir.cursorName = "grabbing"
65+ mouseDownTimer.start();
60 } else {
66 } else {
61 priv.dragging = false;
67 priv.dragging = false;
68+ mouseDownTimer.stop();
62 Mir.cursorName = "";
69 Mir.cursorName = "";
63 }
70 }
64 }
71 }
65
72
66 onPositionChanged: {
73 onPositionChanged: {
67 if (priv.dragging) {
74 if (priv.dragging) {
75+ mouseDownTimer.stop();
76+ Mir.cursorName = "grabbing";
68 var pos = mapToItem(root.target.parent, mouseX, mouseY);
77 var pos = mapToItem(root.target.parent, mouseX, mouseY);
69 // Use integer coordinate values to ensure that target is left in a pixel-aligned
78 // Use integer coordinate values to ensure that target is left in a pixel-aligned
70 // position. Mouse movement could have subpixel precision, yielding a fractional
79 // position. Mouse movement could have subpixel precision, yielding a fractional