on xenial help sign in
don't break focus encasulation
commitc45fe745a2fdb19e22bc5167ddc1d384cb5d5963 authorNick Dedekind <nick.dedekind@canonical.com> dateTue 28 Apr 2015, 09:24 (11 years ago) parent9a35b6b7bdef9d
2 files changed+10−14
qml/Stages/DecoratedWindow.qml−1 qml/Stages/DesktopStage.qml+10−13
qml/Stages/DecoratedWindow.qml−1
@@ -23,7 +23,6 @@ import Unity.Application 0.1
2323FocusScope {
2424 id: root
2525
26− property alias window: applicationWindow
2726 property alias application: applicationWindow.application
2827 property alias active: decoration.active
2928
qml/Stages/DesktopStage.qml+10−13
@@ -47,8 +47,8 @@ FocusScope {
4747 if (appDelegate.state === "minimized") {
4848 appDelegate.state = "normal"
4949 }
50− appDelegate.focusWindow();
5150 ApplicationManager.focusApplication(appId);
51+ appDelegate.focus = true;
5252 }
5353 }
5454
@@ -87,20 +87,22 @@ FocusScope {
8787 id: appRepeater
8888 model: ApplicationManager
8989
90− delegate: Item {
90+ delegate: FocusScope {
9191 id: appDelegate
9292 z: ApplicationManager.count - index
9393 y: units.gu(3)
9494 width: units.gu(60)
9595 height: units.gu(50)
9696
97+ onFocusChanged: {
98+ if (focus) {
99+ ApplicationManager.requestFocusApplication(model.appId);
100+ }
101+ }
102+
97103 readonly property int minWidth: units.gu(10)
98104 readonly property int minHeight: units.gu(10)
99105
100− function focusWindow() {
101− decoratedWindow.window.forceActiveFocus();
102− }
103−
104106 states: [
105107 State {
106108 name: "normal"
@@ -127,7 +129,7 @@ FocusScope {
127129 resizeHandleWidth: units.gu(0.5)
128130 windowId: model.appId // FIXME: Change this to point to windowId once we have such a thing
129131
130− onPressed: decoratedWindow.focus = true;
132+ onPressed: appDelegate.focus = true;
131133 }
132134
133135 DecoratedWindow {
@@ -136,12 +138,7 @@ FocusScope {
136138 anchors.fill: parent
137139 application: ApplicationManager.get(index)
138140 active: ApplicationManager.focusedApplicationId === model.appId
139−
140− onFocusChanged: {
141− if (focus) {
142− ApplicationManager.requestFocusApplication(model.appId);
143− }
144− }
141+ focus: true
145142
146143 onClose: ApplicationManager.stopApplication(model.appId)
147144 onMaximize: appDelegate.state = (appDelegate.state == "maximized" ? "normal" : "maximized")