Merge lp:~gerboland/unity-api/remove-focus-statetracking into lp:unity-api

Proposed by Gerry Boland
Status: Work in progress
Proposed branch: lp:~gerboland/unity-api/remove-focus-statetracking
Merge into: lp:unity-api
Diff against target: 285 lines (+77/-82)
8 files modified
debian/changelog (+6/-0)
include/unity/shell/application/ApplicationInfoInterface.h (+38/-0)
include/unity/shell/application/ApplicationManagerInterface.h (+1/-43)
test/qmltest/mocks/plugins/Unity/Application/Mocks/MockApplicationInfo.cpp (+10/-0)
test/qmltest/mocks/plugins/Unity/Application/Mocks/MockApplicationInfo.h (+3/-0)
test/qmltest/mocks/plugins/Unity/Application/Mocks/MockApplicationManager.cpp (+0/-26)
test/qmltest/mocks/plugins/Unity/Application/Mocks/MockApplicationManager.h (+0/-9)
test/qmltest/unity/shell/application/tst_Application.qml (+19/-4)
To merge this branch: bzr merge lp:~gerboland/unity-api/remove-focus-statetracking
Reviewer Review Type Date Requested Status
Unity Team Pending
Review via email: mp+243417@code.launchpad.net

Commit message

AppMan: expose lifecycle state to shell as writable. Focus no longer responsible for lifecycle state

Description of the change

AppMan: expose lifecycle state to shell as writable. Focus no longer responsible for lifecycle state

To post a comment you must log in.

Unmerged revisions

165. By Gerry Boland

Update doc to remove old reference

164. By Gerry Boland

Unity.Application: Remove focus tracking API and add lifecycle control methods

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'debian/changelog'
--- debian/changelog 2014-11-04 14:42:57 +0000
+++ debian/changelog 2014-12-02 16:14:36 +0000
@@ -1,3 +1,9 @@
1unity-api (7.94) UNRELEASED; urgency=medium
2
3 * Unity.Application: Remove focus state tracking from AppMan API
4
5 -- Gerry Boland <gerry.boland@canonical.com> Thu, 20 Nov 2014 16:57:34 +0000
6
1unity-api (7.93+15.04.20141104-0ubuntu1) vivid; urgency=medium7unity-api (7.93+15.04.20141104-0ubuntu1) vivid; urgency=medium
28
3 [ Michael Zanetti ]9 [ Michael Zanetti ]
410
=== modified file 'include/unity/shell/application/ApplicationInfoInterface.h'
--- include/unity/shell/application/ApplicationInfoInterface.h 2014-09-09 15:51:47 +0000
+++ include/unity/shell/application/ApplicationInfoInterface.h 2014-12-02 16:14:36 +0000
@@ -232,6 +232,44 @@
232 virtual QColor splashColorFooter() const = 0;232 virtual QColor splashColorFooter() const = 0;
233 /// @endcond233 /// @endcond
234234
235 /**
236 * @brief Request that the application is suspended
237 *
238 * @see resume
239 * Attempts to suspend the application process.
240 *
241 * @returns If application is in Starting or Running state, and not in the lifecycle exception list,
242 * it will update the state to be Suspended, and return true. The process will be notified that
243 * it is about to be suspended, allowing it time to prepare, before being suspended 3 seconds later.
244 *
245 * If already Suspended, it will immediately return true.
246 *
247 * Will return false otherwise.
248 *
249 * Method is non-blocking and process manipulation is asynchroneous.
250 */
251 Q_INVOKABLE virtual bool suspend() = 0;
252
253 /**
254 * @brief Request that the application is resumed
255 *
256 * @see suspend
257 * Attempts to resume a suspended or stopped application process.
258 *
259 * @returns If application is in Starting or Running state, it will return true immediately;
260 *
261 * If application Suspended, it will initiate resumption the process, update the state to be
262 * Running.
263 *
264 * If application in Stopped state, it will initiate respawn of the process. Should this succeed
265 * the application state will be updated to Starting and return true;
266 *
267 * Will return false if process can not be resumed.
268 *
269 * Method is non-blocking and process manipulation is asynchroneous.
270 */
271 Q_INVOKABLE virtual bool resume() = 0;
272
235Q_SIGNALS:273Q_SIGNALS:
236 /// @cond274 /// @cond
237 void nameChanged(const QString &name);275 void nameChanged(const QString &name);
238276
=== modified file 'include/unity/shell/application/ApplicationManagerInterface.h'
--- include/unity/shell/application/ApplicationManagerInterface.h 2014-09-29 13:39:01 +0000
+++ include/unity/shell/application/ApplicationManagerInterface.h 2014-12-02 16:14:36 +0000
@@ -55,7 +55,7 @@
55 /**55 /**
56 * @brief The currently focused application.56 * @brief The currently focused application.
57 *57 *
58 * Use focusApplication() and unfocusCurrentApplication() to modify this.58 * This is updated by any Application's MirSurface getting activeFocus
59 */59 */
60 Q_PROPERTY(QString focusedApplicationId READ focusedApplicationId NOTIFY focusedApplicationIdChanged)60 Q_PROPERTY(QString focusedApplicationId READ focusedApplicationId NOTIFY focusedApplicationIdChanged)
6161
@@ -66,13 +66,6 @@
66 */66 */
67 Q_PROPERTY(bool suspended READ suspended WRITE setSuspended NOTIFY suspendedChanged)67 Q_PROPERTY(bool suspended READ suspended WRITE setSuspended NOTIFY suspendedChanged)
6868
69 /**
70 * @brief Activate the dash, regardless of its focused state.
71 *
72 * If this is set to true, the dash will not be put to suspend or will be woken up from suspend.
73 */
74 Q_PROPERTY(bool forceDashActive READ forceDashActive WRITE setForceDashActive NOTIFY forceDashActiveChanged)
75
76protected:69protected:
77 /// @cond70 /// @cond
78 ApplicationManagerInterface(QObject* parent = 0): QAbstractListModel(parent)71 ApplicationManagerInterface(QObject* parent = 0): QAbstractListModel(parent)
@@ -124,9 +117,6 @@
124117
125 virtual bool suspended() const = 0;118 virtual bool suspended() const = 0;
126 virtual void setSuspended(bool suspended) = 0;119 virtual void setSuspended(bool suspended) = 0;
127
128 virtual bool forceDashActive() const = 0;
129 virtual void setForceDashActive(bool forceDashActive) = 0;
130 /// @endcond120 /// @endcond
131121
132 /**122 /**
@@ -150,33 +140,6 @@
150 Q_INVOKABLE virtual unity::shell::application::ApplicationInfoInterface *findApplication(const QString &appId) const = 0;140 Q_INVOKABLE virtual unity::shell::application::ApplicationInfoInterface *findApplication(const QString &appId) const = 0;
151141
152 /**142 /**
153 * @brief Request to focus a given application
154 *
155 * This will request the shell to focus the given application.
156 *
157 * @param appId The appId of the app to be focused.
158 * @returns True if the request will processed, false if it was discarded (i.e. the given appid could not be found)
159 */
160 Q_INVOKABLE virtual bool requestFocusApplication(const QString &appId) = 0;
161
162 /**
163 * @brief Focus the given application.
164 *
165 * This will immediately focus the given application. Usually you should not use this
166 * but instead call requestFocusApplication() in order to allow the shell to prepare
167 * for the upcoming animation or even block the focus request (e.g. focus stealing prevention)
168 *
169 * @param appId The application to be focused.
170 * @returns True if appId found and application focused, else false.
171 */
172 Q_INVOKABLE virtual bool focusApplication(const QString &appId) = 0;
173
174 /**
175 * @brief Unfocus the currently focused application.
176 */
177 Q_INVOKABLE virtual void unfocusCurrentApplication() = 0;
178
179 /**
180 * @brief Start an application.143 * @brief Start an application.
181 *144 *
182 * @param appId The appId for the application to be spawned.145 * @param appId The appId for the application to be spawned.
@@ -217,11 +180,6 @@
217 void suspendedChanged();180 void suspendedChanged();
218181
219 /**182 /**
220 * @brief Will be emitted when the forceDashActive property changes.
221 */
222 void forceDashActiveChanged();
223
224 /**
225 * @brief Will be emitted when an application was added to the model.183 * @brief Will be emitted when an application was added to the model.
226 *184 *
227 * @param appId The appId of the application that was added.185 * @param appId The appId of the application that was added.
228186
=== modified file 'test/qmltest/mocks/plugins/Unity/Application/Mocks/MockApplicationInfo.cpp'
--- test/qmltest/mocks/plugins/Unity/Application/Mocks/MockApplicationInfo.cpp 2014-09-03 22:59:26 +0000
+++ test/qmltest/mocks/plugins/Unity/Application/Mocks/MockApplicationInfo.cpp 2014-12-02 16:14:36 +0000
@@ -125,3 +125,13 @@
125{125{
126 return QColor(0,0,0,0);126 return QColor(0,0,0,0);
127}127}
128
129bool MockApplicationInfo::suspend()
130{
131 return true;
132}
133
134bool MockApplicationInfo::resume()
135{
136 return true;
137}
128138
=== modified file 'test/qmltest/mocks/plugins/Unity/Application/Mocks/MockApplicationInfo.h'
--- test/qmltest/mocks/plugins/Unity/Application/Mocks/MockApplicationInfo.h 2014-09-03 22:59:26 +0000
+++ test/qmltest/mocks/plugins/Unity/Application/Mocks/MockApplicationInfo.h 2014-12-02 16:14:36 +0000
@@ -53,6 +53,9 @@
53 QColor splashColorHeader() const override;53 QColor splashColorHeader() const override;
54 QColor splashColorFooter() const override;54 QColor splashColorFooter() const override;
5555
56 Q_INVOKABLE bool suspend() override;
57 Q_INVOKABLE bool resume() override;
58
56private:59private:
57 QString m_appId;60 QString m_appId;
58 QString m_name;61 QString m_name;
5962
=== modified file 'test/qmltest/mocks/plugins/Unity/Application/Mocks/MockApplicationManager.cpp'
--- test/qmltest/mocks/plugins/Unity/Application/Mocks/MockApplicationManager.cpp 2014-09-29 10:58:06 +0000
+++ test/qmltest/mocks/plugins/Unity/Application/Mocks/MockApplicationManager.cpp 2014-12-02 16:14:36 +0000
@@ -108,32 +108,6 @@
108 Q_UNUSED(suspended)108 Q_UNUSED(suspended)
109}109}
110110
111bool MockApplicationManager::forceDashActive() const
112{
113 return false;
114}
115
116void MockApplicationManager::setForceDashActive(bool forceDashActive)
117{
118 Q_UNUSED(forceDashActive)
119}
120
121bool MockApplicationManager::requestFocusApplication(const QString &appId)
122{
123 Q_UNUSED(appId)
124 return true;
125}
126
127bool MockApplicationManager::focusApplication(const QString &appId)
128{
129 Q_UNUSED(appId)
130 return true;
131}
132
133void MockApplicationManager::unfocusCurrentApplication()
134{
135}
136
137unity::shell::application::ApplicationInfoInterface *MockApplicationManager::startApplication(const QString &appId, const QStringList &arguments)111unity::shell::application::ApplicationInfoInterface *MockApplicationManager::startApplication(const QString &appId, const QStringList &arguments)
138{112{
139 Q_UNUSED(arguments)113 Q_UNUSED(arguments)
140114
=== modified file 'test/qmltest/mocks/plugins/Unity/Application/Mocks/MockApplicationManager.h'
--- test/qmltest/mocks/plugins/Unity/Application/Mocks/MockApplicationManager.h 2014-09-29 10:58:06 +0000
+++ test/qmltest/mocks/plugins/Unity/Application/Mocks/MockApplicationManager.h 2014-12-02 16:14:36 +0000
@@ -43,19 +43,10 @@
43 bool suspended() const;43 bool suspended() const;
44 void setSuspended(bool suspended);44 void setSuspended(bool suspended);
4545
46 bool forceDashActive() const override;
47 void setForceDashActive(bool forceDashActive) override;
48
49 Q_INVOKABLE unity::shell::application::ApplicationInfoInterface *get(const int index) const;46 Q_INVOKABLE unity::shell::application::ApplicationInfoInterface *get(const int index) const;
5047
51 Q_INVOKABLE unity::shell::application::ApplicationInfoInterface *findApplication(const QString &appId) const;48 Q_INVOKABLE unity::shell::application::ApplicationInfoInterface *findApplication(const QString &appId) const;
5249
53 Q_INVOKABLE bool requestFocusApplication(const QString &appId);
54
55 Q_INVOKABLE bool focusApplication(const QString &appId);
56
57 Q_INVOKABLE void unfocusCurrentApplication();
58
59 Q_INVOKABLE unity::shell::application::ApplicationInfoInterface *startApplication(const QString &appId, const QStringList &arguments);50 Q_INVOKABLE unity::shell::application::ApplicationInfoInterface *startApplication(const QString &appId, const QStringList &arguments);
6051
61 Q_INVOKABLE bool stopApplication(const QString &appId);52 Q_INVOKABLE bool stopApplication(const QString &appId);
6253
=== modified file 'test/qmltest/unity/shell/application/tst_Application.qml'
--- test/qmltest/unity/shell/application/tst_Application.qml 2014-09-29 10:58:06 +0000
+++ test/qmltest/unity/shell/application/tst_Application.qml 2014-12-02 16:14:36 +0000
@@ -106,9 +106,6 @@
106 return [106 return [
107 { tag: "ApplicationManager.methods[get]", method: "get" },107 { tag: "ApplicationManager.methods[get]", method: "get" },
108 { tag: "ApplicationManager.methods[findApplication]", method: "findApplication" },108 { tag: "ApplicationManager.methods[findApplication]", method: "findApplication" },
109 { tag: "ApplicationManager.methods[requestFocusApplication]", method: "requestFocusApplication" },
110 { tag: "ApplicationManager.methods[focusApplication]", method: "focusApplication" },
111 { tag: "ApplicationManager.methods[unfocusCurrentApplication]", method: "unfocusCurrentApplication" },
112 { tag: "ApplicationManager.methods[startApplication]", method: "startApplication" },109 { tag: "ApplicationManager.methods[startApplication]", method: "startApplication" },
113 { tag: "ApplicationManager.methods[stopApplication]", method: "stopApplication" },110 { tag: "ApplicationManager.methods[stopApplication]", method: "stopApplication" },
114 ];111 ];
@@ -125,7 +122,6 @@
125 { tag: "ApplicationManager.count", property: "count", type: "number" },122 { tag: "ApplicationManager.count", property: "count", type: "number" },
126 { tag: "ApplicationManager.focusedApplicationId", property: "focusedApplicationId", type: "string" },123 { tag: "ApplicationManager.focusedApplicationId", property: "focusedApplicationId", type: "string" },
127 { tag: "ApplicationManager.suspended", property: "suspended", type: "boolean" },124 { tag: "ApplicationManager.suspended", property: "suspended", type: "boolean" },
128 { tag: "ApplicationManager.forceDashActive", property: "forceDashActive", type: "boolean" },
129 ];125 ];
130 }126 }
131127
@@ -164,5 +160,24 @@
164160
165 verifyData(data)161 verifyData(data)
166 }162 }
163
164 function test_item_methods_data() {
165 return [
166 { tag: "ApplicationInfo.methods[suspend]", method: "suspend" },
167 { tag: "ApplicationInfo.methods[resume]", method: "resume" },
168 ];
169 }
170
171 function test_item_methods(data) {
172 name = "ApplicationInfo";
173 try {
174 object = ApplicationManager.get(0)
175 } catch(err) {
176 object = undefined;
177 print(err)
178 }
179
180 verifyData(data);
181 }
167 }182 }
168}183}

Subscribers

People subscribed via source and target branches

to all changes: