on xenial help sign in
merge prereq
commit7283c7975129a76dffab12d6c2050044e6e51294 authorMichael Zanetti <michael.zanetti@canonical.com> dateTue 28 Mar 2017, 15:44 (10 years ago) parent5174a141897f10
27 files changed+112−630
plugins/Unity/CMakeLists.txt−1 plugins/Unity/Debug/CMakeLists.txt−30 plugins/Unity/Debug/consolelog.cpp−221 plugins/Unity/Debug/consolelog.h−87 plugins/Unity/Debug/plugin.cpp−31 plugins/Unity/Debug/plugin.h−32 plugins/Unity/Debug/qmldir−3 plugins/WindowManager/Screen.cpp+8−7 plugins/WindowManager/Screen.h+5−5 plugins/WindowManager/Screens.cpp+12−11 plugins/WindowManager/Screens.h+5−4 plugins/WindowManager/WorkspaceModel.cpp+11−9 plugins/WindowManager/WorkspaceModel.h+5−5 qml/Shell.qml−16 src/DebuggingController.cpp+1−12 src/DebuggingController.h−14 tests/CMakeLists.txt+1 tests/mocks/Unity/InputInfo/InputWindow.qml−68 tests/mocks/Unity/InputInfo/mockcontroller.cpp+4−16 tests/mocks/Unity/InputInfo/mockcontroller.h+2−4 tests/mocks/Unity/InputInfo/plugin.cpp+1−1 tests/mocks/Unity/InputInfo/qmldir−2 tests/mocks/WindowManager/CMakeLists.txt+4 tests/qmltests/Panel/tst_Panel.qml+6−3 tests/qmltests/Stage/tst_PhoneStage.qml+4−5 tests/qmltests/Stage/tst_TabletStage.qml+41−41 tests/qmltests/tst_Shell.qml+2−2
plugins/Unity/CMakeLists.txt−1
@@ -1,6 +1,5 @@
11add_subdirectory(ApplicationMenu)
22add_subdirectory(Connectivity)
3−add_subdirectory(Debug)
43add_subdirectory(Indicators)
54add_subdirectory(Launcher)
65add_subdirectory(Session)
plugins/Unity/Debug/CMakeLists.txtdeleted−30
@@ -1,30 +0,0 @@
1−include_directories(
2− ${CMAKE_CURRENT_SOURCE_DIR}
3− ${CMAKE_CURRENT_BINARY_DIR}
4−)
5−
6−include_directories(
7− SYSTEM
8− ${Qt5Gui_PRIVATE_INCLUDE_DIRS}
9− ${Qt5Quick_PRIVATE_INCLUDE_DIRS}
10− ${GIO_INCLUDE_DIRS}
11−)
12−
13−set(QMLPLUGIN_SRC
14− consolelog.cpp
15− plugin.cpp
16− )
17−
18−add_library(Debug-qml SHARED
19− ${QMLPLUGIN_SRC}
20− )
21−
22−# Because this is an internal support library, we want
23−# to expose all symbols in it. Consider changing this
24−# either to a static library or just using the
25−# files directly in targets.
26−set_target_properties(Debug-qml PROPERTIES COMPILE_FLAGS -fvisibility=default)
27−
28−qt5_use_modules(Debug-qml Qml Quick Concurrent)
29−
30−add_unity8_plugin(Unity.Debug 0.1 Unity/Debug TARGETS Debug-qml)
plugins/Unity/Debug/consolelog.cppdeleted−221
@@ -1,221 +0,0 @@
1−/*
2− * Copyright 2016 Canonical Ltd.
3− *
4− * This program is free software; you can redistribute it and/or modify
5− * it under the terms of the GNU Lesser General Public License as published by
6− * the Free Software Foundation; version 3.
7− *
8− * This program is distributed in the hope that it will be useful,
9− * but WITHOUT ANY WARRANTY; without even the implied warranty of
10− * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11− * GNU Lesser General Public License for more details.
12− *
13− * You should have received a copy of the GNU Lesser General Public License
14− * along with this program. If not, see <http://www.gnu.org/licenses/>.
15−*/
16−
17−#include "consolelog.h"
18−
19−#include <unistd.h>
20−#include <stdio.h>
21−#include <thread>
22−#include <iostream>
23−#include <sys/ioctl.h>
24−
25−#include <functional>
26−
27−namespace
28−{
29−
30−int wait_fd(std::function<int(void)> fn)
31−{
32− int ret = -1;
33− bool fd_blocked = false;
34− do
35− {
36− ret = fn();
37− fd_blocked = (errno == EINTR || errno == EBUSY);
38− if (fd_blocked)
39− QThread::msleep(10);
40− }
41− while (ret < 0);
42− return ret;
43−}
44−
45−#define PIPE_WAIT(val) wait_fd(std::bind(pipe, val))
46−#define DUP_WAIT(fd) wait_fd(std::bind(dup, fd))
47−#define DUP2_WAIT(fd1, fd2) wait_fd(std::bind(dup2, fd1, fd2))
48−#define CLOSE_WAIT(fd) wait_fd(std::bind(close, fd))
49−
50−}
51−
52−LogRedirector::LogRedirector()
53− : m_ref(0)
54− , m_stop(false)
55−{
56− setObjectName("ConsoleLog");
57−
58− // make stdout & stderr streams unbuffered
59− // so that we don't need to flush the streams
60− // before capture and after capture
61− // (fflush can cause a deadlock if the stream is currently being used)
62− setvbuf(stdout,NULL,_IONBF,0);
63− setvbuf(stderr,NULL,_IONBF,0);
64−}
65−
66−void LogRedirector::run()
67−{
68− PIPE_WAIT(m_pipe);
69−
70− int oldStdOut = DUP_WAIT(fileno(stdout));
71− int oldStdErr = DUP_WAIT(fileno(stderr));
72−
73− DUP2_WAIT(m_pipe[WRITE], fileno(stdout));
74− DUP2_WAIT(m_pipe[WRITE], fileno(stderr));
75− CLOSE_WAIT(m_pipe[WRITE]);
76−
77− while(true) {
78− {
79− QMutexLocker lock(&m_mutex);
80− if (m_stop) break;
81− }
82− checkLog();
83− QThread::msleep(50);
84− }
85−
86− DUP2_WAIT(oldStdOut, fileno(stdout));
87− DUP2_WAIT(oldStdErr, fileno(stderr));
88−
89− CLOSE_WAIT(oldStdOut);
90− CLOSE_WAIT(oldStdErr);
91− CLOSE_WAIT(m_pipe[READ]);
92−}
93−
94−
95−void LogRedirector::checkLog()
96−{
97− // Do not allow read to block with no data.
98− // If we stop the thread while waiting a read,
99− // it will block the main thread waiting for this thread to stop.
100− int count = 0;
101− ioctl(m_pipe[READ], FIONREAD, &count);
102− if (count <= 0) return;
103−
104− std::string captured;
105− std::string buf;
106− const int bufSize = 1024;
107− buf.resize(bufSize);
108− int bytesRead = 0;
109− bytesRead = read(m_pipe[READ], &(*buf.begin()), bufSize);
110− while(bytesRead == bufSize)
111− {
112− captured += buf;
113− bytesRead = 0;
114− bytesRead = read(m_pipe[READ], &(*buf.begin()), bufSize);
115− }
116− if (bytesRead > 0)
117− {
118− buf.resize(bytesRead);
119− captured += buf;
120− }
121−
122− if (!captured.empty()) {
123− Q_EMIT log(QString::fromStdString(captured));
124− }
125−}
126−
127−LogRedirector *LogRedirector::instance()
128−{
129− static LogRedirector* log = nullptr;
130− if (!log) {
131− log = new LogRedirector();
132− }
133− return log;
134−}
135−
136−void LogRedirector::add(ConsoleLog* logger)
137−{
138− QMutexLocker lock(&m_mutex);
139− connect(this, &LogRedirector::log, logger, &ConsoleLog::logged, Qt::UniqueConnection);
140−
141− m_ref++;
142− if (!LogRedirector::instance()->isRunning()) {
143− m_stop = false;
144− LogRedirector::instance()->start();
145− }
146−}
147−
148−void LogRedirector::remove(ConsoleLog* logger)
149−{
150− QMutexLocker lock(&m_mutex);
151− disconnect(this, &LogRedirector::log, logger, &ConsoleLog::logged);
152−
153− m_ref = qMax(m_ref-1, 0);
154− if (m_ref == 0 && LogRedirector::instance()->isRunning()) {
155− m_stop = true;
156− lock.unlock();
157− LogRedirector::instance()->wait();
158− }
159−}
160−
161−ConsoleLog::ConsoleLog(QObject *parent)
162− : QObject(parent)
163− , m_enabled(false)
164− , m_maxLines(60)
165−{
166− auto updateEnabled = [this]() {
167− if (m_enabled) {
168− LogRedirector::instance()->add(this);
169− } else {
170− LogRedirector::instance()->remove(this);
171− }
172− };
173− connect(this, &ConsoleLog::enabledChanged, this, updateEnabled);
174−}
175−
176−ConsoleLog::~ConsoleLog()
177−{
178− if (m_enabled) {
179− LogRedirector::instance()->remove(this);
180− }
181−}
182−
183−void ConsoleLog::setEnabled(bool enabled)
184−{
185− if (m_enabled == enabled) {
186− return;
187− }
188−
189− m_enabled = enabled;
190− Q_EMIT enabledChanged();
191−}
192−
193−QString ConsoleLog::out() const
194−{
195− return m_out.join("\n");
196−}
197−
198−void ConsoleLog::setMaxLines(int maxLines)
199−{
200− if (m_maxLines == maxLines) {
201− return;
202− }
203−
204− m_maxLines = maxLines;
205− while (m_out.count() > m_maxLines) {
206− m_out.removeLast();
207− }
208− Q_EMIT outChanged();
209− Q_EMIT maxLinesChanged();
210−}
211−
212−void ConsoleLog::logged(QString captured)
213−{
214− QStringList li = captured.split("\n", QString::SkipEmptyParts);
215− li << m_out;
216− m_out = li;
217− while (m_out.count() > m_maxLines) {
218− m_out.removeLast();
219− }
220− Q_EMIT outChanged();
221−}
plugins/Unity/Debug/consolelog.hdeleted−87
@@ -1,87 +0,0 @@
1−/*
2− * Copyright 2016 Canonical Ltd.
3− *
4− * This program is free software; you can redistribute it and/or modify
5− * it under the terms of the GNU Lesser General Public License as published by
6− * the Free Software Foundation; version 3.
7− *
8− * This program is distributed in the hope that it will be useful,
9− * but WITHOUT ANY WARRANTY; without even the implied warranty of
10− * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11− * GNU Lesser General Public License for more details.
12− *
13− * You should have received a copy of the GNU Lesser General Public License
14− * along with this program. If not, see <http://www.gnu.org/licenses/>.
15−*/
16−
17−#ifndef CONSOLELOG_H
18−#define CONSOLELOG_H
19−
20−#include <QThread>
21−#include <QMutex>
22−#include <QSet>
23−
24−class ConsoleLog;
25−
26−class LogRedirector : public QThread
27−{
28− Q_OBJECT
29−public:
30− static LogRedirector *instance();
31−
32− void add(ConsoleLog* logger);
33− void remove(ConsoleLog* logger);
34−
35−private Q_SLOTS:
36− void checkLog();
37−
38−Q_SIGNALS:
39− void log(QString log);
40−
41−private:
42− LogRedirector();
43− void run() Q_DECL_OVERRIDE;
44−
45− QMutex m_mutex;
46− int m_pipe[2];
47− int m_ref;
48− bool m_stop;
49−
50− enum PIPES { READ, WRITE };
51−};
52−
53−class ConsoleLog : public QObject
54−{
55− Q_OBJECT
56− Q_PROPERTY(bool enabled READ isEnabled WRITE setEnabled NOTIFY enabledChanged)
57− Q_PROPERTY(QString out READ out NOTIFY outChanged)
58− Q_PROPERTY(int maxLines READ maxLines WRITE setMaxLines NOTIFY maxLinesChanged)
59−public:
60− explicit ConsoleLog(QObject *parent = 0);
61− ~ConsoleLog();
62−
63− bool isEnabled() const { return m_enabled; }
64− void setEnabled(bool enabled);
65−
66− QString out() const;
67−
68− int maxLines() const { return m_maxLines; }
69− void setMaxLines(int maxLines);
70−
71−public Q_SLOTS:
72− void logged(QString captured);
73−
74−Q_SIGNALS:
75− void enabledChanged();
76− void outChanged();
77− void maxLinesChanged();
78−
79−private:
80− void updateEnabled();
81−
82− QStringList m_out;
83− bool m_enabled;
84− int m_maxLines;
85−};
86−
87−#endif // CONSOLELOG_H
plugins/Unity/Debug/plugin.cppdeleted−31
@@ -1,31 +0,0 @@
1−/*
2− * Copyright (C) 2016 Canonical, Ltd.
3− *
4− * This program is free software; you can redistribute it and/or modify
5− * it under the terms of the GNU General Public License as published by
6− * the Free Software Foundation; version 3.
7− *
8− * This program is distributed in the hope that it will be useful,
9− * but WITHOUT ANY WARRANTY; without even the implied warranty of
10− * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11− * GNU General Public License for more details.
12− *
13− * You should have received a copy of the GNU General Public License
14− * along with this program. If not, see <http://www.gnu.org/licenses/>.
15− */
16−
17−// Qt
18−#include <QtQml/qqml.h>
19−
20−// self
21−#include "plugin.h"
22−
23−// local
24−#include "consolelog.h"
25−
26−void UnityDebugPlugin::registerTypes(const char *uri)
27−{
28− Q_ASSERT(uri == QLatin1String("Unity.Debug"));
29−
30− qmlRegisterType<ConsoleLog>(uri, 0, 1, "ConsoleLog");
31−}
plugins/Unity/Debug/plugin.hdeleted−32
@@ -1,32 +0,0 @@
1−/*
2− * Copyright (C) 2016 Canonical, Ltd.
3− *
4− * This program is free software; you can redistribute it and/or modify
5− * it under the terms of the GNU General Public License as published by
6− * the Free Software Foundation; version 3.
7− *
8− * This program is distributed in the hope that it will be useful,
9− * but WITHOUT ANY WARRANTY; without even the implied warranty of
10− * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11− * GNU General Public License for more details.
12− *
13− * You should have received a copy of the GNU General Public License
14− * along with this program. If not, see <http://www.gnu.org/licenses/>.
15− */
16−
17−#ifndef UNITYDEBUG_PLUGIN_H
18−#define UNITYDEBUG_PLUGIN_H
19−
20−#include <QtQml/QQmlEngine>
21−#include <QtQml/QQmlExtensionPlugin>
22−
23−class UnityDebugPlugin : public QQmlExtensionPlugin
24−{
25− Q_OBJECT
26− Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QQmlExtensionInterface")
27−
28−public:
29− void registerTypes(const char *uri) override;
30−};
31−
32−#endif
plugins/Unity/Debug/qmldirdeleted−3
@@ -1,3 +0,0 @@
1−module Unity.Debug
2−plugin Debug-qml
3−typeinfo Debug.qmltypes
plugins/WindowManager/Screen.cpp+8−7
@@ -185,11 +185,6 @@ QString Screen::outputTypeName() const
185185 return QString();
186186}
187187
188−void Screen::setSyncing(bool syncing)
189−{
190− workspaces()->setSyncing(syncing);
191−}
192−
193188void Screen::sync(Screen *proxy)
194189{
195190 if (!proxy) return;
@@ -258,9 +253,10 @@ void ConcreteScreen::setCurrentWorkspace(Workspace *workspace)
258253 }
259254}
260255
261−ProxyScreen::ProxyScreen(Screen *const screen)
262− : m_workspaces(new ProxyWorkspaceModel(screen->workspaces()))
256+ProxyScreen::ProxyScreen(Screen *const screen, ProxyScreens* screens)
257+ : m_workspaces(new ProxyWorkspaceModel(screen->workspaces(), this))
263258 , m_original(screen)
259+ , m_screens(screens)
264260{
265261 connectToScreen(screen);
266262
@@ -296,3 +292,8 @@ void ProxyScreen::setCurrentWorkspace(Workspace *workspace)
296292 m_original->setCurrentWorkspace(p->proxyObject());
297293 }
298294}
295+
296+bool ProxyScreen::isSyncing() const
297+{
298+ return m_screens->isSyncing();
299+}
plugins/WindowManager/Screen.h+5−5
@@ -8,7 +8,7 @@
88#include "WorkspaceModel.h"
99
1010class ProxyScreen;
11−class ScreenAttached;
11+class ProxyScreens;
1212
1313class Screen: public QObject
1414{
@@ -55,7 +55,6 @@ public:
5555 virtual Workspace *currentWorkspace() const = 0;
5656 virtual void setCurrentWorkspace(Workspace* workspace) = 0;
5757
58− void setSyncing(bool);
5958 void sync(Screen* proxy);
6059
6160 qtmir::Screen* wrapped() const { return m_wrapped; }
@@ -101,8 +100,6 @@ public:
101100 Workspace *currentWorkspace() const override;
102101 void setCurrentWorkspace(Workspace* workspace) override;
103102
104− static ScreenAttached *qmlAttachedProperties(QObject *owner);
105−
106103protected:
107104 void resetCurrentWorkspace();
108105
@@ -114,7 +111,7 @@ class ProxyScreen : public Screen
114111{
115112 Q_OBJECT
116113public:
117− explicit ProxyScreen(Screen*const screen);
114+ explicit ProxyScreen(Screen*const screen, ProxyScreens* screens);
118115
119116 // From qtmir::Screen
120117 WorkspaceModel* workspaces() const override;
@@ -123,9 +120,12 @@ public:
123120
124121 Screen* proxyObject() const { return m_original.data(); }
125122
123+ bool isSyncing() const;
124+
126125private:
127126 const QScopedPointer<WorkspaceModel> m_workspaces;
128127 const QPointer<Screen> m_original;
128+ const ProxyScreens* m_screens;
129129 QPointer<Workspace> m_currentWorspace;
130130};
131131
plugins/WindowManager/Screens.cpp+12−11
@@ -137,22 +137,17 @@ ProxyScreens *ConcreteScreens::createProxy()
137137 return new ProxyScreens(this);
138138}
139139
140−void ConcreteScreens::sync(Screens *proxy)
140+void ConcreteScreens::sync(ProxyScreens *proxy)
141141{
142142 if (!proxy) return;
143−
144− for (auto screen : m_screens) {
145− screen->setSyncing(true);
146− }
143+ proxy->setSyncing(true);
147144
148145 const auto& proxyList = proxy->list();
149146 for (int i = 0; i < m_screens.count() && i < proxyList.count(); ++i) {
150147 m_screens[i]->sync(proxyList[i]);
151148 }
152149
153− for (auto screen : m_screens) {
154− screen->setSyncing(false);
155− }
150+ proxy->setSyncing(true);
156151}
157152
158153void ConcreteScreens::onScreenAdded(qtmir::Screen *added)
@@ -199,6 +194,7 @@ void ConcreteScreens::onScreenRemoved(qtmir::Screen *removed)
199194ProxyScreens::ProxyScreens(Screens * const screens)
200195 : Screens(screens->m_wrapped)
201196 , m_original(screens)
197+ , m_syncing(false)
202198{
203199 connect(screens, &Screens::screenAdded, this, [this](Screen *added) {
204200 Q_FOREACH(auto screen, m_screens) {
@@ -207,7 +203,7 @@ ProxyScreens::ProxyScreens(Screens * const screens)
207203 }
208204
209205 beginInsertRows(QModelIndex(), count(), count());
210− auto screenWrapper(new ProxyScreen(added));
206+ auto screenWrapper(new ProxyScreen(added, this));
211207 QQmlEngine::setObjectOwnership(screenWrapper, QQmlEngine::CppOwnership);
212208 m_screens.push_back(screenWrapper);
213209 endInsertRows();
@@ -237,8 +233,13 @@ ProxyScreens::ProxyScreens(Screens * const screens)
237233 });
238234
239235 Q_FOREACH(Screen* screen, screens->list()) {
240− auto screenWrapper(new ProxyScreen(screen));
236+ auto screenWrapper(new ProxyScreen(screen, this));
241237 QQmlEngine::setObjectOwnership(screenWrapper, QQmlEngine::CppOwnership);
242− m_screens.push_back(new ProxyScreen(screen));
238+ m_screens.push_back(screenWrapper);
243239 }
244240}
241+
242+void ProxyScreens::setSyncing(bool syncing)
243+{
244+ m_syncing = syncing;
245+}
plugins/WindowManager/Screens.h+5−4
@@ -55,8 +55,6 @@ public:
5555 int count() const;
5656 QVariant activeScreen() const;
5757
58− bool isSyncing() const { return m_syncing; }
59−
6058 const QVector<Screen*>& list() const { return m_screens; }
6159
6260public Q_SLOTS:
@@ -74,7 +72,6 @@ protected:
7472
7573 QVector<Screen*> m_screens;
7674 const QSharedPointer<qtmir::Screens> m_wrapped;
77− bool m_syncing;
7875
7976 friend class ProxyScreens;
8077};
@@ -87,7 +84,7 @@ public:
8784 ~ConcreteScreens();
8885
8986 Q_INVOKABLE ProxyScreens *createProxy();
90− Q_INVOKABLE void sync(Screens *proxy);
87+ Q_INVOKABLE void sync(ProxyScreens *proxy);
9188
9289 static ConcreteScreens *self();
9390
@@ -106,8 +103,12 @@ class ProxyScreens : public Screens
106103public:
107104 explicit ProxyScreens(Screens*const screens);
108105
106+ void setSyncing(bool syncing);
107+ bool isSyncing() const { return m_syncing; }
108+
109109private:
110110 const QPointer<Screens> m_original;
111+ bool m_syncing;
111112};
112113
113114#endif // SCREENS_H
plugins/WindowManager/WorkspaceModel.cpp+11−9
@@ -17,6 +17,7 @@
1717#include "WorkspaceModel.h"
1818#include "WorkspaceManager.h"
1919#include "Workspace.h"
20+#include "Screen.h"
2021
2122#include <QQmlEngine>
2223
@@ -119,11 +120,6 @@ QVariant WorkspaceModel::data(const QModelIndex &index, int role) const
119120 }
120121}
121122
122−void WorkspaceModel::setSyncing(bool syncing)
123−{
124− m_syncing = syncing;
125−}
126−
127123void WorkspaceModel::sync(WorkspaceModel *proxy)
128124{
129125 if (!proxy) return;
@@ -206,8 +202,9 @@ void WorkspaceModel::insertUnassigned(Workspace *workspace)
206202}
207203
208204
209−ProxyWorkspaceModel::ProxyWorkspaceModel(WorkspaceModel * const model)
205+ProxyWorkspaceModel::ProxyWorkspaceModel(WorkspaceModel * const model, ProxyScreen* screen)
210206 : m_original(model)
207+ , m_screen(screen)
211208{
212209 Q_FOREACH(auto workspace, model->list()) {
213210 auto proxy = new ProxyWorkspace(workspace);
@@ -215,12 +212,12 @@ ProxyWorkspaceModel::ProxyWorkspaceModel(WorkspaceModel * const model)
215212 proxy->assign(this);
216213 }
217214 connect(m_original, &WorkspaceModel::workspaceInserted, this, [this](int index, Workspace* inserted) {
218− if (m_original->isSyncing()) return;
215+ if (isSyncing()) return;
219216
220217 (new ProxyWorkspace(inserted))->assign(this, index);
221218 });
222219 connect(m_original, &WorkspaceModel::workspaceRemoved, this, [this](Workspace* removed) {
223− if (m_original->isSyncing()) return;
220+ if (isSyncing()) return;
224221
225222 for (int i = 0; i < rowCount(); i++) {
226223 auto workspaceProxy = qobject_cast<ProxyWorkspace*>(get(i));
@@ -232,7 +229,7 @@ ProxyWorkspaceModel::ProxyWorkspaceModel(WorkspaceModel * const model)
232229 }
233230 });
234231 connect(m_original, &WorkspaceModel::workspaceMoved, this, [this](int from, int to) {
235− if (m_original->isSyncing()) return;
232+ if (isSyncing()) return;
236233
237234 move(from, to);
238235 });
@@ -243,6 +240,11 @@ void ProxyWorkspaceModel::move(int from, int to)
243240 WorkspaceModel::move(from, to);
244241}
245242
243+bool ProxyWorkspaceModel::isSyncing() const
244+{
245+ return m_screen->isSyncing();
246+}
247+
246248void ProxyWorkspaceModel::addWorkspace()
247249{
248250 auto newWorkspace = WorkspaceManager::instance()->createWorkspace();
plugins/WindowManager/WorkspaceModel.h+5−5
@@ -25,6 +25,7 @@ Q_DECLARE_LOGGING_CATEGORY(WORKSPACES)
2525
2626class Workspace;
2727class ProxyWorkspaceModel;
28+class ProxyScreen;
2829
2930class WorkspaceModel : public QAbstractListModel
3031{
@@ -61,12 +62,9 @@ public:
6162
6263 const QVector<Workspace*>& list() const { return m_workspaces; }
6364
64− void setSyncing(bool);
6565 void sync(WorkspaceModel* proxy);
6666 void finishSync();
6767
68− bool isSyncing() { return m_syncing; }
69−
7068Q_SIGNALS:
7169 void countChanged();
7270
@@ -79,7 +77,6 @@ protected:
7977
8078 QVector<Workspace*> m_workspaces;
8179 QSet<Workspace*> m_unassignedWorkspaces;
82− bool m_syncing;
8380
8481 friend class ProxyWorkspaceModel;
8582};
@@ -88,15 +85,18 @@ class ProxyWorkspaceModel : public WorkspaceModel
8885{
8986 Q_OBJECT
9087public:
91− explicit ProxyWorkspaceModel(WorkspaceModel*const model);
88+ explicit ProxyWorkspaceModel(WorkspaceModel*const model, ProxyScreen* screen);
9289
9390 Q_INVOKABLE void move(int from, int to) override;
9491
92+ bool isSyncing() const;
93+
9594public Q_SLOTS:
9695 void addWorkspace();
9796
9897protected:
9998 const QPointer<WorkspaceModel> m_original;
99+ const ProxyScreen* m_screen;
100100};
101101
102102#endif // WORKSPACEMODEL_H
qml/Shell.qml−16
@@ -907,20 +907,4 @@ StyledItem {
907907 }
908908 }
909909 }
910−
911− Loader {
912− z: shutdownFadeOutRectangle.z + 1
913− active: DebuggingController.logOverlay
914−
915− sourceComponent: Text {
916− width: shell.width
917− height: shell.height
918−
919− text: consoleLog.out
920− Debug.ConsoleLog {
921− id: consoleLog
922− enabled: true
923− }
924− }
925− }
926910}
src/DebuggingController.cpp+1−12
@@ -49,8 +49,7 @@ public:
4949};
5050
5151DebuggingController::DebuggingController(QObject *parent):
52− UnityDBusObject(QStringLiteral("/com/canonical/Unity8/Debugging"), QStringLiteral("com.canonical.Unity8"), true, parent),
53− m_logOverlay(false)
52+ UnityDBusObject(QStringLiteral("/com/canonical/Unity8/Debugging"), QStringLiteral("com.canonical.Unity8"), true, parent)
5453{
5554}
5655
@@ -91,13 +90,3 @@ void DebuggingController::SetLoggingFilterRules(const QString &filterRules)
9190{
9291 QLoggingCategory::setFilterRules(filterRules);
9392}
94−
95−void DebuggingController::SetLogOverlay(bool logOverlay)
96−{
97− if (logOverlay == m_logOverlay) {
98− return;
99− }
100−
101− m_logOverlay = logOverlay;
102− Q_EMIT logOverlayChanged(m_logOverlay);
103−}
src/DebuggingController.h−14
@@ -32,14 +32,10 @@ class DebuggingController: public UnityDBusObject
3232 Q_OBJECT
3333 Q_CLASSINFO("D-Bus Interface", "com.canonical.Unity8.Debugging")
3434
35− Q_PROPERTY(bool logOverlay READ logOverlay NOTIFY logOverlayChanged)
36−
3735public:
3836 DebuggingController(QObject *parent = nullptr);
3937 ~DebuggingController() = default;
4038
41− bool logOverlay() const { return m_logOverlay; }
42−
4339public Q_SLOTS:
4440 /**
4541 * Set the QSG_VISUALIZE mode. This follows the vlues supported by Qt in
@@ -57,15 +53,5 @@ public Q_SLOTS:
5753 */
5854 Q_SCRIPTABLE void SetLoggingFilterRules(const QString &filterRules);
5955
60− /**
61− * Enable/Disable the shell console log overlay
62− */
63− Q_SCRIPTABLE void SetLogOverlay(bool logOverlay);
64−
65−Q_SIGNALS:
66− void logOverlayChanged(bool logOverlay);
67−
68−private:
69− bool m_logOverlay;
7056};
7157#endif // DEBUGGINGCONTROLLER_H
tests/CMakeLists.txt+1
@@ -46,6 +46,7 @@ macro(unity8_parse_arguments)
4646 list(APPEND ld_paths
4747 ${UNITY_MOCKPATH}/liblightdm
4848 ${UNITY_MOCKPATH}/libusermetrics
49+ ${UNITY_MOCKPATH}/WindowManager
4950 )
5051
5152 string(REPLACE ";" ":" ld_library_path "${ld_paths}")
tests/mocks/Unity/InputInfo/InputWindow.qmldeleted−68
@@ -1,68 +0,0 @@
1−import QtQuick 2.4
2−import Ubuntu.Components 1.3
3−import Unity.InputInfo 0.1
4−
5−Rectangle {
6− id: rect
7− color: "white"
8− width: parent.width
9− height: parent.height
10−
11− Action {
12− id: mouseAction
13− text: checked ? "Remove Mouse" : "Add Mouse"
14− onTriggered: {
15− if (checked) {
16− console.log("ADD")
17− MockInputDeviceBackend.addMockDevice("/mouse0", InputInfo.Mouse);
18− } else {
19− console.log("REMOVE")
20− MockInputDeviceBackend.removeDevice("/mouse0");
21− }
22− }
23− iconName: "input-mouse-symbolic"
24− checkable: true
25− checked: false
26− }
27−
28− Action {
29− id: kbAction
30− text: checked ? "Remove Keyboard" : "Add Keyboard"
31− onTriggered: {
32− if (checked) {
33− MockInputDeviceBackend.addMockDevice("/kbd0", InputInfo.Keyboard);
34− } else {
35− MockInputDeviceBackend.removeDevice("/kbd0");
36− }
37− }
38− iconName: "input-keyboard-symbolic"
39− checkable: true
40− checked: false
41− }
42−
43− Column {
44− anchors {
45− fill: parent
46− margins: units.gu(1)
47− }
48− spacing: units.gu(1)
49−
50− Button {
51− anchors {
52− left: parent.left
53− right: parent.right
54− }
55− action: mouseAction
56− color: mouseAction.checked ? UbuntuColors.red : UbuntuColors.green
57− }
58−
59− Button {
60− anchors {
61− left: parent.left
62− right: parent.right
63− }
64− action: kbAction
65− color: kbAction.checked ? UbuntuColors.red : UbuntuColors.green
66− }
67− }
68−}
tests/mocks/Unity/InputInfo/mockcontroller.cpp+4−16
@@ -23,26 +23,14 @@
2323#include <QQuickItem>
2424#include <paths.h>
2525
26−MockController::MockController(QQmlEngine *engine)
26+MockController::MockController(QObject *parent):
27+ QObject(parent)
2728{
28− QQmlComponent component(engine);
29− component.setData("import QtQuick 2.4; import Unity.InputInfo 0.1; InputWindow { }", ::qmlDirectory());
30− QObject *myObject = component.create();
31− QQuickItem *item = qobject_cast<QQuickItem*>(myObject);
32− if (item) {
33− auto window = new QQuickView();
34− window->setTitle("Input");
35− item->setParentItem(window->contentItem());
36− window->setResizeMode(QQuickView::SizeRootObjectToView);
37− window->setWidth(200);
38− window->setHeight(100);
39− window->show();
40− }
4129}
4230
43−MockController *MockController::instance(QQmlEngine *engine)
31+MockController *MockController::instance()
4432{
45− static MockController* controller = new MockController(engine);
33+ static MockController* controller = new MockController();
4634 return controller;
4735}
4836
tests/mocks/Unity/InputInfo/mockcontroller.h+2−4
@@ -20,16 +20,14 @@
2020#include <QObject>
2121#include "qinputinfo.h"
2222
23−class QQmlEngine;
24−
2523class MockController: public QObject
2624{
2725 Q_OBJECT
2826public:
29− MockController(QQmlEngine *engine);
27+ MockController(QObject *parent = nullptr);
3028 ~MockController() = default;
3129
32− static MockController *instance(QQmlEngine *engine);
30+ static MockController *instance();
3331
3432 Q_INVOKABLE QInputDevice* addMockDevice(const QString &devicePath, QInputDevice::InputType type);
3533 Q_INVOKABLE void removeDevice(const QString &devicePath);
tests/mocks/Unity/InputInfo/plugin.cpp+1−1
@@ -27,7 +27,7 @@
2727static QObject *backendProvider(QQmlEngine *engine, QJSEngine *scriptEngine)
2828{
2929 Q_UNUSED(scriptEngine)
30− return MockController::instance(engine);
30+ return MockController::instance();
3131}
3232
3333void InputInfoPlugin::registerTypes(const char *uri)
tests/mocks/Unity/InputInfo/qmldir−2
@@ -1,4 +1,2 @@
11module Unity.InputInfo
22plugin MockInputInfo
3−
4−InputWindow 0.1 InputWindow.qml
tests/mocks/WindowManager/CMakeLists.txt+4
@@ -19,6 +19,10 @@ target_link_libraries(mockwindowmanagmentpolicy
1919)
2020qt5_use_modules(mockwindowmanagmentpolicy Core)
2121
22+install(TARGETS mockwindowmanagmentpolicy
23+ DESTINATION ${SHELL_INSTALL_QML}/mocks/WindowManager
24+ )
25+
2226set(WINDOWMANAGER_SRC
2327 ${CMAKE_SOURCE_DIR}/plugins/WindowManager/Screen.cpp
2428 ${CMAKE_SOURCE_DIR}/plugins/WindowManager/ScreenAttached.cpp
tests/qmltests/Panel/tst_Panel.qml+6−3
@@ -42,7 +42,9 @@ PanelTest {
4242 value: keyboardAttached.checked
4343 }
4444
45− readonly property alias panelState: panel.panelState
45+ readonly property var panelState: PanelState {
46+
47+ }
4648
4749 ApplicationMenuDataLoader {
4850 id: appMenuData
@@ -86,6 +88,7 @@ PanelTest {
8688
8789 indicatorMenuWidth: parent.width > units.gu(60) ? units.gu(40) : parent.width
8890 applicationMenuWidth: parent.width > units.gu(60) ? units.gu(40) : parent.width
91+ panelState: root.panelState
8992
9093 applicationMenus {
9194 model: UnityMenuModel {
@@ -855,7 +858,7 @@ PanelTest {
855858
856859 var indicatorsBar = findChild(panel.applicationMenus, "indicatorsBar");
857860
858− PanelState.title = "Fake Title"
861+ root.panelState.title = "Fake Title"
859862 pullDownApplicationsMenu(0 /*xPos*/);
860863 compare(aboutToShowCalledSpy.count, 1);
861864
@@ -888,7 +891,7 @@ PanelTest {
888891
889892 var indicatorsBar = findChild(panel.applicationMenus, "indicatorsBar");
890893
891− PanelState.title = "Fake Title"
894+ panelState.title = "Fake Title"
892895 pullDownApplicationsMenu(0 /*xPos*/);
893896
894897 tryCompare(indicatorsBar, "currentItemIndex", 0);
tests/qmltests/Stage/tst_PhoneStage.qml+4−5
@@ -31,6 +31,8 @@ Item {
3131
3232 property var greeter: { fullyShown: true }
3333
34+ readonly property var topLevelSurfaceList: WorkspaceManager.activeWorkspace.windowModel
35+
3436 ApplicationMenuDataLoader {
3537 id: appMenuData
3638 }
@@ -45,11 +47,8 @@ Item {
4547 orientations: Orientations {}
4648 applicationManager: ApplicationManager
4749 mode: "staged"
48− topLevelSurfaceList: TopLevelWindowModel {
49− id: topLevelSurfaceList
50− applicationManager: ApplicationManager
51− surfaceManager: SurfaceManager
52− }
50+ topLevelSurfaceList: root.topLevelSurfaceList
51+
5352 Component.onCompleted: {
5453 ApplicationManager.startApplication("unity8-dash");
5554 }
tests/qmltests/Stage/tst_TabletStage.qml+41−41
@@ -35,6 +35,8 @@ Rectangle {
3535
3636 property var greeter: { fullyShown: true }
3737
38+ readonly property var topLevelSurfaceList: WorkspaceManager.activeWorkspace.windowModel
39+
3840 ApplicationMenuDataLoader {
3941 id: appMenuData
4042 }
@@ -54,12 +56,10 @@ Rectangle {
5456 focus: true
5557 mode: "stagedWithSideStage"
5658 applicationManager: ApplicationManager
57− topLevelSurfaceList: TopLevelWindowModel {
58− id: topLevelSurfaceList
59− applicationManager: ApplicationManager
60− surfaceManager: SurfaceManager
61− }
59+ topLevelSurfaceList: root.topLevelSurfaceList
60+
6261 Component.onCompleted: {
62+ print("starting dash")
6363 ApplicationManager.startApplication("unity8-dash");
6464 }
6565 }
@@ -131,21 +131,21 @@ Rectangle {
131131 name: "TabletStage"
132132 when: windowShown
133133
134− readonly property alias topSurfaceList: stage.topLevelSurfaceList
134+ readonly property alias topLevelSurfaceList: root.topLevelSurfaceList
135135 property Item sideStage: stage ? findChild(stage, "sideStage") : null
136136
137137 function init() {
138138 stageSaver.clear();
139139
140140 ApplicationManager.startApplication("unity8-dash");
141− tryCompare(topSurfaceList, "count", 1);
142− compare(topSurfaceList.applicationAt(0).appId, "unity8-dash");
141+ tryCompare(topLevelSurfaceList, "count", 1);
142+ compare(topLevelSurfaceList.applicationAt(0).appId, "unity8-dash");
143143
144144 // this is very strange, but sometimes the test starts without
145145 // Stage components having finished loading themselves
146146 var appWindow = null
147147 while (!appWindow) {
148− appWindow = findAppWindowForSurfaceId(topSurfaceList.idAt(0));
148+ appWindow = findAppWindowForSurfaceId(topLevelSurfaceList.idAt(0));
149149 if (!appWindow) {
150150 console.log("didn't find unity8-dash appWindow in Stage. Trying again...");
151151 wait(50);
@@ -157,7 +157,7 @@ Rectangle {
157157 tryCompare(appRepeater, "count", 1);
158158 tryCompare(appRepeater.itemAt(0), "x", 0);
159159
160− waitUntilAppSurfaceShowsUp(topSurfaceList.idAt(0));
160+ waitUntilAppSurfaceShowsUp(topLevelSurfaceList.idAt(0));
161161 sideStage.hideNow()
162162 tryCompare(sideStage, "x", stage.width)
163163 }
@@ -272,7 +272,7 @@ Rectangle {
272272 function test_tappingSwitchesFocusBetweenStages() {
273273 WindowStateStorage.saveStage(dialerCheckBox.appId, ApplicationInfoInterface.SideStage)
274274
275− var webbrowserSurfaceId = topSurfaceList.nextId;
275+ var webbrowserSurfaceId = topLevelSurfaceList.nextId;
276276 webbrowserCheckBox.checked = true;
277277 waitUntilAppSurfaceShowsUp(webbrowserSurfaceId);
278278 var webbrowserDelegate = findChild(stage, "appDelegate_" + webbrowserSurfaceId);
@@ -283,7 +283,7 @@ Rectangle {
283283
284284 tryCompare(webbrowserWindow.surface, "activeFocus", true);
285285
286− var dialerSurfaceId = topSurfaceList.nextId;
286+ var dialerSurfaceId = topLevelSurfaceList.nextId;
287287 dialerCheckBox.checked = true;
288288 waitUntilAppSurfaceShowsUp(dialerSurfaceId);
289289
@@ -315,7 +315,7 @@ Rectangle {
315315 function test_closeAppInSideStage() {
316316 WindowStateStorage.saveStage(dialerCheckBox.appId, ApplicationInfoInterface.SideStage)
317317
318− var dialerSurfaceId = topSurfaceList.nextId;
318+ var dialerSurfaceId = topLevelSurfaceList.nextId;
319319 dialerCheckBox.checked = true;
320320 waitUntilAppSurfaceShowsUp(dialerSurfaceId);
321321
@@ -341,7 +341,7 @@ Rectangle {
341341 }
342342
343343 function test_suspendsAndResumesAppsInMainStage() {
344− var webbrowserSurfaceId = topSurfaceList.nextId;
344+ var webbrowserSurfaceId = topLevelSurfaceList.nextId;
345345 webbrowserCheckBox.checked = true;
346346 waitUntilAppSurfaceShowsUp(webbrowserSurfaceId);
347347 var webbrowserApp = ApplicationManager.findApplication(webbrowserCheckBox.appId);
@@ -350,7 +350,7 @@ Rectangle {
350350
351351 tryCompare(webbrowserApp, "state", ApplicationInfoInterface.Running);
352352
353− var gallerySurfaceId = topSurfaceList.nextId;
353+ var gallerySurfaceId = topLevelSurfaceList.nextId;
354354 galleryCheckBox.checked = true;
355355 waitUntilAppSurfaceShowsUp(gallerySurfaceId);
356356 var galleryApp = ApplicationManager.findApplication(galleryCheckBox.appId);
@@ -381,7 +381,7 @@ Rectangle {
381381 // launch two main stage apps
382382 // gallery will be on foreground and webbrowser on background
383383
384− var webbrowserSurfaceId = topSurfaceList.nextId;
384+ var webbrowserSurfaceId = topLevelSurfaceList.nextId;
385385 webbrowserCheckBox.checked = true;
386386 waitUntilAppSurfaceShowsUp(webbrowserSurfaceId);
387387 var webbrowserDelegate = findChild(stage, "appDelegate_" + webbrowserSurfaceId);
@@ -389,7 +389,7 @@ Rectangle {
389389 compare(webbrowserDelegate.stage, ApplicationInfoInterface.MainStage);
390390 var webbrowserApp = ApplicationManager.findApplication(webbrowserCheckBox.appId);
391391
392− var gallerySurfaceId = topSurfaceList.nextId;
392+ var gallerySurfaceId = topLevelSurfaceList.nextId;
393393 galleryCheckBox.checked = true;
394394 waitUntilAppSurfaceShowsUp(gallerySurfaceId);
395395 var galleryApp = ApplicationManager.findApplication(galleryCheckBox.appId);
@@ -401,14 +401,14 @@ Rectangle {
401401 // then launch two side stage apps
402402 // facebook will be on foreground and dialer on background
403403
404− var dialerSurfaceId = topSurfaceList.nextId;
404+ var dialerSurfaceId = topLevelSurfaceList.nextId;
405405 dialerCheckBox.checked = true;
406406 waitUntilAppSurfaceShowsUp(dialerSurfaceId);
407407 var dialerApp = ApplicationManager.findApplication(dialerCheckBox.appId);
408408 var dialerDelegate = findChild(stage, "appDelegate_" + dialerSurfaceId);
409409 compare(dialerDelegate.stage, ApplicationInfoInterface.SideStage);
410410
411− var facebookSurfaceId = topSurfaceList.nextId;
411+ var facebookSurfaceId = topLevelSurfaceList.nextId;
412412 facebookCheckBox.checked = true;
413413 waitUntilAppSurfaceShowsUp(facebookSurfaceId);
414414 var facebookApp = ApplicationManager.findApplication(facebookCheckBox.appId);
@@ -443,14 +443,14 @@ Rectangle {
443443 function test_foregroundAppsAreSuspendedWhenStageIsSuspended() {
444444 WindowStateStorage.saveStage(dialerCheckBox.appId, ApplicationInfoInterface.SideStage)
445445
446− var webbrowserSurfaceId = topSurfaceList.nextId;
446+ var webbrowserSurfaceId = topLevelSurfaceList.nextId;
447447 webbrowserCheckBox.checked = true;
448448 waitUntilAppSurfaceShowsUp(webbrowserSurfaceId);
449449 var webbrowserApp = ApplicationManager.findApplication(webbrowserCheckBox.appId);
450450 var webbrowserDelegate = findChild(stage, "appDelegate_" + webbrowserSurfaceId);
451451 compare(webbrowserDelegate.stage, ApplicationInfoInterface.MainStage);
452452
453− var dialerSurfaceId = topSurfaceList.nextId;
453+ var dialerSurfaceId = topLevelSurfaceList.nextId;
454454 dialerCheckBox.checked = true;
455455 waitUntilAppSurfaceShowsUp(dialerSurfaceId);
456456 var dialerApp = ApplicationManager.findApplication(dialerCheckBox.appId);
@@ -524,7 +524,7 @@ Rectangle {
524524 tryCompare(stagesPriv, "mainStageAppId", "unity8-dash");
525525 tryCompare(stagesPriv, "sideStageAppId", "");
526526
527− var appSurfaceId = topSurfaceList.nextId;
527+ var appSurfaceId = topLevelSurfaceList.nextId;
528528 var app = ApplicationManager.startApplication(data.appId);
529529 waitUntilAppSurfaceShowsUp(appSurfaceId);
530530
@@ -548,7 +548,7 @@ Rectangle {
548548 tryCompare(stagesPriv, "mainStageAppId", "unity8-dash");
549549 tryCompare(stagesPriv, "sideStageAppId", "");
550550
551− var webbrowserSurfaceId = topSurfaceList.nextId;
551+ var webbrowserSurfaceId = topLevelSurfaceList.nextId;
552552 webbrowserCheckBox.checked = true;
553553 waitUntilAppSurfaceShowsUp(webbrowserSurfaceId);
554554
@@ -573,7 +573,7 @@ Rectangle {
573573 tryCompare(stagesPriv, "mainStageAppId", "unity8-dash");
574574 tryCompare(stagesPriv, "sideStageAppId", "");
575575
576− var webbrowserSurfaceId = topSurfaceList.nextId;
576+ var webbrowserSurfaceId = topLevelSurfaceList.nextId;
577577 webbrowserCheckBox.checked = true;
578578 waitUntilAppSurfaceShowsUp(webbrowserSurfaceId);
579579
@@ -591,7 +591,7 @@ Rectangle {
591591 function test_loadSideStageByDraggingFromMainStage() {
592592 sideStage.showNow();
593593 print("sidestage now shown. launching browser")
594− var webbrowserSurfaceId = topSurfaceList.nextId;
594+ var webbrowserSurfaceId = topLevelSurfaceList.nextId;
595595 webbrowserCheckBox.checked = true;
596596 waitUntilAppSurfaceShowsUp(webbrowserSurfaceId);
597597
@@ -612,7 +612,7 @@ Rectangle {
612612 tryCompareFunction(function() {
613613 return WindowStateStorage.getStage(webbrowserCheckBox.appId, ApplicationInfoInterface.MainStage) === ApplicationInfoInterface.SideStage
614614 }, true);
615− var webbrowserSurfaceId = topSurfaceList.nextId;
615+ var webbrowserSurfaceId = topLevelSurfaceList.nextId;
616616 webbrowserCheckBox.checked = true;
617617 waitUntilAppSurfaceShowsUp(webbrowserSurfaceId);
618618
@@ -628,7 +628,7 @@ Rectangle {
628628
629629 /*
630630 1- Suspended app gets killed behind the scenes, causing its surface to go zombie.
631− 2- Surface gets screenshotted and removed. Its slot in the topSurfaceList remains,
631+ 2- Surface gets screenshotted and removed. Its slot in the topLevelSurfaceList remains,
632632 though (so ApplicationWindow can display the screenshot in its place).
633633 3- User taps on the screenshot of the long-gone surface.
634634
@@ -636,11 +636,11 @@ Rectangle {
636636 Application gets relaunched. Its new surface will seamlessly replace the screenshot.
637637 */
638638 function test_selectSuspendedAppWithoutSurface() {
639− compare(topSurfaceList.applicationAt(0).appId, "unity8-dash");
640− var dashSurfaceId = topSurfaceList.idAt(0);
641− var dashWindow = topSurfaceList.windowAt(0);
639+ compare(topLevelSurfaceList.applicationAt(0).appId, "unity8-dash");
640+ var dashSurfaceId = topLevelSurfaceList.idAt(0);
641+ var dashWindow = topLevelSurfaceList.windowAt(0);
642642
643− var webbrowserSurfaceId = topSurfaceList.nextId;
643+ var webbrowserSurfaceId = topLevelSurfaceList.nextId;
644644 webbrowserCheckBox.checked = true;
645645 waitUntilAppSurfaceShowsUp(webbrowserSurfaceId);
646646 var webbrowserApp = ApplicationManager.findApplication(webbrowserCheckBox.appId);
@@ -657,22 +657,22 @@ Rectangle {
657657
658658 // wait until the surface is gone
659659 tryCompare(webbrowserApp.surfaceList, "count", 0);
660− compare(topSurfaceList.surfaceAt(topSurfaceList.indexForId(webbrowserSurfaceId)), null);
660+ compare(topLevelSurfaceList.surfaceAt(topLevelSurfaceList.indexForId(webbrowserSurfaceId)), null);
661661
662662 switchToSurface(webbrowserSurfaceId);
663663
664664 // webbrowser should have been brought to front
665− tryCompareFunction(function(){return topSurfaceList.idAt(0);}, webbrowserSurfaceId);
665+ tryCompareFunction(function(){return topLevelSurfaceList.idAt(0);}, webbrowserSurfaceId);
666666
667667 // and it should eventually get a new surface and get resumed
668− tryCompareFunction(function(){return topSurfaceList.surfaceAt(0) !== null;}, true);
669− compare(topSurfaceList.count, 2); // still two top-level items
668+ tryCompareFunction(function(){return topLevelSurfaceList.surfaceAt(0) !== null;}, true);
669+ compare(topLevelSurfaceList.count, 2); // still two top-level items
670670 tryCompare(webbrowserApp, "state", ApplicationInfoInterface.Running);
671671 compare(webbrowserApp.surfaceList.count, 1);
672672 }
673673
674674 function test_draggingSurfaceKeepsSurfaceFocus() {
675− var webbrowserSurfaceId = topSurfaceList.nextId;
675+ var webbrowserSurfaceId = topLevelSurfaceList.nextId;
676676 webbrowserCheckBox.checked = true;
677677 waitUntilAppSurfaceShowsUp(webbrowserSurfaceId);
678678
@@ -690,8 +690,8 @@ Rectangle {
690690
691691 function test_dashDoesNotDragToSidestage() {
692692 sideStage.showNow();
693− compare(topSurfaceList.applicationAt(0).appId, "unity8-dash");
694− var dashSurfaceId = topSurfaceList.idAt(0);
693+ compare(topLevelSurfaceList.applicationAt(0).appId, "unity8-dash");
694+ var dashSurfaceId = topLevelSurfaceList.idAt(0);
695695
696696 var appDelegate = findChild(stage, "appDelegate_" + dashSurfaceId);
697697 verify(appDelegate);
@@ -713,7 +713,7 @@ Rectangle {
713713
714714 function test_switchRestoreStageOnRotation() {
715715 WindowStateStorage.saveStage(webbrowserCheckBox.appId, ApplicationInfoInterface.SideStage)
716− var webbrowserSurfaceId = topSurfaceList.nextId;
716+ var webbrowserSurfaceId = topLevelSurfaceList.nextId;
717717 webbrowserCheckBox.checked = true;
718718 waitUntilAppSurfaceShowsUp(webbrowserSurfaceId);
719719
@@ -732,7 +732,7 @@ Rectangle {
732732 }
733733
734734 function test_restoreSavedStageOnCloseReopen() {
735− var webbrowserSurfaceId = topSurfaceList.nextId;
735+ var webbrowserSurfaceId = topLevelSurfaceList.nextId;
736736 webbrowserCheckBox.checked = true;
737737 waitUntilAppSurfaceShowsUp(webbrowserSurfaceId);
738738
@@ -750,7 +750,7 @@ Rectangle {
750750 // back to landscape
751751 stage.shellOrientation = Qt.LandscapeOrientation;
752752
753− webbrowserSurfaceId = topSurfaceList.nextId;
753+ webbrowserSurfaceId = topLevelSurfaceList.nextId;
754754 webbrowserCheckBox.checked = true;
755755 waitUntilAppSurfaceShowsUp(webbrowserSurfaceId);
756756
tests/qmltests/tst_Shell.qml+2−2
@@ -60,7 +60,7 @@ Rectangle {
6060 property var shell: shellLoader.item ? shellLoader.item : null
6161 onShellChanged: {
6262 if (shell) {
63− topLevelSurfaceList = testCase.findInvisibleChild(shell, "topLevelSurfaceList");
63+ topLevelSurfaceList = shell.topLevelSurfaceList;
6464 panelState = testCase.findInvisibleChild(shell, "panelState");
6565 } else {
6666 topLevelSurfaceList = null;
@@ -607,7 +607,7 @@ Rectangle {
607607 waitForGreeterToStabilize();
608608
609609 // from StageTestCase
610− topLevelSurfaceList = findInvisibleChild(shell, "topLevelSurfaceList");
610+ topLevelSurfaceList = shell.topLevelSurfaceList;
611611 verify(topLevelSurfaceList);
612612 stage = findChild(shell, "stage");
613613