on xenial help sign in
experimental 3-finger drag support
fc4d76fLukáš Tinkl
qml/Shell.qml+2−2
@@ -549,8 +549,8 @@ Item {
549 }
549 }
550
550
551 WindowControlsOverlay {
551 WindowControlsOverlay {
552− x: target ? target.x : undefined
552+ x: target ? target.x : -1
553− y: target ? target.y : undefined
553+ y: target ? target.y : -1
554 width: target ? target.width : undefined
554 width: target ? target.width : undefined
555 height: target? target.height : undefined
555 height: target? target.height : undefined
556 target: applicationsDisplayLoader.item && applicationsDisplayLoader.item.mainAppDelegate ? applicationsDisplayLoader.item.mainAppDelegate : null
556 target: applicationsDisplayLoader.item && applicationsDisplayLoader.item.mainAppDelegate ? applicationsDisplayLoader.item.mainAppDelegate : null
qml/Stages/ResizeGrip.qml+1−1
@@ -37,7 +37,7 @@ Rectangle {
37
37
38 MouseArea {
38 MouseArea {
39 anchors.fill: parent
39 anchors.fill: parent
40− anchors.margins: -units.gu(1)
40+ anchors.margins: -units.gu(1.5)
41 hoverEnabled: true
41 hoverEnabled: true
42
42
43 Mouse.enabled: resizeTarget
43 Mouse.enabled: resizeTarget
qml/Stages/WindowControlsOverlay.qml+35−20
@@ -35,12 +35,11 @@ Item {
35 minimumTouchPoints: 2
35 minimumTouchPoints: 2
36 maximumTouchPoints: minimumTouchPoints
36 maximumTouchPoints: minimumTouchPoints
37 recognitionPeriod: 500
37 recognitionPeriod: 500
38− releaseRejectPeriod: 500
38+ //releaseRejectPeriod: 500
39
39
40 readonly property bool recognizedPress: status == TouchGestureArea.Recognized &&
40 readonly property bool recognizedPress: status == TouchGestureArea.Recognized &&
41 touchPoints.length >= minimumTouchPoints &&
41 touchPoints.length >= minimumTouchPoints &&
42 touchPoints.length <= maximumTouchPoints
42 touchPoints.length <= maximumTouchPoints
43−
44 onRecognizedPressChanged: {
43 onRecognizedPressChanged: {
45 if (recognizedPress && target && !target.fullscreen) {
44 if (recognizedPress && target && !target.fullscreen) {
46 print("!!! RECOGNIZED")
45 print("!!! RECOGNIZED")
@@ -48,6 +47,17 @@ Item {
48 }
47 }
49 }
48 }
50
49
50+ readonly property bool recognizedDrag: recognizedPress && dragging
51+ onRecognizedDragChanged: {
52+ print("Dragging:", recognizedDrag);
53+ priv.handlePressedChanged(recognizedDrag, center.x, center.y);
54+ }
55+
56+ readonly property point center: Qt.point(touchPoints[0].x, touchPoints[0].y);
57+ onCenterChanged: {
58+ priv.handlePositionChanged(center.x, center.y)
59+ }
60+
51 onStatusChanged: {
61 onStatusChanged: {
52 print("Status changed:", status)
62 print("Status changed:", status)
53 }
63 }
@@ -67,6 +77,27 @@ Item {
67 property bool dragging
77 property bool dragging
68
78
69 readonly property var resizeArea: root.target && root.target.resizeArea ? root.target.resizeArea : null
79 readonly property var resizeArea: root.target && root.target.resizeArea ? root.target.resizeArea : null
80+
81+ function handlePressedChanged(pressed, mouseX, mouseY) {
82+ if (pressed) {
83+ var pos = mapToItem(root.target, mouseX, mouseY);
84+ print("SAVING POS", pos.x, pos.y)
85+ priv.distanceX = pos.x;
86+ priv.distanceY = pos.y;
87+ priv.dragging = true;
88+ } else {
89+ priv.dragging = false;
90+ }
91+ }
92+
93+ function handlePositionChanged(mouseX, mouseY) {
94+ if (priv.dragging) {
95+ var pos = mapToItem(root.target.parent, mouseX, mouseY);
96+ root.target.x = pos.x - priv.distanceX;
97+ root.target.y = Math.max(pos.y - priv.distanceY, PanelState.panelHeight);
98+ print("MOVED TO", root.target.x, root.target.y)
99+ }
100+ }
70 }
101 }
71
102
72 Binding {
103 Binding {
@@ -106,24 +137,8 @@ Item {
106 hoverEnabled: true
137 hoverEnabled: true
107 cursorShape: priv.dragging ? Qt.ClosedHandCursor : (overlay.visible ? Qt.OpenHandCursor : Qt.ArrowCursor)
138 cursorShape: priv.dragging ? Qt.ClosedHandCursor : (overlay.visible ? Qt.OpenHandCursor : Qt.ArrowCursor)
108
139
109− onPressedChanged: {
140+ onPressedChanged: priv.handlePressedChanged(pressed, mouseX, mouseY)
110− if (pressed) {
111− var pos = mapToItem(root.target, mouseX, mouseY);
112− priv.distanceX = pos.x;
113− priv.distanceY = pos.y;
114− priv.dragging = true;
115− } else {
116− priv.dragging = false;
117− }
118− }
119−
120− onPositionChanged: {
141+ onPositionChanged: priv.handlePositionChanged(mouseX, mouseY)
121− if (priv.dragging) {
122− var pos = mapToItem(root.target.parent, mouseX, mouseY);
123− root.target.x = pos.x - priv.distanceX;
124− root.target.y = Math.max(pos.y - priv.distanceY, PanelState.panelHeight);
125− }
126− }
127 }
142 }
128
143
129 // dismiss area
144 // dismiss area