@@ -27,14 +27,16 @@ Item {
2727 // to be set from outside
2828 property Item target // appDelegate
2929
30+ readonly property bool overlayShown: overlay.visible
31+
3032 TouchGestureArea {
3133 id: gestureArea
3234 anchors.fill: parent
3335
3436 // NB: for testing set to 2, not to clash with unity7 touch overlay controls
35− minimumTouchPoints: 3
37+ minimumTouchPoints: 2
3638 maximumTouchPoints: minimumTouchPoints
37− recognitionPeriod: 500
39+ releaseRejectPeriod: 500
3840
3941 readonly property bool recognizedPress: status == TouchGestureArea.Recognized &&
4042 touchPoints.length >= minimumTouchPoints &&
@@ -47,12 +49,18 @@ Item {
4749
4850 readonly property bool recognizedDrag: recognizedPress && dragging
4951 onRecognizedDragChanged: {
50− priv.handlePressedChanged(recognizedDrag, tp.x, tp.y);
52+ if (recognizedDrag) {
53+ priv.handlePressedChanged(true, tp.x, tp.y);
54+ } else if (!moveHandler.containsPress) { // prevent interfering with the central piece drag/move
55+ priv.dragging = false;
56+ }
5157 }
5258
5359 readonly property point tp: recognizedPress ? Qt.point(touchPoints[0].x, touchPoints[0].y) : Qt.point(-1, -1)
5460 onUpdated: {
55− priv.handlePositionChanged(tp.x, tp.y)
61+ if (recognizedDrag) {
62+ priv.handlePositionChanged(tp.x, tp.y);
63+ }
5664 }
5765 }
5866
@@ -85,24 +93,18 @@ Item {
8593 function handlePositionChanged(mouseX, mouseY) {
8694 if (priv.dragging) {
8795 var pos = mapToItem(root.target.parent, mouseX, mouseY);
88− root.target.x = pos.x - priv.distanceX;
89− root.target.y = Math.max(pos.y - priv.distanceY, PanelState.panelHeight);
96+ root.target.x = Math.round(pos.x - priv.distanceX);
97+ root.target.y = Math.round(Math.max(pos.y - priv.distanceY, PanelState.panelHeight));
9098 }
9199 }
92100 }
93101
94− Binding {
95− target: TouchControlsState
96− property: "overlayShown"
97− value: overlay.visible
98− }
99−
100102 // the visual overlay
101103 Item {
102104 id: overlay
103105 objectName: "windowControlsOverlay"
104106 anchors.fill: parent
105− enabled: target.surface == MirFocusController.focusedSurface && overlayTimer.running
107+ enabled: target && overlayTimer.running
106108 visible: opacity > 0
107109 opacity: enabled ? 0.95 : 0
108110
@@ -123,6 +125,7 @@ Item {
123125
124126 // move handler
125127 MouseArea {
128+ id: moveHandler
126129 anchors.fill: parent
127130 visible: overlay.visible
128131 enabled: visible