on xenial help sign in
fix the focused window title string
commit45ffbccbc8760b237189fdc7618eb214cff69d00 authorMichael Zanetti <michael.zanetti@canonical.com> dateWed 3 Aug 2016, 20:54 (10 years ago) parent280d296
4 files changed+68−27
qml/Shell.qml+4−1 qml/Stage/Spread/Spread.qml+6−2 qml/Stage/Stage.qml+13−11 tests/qmltests/tst_Shell.qml+45−13
qml/Shell.qml+4−1
@@ -271,6 +271,8 @@ StyledItem {
271271 && launcher.progress == 0
272272 && !notifications.useModal
273273
274+ onInteractiveChanged: { if (interactive) { focus = true; } }
275+
274276 // TODO: This is not implemented yet in the new stage...
275277 spreadEnabled: tutorial.spreadEnabled && (!greeter || (!greeter.hasLockedApp && !greeter.shown))
276278 keepDashRunning: launcher.shown || launcher.dashSwipe
@@ -297,6 +299,7 @@ StyledItem {
297299
298300 Loader {
299301 id: greeterLoader
302+ objectName: "greeterLoader"
300303 anchors.fill: parent
301304 anchors.topMargin: panel.panelHeight
302305 sourceComponent: shell.mode != "shell" ? integratedGreeter :
@@ -499,7 +502,7 @@ StyledItem {
499502 }
500503 onFocusChanged: {
501504 if (!focus) {
502− shell.focus = true;
505+ stages.focus = true;
503506 }
504507 }
505508
qml/Stage/Spread/Spread.qml+6−2
@@ -6,8 +6,8 @@ Item {
66 id: root
77
88 // Information about the environment
9− property int totalItemCount: 0
109 property int highlightedIndex: 1
10+ property var model: null
1111
1212 // some config options
1313 property real contentMargin: 0.16 * root.height
@@ -22,6 +22,7 @@ Item {
2222
2323
2424 // Calculated stuff
25+ readonly property int totalItemCount: model.count
2526 readonly property real leftStackXPos: 0.03 * root.width
2627 readonly property real rightStackXPos: root.width - 1.5 * leftStackXPos
2728
@@ -89,9 +90,11 @@ Item {
8990 y: windowTitleTopMargin
9091// //y: priv.spreadTopMargin + priv.contentTopMargin + settings.spreadOffset + settings.titleOffset - height - (priv.contentTopMargin - height) / 4
9192// visible: height < priv.contentTopMargin
92− text: "focused window title"
93+ text: root.highlightedIndex >= 0 && root.model ? root.model.surfaceAt(root.highlightedIndex).name : ""
9394 fontSize: root.height < units.gu(85) ? 'medium' : 'large'
9495 color: "white"
96+ opacity: root.highlightedIndex >= 0 ? 1 : 0
97+ Behavior on opacity { UbuntuNumberAnimation { } }
9598 }
9699
97100// Label {
@@ -105,6 +108,7 @@ Item {
105108
106109
107110 Keys.onPressed: {
111+ print("key pressed")
108112 switch (event.key) {
109113 case Qt.Key_Left:
110114 case Qt.Key_Backtab:
qml/Stage/Stage.qml+13−11
@@ -111,8 +111,7 @@ AbstractStage {
111111
112112 property var focusedAppDelegate: null
113113 onFocusedAppDelegateChanged: {
114− print("focusedAppDelegate changed", focusedAppDelegate.objectName)
115− if (root.state == "spread") {
114+ if (focusedAppDelegate && root.state == "spread") {
116115 goneToSpread = false;
117116 }
118117 }
@@ -121,8 +120,8 @@ AbstractStage {
121120
122121 property bool goneToSpread: false
123122 property int closingIndex: -1
124− property int animationDuration: 4000
125−// property int animationDuration: UbuntuAnimation.FastDuration
123+// property int animationDuration: 4000
124+ property int animationDuration: UbuntuAnimation.FastDuration
126125
127126 function updateForegroundMaximizedApp() {
128127 var found = false;
@@ -172,7 +171,7 @@ AbstractStage {
172171 }
173172
174173 function updateMainAndSideStageIndexes() {
175− print("updating stage indexes, sideStage shown:", sideStage.shown)
174+// print("updating stage indexes, sideStage shown:", sideStage.shown)
176175 var choseMainStage = false;
177176 var choseSideStage = false;
178177
@@ -181,7 +180,6 @@ AbstractStage {
181180
182181 for (var i = 0; i < appRepeater.count && (!choseMainStage || !choseSideStage); ++i) {
183182 var appDelegate = appRepeater.itemAt(i);
184− print("have app on stage", appDelegate.applicationId, appDelegate.stage)
185183 if (/*sideStage.shown && */appDelegate.stage == ApplicationInfoInterface.SideStage
186184 && !choseSideStage) {
187185 priv.sideStageDelegate = appDelegate
@@ -332,11 +330,14 @@ AbstractStage {
332330 },
333331 Transition {
334332 from: "spread"
335− ScriptAction { script: {
336− var item = appRepeater.itemAt(spreadItem.highlightedIndex);
337− item.claimFocus();
338− item.playFocusAnimation();
333+ SequentialAnimation {
334+ ScriptAction { script: {
335+ var item = appRepeater.itemAt(spreadItem.highlightedIndex);
336+ item.claimFocus();
337+ item.playFocusAnimation();
338+ }
339339 }
340+ PropertyAction { target: spreadItem; property: "highlightedIndex"; value: -1 }
340341 }
341342 },
342343 Transition {
@@ -365,7 +366,7 @@ AbstractStage {
365366 Spread {
366367 id: spreadItem
367368 anchors.fill: appContainer
368− totalItemCount: appRepeater.count
369+ model: root.topLevelSurfaceList
369370 z: 10
370371 }
371372
@@ -1306,6 +1307,7 @@ AbstractStage {
13061307 gesturePoints = [];
13071308 } else {
13081309 if (gesturePoints[gesturePoints.length - 1] < -root.width * 0.4 ) {
1310+ print("gone to spread true")
13091311 priv.goneToSpread = true;
13101312 } else {
13111313 if (appRepeater.count > 1) {
tests/qmltests/tst_Shell.qml+45−13
@@ -107,6 +107,7 @@ Rectangle {
107107 sourceComponent: Component {
108108 Shell {
109109 id: __shell
110+ objectName: "shell"
110111 usageScenario: usageScenarioSelector.model[usageScenarioSelector.selectedIndex]
111112 nativeWidth: width
112113 nativeHeight: height
@@ -183,22 +184,44 @@ Rectangle {
183184 callManager.foregroundCall = callManager.foregroundCall ? null : phoneCall;
184185 }
185186 }
186− }
187− Button {
188− text: "Show Launcher"
189− activeFocusOnPress: false
190− onClicked: {
191− if (shellLoader.status !== Loader.Ready)
192− return;
187+ Button {
188+ text: "Show Launcher"
189+ activeFocusOnPress: false
190+ onClicked: {
191+ if (shellLoader.status !== Loader.Ready)
192+ return;
193193
194− var launcher = testCase.findChild(shellLoader.item, "launcher");
195− launcher.state = "visible";
194+ var launcher = testCase.findChild(shellLoader.item, "launcher");
195+ launcher.state = "visible";
196+ }
196197 }
198+ Button {
199+ text: "Print focused"
200+ activeFocusOnPress: false
201+ onClicked: {
202+ var childs = new Array(0);
203+ childs.push(shellLoader.item)
204+ while (childs.length > 0) {
205+ if (childs[0].activeFocus && childs[0].focus && childs[0].objectName != "shell") {
206+ print("Active focus is on item:", childs[0]);
207+ return;
208+ }
209+ for (var i in childs[0].children) {
210+ childs.push(childs[0].children[i])
211+ }
212+ childs.splice(0, 1);
213+ }
214+ print("No active focused item found within shell.")
215+ }
216+ }
217+ }
218+ Label {
219+ text: "LightDM mock mode"
197220 }
221+
198222 ListItem.ItemSelector {
199223 anchors { left: parent.left; right: parent.right }
200224 activeFocusOnPress: false
201− text: "LightDM mock mode"
202225 model: ["single", "single-passphrase", "single-pin", "full"]
203226 onSelectedIndexChanged: {
204227 shellLoader.active = false;
@@ -207,11 +230,14 @@ Rectangle {
207230 shellLoader.active = true;
208231 }
209232 }
233+ Label {
234+ text: "Size"
235+ }
236+
210237 ListItem.ItemSelector {
211238 id: sizeSelector
212239 anchors { left: parent.left; right: parent.right }
213240 activeFocusOnPress: false
214− text: "Size"
215241 model: ["phone", "tablet", "desktop"]
216242 onSelectedIndexChanged: {
217243// shellLoader.active = false;
@@ -219,22 +245,28 @@ Rectangle {
219245// shellLoader.active = true;
220246 }
221247 }
248+ Label {
249+ text: "Usage scenario"
250+ }
251+
222252 ListItem.ItemSelector {
223253 id: usageScenarioSelector
224254 anchors { left: parent.left; right: parent.right }
225255 activeFocusOnPress: false
226− text: "Usage scenario"
227256 model: ["phone", "tablet", "desktop"]
228257 }
229258 MouseTouchEmulationCheckbox {
230259 id: mouseEmulation
231260 checked: true
232261 }
262+ Label {
263+ text: "Ctrl key as"
264+ }
265+
233266 ListItem.ItemSelector {
234267 id: ctrlModifier
235268 anchors { left: parent.left; right: parent.right }
236269 activeFocusOnPress: false
237− text: "Ctrl key as"
238270 model: ["Ctrl", "Alt", "Super"]
239271 onSelectedIndexChanged: {
240272 var keyMapper = testCase.findChild(shellContainer, "physicalKeysMapper");