on xenial help sign in
[TLWM] always activate the newly-prepended window
d58308cRatchanan Srirattanamet
plugins/WindowManager/TopLevelWindowModel.cpp+2−3
@@ -195,9 +195,8 @@ void TopLevelWindowModel::prependSurfaceHelper(unityapi::MirSurfaceInterface *su
195
195
196 prependWindow(window, application);
196 prependWindow(window, application);
197
197
198− if (!surface) {
198+ // Activate the newly-prepended window.
199− activateEmptyWindow(window);
199+ window->activate();
200− }
201
200
202 INFO_MSG << " after " << toString();
201 INFO_MSG << " after " << toString();
203}
202}
tests/qmltests/Stage/tst_QMLTopLevelWindowModel.qml+19
@@ -168,5 +168,24 @@ Item {
168 tlwm.rootFocus = true;
168 tlwm.rootFocus = true;
169 compare(dialerApp.focused, true);
169 compare(dialerApp.focused, true);
170 }
170 }
171+
172+ /*
173+ Ensure that the newly-opened window from an already-opened app will
174+ be focused in addition to being on top.
175+ */
176+ function test_focusNewWindowFromOpenedApp()
177+ {
178+ var firstWindowSurfaceId = tlwm.nextId;
179+ var webbrowserApp = ApplicationManager.startApplication("morph-browser");
180+ waitUntilAppSurfaceShowsUp(firstWindowSurfaceId);
181+
182+ // Create the second window
183+ var secondWindowSurfaceId = tlwm.nextId;
184+ webbrowserApp.createSurface();
185+
186+ var topWindow = tlwm.windowAt(0);
187+ compare(topWindow.id, secondWindowSurfaceId, "The top window is not the second window.");
188+ compare(topWindow.focused, true, "The second window isn't focused.");
189+ }
171 }
190 }
172}
191}