@@ -27,14 +27,16 @@ Item {
27 // to be set from outside
27 // to be set from outside
28 property Item target // appDelegate
28 property Item target // appDelegate
30+ readonly property bool overlayShown: overlay.visible
30 TouchGestureArea {
32 TouchGestureArea {
31 id: gestureArea
33 id: gestureArea
32 anchors.fill: parent
34 anchors.fill: parent
34 // NB: for testing set to 2, not to clash with unity7 touch overlay controls
36 // NB: for testing set to 2, not to clash with unity7 touch overlay controls
35− minimumTouchPoints: 3
37+ minimumTouchPoints: 2
36 maximumTouchPoints: minimumTouchPoints
38 maximumTouchPoints: minimumTouchPoints
37− recognitionPeriod: 500
39+ releaseRejectPeriod: 500
39 readonly property bool recognizedPress: status == TouchGestureArea.Recognized &&
41 readonly property bool recognizedPress: status == TouchGestureArea.Recognized &&
40 touchPoints.length >= minimumTouchPoints &&
42 touchPoints.length >= minimumTouchPoints &&
@@ -47,12 +49,18 @@ Item {
48 readonly property bool recognizedDrag: recognizedPress && dragging
50 readonly property bool recognizedDrag: recognizedPress && dragging
49 onRecognizedDragChanged: {
51 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;
53 readonly property point tp: recognizedPress ? Qt.point(touchPoints[0].x, touchPoints[0].y) : Qt.point(-1, -1)
59 readonly property point tp: recognizedPress ? Qt.point(touchPoints[0].x, touchPoints[0].y) : Qt.point(-1, -1)
54 onUpdated: {
60 onUpdated: {
61+ if (recognizedDrag) {
55− priv.handlePositionChanged(tp.x, tp.y)
62+ priv.handlePositionChanged(tp.x, tp.y);
@@ -85,24 +93,18 @@ Item {
85 function handlePositionChanged(mouseX, mouseY) {
93 function handlePositionChanged(mouseX, mouseY) {
86 if (priv.dragging) {
94 if (priv.dragging) {
87 var pos = mapToItem(root.target.parent, mouseX, mouseY);
95 var pos = mapToItem(root.target.parent, mouseX, mouseY);
88− root.target.x = pos.x - priv.distanceX;
96+ root.target.x = Math.round(pos.x - priv.distanceX);
89− root.target.y = Math.max(pos.y - priv.distanceY, PanelState.panelHeight);
97+ root.target.y = Math.round(Math.max(pos.y - priv.distanceY, PanelState.panelHeight));
95− target: TouchControlsState
96− property: "overlayShown"
97− value: overlay.visible
100 // the visual overlay
102 // the visual overlay
102 id: overlay
104 id: overlay
103 objectName: "windowControlsOverlay"
105 objectName: "windowControlsOverlay"
104 anchors.fill: parent
106 anchors.fill: parent
105− enabled: target.surface == MirFocusController.focusedSurface && overlayTimer.running
107+ enabled: target && overlayTimer.running
106 visible: opacity > 0
108 visible: opacity > 0
107 opacity: enabled ? 0.95 : 0
109 opacity: enabled ? 0.95 : 0
@@ -123,6 +125,7 @@ Item {
124 // move handler
126 // move handler
125 MouseArea {
127 MouseArea {
126 anchors.fill: parent
129 anchors.fill: parent
127 visible: overlay.visible
130 visible: overlay.visible
128 enabled: visible
131 enabled: visible