on xenial help sign in
[WindowManager] Focus surface on startup only if focus is requested

This focuses newly created surface only if focus is requested by the user. Needs: https://github.com/ubports/qtmir/pull/27 Fixes: https://github.com/ubports/ubuntu-touch/issues/1088

commit4169ccd304a6b00d38344ae38a602b22cc10a12e authorMarius Gripsgard <marius@ubports.com> dateThu 15 Aug 2019, 23:28 (7 years ago) parent1829fbf
1 file changed+9
plugins/WindowManager/Window.cpp+9
plugins/WindowManager/Window.cpp+9
@@ -27,6 +27,7 @@ namespace unityapi = unity::shell::application;
2727Q_LOGGING_CATEGORY(UNITY_WINDOW, "unity.window", QtWarningMsg)
2828
2929#define DEBUG_MSG qCDebug(UNITY_WINDOW).nospace() << qPrintable(toString()) << "::" << __func__
30+#define WARNING_MSG qCWarning(UNITY_WINDOW).nospace() << qPrintable(toString()) << "::" << __func__
3031
3132Window::Window(int id, QObject *parent)
3233 : QObject(parent)
@@ -184,7 +185,15 @@ void Window::setSurface(unityapi::MirSurfaceInterface *surface)
184185 setSurface(nullptr);
185186 });
186187
188+ // Surface should never be focused at this point!
189+ if (m_surface->focused()) {
190+ WARNING_MSG << "Inital surface is focused!";
191+ }
192+
187193 // bring it up to speed
194+ if (m_focused) {
195+ m_surface->activate();
196+ }
188197 if (m_positionRequested) {
189198 m_surface->setRequestedPosition(m_requestedPosition);
190199 }