on xenial help sign in
Review feedback + some misc fixes
86231ceDaniel d'Andrada
debian/unity8-private.install+1
@@ -14,6 +14,7 @@ usr/lib/*/unity8/qml/Ubuntu
14usr/lib/*/unity8/qml/Unity
14usr/lib/*/unity8/qml/Unity
15usr/lib/*/unity8/qml/UInput
15usr/lib/*/unity8/qml/UInput
16usr/lib/*/unity8/qml/Utils
16usr/lib/*/unity8/qml/Utils
17+usr/lib/*/unity8/qml/WindowManager
17usr/lib/*/unity8/qml/Wizard
18usr/lib/*/unity8/qml/Wizard
18usr/share/accountsservice/interfaces
19usr/share/accountsservice/interfaces
19usr/share/dbus-1/interfaces
20usr/share/dbus-1/interfaces
plugins/WindowManager/TopLevelSurfaceList.cpp+25−26
@@ -25,7 +25,7 @@ Q_LOGGING_CATEGORY(UNITY_TOPSURFACELIST, "unity.topsurfacelist")
25
25
26#define DEBUG_MSG qCDebug(UNITY_TOPSURFACELIST).nospace().noquote() << __func__
26#define DEBUG_MSG qCDebug(UNITY_TOPSURFACELIST).nospace().noquote() << __func__
27
27
28−namespace unityapi = unity::shell::application;
28+using namespace unity::shell::application;
29
29
30TopLevelSurfaceList::TopLevelSurfaceList(QObject *parent) :
30TopLevelSurfaceList::TopLevelSurfaceList(QObject *parent) :
31 QAbstractListModel(parent)
31 QAbstractListModel(parent)
@@ -49,7 +49,7 @@ QVariant TopLevelSurfaceList::data(const QModelIndex& index, int role) const
49 return QVariant();
49 return QVariant();
50
50
51 if (role == SurfaceRole) {
51 if (role == SurfaceRole) {
52− unityapi::MirSurfaceInterface *surface = m_surfaceList.at(index.row()).surface;
52+ MirSurfaceInterface *surface = m_surfaceList.at(index.row()).surface;
53 return QVariant::fromValue(surface);
53 return QVariant::fromValue(surface);
54 } else if (role == ApplicationRole) {
54 } else if (role == ApplicationRole) {
55 return QVariant::fromValue(m_surfaceList.at(index.row()).application);
55 return QVariant::fromValue(m_surfaceList.at(index.row()).application);
@@ -60,7 +60,7 @@ QVariant TopLevelSurfaceList::data(const QModelIndex& index, int role) const
60 }
60 }
61}
61}
62
62
63−void TopLevelSurfaceList::raise(unityapi::MirSurfaceInterface *surface)
63+void TopLevelSurfaceList::raise(MirSurfaceInterface *surface)
64{
64{
65 if (!surface)
65 if (!surface)
66 return;
66 return;
@@ -73,13 +73,13 @@ void TopLevelSurfaceList::raise(unityapi::MirSurfaceInterface *surface)
73 }
73 }
74}
74}
75
75
76−void TopLevelSurfaceList::prependPlaceholder(unityapi::ApplicationInfoInterface *application)
76+void TopLevelSurfaceList::prependPlaceholder(ApplicationInfoInterface *application)
77{
77{
78 DEBUG_MSG << "(" << application->appId() << ")";
78 DEBUG_MSG << "(" << application->appId() << ")";
79 prependSurfaceHelper(nullptr, application);
79 prependSurfaceHelper(nullptr, application);
80}
80}
81
81
82−void TopLevelSurfaceList::prependSurface(unityapi::MirSurfaceInterface *surface, unityapi::ApplicationInfoInterface *application)
82+void TopLevelSurfaceList::prependSurface(MirSurfaceInterface *surface, ApplicationInfoInterface *application)
83{
83{
84 Q_ASSERT(surface != nullptr);
84 Q_ASSERT(surface != nullptr);
85
85
@@ -101,7 +101,7 @@ void TopLevelSurfaceList::prependSurface(unityapi::MirSurfaceInterface *surface,
101 }
101 }
102}
102}
103
103
104−void TopLevelSurfaceList::prependSurfaceHelper(unityapi::MirSurfaceInterface *surface, unityapi::ApplicationInfoInterface *application)
104+void TopLevelSurfaceList::prependSurfaceHelper(MirSurfaceInterface *surface, ApplicationInfoInterface *application)
105{
105{
106 beginInsertRows(QModelIndex(), 0 /*first*/, 0 /*last*/);
106 beginInsertRows(QModelIndex(), 0 /*first*/, 0 /*last*/);
107 int id = generateId();
107 int id = generateId();
@@ -115,14 +115,14 @@ void TopLevelSurfaceList::prependSurfaceHelper(unityapi::MirSurfaceInterface *su
115 Q_EMIT listChanged();
115 Q_EMIT listChanged();
116}
116}
117
117
118−void TopLevelSurfaceList::connectSurface(unityapi::MirSurfaceInterface *surface)
118+void TopLevelSurfaceList::connectSurface(MirSurfaceInterface *surface)
119{
119{
120− connect(surface, &unityapi::MirSurfaceInterface::focusedChanged, this, [this, surface](bool focused){
120+ connect(surface, &MirSurfaceInterface::focusedChanged, this, [this, surface](bool focused){
121 if (focused) {
121 if (focused) {
122 this->raise(surface);
122 this->raise(surface);
123 }
123 }
124 });
124 });
125− connect(surface, &unityapi::MirSurfaceInterface::liveChanged, this, [this, surface](bool live){
125+ connect(surface, &MirSurfaceInterface::liveChanged, this, [this, surface](bool live){
126 if (!live) {
126 if (!live) {
127 onSurfaceDied(surface);
127 onSurfaceDied(surface);
128 }
128 }
@@ -130,7 +130,7 @@ void TopLevelSurfaceList::connectSurface(unityapi::MirSurfaceInterface *surface)
130 connect(surface, &QObject::destroyed, this, [this, surface](){ this->onSurfaceDestroyed(surface); });
130 connect(surface, &QObject::destroyed, this, [this, surface](){ this->onSurfaceDestroyed(surface); });
131}
131}
132
132
133−void TopLevelSurfaceList::onSurfaceDied(unityapi::MirSurfaceInterface *surface)
133+void TopLevelSurfaceList::onSurfaceDied(MirSurfaceInterface *surface)
134{
134{
135 int i = indexOf(surface);
135 int i = indexOf(surface);
136 if (i == -1) {
136 if (i == -1) {
@@ -140,9 +140,9 @@ void TopLevelSurfaceList::onSurfaceDied(unityapi::MirSurfaceInterface *surface)
140 auto application = m_surfaceList[i].application;
140 auto application = m_surfaceList[i].application;
141
141
142 // can't be starting if it already has a surface
142 // can't be starting if it already has a surface
143− Q_ASSERT(application->state() != unityapi::ApplicationInfoInterface::Starting);
143+ Q_ASSERT(application->state() != ApplicationInfoInterface::Starting);
144
144
145− if (application->state() == unityapi::ApplicationInfoInterface::Running) {
145+ if (application->state() == ApplicationInfoInterface::Running) {
146 m_surfaceList[i].removeOnceSurfaceDestroyed = true;
146 m_surfaceList[i].removeOnceSurfaceDestroyed = true;
147 } else {
147 } else {
148 // assume it got killed by the out-of-memory daemon.
148 // assume it got killed by the out-of-memory daemon.
@@ -153,7 +153,7 @@ void TopLevelSurfaceList::onSurfaceDied(unityapi::MirSurfaceInterface *surface)
153 }
153 }
154}
154}
155
155
156−void TopLevelSurfaceList::onSurfaceDestroyed(unityapi::MirSurfaceInterface *surface)
156+void TopLevelSurfaceList::onSurfaceDestroyed(MirSurfaceInterface *surface)
157{
157{
158 int i = indexOf(surface);
158 int i = indexOf(surface);
159 if (i == -1) {
159 if (i == -1) {
@@ -179,7 +179,7 @@ void TopLevelSurfaceList::removeAt(int index)
179 Q_EMIT listChanged();
179 Q_EMIT listChanged();
180}
180}
181
181
182−int TopLevelSurfaceList::indexOf(unityapi::MirSurfaceInterface *surface)
182+int TopLevelSurfaceList::indexOf(MirSurfaceInterface *surface)
183{
183{
184 for (int i = 0; i < m_surfaceList.count(); ++i) {
184 for (int i = 0; i < m_surfaceList.count(); ++i) {
185 if (m_surfaceList.at(i).surface == surface) {
185 if (m_surfaceList.at(i).surface == surface) {
@@ -208,7 +208,7 @@ void TopLevelSurfaceList::moveSurface(int from, int to)
208 }
208 }
209}
209}
210
210
211−unityapi::MirSurfaceInterface *TopLevelSurfaceList::surfaceAt(int index) const
211+MirSurfaceInterface *TopLevelSurfaceList::surfaceAt(int index) const
212{
212{
213 if (index >=0 && index < m_surfaceList.count()) {
213 if (index >=0 && index < m_surfaceList.count()) {
214 return m_surfaceList[index].surface;
214 return m_surfaceList[index].surface;
@@ -217,7 +217,7 @@ unityapi::MirSurfaceInterface *TopLevelSurfaceList::surfaceAt(int index) const
217 }
217 }
218}
218}
219
219
220−unityapi::ApplicationInfoInterface *TopLevelSurfaceList::applicationAt(int index) const
220+ApplicationInfoInterface *TopLevelSurfaceList::applicationAt(int index) const
221{
221{
222 if (index >=0 && index < m_surfaceList.count()) {
222 if (index >=0 && index < m_surfaceList.count()) {
223 return m_surfaceList[index].application;
223 return m_surfaceList[index].application;
@@ -296,15 +296,15 @@ QString TopLevelSurfaceList::toString()
296 return str;
296 return str;
297}
297}
298
298
299−void TopLevelSurfaceList::addApplication(unityapi::ApplicationInfoInterface *application)
299+void TopLevelSurfaceList::addApplication(ApplicationInfoInterface *application)
300{
300{
301 DEBUG_MSG << "(" << application->appId() << ")";
301 DEBUG_MSG << "(" << application->appId() << ")";
302 Q_ASSERT(!m_applications.contains(application));
302 Q_ASSERT(!m_applications.contains(application));
303 m_applications.append(application);
303 m_applications.append(application);
304
304
305− unityapi::MirSurfaceListInterface *surfaceList = application->surfaceList();
305+ MirSurfaceListInterface *surfaceList = application->surfaceList();
306
306
307− if (application->state() != unityapi::ApplicationInfoInterface::Stopped) {
307+ if (application->state() != ApplicationInfoInterface::Stopped) {
308 if (surfaceList->count() == 0) {
308 if (surfaceList->count() == 0) {
309 prependPlaceholder(application);
309 prependPlaceholder(application);
310 } else {
310 } else {
@@ -323,12 +323,12 @@ void TopLevelSurfaceList::addApplication(unityapi::ApplicationInfoInterface *app
323 });
323 });
324}
324}
325
325
326−void TopLevelSurfaceList::removeApplication(unityapi::ApplicationInfoInterface *application)
326+void TopLevelSurfaceList::removeApplication(ApplicationInfoInterface *application)
327{
327{
328 DEBUG_MSG << "(" << application->appId() << ")";
328 DEBUG_MSG << "(" << application->appId() << ")";
329 Q_ASSERT(m_applications.contains(application));
329 Q_ASSERT(m_applications.contains(application));
330
330
331− unityapi::MirSurfaceListInterface *surfaceList = application->surfaceList();
331+ MirSurfaceListInterface *surfaceList = application->surfaceList();
332
332
333 disconnect(surfaceList, 0, this, 0);
333 disconnect(surfaceList, 0, this, 0);
334
334
@@ -401,23 +401,22 @@ void TopLevelSurfaceList::setApplicationsModel(QAbstractListModel* value)
401 endResetModel();
401 endResetModel();
402}
402}
403
403
404−unityapi::ApplicationInfoInterface *TopLevelSurfaceList::getApplicationFromModelAt(int index)
404+ApplicationInfoInterface *TopLevelSurfaceList::getApplicationFromModelAt(int index)
405{
405{
406 QModelIndex modelIndex = m_applicationsModel->index(index);
406 QModelIndex modelIndex = m_applicationsModel->index(index);
407
407
408 QVariant variant = m_applicationsModel->data(modelIndex, m_applicationRole);
408 QVariant variant = m_applicationsModel->data(modelIndex, m_applicationRole);
409
409
410− // variant.value<unityapi::ApplicationInfoInterface*>() returns null for some reason.
410+ // variant.value<ApplicationInfoInterface*>() returns null for some reason.
411− return static_cast<unityapi::ApplicationInfoInterface*>(variant.value<QObject*>());
411+ return static_cast<ApplicationInfoInterface*>(variant.value<QObject*>());
412}
412}
413
413
414void TopLevelSurfaceList::findApplicationRole()
414void TopLevelSurfaceList::findApplicationRole()
415{
415{
416 QHash<int, QByteArray> namesHash = m_applicationsModel->roleNames();
416 QHash<int, QByteArray> namesHash = m_applicationsModel->roleNames();
417− QHash<int, QByteArray>::iterator i;
418
417
419 m_applicationRole = -1;
418 m_applicationRole = -1;
420− for (i = namesHash.begin(); i != namesHash.end() && m_applicationRole == -1; ++i) {
419+ for (auto i = namesHash.begin(); i != namesHash.end() && m_applicationRole == -1; ++i) {
421 if (i.value() == "application") {
420 if (i.value() == "application") {
422 m_applicationRole = i.key();
421 m_applicationRole = i.key();
423 }
422 }
plugins/WindowManager/TopLevelSurfaceList.h+4−5
@@ -91,11 +91,10 @@ public:
91 // QAbstractItemModel methods
91 // QAbstractItemModel methods
92 int rowCount(const QModelIndex &parent = QModelIndex()) const override;
92 int rowCount(const QModelIndex &parent = QModelIndex()) const override;
93 QVariant data(const QModelIndex& index, int role) const override;
93 QVariant data(const QModelIndex& index, int role) const override;
94− QHash<int, QByteArray> roleNames() const {
94+ QHash<int, QByteArray> roleNames() const override {
95− QHash<int, QByteArray> roleNames;
95+ QHash<int, QByteArray> roleNames { {SurfaceRole, "surface"},
96− roleNames.insert(SurfaceRole, "surface");
97− roleNames.insert(ApplicationRole, "application");
96+ {ApplicationRole, "application"},
98− roleNames.insert(IdRole, "id");
97+ {IdRole, "id"} };
99 return roleNames;
98 return roleNames;
100 }
99 }
101
100
qml/Components/KeymapSwitcher.qml−1
@@ -59,7 +59,6 @@ QtObject {
59
59
60 property Binding surfaceKeymapBinding: Binding {
60 property Binding surfaceKeymapBinding: Binding {
61 target: MirFocusController.focusedSurface
61 target: MirFocusController.focusedSurface
62− when: target != null && target.live
63 property: "keymap"
62 property: "keymap"
64 value: root.currentKeymap
63 value: root.currentKeymap
65 }
64 }
qml/Shell.qml+4−4
@@ -101,19 +101,18 @@ Item {
101 applicationsDisplayLoader.item ? applicationsDisplayLoader.item.mainApp : null
101 applicationsDisplayLoader.item ? applicationsDisplayLoader.item.mainApp : null
102 onMainAppChanged: {
102 onMainAppChanged: {
103 if (mainApp) {
103 if (mainApp) {
104− _makeGreeterReactToAppChange(mainApp.appId);
104+ _onMainAppChanged(mainApp.appId);
105 }
105 }
106−
107 }
106 }
108 Connections {
107 Connections {
109 target: ApplicationManager
108 target: ApplicationManager
110 onFocusRequested: {
109 onFocusRequested: {
111 if (shell.mainApp && shell.mainApp.appId === appId) {
110 if (shell.mainApp && shell.mainApp.appId === appId) {
112− _makeGreeterReactToAppChange(appId);
111+ _onMainAppChanged(appId);
113 }
112 }
114 }
113 }
115 }
114 }
116− function _makeGreeterReactToAppChange(appId) {
115+ function _onMainAppChanged(appId) {
117 if (tutorial.running && appId != "" && appId != "unity8-dash") {
116 if (tutorial.running && appId != "" && appId != "unity8-dash") {
118 // If this happens on first boot, we may be in edge
117 // If this happens on first boot, we may be in edge
119 // tutorial or wizard while receiving a call. But a call
118 // tutorial or wizard while receiving a call. But a call
@@ -570,6 +569,7 @@ Item {
570 }
569 }
571 onLauncherApplicationSelected: {
570 onLauncherApplicationSelected: {
572 greeter.notifyUserRequestedApp(appId);
571 greeter.notifyUserRequestedApp(appId);
572+ shell.activateApplication(appId);
573 }
573 }
574 onShownChanged: {
574 onShownChanged: {
575 if (shown) {
575 if (shown) {
qml/Stages/ApplicationWindow.qml+7−3
@@ -55,6 +55,10 @@ FocusScope {
55 readonly property int heightIncrement: surface ? surface.heightIncrement : 0
55 readonly property int heightIncrement: surface ? surface.heightIncrement : 0
56
56
57 onSurfaceChanged: {
57 onSurfaceChanged: {
58+ // The order in which the instructions are executed here matters, to that the correct state
59+ // transitions in stateGroup take place.
60+ // More specifically, the moment surfaceContainer.surface gets updated relative to the
61+ // other instructions.
58 if (surface) {
62 if (surface) {
59 surfaceContainer.surface = surface;
63 surfaceContainer.surface = surface;
60 d.liveSurface = surface.live;
64 d.liveSurface = surface.live;
@@ -78,9 +82,9 @@ FocusScope {
78 onLiveChanged: d.liveSurface = root.surface.live
82 onLiveChanged: d.liveSurface = root.surface.live
79 }
83 }
80 // using liveSurface instead of root.surface.live because with the latter
84 // using liveSurface instead of root.surface.live because with the latter
81− // this expression is not reevaluated when root.surface.live changes
85+ // this expression is not reevaluated when root.surface changes
82− property bool needToTakeScreenshot: root.surface && d.surfaceInitialized && !d.liveSurface
86+ readonly property bool needToTakeScreenshot: root.surface && d.surfaceInitialized && !d.liveSurface
83− && applicationState !== ApplicationInfoInterface.Running
87+ && applicationState !== ApplicationInfoInterface.Running
84 onNeedToTakeScreenshotChanged: {
88 onNeedToTakeScreenshotChanged: {
85 if (needToTakeScreenshot && screenshotImage.status === Image.Null) {
89 if (needToTakeScreenshot && screenshotImage.status === Image.Null) {
86 screenshotImage.take();
90 screenshotImage.take();
qml/Stages/DecoratedWindow.qml+1−1
@@ -29,7 +29,7 @@ FocusScope {
29 property alias application: applicationWindow.application
29 property alias application: applicationWindow.application
30 property alias surface: applicationWindow.surface
30 property alias surface: applicationWindow.surface
31 property alias active: decoration.active
31 property alias active: decoration.active
32− property alias title: decoration.title
32+ readonly property alias title: applicationWindow.title
33 property alias fullscreen: applicationWindow.fullscreen
33 property alias fullscreen: applicationWindow.fullscreen
34
34
35 readonly property bool decorationShown: !fullscreen
35 readonly property bool decorationShown: !fullscreen
qml/Stages/DesktopStage.qml−4
@@ -332,10 +332,6 @@ AbstractStage {
332
332
333 function close() {
333 function close() {
334 model.surface.close();
334 model.surface.close();
335− // TODO: Should we brute force and stop the application if it doesn't quit
336− // after having its last window closed?
337− // TODO: Destroy the surface if the application doesn't comply after a given
338− // amount of time.
339 }
335 }
340
336
341 function maximize(animated) {
337 function maximize(animated) {
qml/Stages/PhoneStage.qml+4−3
@@ -291,14 +291,14 @@ AbstractStage {
291 }
291 }
292 }
292 }
293 function undoContentXReset() {
293 function undoContentXReset() {
294− if (contentWidth === -1) {
294+ if (contentWidth <= 0) {
295 contentWidthOnLastContentXChange = contentWidth;
295 contentWidthOnLastContentXChange = contentWidth;
296 lastContentX = contentX;
296 lastContentX = contentX;
297 return false;
297 return false;
298 }
298 }
299
299
300− if (contentWidth != contentWidthOnLastContentXChange
300+ if (contentWidth !== contentWidthOnLastContentXChange
301− && lastContentX == -shift && contentX == 0) {
301+ && lastContentX === -shift && contentX === 0) {
302 // Flickable is resetting contentX because contentWidth has changed. Undo it.
302 // Flickable is resetting contentX because contentWidth has changed. Undo it.
303 contentX = -shift;
303 contentX = -shift;
304 return true;
304 return true;
@@ -310,6 +310,7 @@ AbstractStage {
310 }
310 }
311 property real contentWidthOnLastContentXChange: -1
311 property real contentWidthOnLastContentXChange: -1
312 property real lastContentX: 0
312 property real lastContentX: 0
313+ // </FIXME-contentX>
313
314
314 Behavior on contentX {
315 Behavior on contentX {
315 enabled: root.altTabPressed
316 enabled: root.altTabPressed
qml/Stages/PromptSurfaceAnimations.qml+4
@@ -39,6 +39,7 @@ StateGroup {
39 transitions: [
39 transitions: [
40 Transition {
40 Transition {
41 from: "*"; to: "zombie"
41 from: "*"; to: "zombie"
42+ // Slide downwards until it's out of view, through the bottom of the window
42 SequentialAnimation {
43 SequentialAnimation {
43 // clip so we don't go out of parent's bounds during spread
44 // clip so we don't go out of parent's bounds during spread
44 PropertyAction { target: root.container.parent; property: "clip"; value: true }
45 PropertyAction { target: root.container.parent; property: "clip"; value: true }
@@ -47,12 +48,15 @@ StateGroup {
47 PropertyAction { target: root.surfaceItem; property: "visible"; value: false }
48 PropertyAction { target: root.surfaceItem; property: "visible"; value: false }
48 PropertyAction { target: container.parent; property: "clip"; value: false }
49 PropertyAction { target: container.parent; property: "clip"; value: false }
49 ScriptAction { script: {
50 ScriptAction { script: {
51+ // Unity.Application can't destroy a zombie MirSurface if it's still being
52+ // referenced by a MirSurfaceItem.
50 root.surfaceItem.surface = null;
53 root.surfaceItem.surface = null;
51 } }
54 } }
52 }
55 }
53 },
56 },
54 Transition {
57 Transition {
55 from: "*"; to: "ready"
58 from: "*"; to: "ready"
59+ // Slide upwards into view, from the bottom of the window
56 SequentialAnimation {
60 SequentialAnimation {
57 // clip so we don't go out of parent's bounds during spread
61 // clip so we don't go out of parent's bounds during spread
58 PropertyAction { target: root.container.parent; property: "clip"; value: true }
62 PropertyAction { target: root.container.parent; property: "clip"; value: true }
qml/Stages/SurfaceContainer.qml+3−3
@@ -36,9 +36,9 @@ FocusScope {
36 property bool inPromptSession: false
36 property bool inPromptSession: false
37
37
38 onSurfaceChanged: {
38 onSurfaceChanged: {
39− // not a binding because in some cases
40− // we remove the surface from the surfaceItem programatically,
39+ // Not a binding because animations might remove the surface from the surfaceItem
40+ // programatically (in order to signal that a zombie surface is free for deletion),
41− // even though root.surface is still !null
41+ // even though root.surface is still !null.
42 surfaceItem.surface = surface;
42 surfaceItem.surface = surface;
43 }
43 }
44
44
qml/Stages/TabletStage.qml+2−3
@@ -367,7 +367,7 @@ AbstractStage {
367 }
367 }
368 }
368 }
369 function undoContentXReset() {
369 function undoContentXReset() {
370− if (contentWidth === -1) {
370+ if (contentWidth <= 0) {
371 contentWidthOnLastContentXChange = contentWidth;
371 contentWidthOnLastContentXChange = contentWidth;
372 lastContentX = contentX;
372 lastContentX = contentX;
373 return false;
373 return false;
@@ -536,7 +536,6 @@ AbstractStage {
536 if (index > 2) return index;
536 if (index > 2) return index;
537
537
538 var mainStageIndex = root.topLevelSurfaceList.indexForId(priv.mainStageItemId);
538 var mainStageIndex = root.topLevelSurfaceList.indexForId(priv.mainStageItemId);
539− var sideStageIndex = root.topLevelSurfaceList.indexForId(priv.sideStageItemId);
540
539
541 if (index == mainStageIndex) {
540 if (index == mainStageIndex) {
542 // Active main stage always at 0
541 // Active main stage always at 0
@@ -719,7 +718,7 @@ AbstractStage {
719 id: spreadTile
718 id: spreadTile
720 objectName: "spreadDelegate_" + model.id
719 objectName: "spreadDelegate_" + model.id
721
720
722− property int index: model.index
721+ readonly property int index: model.index
723 width: spreadView.width
722 width: spreadView.width
724 height: spreadView.height
723 height: spreadView.height
725 active: model.id == priv.mainStageItemId || model.id == priv.sideStageItemId
724 active: model.id == priv.mainStageItemId || model.id == priv.sideStageItemId
tests/mocks/Unity/Application/ApplicationManager.cpp−1
@@ -352,7 +352,6 @@ void ApplicationManager::buildListOfAvailableApplications()
352 application->setName("Camera");
352 application->setName("Camera");
353 application->setScreenshotId("camera");
353 application->setScreenshotId("camera");
354 application->setIconId("camera");
354 application->setIconId("camera");
355− application->setShellChrome(Mir::LowChrome);
356 application->setFullscreen(true);
355 application->setFullscreen(true);
357 application->setSupportedOrientations(Qt::PortraitOrientation
356 application->setSupportedOrientations(Qt::PortraitOrientation
358 | Qt::LandscapeOrientation
357 | Qt::LandscapeOrientation
tests/mocks/Unity/Application/MirSurface.cpp+28
@@ -23,6 +23,31 @@
23
23
24#if MIRSURFACE_DEBUG
24#if MIRSURFACE_DEBUG
25#define DEBUG_MSG(params) qDebug().nospace() << "MirSurface[" << (void*)this << "," << m_name << "]::" << __func__ << " " << params
25#define DEBUG_MSG(params) qDebug().nospace() << "MirSurface[" << (void*)this << "," << m_name << "]::" << __func__ << " " << params
26+
27+const char *stateToStr(Mir::State state)
28+{
29+ switch(state) {
30+ case Mir::UnknownState:
31+ return "unknown";
32+ case Mir::RestoredState:
33+ return "restored";
34+ case Mir::MinimizedState:
35+ return "minimized";
36+ case Mir::MaximizedState:
37+ return "maximized";
38+ case Mir::VertMaximizedState:
39+ return "vert-maximized";
40+ case Mir::FullscreenState:
41+ return "fullscreen";
42+ case Mir::HorizMaximizedState:
43+ return "horiz-maximized";
44+ case Mir::HiddenState:
45+ return "hidden";
46+ default:
47+ return "???";
48+ };
49+}
50+
26#else
51#else
27#define DEBUG_MSG(params) ((void)0)
52#define DEBUG_MSG(params) ((void)0)
28#endif
53#endif
@@ -95,6 +120,7 @@ void MirSurface::setState(Mir::State state)
95 if (state == m_state)
120 if (state == m_state)
96 return;
121 return;
97
122
123+ DEBUG_MSG(stateToStr(state));
98 m_state = state;
124 m_state = state;
99 Q_EMIT stateChanged(state);
125 Q_EMIT stateChanged(state);
100}
126}
@@ -159,6 +185,7 @@ void MirSurface::setOrientationAngle(Mir::OrientationAngle angle)
159void MirSurface::setKeymap(const QString &value)
185void MirSurface::setKeymap(const QString &value)
160{
186{
161 if (value != m_keymap) {
187 if (value != m_keymap) {
188+ DEBUG_MSG(value);
162 m_keymap = value;
189 m_keymap = value;
163 Q_EMIT keymapChanged(m_keymap);
190 Q_EMIT keymapChanged(m_keymap);
164 }
191 }
@@ -179,6 +206,7 @@ void MirSurface::setShellChrome(Mir::ShellChrome shellChrome)
179 if (shellChrome == m_shellChrome)
206 if (shellChrome == m_shellChrome)
180 return;
207 return;
181
208
209+ DEBUG_MSG(shellChrome);
182 m_shellChrome = shellChrome;
210 m_shellChrome = shellChrome;
183 Q_EMIT shellChromeChanged(shellChrome);
211 Q_EMIT shellChromeChanged(shellChrome);
184}
212}
tests/qmltests/tst_OrientedShell.qml+13−7
@@ -495,17 +495,23 @@ Rectangle {
495 function test_appSupportingOnlyPrimaryOrientationMakesPhoneShellStayPut() {
495 function test_appSupportingOnlyPrimaryOrientationMakesPhoneShellStayPut() {
496 loadShell("mako");
496 loadShell("mako");
497
497
498+ var spreadRepeater = findChild(shell, "spreadRepeater");
499+ verify(spreadRepeater);
500+
498 // unity8-dash supports only primary orientation and should be already running
501 // unity8-dash supports only primary orientation and should be already running
499− var dashAppWindow = findChild(shell, "appWindow_unity8-dash");
502+ compare(spreadRepeater.count, 1);
500− verify(dashAppWindow);
503+ var dashDelegate = spreadRepeater.itemAt(0);
501− compare(ApplicationManager.focusedApplicationId, "unity8-dash");
502− var dashApp = dashAppWindow.application
504+ var dashApp = dashDelegate.application;
503 verify(dashApp);
505 verify(dashApp);
506+ compare(dashApp.appId, "unity8-dash");
507+ var dashAppWindow = findChild(dashDelegate, "appWindow");
508+ verify(dashAppWindow);
509+ compare(dashDelegate.focus, true);
504 compare(dashApp.rotatesWindowContents, false);
510 compare(dashApp.rotatesWindowContents, false);
505 compare(dashApp.supportedOrientations, Qt.PrimaryOrientation);
511 compare(dashApp.supportedOrientations, Qt.PrimaryOrientation);
506 compare(dashApp.stage, ApplicationInfoInterface.MainStage);
512 compare(dashApp.stage, ApplicationInfoInterface.MainStage);
507
513
508− tryCompareFunction(function(){return dashApp.session.lastSurface != null;}, true);
514+ tryCompareFunction(function(){return dashDelegate.surface != null;}, true);
509 verify(checkAppSurfaceOrientation(dashAppWindow, dashApp, root.primaryOrientationAngle));
515 verify(checkAppSurfaceOrientation(dashAppWindow, dashApp, root.primaryOrientationAngle));
510
516
511 compare(shell.transformRotationAngle, root.primaryOrientationAngle);
517 compare(shell.transformRotationAngle, root.primaryOrientationAngle);
@@ -915,9 +921,9 @@ Rectangle {
915 verify(item.application.appId, "dialer-app");
921 verify(item.application.appId, "dialer-app");
916 }
922 }
917
923
924+ WindowStateStorage.saveStage("dialer-app", ApplicationInfoInterface.SideStage)
918 var dialerApp = ApplicationManager.startApplication("dialer-app");
925 var dialerApp = ApplicationManager.startApplication("dialer-app");
919 verify(dialerApp);
926 verify(dialerApp);
920− dialerApp.stage = ApplicationInfoInterface.SideStage;
921
927
922 // ensure the mock dialer-app is as we expect
928 // ensure the mock dialer-app is as we expect
923 compare(dialerApp.rotatesWindowContents, false);
929 compare(dialerApp.rotatesWindowContents, false);
@@ -962,9 +968,9 @@ Rectangle {
962 verify(item.application.appId, "dialer-app");
968 verify(item.application.appId, "dialer-app");
963 }
969 }
964
970
971+ WindowStateStorage.saveStage("dialer-app", ApplicationInfoInterface.SideStage)
965 var dialerApp = ApplicationManager.startApplication("dialer-app");
972 var dialerApp = ApplicationManager.startApplication("dialer-app");
966 verify(dialerApp);
973 verify(dialerApp);
967− dialerApp.stage = ApplicationInfoInterface.SideStage;
968
974
969 // ensure the mock dialer-app is as we expect
975 // ensure the mock dialer-app is as we expect
970 compare(dialerApp.rotatesWindowContents, false);
976 compare(dialerApp.rotatesWindowContents, false);
tests/qmltests/tst_Shell.qml+27−14
@@ -2299,9 +2299,18 @@ Rectangle {
2299
2299
2300 tryCompare(launcher, "lockedVisible", true);
2300 tryCompare(launcher, "lockedVisible", true);
2301
2301
2302− var cameraSurfaceId = topLevelSurfaceList.nextId;
2302+ var surfaceId = topLevelSurfaceList.nextId;
2303− var cameraApp = ApplicationManager.startApplication("camera-app");
2303+ var app = ApplicationManager.startApplication("gmail-webapp");
2304+
2304− waitUntilAppWindowIsFullyLoaded(cameraSurfaceId);
2305+ waitUntilAppWindowIsFullyLoaded(surfaceId);
2306+
2307+ // Sanity check: ensure the fake app we chose creates a surface the way
2308+ // we expect it to.
2309+ compare(app.surfaceList.get(0).shellChrome, Mir.NormalChrome);
2310+
2311+ compare(launcher.lockedVisible, true);
2312+
2313+ app.surfaceList.get(0).state = Mir.FullscreenState;
2305
2314
2306 tryCompare(launcher, "lockedVisible", false);
2315 tryCompare(launcher, "lockedVisible", false);
2307 }
2316 }
@@ -2361,19 +2370,21 @@ Rectangle {
2361 AccountsService.keymaps = ["sk", "cz+qwerty", "fr"] // "configure" the keymaps for user
2370 AccountsService.keymaps = ["sk", "cz+qwerty", "fr"] // "configure" the keymaps for user
2362
2371
2363 // start some app
2372 // start some app
2373+ var appSurfaceId = topLevelSurfaceList.nextId;
2364 var app = ApplicationManager.startApplication("dialer-app");
2374 var app = ApplicationManager.startApplication("dialer-app");
2365− waitUntilAppWindowIsFullyLoaded(app);
2375+ waitUntilAppWindowIsFullyLoaded(appSurfaceId);
2376+ var appSurface = app.surfaceList.get(0);
2366
2377
2367 // verify the initial keymap of the newly started app is the first one from the list
2378 // verify the initial keymap of the newly started app is the first one from the list
2368− tryCompare(app.session.lastSurface, "keymap", "sk");
2379+ tryCompare(appSurface, "keymap", "sk");
2369
2380
2370 // switch to next keymap, should go to "cz+qwerty"
2381 // switch to next keymap, should go to "cz+qwerty"
2371 keyClick(Qt.Key_Space, Qt.MetaModifier);
2382 keyClick(Qt.Key_Space, Qt.MetaModifier);
2372− tryCompare(app.session.lastSurface, "keymap", "cz+qwerty");
2383+ tryCompare(appSurface, "keymap", "cz+qwerty");
2373
2384
2374 // switch to next keymap, should go to "fr"
2385 // switch to next keymap, should go to "fr"
2375 keyClick(Qt.Key_Space, Qt.MetaModifier);
2386 keyClick(Qt.Key_Space, Qt.MetaModifier);
2376− tryCompare(app.session.lastSurface, "keymap", "fr");
2387+ tryCompare(appSurface, "keymap", "fr");
2377
2388
2378 // go to e.g. desktop stage
2389 // go to e.g. desktop stage
2379 loadShell("desktop");
2390 loadShell("desktop");
@@ -2381,30 +2392,32 @@ Rectangle {
2381 waitForRendering(shell);
2392 waitForRendering(shell);
2382
2393
2383 // start a second app, should get the last configured keyboard, "fr"
2394 // start a second app, should get the last configured keyboard, "fr"
2395+ var app2SurfaceId = topLevelSurfaceList.nextId;
2384 var app2 = ApplicationManager.startApplication("calendar-app");
2396 var app2 = ApplicationManager.startApplication("calendar-app");
2385− waitUntilAppWindowIsFullyLoaded(app2);
2397+ waitUntilAppWindowIsFullyLoaded(app2SurfaceId);
2398+ var app2Surface = app2.surfaceList.get(0);
2386− tryCompare(app2.session.lastSurface, "keymap", "fr");
2399+ tryCompare(app2Surface, "keymap", "fr");
2387
2400
2388 // focus our first app, make sure it also has the "fr" keymap
2401 // focus our first app, make sure it also has the "fr" keymap
2389 ApplicationManager.requestFocusApplication("dialer-app");
2402 ApplicationManager.requestFocusApplication("dialer-app");
2390− tryCompare(app.session.lastSurface, "keymap", "fr");
2403+ tryCompare(appSurface, "keymap", "fr");
2391
2404
2392 // switch to previous keymap, should be "cz+qwerty"
2405 // switch to previous keymap, should be "cz+qwerty"
2393 keyClick(Qt.Key_Space, Qt.MetaModifier|Qt.ShiftModifier);
2406 keyClick(Qt.Key_Space, Qt.MetaModifier|Qt.ShiftModifier);
2394− tryCompare(app.session.lastSurface, "keymap", "cz+qwerty");
2407+ tryCompare(appSurface, "keymap", "cz+qwerty");
2395
2408
2396 // go next twice to "sk", past the end
2409 // go next twice to "sk", past the end
2397 keyClick(Qt.Key_Space, Qt.MetaModifier);
2410 keyClick(Qt.Key_Space, Qt.MetaModifier);
2398 keyClick(Qt.Key_Space, Qt.MetaModifier);
2411 keyClick(Qt.Key_Space, Qt.MetaModifier);
2399− tryCompare(app.session.lastSurface, "keymap", "sk");
2412+ tryCompare(appSurface, "keymap", "sk");
2400
2413
2401 // go back once to past the beginning, to "fr"
2414 // go back once to past the beginning, to "fr"
2402 keyClick(Qt.Key_Space, Qt.MetaModifier|Qt.ShiftModifier);
2415 keyClick(Qt.Key_Space, Qt.MetaModifier|Qt.ShiftModifier);
2403− tryCompare(app.session.lastSurface, "keymap", "fr");
2416+ tryCompare(appSurface, "keymap", "fr");
2404
2417
2405 // switch to app2, should also get "fr"
2418 // switch to app2, should also get "fr"
2406 ApplicationManager.requestFocusApplication("calendar-app");
2419 ApplicationManager.requestFocusApplication("calendar-app");
2407− tryCompare(app2.session.lastSurface, "keymap", "fr");
2420+ tryCompare(app2Surface, "keymap", "fr");
2408 }
2421 }
2409 }
2422 }
2410}
2423}