on xenial help sign in
Set initial surface size

Removes flicker on start up in desktop mode Fixes: #1532974 Approved by: Nick Dedekind

commit43f32161ef1285ebee3f5f64071ed0b5e22a2630 authorDaniel d'Andrada <daniel.dandrada@canonical.com> dateFri 12 Feb 2016, 00:10 (11 years ago) parenta3c83ad35341fe
4 files changed+27−3
qml/Stages/ApplicationWindow.qml+7−1 tests/mocks/Unity/Application/ApplicationInfo.cpp+14−1 tests/mocks/Unity/Application/ApplicationInfo.h+4−1 tests/plugins/Unity/Launcher/launchermodeltest.cpp+2
qml/Stages/ApplicationWindow.qml+7−1
@@ -1,5 +1,5 @@
11/*
2− * Copyright 2014-2015 Canonical Ltd.
2+ * Copyright 2014-2016 Canonical Ltd.
33 *
44 * This program is free software; you can redistribute it and/or modify
55 * it under the terms of the GNU Lesser General Public License as published by
@@ -89,6 +89,12 @@ FocusScope {
8989 property bool surfaceOldEnoughToBeResized: false
9090 }
9191
92+ Binding {
93+ target: root.application
94+ property: "initialSurfaceSize"
95+ value: Qt.size(root.requestedWidth, root.requestedHeight)
96+ }
97+
9298 Timer {
9399 id: surfaceInitTimer
94100 interval: 100
tests/mocks/Unity/Application/ApplicationInfo.cpp+14−1
@@ -1,5 +1,5 @@
11/*
2− * Copyright (C) 2013-2015 Canonical, Ltd.
2+ * Copyright (C) 2013-2016 Canonical, Ltd.
33 *
44 * This program is free software; you can redistribute it and/or modify
55 * it under the terms of the GNU General Public License as published by
@@ -278,3 +278,16 @@ void ApplicationInfo::setExemptFromLifecycle(bool exemptFromLifecycle)
278278 Q_EMIT exemptFromLifecycleChanged(m_exemptFromLifecycle);
279279 }
280280}
281+
282+QSize ApplicationInfo::initialSurfaceSize() const
283+{
284+ return m_initialSurfaceSize;
285+}
286+
287+void ApplicationInfo::setInitialSurfaceSize(const QSize &size)
288+{
289+ if (size != m_initialSurfaceSize) {
290+ m_initialSurfaceSize = size;
291+ Q_EMIT initialSurfaceSizeChanged(m_initialSurfaceSize);
292+ }
293+}
tests/mocks/Unity/Application/ApplicationInfo.h+4−1
@@ -1,5 +1,5 @@
11/*
2− * Copyright (C) 2013-2015 Canonical, Ltd.
2+ * Copyright (C) 2013-2016 Canonical, Ltd.
33 *
44 * This program is free software; you can redistribute it and/or modify
55 * it under the terms of the GNU General Public License as published by
@@ -95,6 +95,8 @@ public:
9595 bool exemptFromLifecycle() const override;
9696 void setExemptFromLifecycle(bool) override;
9797
98+ QSize initialSurfaceSize() const override;
99+ void setInitialSurfaceSize(const QSize &size) override;
98100public:
99101 void setSession(Session* session);
100102 Session* session() const { return m_session; }
@@ -129,6 +131,7 @@ private:
129131 RequestedState m_requestedState;
130132 bool m_isTouchApp;
131133 bool m_exemptFromLifecycle;
134+ QSize m_initialSurfaceSize;
132135
133136 bool m_manualSurfaceCreation;
134137};
tests/plugins/Unity/Launcher/launchermodeltest.cpp+2
@@ -61,6 +61,8 @@ public:
6161 bool isTouchApp() const override { return true; }
6262 bool exemptFromLifecycle() const override { return false; }
6363 void setExemptFromLifecycle(bool) override {}
64+ QSize initialSurfaceSize() const override { return QSize(); }
65+ void setInitialSurfaceSize(const QSize &) override {}
6466
6567 // Methods used for mocking (not in the interface)
6668 void setFocused(bool focused) { m_focused = focused; Q_EMIT focusedChanged(focused); }