@@ -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;
77 ApplicationManager.focusApplication(appId);
76 ApplicationManager.focusApplication(appId);
@@ -108,8 +107,8 @@ Rectangle {
108 onClose: {
107 onClose: {
109 ApplicationManager.stopApplication(ApplicationManager.focusedApplicationId)
108 ApplicationManager.stopApplication(ApplicationManager.focusedApplicationId)
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();
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+ property bool maximized: false
200+ property bool minimized: false
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 {
213+ function maximize() {
217+ function minimize() {
221+ function unmaximize() {
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 {
219 states: [
234 states: [
221− name: "normal"
236+ name: "normal"; when: !appDelegate.maximized && !appDelegate.minimized && root.state !== "altTab"
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 }
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 }
@@ -307,8 +322,8 @@ Rectangle {
307 focus: false
322 focus: false
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()
313 transform: [
328 transform: [