on xenial help sign in
tweak state handling a bit
8c65fd0Michael Zanetti
qml/Stages/DesktopStage.qml+25−10
@@ -71,9 +71,8 @@ Rectangle {
71 onFocusRequested: {
71 onFocusRequested: {
72 var appIndex = priv.indexOf(appId);
72 var appIndex = priv.indexOf(appId);
73 var appDelegate = appRepeater.itemAt(appIndex);
73 var appDelegate = appRepeater.itemAt(appIndex);
74− if (appDelegate.state === "minimized") {
74+ print("focus requested", appDelegate.minimized, appDelegate.maximized)
75− appDelegate.state = "normal"
75+ appDelegate.minimized = false;
76− }
77 ApplicationManager.focusApplication(appId);
76 ApplicationManager.focusApplication(appId);
78 }
77 }
79 }
78 }
@@ -108,8 +107,8 @@ Rectangle {
108 onClose: {
107 onClose: {
109 ApplicationManager.stopApplication(ApplicationManager.focusedApplicationId)
108 ApplicationManager.stopApplication(ApplicationManager.focusedApplicationId)
110 }
109 }
111− onMinimize: appRepeater.itemAt(0).state = "minimized"
110+ onMinimize: appRepeater.itemAt(0).minimize();
112− onMaximize: appRepeater.itemAt(0).state = "normal"
111+ onMaximize: appRepeater.itemAt(0).unmaximize();
113 }
112 }
114
113
115 Binding {
114 Binding {
@@ -197,6 +196,9 @@ Rectangle {
197 readonly property int minWidth: units.gu(10)
196 readonly property int minWidth: units.gu(10)
198 readonly property int minHeight: units.gu(10)
197 readonly property int minHeight: units.gu(10)
199
198
199+ property bool maximized: false
200+ property bool minimized: false
201+
200 onFocusChanged: {
202 onFocusChanged: {
201 if (focus && ApplicationManager.focusedApplicationId !== model.appId) {
203 if (focus && ApplicationManager.focusedApplicationId !== model.appId) {
202 ApplicationManager.requestFocusApplication(model.appId);
204 ApplicationManager.requestFocusApplication(model.appId);
@@ -208,6 +210,19 @@ Rectangle {
208 }
210 }
209 }
211 }
210
212
213+ function maximize() {
214+ minimized = false;
215+ maximized = true;
216+ }
217+ function minimize() {
218+ maximized = false;
219+ minimized = true;
220+ }
221+ function unmaximize() {
222+ minimized = false;
223+ maximized = false;
224+ }
225+
211 Behavior on x {
226 Behavior on x {
212 id: closeBehavior
227 id: closeBehavior
213 enabled: appRepeater.closingIndex >= 0
228 enabled: appRepeater.closingIndex >= 0
@@ -218,14 +233,14 @@ Rectangle {
218
233
219 states: [
234 states: [
220 State {
235 State {
221− name: "normal"
236+ name: "normal"; when: !appDelegate.maximized && !appDelegate.minimized && root.state !== "altTab"
222 },
237 },
223 State {
238 State {
224− name: "maximized"
239+ name: "maximized"; when: appDelegate.maximized && (root.state !== "altTab" || (root.state == "altTab" && !root.workspacesUpdated))
225 PropertyChanges { target: appDelegate; x: 0; y: 0; width: root.width; height: root.height }
240 PropertyChanges { target: appDelegate; x: 0; y: 0; width: root.width; height: root.height }
226 },
241 },
227 State {
242 State {
228− name: "minimized"
243+ name: "minimized"; when: appDelegate.minimized && (root.state !== "altTab" || (root.state == "altTab" && !root.workspacesUpdated))
229 PropertyChanges { target: appDelegate; x: -appDelegate.width / 2; scale: units.gu(5) / appDelegate.width; opacity: 0 }
244 PropertyChanges { target: appDelegate; x: -appDelegate.width / 2; scale: units.gu(5) / appDelegate.width; opacity: 0 }
230 },
245 },
231 State {
246 State {
@@ -307,8 +322,8 @@ Rectangle {
307 focus: false
322 focus: false
308
323
309 onClose: ApplicationManager.stopApplication(model.appId)
324 onClose: ApplicationManager.stopApplication(model.appId)
310− onMaximize: appDelegate.state = (appDelegate.state == "maximized" ? "normal" : "maximized")
325+ onMaximize: appDelegate.maximize()
311− onMinimize: appDelegate.state = "minimized"
326+ onMinimize: appDelegate.minimize()
312
327
313 transform: [
328 transform: [
314 Scale {
329 Scale {