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
1=== modified file 'debian/changelog'
2--- debian/changelog 2014-11-04 14:42:57 +0000
3+++ debian/changelog 2014-12-02 16:14:36 +0000
4@@ -1,3 +1,9 @@
5+unity-api (7.94) UNRELEASED; urgency=medium
6+
7+ * Unity.Application: Remove focus state tracking from AppMan API
8+
9+ -- Gerry Boland <gerry.boland@canonical.com> Thu, 20 Nov 2014 16:57:34 +0000
10+
11 unity-api (7.93+15.04.20141104-0ubuntu1) vivid; urgency=medium
12
13 [ Michael Zanetti ]
14
15=== modified file 'include/unity/shell/application/ApplicationInfoInterface.h'
16--- include/unity/shell/application/ApplicationInfoInterface.h 2014-09-09 15:51:47 +0000
17+++ include/unity/shell/application/ApplicationInfoInterface.h 2014-12-02 16:14:36 +0000
18@@ -232,6 +232,44 @@
19 virtual QColor splashColorFooter() const = 0;
20 /// @endcond
21
22+ /**
23+ * @brief Request that the application is suspended
24+ *
25+ * @see resume
26+ * Attempts to suspend the application process.
27+ *
28+ * @returns If application is in Starting or Running state, and not in the lifecycle exception list,
29+ * it will update the state to be Suspended, and return true. The process will be notified that
30+ * it is about to be suspended, allowing it time to prepare, before being suspended 3 seconds later.
31+ *
32+ * If already Suspended, it will immediately return true.
33+ *
34+ * Will return false otherwise.
35+ *
36+ * Method is non-blocking and process manipulation is asynchroneous.
37+ */
38+ Q_INVOKABLE virtual bool suspend() = 0;
39+
40+ /**
41+ * @brief Request that the application is resumed
42+ *
43+ * @see suspend
44+ * Attempts to resume a suspended or stopped application process.
45+ *
46+ * @returns If application is in Starting or Running state, it will return true immediately;
47+ *
48+ * If application Suspended, it will initiate resumption the process, update the state to be
49+ * Running.
50+ *
51+ * If application in Stopped state, it will initiate respawn of the process. Should this succeed
52+ * the application state will be updated to Starting and return true;
53+ *
54+ * Will return false if process can not be resumed.
55+ *
56+ * Method is non-blocking and process manipulation is asynchroneous.
57+ */
58+ Q_INVOKABLE virtual bool resume() = 0;
59+
60 Q_SIGNALS:
61 /// @cond
62 void nameChanged(const QString &name);
63
64=== modified file 'include/unity/shell/application/ApplicationManagerInterface.h'
65--- include/unity/shell/application/ApplicationManagerInterface.h 2014-09-29 13:39:01 +0000
66+++ include/unity/shell/application/ApplicationManagerInterface.h 2014-12-02 16:14:36 +0000
67@@ -55,7 +55,7 @@
68 /**
69 * @brief The currently focused application.
70 *
71- * Use focusApplication() and unfocusCurrentApplication() to modify this.
72+ * This is updated by any Application's MirSurface getting activeFocus
73 */
74 Q_PROPERTY(QString focusedApplicationId READ focusedApplicationId NOTIFY focusedApplicationIdChanged)
75
76@@ -66,13 +66,6 @@
77 */
78 Q_PROPERTY(bool suspended READ suspended WRITE setSuspended NOTIFY suspendedChanged)
79
80- /**
81- * @brief Activate the dash, regardless of its focused state.
82- *
83- * If this is set to true, the dash will not be put to suspend or will be woken up from suspend.
84- */
85- Q_PROPERTY(bool forceDashActive READ forceDashActive WRITE setForceDashActive NOTIFY forceDashActiveChanged)
86-
87 protected:
88 /// @cond
89 ApplicationManagerInterface(QObject* parent = 0): QAbstractListModel(parent)
90@@ -124,9 +117,6 @@
91
92 virtual bool suspended() const = 0;
93 virtual void setSuspended(bool suspended) = 0;
94-
95- virtual bool forceDashActive() const = 0;
96- virtual void setForceDashActive(bool forceDashActive) = 0;
97 /// @endcond
98
99 /**
100@@ -150,33 +140,6 @@
101 Q_INVOKABLE virtual unity::shell::application::ApplicationInfoInterface *findApplication(const QString &appId) const = 0;
102
103 /**
104- * @brief Request to focus a given application
105- *
106- * This will request the shell to focus the given application.
107- *
108- * @param appId The appId of the app to be focused.
109- * @returns True if the request will processed, false if it was discarded (i.e. the given appid could not be found)
110- */
111- Q_INVOKABLE virtual bool requestFocusApplication(const QString &appId) = 0;
112-
113- /**
114- * @brief Focus the given application.
115- *
116- * This will immediately focus the given application. Usually you should not use this
117- * but instead call requestFocusApplication() in order to allow the shell to prepare
118- * for the upcoming animation or even block the focus request (e.g. focus stealing prevention)
119- *
120- * @param appId The application to be focused.
121- * @returns True if appId found and application focused, else false.
122- */
123- Q_INVOKABLE virtual bool focusApplication(const QString &appId) = 0;
124-
125- /**
126- * @brief Unfocus the currently focused application.
127- */
128- Q_INVOKABLE virtual void unfocusCurrentApplication() = 0;
129-
130- /**
131 * @brief Start an application.
132 *
133 * @param appId The appId for the application to be spawned.
134@@ -217,11 +180,6 @@
135 void suspendedChanged();
136
137 /**
138- * @brief Will be emitted when the forceDashActive property changes.
139- */
140- void forceDashActiveChanged();
141-
142- /**
143 * @brief Will be emitted when an application was added to the model.
144 *
145 * @param appId The appId of the application that was added.
146
147=== modified file 'test/qmltest/mocks/plugins/Unity/Application/Mocks/MockApplicationInfo.cpp'
148--- test/qmltest/mocks/plugins/Unity/Application/Mocks/MockApplicationInfo.cpp 2014-09-03 22:59:26 +0000
149+++ test/qmltest/mocks/plugins/Unity/Application/Mocks/MockApplicationInfo.cpp 2014-12-02 16:14:36 +0000
150@@ -125,3 +125,13 @@
151 {
152 return QColor(0,0,0,0);
153 }
154+
155+bool MockApplicationInfo::suspend()
156+{
157+ return true;
158+}
159+
160+bool MockApplicationInfo::resume()
161+{
162+ return true;
163+}
164
165=== modified file 'test/qmltest/mocks/plugins/Unity/Application/Mocks/MockApplicationInfo.h'
166--- test/qmltest/mocks/plugins/Unity/Application/Mocks/MockApplicationInfo.h 2014-09-03 22:59:26 +0000
167+++ test/qmltest/mocks/plugins/Unity/Application/Mocks/MockApplicationInfo.h 2014-12-02 16:14:36 +0000
168@@ -53,6 +53,9 @@
169 QColor splashColorHeader() const override;
170 QColor splashColorFooter() const override;
171
172+ Q_INVOKABLE bool suspend() override;
173+ Q_INVOKABLE bool resume() override;
174+
175 private:
176 QString m_appId;
177 QString m_name;
178
179=== modified file 'test/qmltest/mocks/plugins/Unity/Application/Mocks/MockApplicationManager.cpp'
180--- test/qmltest/mocks/plugins/Unity/Application/Mocks/MockApplicationManager.cpp 2014-09-29 10:58:06 +0000
181+++ test/qmltest/mocks/plugins/Unity/Application/Mocks/MockApplicationManager.cpp 2014-12-02 16:14:36 +0000
182@@ -108,32 +108,6 @@
183 Q_UNUSED(suspended)
184 }
185
186-bool MockApplicationManager::forceDashActive() const
187-{
188- return false;
189-}
190-
191-void MockApplicationManager::setForceDashActive(bool forceDashActive)
192-{
193- Q_UNUSED(forceDashActive)
194-}
195-
196-bool MockApplicationManager::requestFocusApplication(const QString &appId)
197-{
198- Q_UNUSED(appId)
199- return true;
200-}
201-
202-bool MockApplicationManager::focusApplication(const QString &appId)
203-{
204- Q_UNUSED(appId)
205- return true;
206-}
207-
208-void MockApplicationManager::unfocusCurrentApplication()
209-{
210-}
211-
212 unity::shell::application::ApplicationInfoInterface *MockApplicationManager::startApplication(const QString &appId, const QStringList &arguments)
213 {
214 Q_UNUSED(arguments)
215
216=== modified file 'test/qmltest/mocks/plugins/Unity/Application/Mocks/MockApplicationManager.h'
217--- test/qmltest/mocks/plugins/Unity/Application/Mocks/MockApplicationManager.h 2014-09-29 10:58:06 +0000
218+++ test/qmltest/mocks/plugins/Unity/Application/Mocks/MockApplicationManager.h 2014-12-02 16:14:36 +0000
219@@ -43,19 +43,10 @@
220 bool suspended() const;
221 void setSuspended(bool suspended);
222
223- bool forceDashActive() const override;
224- void setForceDashActive(bool forceDashActive) override;
225-
226 Q_INVOKABLE unity::shell::application::ApplicationInfoInterface *get(const int index) const;
227
228 Q_INVOKABLE unity::shell::application::ApplicationInfoInterface *findApplication(const QString &appId) const;
229
230- Q_INVOKABLE bool requestFocusApplication(const QString &appId);
231-
232- Q_INVOKABLE bool focusApplication(const QString &appId);
233-
234- Q_INVOKABLE void unfocusCurrentApplication();
235-
236 Q_INVOKABLE unity::shell::application::ApplicationInfoInterface *startApplication(const QString &appId, const QStringList &arguments);
237
238 Q_INVOKABLE bool stopApplication(const QString &appId);
239
240=== modified file 'test/qmltest/unity/shell/application/tst_Application.qml'
241--- test/qmltest/unity/shell/application/tst_Application.qml 2014-09-29 10:58:06 +0000
242+++ test/qmltest/unity/shell/application/tst_Application.qml 2014-12-02 16:14:36 +0000
243@@ -106,9 +106,6 @@
244 return [
245 { tag: "ApplicationManager.methods[get]", method: "get" },
246 { tag: "ApplicationManager.methods[findApplication]", method: "findApplication" },
247- { tag: "ApplicationManager.methods[requestFocusApplication]", method: "requestFocusApplication" },
248- { tag: "ApplicationManager.methods[focusApplication]", method: "focusApplication" },
249- { tag: "ApplicationManager.methods[unfocusCurrentApplication]", method: "unfocusCurrentApplication" },
250 { tag: "ApplicationManager.methods[startApplication]", method: "startApplication" },
251 { tag: "ApplicationManager.methods[stopApplication]", method: "stopApplication" },
252 ];
253@@ -125,7 +122,6 @@
254 { tag: "ApplicationManager.count", property: "count", type: "number" },
255 { tag: "ApplicationManager.focusedApplicationId", property: "focusedApplicationId", type: "string" },
256 { tag: "ApplicationManager.suspended", property: "suspended", type: "boolean" },
257- { tag: "ApplicationManager.forceDashActive", property: "forceDashActive", type: "boolean" },
258 ];
259 }
260
261@@ -164,5 +160,24 @@
262
263 verifyData(data)
264 }
265+
266+ function test_item_methods_data() {
267+ return [
268+ { tag: "ApplicationInfo.methods[suspend]", method: "suspend" },
269+ { tag: "ApplicationInfo.methods[resume]", method: "resume" },
270+ ];
271+ }
272+
273+ function test_item_methods(data) {
274+ name = "ApplicationInfo";
275+ try {
276+ object = ApplicationManager.get(0)
277+ } catch(err) {
278+ object = undefined;
279+ print(err)
280+ }
281+
282+ verifyData(data);
283+ }
284 }
285 }

Subscribers

People subscribed via source and target branches

to all changes: