on xenial help sign in
activate/focus/restore windows when clicking on their decoration or

when activating them from the spread

commitd84f955a30c924b5387901b5cdeb25004f9a22fb authorLukáš Tinkl <lukas.tinkl@canonical.com> dateSat 17 Oct 2015, 00:26 (11 years ago) parentcab9943
2 files changed+9−3
qml/Stages/DesktopStage.qml+6−2 qml/Stages/WindowMoveResizeArea.qml+3−1
qml/Stages/DesktopStage.qml+6−2
@@ -86,6 +86,11 @@ Rectangle {
8686 var index = indexOf(focusedAppId);
8787 return index >= 0 && index < appRepeater.count ? appRepeater.itemAt(index) : null
8888 }
89+ onFocusedAppDelegateChanged: { // restore the window from minimization when we focus it (e.g. using spread)
90+ if (priv.focusedAppDelegate.minimized) {
91+ priv.focusedAppDelegate.unmaximize()
92+ }
93+ }
8994
9095 function indexOf(appId) {
9196 for (var i = 0; i < ApplicationManager.count; i++) {
@@ -222,8 +227,7 @@ Rectangle {
222227 minHeight: appDelegate.minHeight
223228 resizeHandleWidth: units.gu(2)
224229 windowId: model.appId // FIXME: Change this to point to windowId once we have such a thing
225−
226− onPressed: { ApplicationManager.focusApplication(model.appId) }
230+ appId: model.appId
227231 }
228232
229233 DecoratedWindow {
qml/Stages/WindowMoveResizeArea.qml+3−1
@@ -19,6 +19,7 @@
1919import QtQuick 2.3
2020import Ubuntu.Components 1.1
2121import Utils 0.1
22+import Unity.Application 0.1
2223
2324MouseArea {
2425 id: root
@@ -31,6 +32,7 @@ MouseArea {
3132 // The area will anchor to it and manage move and resize events
3233 property Item target: null
3334 property string windowId: ""
35+ property string appId: ""
3436 property int resizeHandleWidth: 0
3537 property int minWidth: 0
3638 property int minHeight: 0
@@ -46,7 +48,6 @@ MouseArea {
4648 property bool resizeBottom: false
4749 property bool resizeLeft: false
4850 property bool resizeRight: false
49−
5051 }
5152
5253 Component.onCompleted: {
@@ -60,6 +61,7 @@ MouseArea {
6061 }
6162
6263 onPressed: {
64+ ApplicationManager.focusApplication(root.appId)
6365 priv.startPoint = Qt.point(mouse.x, mouse.y);
6466 priv.resizeTop = mouseY < root.resizeHandleWidth;
6567 priv.resizeBottom = mouseY > (root.height - root.resizeHandleWidth);