on xenial help sign in
don't break focus encasulation
c45fe74Nick Dedekind
qml/Stages/DecoratedWindow.qml−1
@@ -23,7 +23,6 @@ import Unity.Application 0.1
23FocusScope {
23FocusScope {
24 id: root
24 id: root
25
25
26− property alias window: applicationWindow
27 property alias application: applicationWindow.application
26 property alias application: applicationWindow.application
28 property alias active: decoration.active
27 property alias active: decoration.active
29
28
qml/Stages/DesktopStage.qml+10−13
@@ -47,8 +47,8 @@ FocusScope {
47 if (appDelegate.state === "minimized") {
47 if (appDelegate.state === "minimized") {
48 appDelegate.state = "normal"
48 appDelegate.state = "normal"
49 }
49 }
50− appDelegate.focusWindow();
51 ApplicationManager.focusApplication(appId);
50 ApplicationManager.focusApplication(appId);
51+ appDelegate.focus = true;
52 }
52 }
53 }
53 }
54
54
@@ -87,20 +87,22 @@ FocusScope {
87 id: appRepeater
87 id: appRepeater
88 model: ApplicationManager
88 model: ApplicationManager
89
89
90− delegate: Item {
90+ delegate: FocusScope {
91 id: appDelegate
91 id: appDelegate
92 z: ApplicationManager.count - index
92 z: ApplicationManager.count - index
93 y: units.gu(3)
93 y: units.gu(3)
94 width: units.gu(60)
94 width: units.gu(60)
95 height: units.gu(50)
95 height: units.gu(50)
96
96
97+ onFocusChanged: {
98+ if (focus) {
99+ ApplicationManager.requestFocusApplication(model.appId);
100+ }
101+ }
102+
97 readonly property int minWidth: units.gu(10)
103 readonly property int minWidth: units.gu(10)
98 readonly property int minHeight: units.gu(10)
104 readonly property int minHeight: units.gu(10)
99
105
100− function focusWindow() {
101− decoratedWindow.window.forceActiveFocus();
102− }
103−
104 states: [
106 states: [
105 State {
107 State {
106 name: "normal"
108 name: "normal"
@@ -127,7 +129,7 @@ FocusScope {
127 resizeHandleWidth: units.gu(0.5)
129 resizeHandleWidth: units.gu(0.5)
128 windowId: model.appId // FIXME: Change this to point to windowId once we have such a thing
130 windowId: model.appId // FIXME: Change this to point to windowId once we have such a thing
129
131
130− onPressed: decoratedWindow.focus = true;
132+ onPressed: appDelegate.focus = true;
131 }
133 }
132
134
133 DecoratedWindow {
135 DecoratedWindow {
@@ -136,12 +138,7 @@ FocusScope {
136 anchors.fill: parent
138 anchors.fill: parent
137 application: ApplicationManager.get(index)
139 application: ApplicationManager.get(index)
138 active: ApplicationManager.focusedApplicationId === model.appId
140 active: ApplicationManager.focusedApplicationId === model.appId
139−
140− onFocusChanged: {
141− if (focus) {
141+ focus: true
142− ApplicationManager.requestFocusApplication(model.appId);
143− }
144− }
145
142
146 onClose: ApplicationManager.stopApplication(model.appId)
143 onClose: ApplicationManager.stopApplication(model.appId)
147 onMaximize: appDelegate.state = (appDelegate.state == "maximized" ? "normal" : "maximized")
144 onMaximize: appDelegate.state = (appDelegate.state == "maximized" ? "normal" : "maximized")