@@ -77,7 +77,6 @@ Rectangle {
77 var appIndex = priv.indexOf(appId);
77 var appIndex = priv.indexOf(appId);
78 var appDelegate = appRepeater.itemAt(appIndex);
78 var appDelegate = appRepeater.itemAt(appIndex);
79 appDelegate.minimized = false;
79 appDelegate.minimized = false;
80− appDelegate.focus = true;
81 ApplicationManager.focusApplication(appId);
80 ApplicationManager.focusApplication(appId);
@@ -91,12 +90,6 @@ Rectangle {
91 return index >= 0 && index < appRepeater.count ? appRepeater.itemAt(index) : null
90 return index >= 0 && index < appRepeater.count ? appRepeater.itemAt(index) : null
94− onFocusedAppDelegateChanged: {
95− if (focusedAppDelegate) {
96− focusedAppDelegate.focus = true;
100 function indexOf(appId) {
93 function indexOf(appId) {
101 for (var i = 0; i < ApplicationManager.count; i++) {
94 for (var i = 0; i < ApplicationManager.count; i++) {
102 if (ApplicationManager.get(i).appId == appId) {
95 if (ApplicationManager.get(i).appId == appId) {
@@ -133,23 +126,28 @@ Rectangle {
133 id: appContainer
126 id: appContainer
134 objectName: "appContainer"
127 objectName: "appContainer"
135 anchors.fill: parent
128 anchors.fill: parent
137 Keys.onPressed: {
131 Keys.onPressed: {
138 switch (event.key) {
132 switch (event.key) {
139 case Qt.Key_Left:
133 case Qt.Key_Left:
140 case Qt.Key_Backtab:
134 case Qt.Key_Backtab:
141 selectPrevious(event.isAutoRepeat)
135 selectPrevious(event.isAutoRepeat)
136+ event.accepted = true;
143 case Qt.Key_Right:
138 case Qt.Key_Right:
144 case Qt.Key_Tab:
139 case Qt.Key_Tab:
145 selectNext(event.isAutoRepeat)
140 selectNext(event.isAutoRepeat)
141+ event.accepted = true;
147 case Qt.Key_Escape:
143 case Qt.Key_Escape:
148 appRepeater.highlightedIndex = -1
144 appRepeater.highlightedIndex = -1
145+ event.accepted = true;
149 case Qt.Key_Enter:
146 case Qt.Key_Enter:
150 case Qt.Key_Return:
147 case Qt.Key_Return:
151 case Qt.Key_Space:
148 case Qt.Key_Space:
152 root.state = ""
149 root.state = ""
150+ event.accepted = true;
@@ -180,7 +178,8 @@ Rectangle {
181 function focusSelected() {
179 function focusSelected() {
182 if (appRepeater.highlightedIndex != -1) {
180 if (appRepeater.highlightedIndex != -1) {
183− appRepeater.itemAt(appRepeater.highlightedIndex).focus = true;
181+ var application = ApplicationManager.get(appRepeater.highlightedIndex);
182+ ApplicationManager.focusApplication(application.appId);
@@ -220,17 +219,7 @@ Rectangle {
220 property bool maximized: false
219 property bool maximized: false
221 property bool minimized: false
220 property bool minimized: false
223− onFocusChanged: {
222+ focus: priv.focusedAppId === model.appId && root.state !== "altTab"
224− if (focus && ApplicationManager.focusedApplicationId !== model.appId) {
225− ApplicationManager.requestFocusApplication(model.appId);
226− decoratedWindow.forceActiveFocus();
229− Component.onCompleted: {
230− if (ApplicationManager.focusedApplicationId == model.appId) {
231− decoratedWindow.forceActiveFocus();
235 Binding {
224 Binding {
236 target: ApplicationManager.get(index)
225 target: ApplicationManager.get(index)
@@ -356,7 +345,7 @@ Rectangle {
356 resizeHandleWidth: units.gu(2)
345 resizeHandleWidth: units.gu(2)
357 windowId: model.appId // FIXME: Change this to point to windowId once we have such a thing
346 windowId: model.appId // FIXME: Change this to point to windowId once we have such a thing
359− onPressed: appDelegate.focus = true;
348+ onPressed: ApplicationManager.focusApplication(model.appId);
362 DecoratedWindow {
351 DecoratedWindow {
@@ -368,7 +357,7 @@ Rectangle {
368 windowHeight: appDelegate.windowHeight
357 windowHeight: appDelegate.windowHeight
369 application: ApplicationManager.get(index)
358 application: ApplicationManager.get(index)
370 active: ApplicationManager.focusedApplicationId === model.appId
359 active: ApplicationManager.focusedApplicationId === model.appId
371− focus: false
360+ focus: true
373 onClose: ApplicationManager.stopApplication(model.appId)
362 onClose: ApplicationManager.stopApplication(model.appId)
374 onMaximize: appDelegate.maximize()
363 onMaximize: appDelegate.maximize()
@@ -641,7 +630,6 @@ Rectangle {
641 PropertyChanges { target: spreadFlickable; enabled: spreadFlickable.contentWidth > spreadFlickable.minContentWidth }
630 PropertyChanges { target: spreadFlickable; enabled: spreadFlickable.contentWidth > spreadFlickable.minContentWidth }
642 PropertyChanges { target: currentSelectedLabel; visible: true }
631 PropertyChanges { target: currentSelectedLabel; visible: true }
643 PropertyChanges { target: spreadBackground; visible: true }
632 PropertyChanges { target: spreadBackground; visible: true }
644− PropertyChanges { target: appContainer; focus: true }
645 PropertyChanges { target: hoverMouseArea; enabled: true }
633 PropertyChanges { target: hoverMouseArea; enabled: true }