@@ -77,7 +77,6 @@ Rectangle {
7777 var appIndex = priv.indexOf(appId);
7878 var appDelegate = appRepeater.itemAt(appIndex);
7979 appDelegate.minimized = false;
80− appDelegate.focus = true;
8180 ApplicationManager.focusApplication(appId);
8281 }
8382 }
@@ -91,12 +90,6 @@ Rectangle {
9190 return index >= 0 && index < appRepeater.count ? appRepeater.itemAt(index) : null
9291 }
9392
94− onFocusedAppDelegateChanged: {
95− if (focusedAppDelegate) {
96− focusedAppDelegate.focus = true;
97− }
98− }
99−
10093 function indexOf(appId) {
10194 for (var i = 0; i < ApplicationManager.count; i++) {
10295 if (ApplicationManager.get(i).appId == appId) {
@@ -140,17 +133,21 @@ Rectangle {
140133 case Qt.Key_Left:
141134 case Qt.Key_Backtab:
142135 selectPrevious(event.isAutoRepeat)
136+ event.accepted = true;
143137 break;
144138 case Qt.Key_Right:
145139 case Qt.Key_Tab:
146140 selectNext(event.isAutoRepeat)
141+ event.accepted = true;
147142 break;
148143 case Qt.Key_Escape:
149144 appRepeater.highlightedIndex = -1
145+ event.accepted = true;
150146 case Qt.Key_Enter:
151147 case Qt.Key_Return:
152148 case Qt.Key_Space:
153149 root.state = ""
150+ event.accepted = true;
154151 }
155152 }
156153
@@ -181,7 +178,8 @@ Rectangle {
181178
182179 function focusSelected() {
183180 if (appRepeater.highlightedIndex != -1) {
184− appRepeater.itemAt(appRepeater.highlightedIndex).focus = true;
181+ var application = ApplicationManager.get(appRepeater.highlightedIndex);
182+ ApplicationManager.focusApplication(application.appId);
185183 }
186184 }
187185
@@ -206,11 +204,7 @@ Rectangle {
206204 property bool maximized: false
207205 property bool minimized: false
208206
209− onFocusChanged: {
210− if (focus && ApplicationManager.focusedApplicationId !== model.appId) {
211− ApplicationManager.requestFocusApplication(model.appId);
212− }
213− }
207+ focus: priv.focusedAppId === model.appId && root.state !== "altTab"
214208
215209 Binding {
216210 target: ApplicationManager.get(index)
@@ -321,7 +315,7 @@ Rectangle {
321315 resizeHandleWidth: units.gu(2)
322316 windowId: model.appId // FIXME: Change this to point to windowId once we have such a thing
323317
324− onPressed: appDelegate.focus = true;
318+ onPressed: ApplicationManager.focusApplication(model.appId);
325319 }
326320
327321 DecoratedWindow {
@@ -577,7 +571,6 @@ Rectangle {
577571 PropertyChanges { target: spreadFlickable; enabled: true }
578572 PropertyChanges { target: currentSelectedLabel; visible: true }
579573 PropertyChanges { target: spreadBackground; visible: true }
580− PropertyChanges { target: appContainer; focus: true }
581574 }
582575 ]
583576 signal updateWorkspaces();