~lukas-kde/unity8/fix-launcher-surface-count-lp1669047

« back to all changes in this revision

Viewing changes to qml/Stage/ChildWindow.qml

  • Committer: Bileto Bot
  • Author(s): Daniel d'Andrada
  • Date: 2017-03-08 09:50:55 UTC
  • mfrom: (2833.2.1 dragChildWithAltPress)
  • Revision ID: ci-train-bot@canonical.com-20170308095055-kvpcnkig2nboe8xi
Drag child windows with Alt+LeftMouseButton (LP: #1664947)

Approved by: Lukáš Tinkl, Unity8 CI Bot

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/*
2
 
 * Copyright (C) 2016 Canonical, Ltd.
 
2
 * Copyright (C) 2016-2017 Canonical, Ltd.
3
3
 *
4
4
 * This program is free software; you can redistribute it and/or modify
5
5
 * it under the terms of the GNU General Public License as published by
144
144
    }
145
145
 
146
146
    Loader {
 
147
        active: d.moveable
 
148
        anchors.fill: parent
 
149
        sourceComponent: Component {
 
150
            MouseArea {
 
151
                acceptedButtons: Qt.LeftButton
 
152
                property bool dragging: false
 
153
                cursorShape: undefined // don't interfere with the cursor shape set by the underlying MirSurfaceItem
 
154
                onPressed: {
 
155
                    if (mouse.button == Qt.LeftButton && mouse.modifiers == Qt.AltModifier) {
 
156
                        d.moveHandler.handlePressedChanged(true, Qt.LeftButton, mouse.x, mouse.y);
 
157
                        dragging = true;
 
158
                        mouse.accepted = true;
 
159
                    } else {
 
160
                        mouse.accepted = false;
 
161
                    }
 
162
                }
 
163
                onPositionChanged: {
 
164
                    if (dragging) {
 
165
                        d.moveHandler.handlePositionChanged(mouse);
 
166
                    }
 
167
                }
 
168
                onReleased: {
 
169
                    if (dragging) {
 
170
                        d.moveHandler.handlePressedChanged(false, Qt.LeftButton);
 
171
                        d.moveHandler.handleReleased();
 
172
                        dragging = false;
 
173
                    }
 
174
                }
 
175
            }
 
176
        }
 
177
    }
 
178
 
 
179
    Loader {
147
180
        id: touchOverlayLoader
148
181
        active: d.resizeable || d.moveable
149
182
        anchors.top: decorationLoader.top