on xenial help sign in
Implement moving windows by Alt + left mouse button

Approved by: Daniel d'Andrada

commit0faecb01b14b8801589b5a7ef3e1f4d85281f196 authorLukáš Tinkl <lukas.tinkl@canonical.com> dateMon 24 Oct 2016, 11:35 (10 years ago) parente7bed11787a552
1 file changed+29
qml/Stage/DecoratedWindow.qml+29
qml/Stage/DecoratedWindow.qml+29
@@ -225,7 +225,36 @@ FocusScope {
225225 yScale: applicationWindow.itemScale
226226 }
227227 ]
228+ }
228229
230+ MouseArea {
231+ anchors.fill: applicationWindow
232+ acceptedButtons: Qt.LeftButton
233+ property bool dragging: false
234+ cursorShape: undefined // don't interfere with the cursor shape set by the underlying MirSurfaceItem
235+ onPressed: {
236+ if (mouse.button == Qt.LeftButton && mouse.modifiers == Qt.AltModifier) {
237+ root.decorationPressed(); // to raise it
238+ moveHandler.handlePressedChanged(true, Qt.LeftButton, mouse.x, mouse.y);
239+ dragging = true;
240+ mouse.accepted = true;
241+ } else {
242+ mouse.accepted = false;
243+ }
244+ }
245+ onPositionChanged: {
246+ if (dragging) {
247+ moveHandler.handlePositionChanged(mouse);
248+ }
249+ }
250+ onReleased: {
251+ if (dragging) {
252+ moveHandler.handlePressedChanged(false, Qt.LeftButton);
253+ root.decorationReleased(); // commits the fake preview max rectangle
254+ moveHandler.handleReleased();
255+ dragging = false;
256+ }
257+ }
229258 }
230259
231260 Rectangle {