Merge lp:~dandrader/unity-api/miral-surfacemanager into lp:~unity-team/unity-api/miral

Proposed by Daniel d'Andrada
Status: Merged
Approved by: Gerry Boland
Approved revision: 258
Merged at revision: 258
Proposed branch: lp:~dandrader/unity-api/miral-surfacemanager
Merge into: lp:~unity-team/unity-api/miral
Diff against target: 442 lines (+70/-296)
8 files modified
include/unity/shell/application/ApplicationInfoInterface.h (+5/-0)
include/unity/shell/application/ApplicationManagerInterface.h (+6/-0)
include/unity/shell/application/MirSurfaceInterface.h (+5/-0)
include/unity/shell/application/SurfaceManagerInterface.h (+50/-0)
include/unity/shell/application/TopLevelWindowModelInterface.h (+0/-152)
include/unity/shell/application/WindowInterface.h (+0/-144)
test/qmltest/mocks/plugins/Unity/Application/Mocks/MockApplicationInfo.h (+2/-0)
test/qmltest/mocks/plugins/Unity/Application/Mocks/MockApplicationManager.h (+2/-0)
To merge this branch: bzr merge lp:~dandrader/unity-api/miral-surfacemanager
Reviewer Review Type Date Requested Status
Gerry Boland (community) Approve
Review via email: mp+310910@code.launchpad.net

Commit message

Add SurfaceManager and remove TopLevelWindowModel and Window

To post a comment you must log in.
259. By Daniel d'Andrada

Update useless tests

Revision history for this message
Gerry Boland (gerboland) wrote :

Ok

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'include/unity/shell/application/ApplicationInfoInterface.h'
2--- include/unity/shell/application/ApplicationInfoInterface.h 2016-07-25 13:56:35 +0000
3+++ include/unity/shell/application/ApplicationInfoInterface.h 2016-11-17 12:23:58 +0000
4@@ -282,6 +282,11 @@
5 RequestedSuspended = Suspended
6 };
7
8+ /**
9+ * @brief Closes the application
10+ */
11+ virtual void close() = 0;
12+
13 /// @cond
14 virtual ~ApplicationInfoInterface() {}
15
16
17=== modified file 'include/unity/shell/application/ApplicationManagerInterface.h'
18--- include/unity/shell/application/ApplicationManagerInterface.h 2016-07-25 13:56:35 +0000
19+++ include/unity/shell/application/ApplicationManagerInterface.h 2016-11-17 12:23:58 +0000
20@@ -33,6 +33,7 @@
21 {
22
23 class ApplicationInfoInterface;
24+class MirSurfaceInterface;
25
26 /**
27 * @brief The Application manager
28@@ -134,6 +135,11 @@
29 */
30 Q_INVOKABLE virtual unity::shell::application::ApplicationInfoInterface *findApplication(const QString &appId) const = 0;
31
32+ /*
33+ * @brief Returns the AplicationInfo with the given surface
34+ */
35+ virtual ApplicationInfoInterface *findApplicationWithSurface(MirSurfaceInterface* surface) = 0;
36+
37 /**
38 * @brief Request to focus a given application
39 *
40
41=== modified file 'include/unity/shell/application/MirSurfaceInterface.h'
42--- include/unity/shell/application/MirSurfaceInterface.h 2016-11-03 12:25:43 +0000
43+++ include/unity/shell/application/MirSurfaceInterface.h 2016-11-17 12:23:58 +0000
44@@ -264,6 +264,11 @@
45 * @brief Emitted in response to a requestFocus() call
46 */
47 void focusRequested();
48+
49+ /**
50+ * @brief Emitted when close() is called
51+ */
52+ void closeRequested();
53 };
54
55 } // namespace application
56
57=== added file 'include/unity/shell/application/SurfaceManagerInterface.h'
58--- include/unity/shell/application/SurfaceManagerInterface.h 1970-01-01 00:00:00 +0000
59+++ include/unity/shell/application/SurfaceManagerInterface.h 2016-11-17 12:23:58 +0000
60@@ -0,0 +1,50 @@
61+/*
62+ * Copyright (C) 2016 Canonical, Ltd.
63+ *
64+ * This program is free software; you can redistribute it and/or modify
65+ * it under the terms of the GNU General Public License as published by
66+ * the Free Software Foundation; version 3.
67+ *
68+ * This program is distributed in the hope that it will be useful,
69+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
70+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
71+ * GNU General Public License for more details.
72+ *
73+ * You should have received a copy of the GNU General Public License
74+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
75+ */
76+
77+#ifndef UNITY_SHELL_APPLICATION_SURFACEMANAGERINTERFACE_H
78+#define UNITY_SHELL_APPLICATION_SURFACEMANAGERINTERFACE_H
79+
80+#include <QObject>
81+#include <QVector>
82+
83+namespace unity {
84+namespace shell {
85+namespace application {
86+
87+class MirSurfaceInterface;
88+
89+class SurfaceManagerInterface : public QObject
90+{
91+ Q_OBJECT
92+
93+public:
94+ virtual ~SurfaceManagerInterface() {}
95+
96+ virtual void raise(MirSurfaceInterface *surface) = 0;
97+ virtual void activate(MirSurfaceInterface *surface) = 0;
98+
99+Q_SIGNALS:
100+ void surfaceCreated(MirSurfaceInterface *surface);
101+ void surfacesRaised(const QVector<MirSurfaceInterface*> &surfaces);
102+ void modificationsStarted();
103+ void modificationsEnded();
104+};
105+
106+} // namespace application
107+} // namespace shell
108+} // namespace unity
109+
110+#endif // UNITY_SHELL_APPLICATION_SURFACEMANAGERINTERFACE_H
111
112=== removed file 'include/unity/shell/application/TopLevelWindowModelInterface.h'
113--- include/unity/shell/application/TopLevelWindowModelInterface.h 2016-11-07 13:58:38 +0000
114+++ include/unity/shell/application/TopLevelWindowModelInterface.h 1970-01-01 00:00:00 +0000
115@@ -1,152 +0,0 @@
116-/*
117- * Copyright (C) 2016 Canonical, Ltd.
118- *
119- * This program is free software; you can redistribute it and/or modify
120- * it under the terms of the GNU General Public License as published by
121- * the Free Software Foundation; version 3.
122- *
123- * This program is distributed in the hope that it will be useful,
124- * but WITHOUT ANY WARRANTY; without even the implied warranty of
125- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
126- * GNU General Public License for more details.
127- *
128- * You should have received a copy of the GNU General Public License
129- * along with this program. If not, see <http://www.gnu.org/licenses/>.
130- */
131-
132-#ifndef UNITY_SHELL_APPLICATION_TOPLEVELWINDOWMODELINTERFACE_H
133-#define UNITY_SHELL_APPLICATION_TOPLEVELWINDOWMODELINTERFACE_H
134-
135-#include <QAbstractListModel>
136-
137-namespace unity
138-{
139-namespace shell
140-{
141-namespace application
142-{
143-
144-class ApplicationInfoInterface;
145-class MirSurfaceInterface;
146-class WindowInterface;
147-
148-/**
149- * @brief A model of top-level surfaces
150- *
151- * It's an abstraction of top-level application windows.
152- *
153- * When an entry first appears, it normaly doesn't have a surface yet, meaning that the application is
154- * still starting up. A shell should then display a splash screen or saved screenshot of the application
155- * until its surface comes up.
156- *
157- * As applications can have multiple surfaces and you can also have entries without surfaces at all,
158- * the only way to unambiguously refer to an entry in this model is through its id.
159- */
160-class TopLevelWindowModelInterface : public QAbstractListModel
161-{
162- Q_OBJECT
163-
164- /**
165- * @brief Number of top-level surfaces in this model
166- *
167- * This is the same as rowCount, added in order to keep compatibility with QML ListModels.
168- */
169- Q_PROPERTY(int count READ rowCount NOTIFY countChanged)
170-
171- /**
172- * @brief The input method surface, if any
173- *
174- * The surface of a onscreen keyboard (akak "virtual keyboard") would be kept here and not in the model itself.
175- */
176- Q_PROPERTY(unity::shell::application::MirSurfaceInterface* inputMethodSurface READ inputMethodSurface NOTIFY inputMethodSurfaceChanged)
177-
178- /**
179- * @brief The currently focused window, if any
180- */
181- Q_PROPERTY(unity::shell::application::WindowInterface* focusedWindow READ focusedWindow
182- NOTIFY focusedWindowChanged)
183-public:
184- /**
185- * @brief The Roles supported by the model
186- *
187- * WindowRole - A WindowInterface.
188- * ApplicationRole - An ApplicationInfoInterface
189- */
190- enum Roles {
191- WindowRole = Qt::UserRole,
192- ApplicationRole = Qt::UserRole + 1,
193- };
194-
195- virtual ~TopLevelWindowModelInterface() {}
196-
197- QHash<int, QByteArray> roleNames() const override {
198- QHash<int, QByteArray> roleNames { {WindowRole, "window"},
199- {ApplicationRole, "application"} };
200- return roleNames;
201- }
202-
203- /// @cond
204- virtual MirSurfaceInterface* inputMethodSurface() const = 0;
205- virtual WindowInterface* focusedWindow() const = 0;
206- /// @endcond
207-
208-public Q_SLOTS:
209- /**
210- * @brief Returns the surface at the given index
211- *
212- * It will be a nullptr if the application is still starting up and thus hasn't yet created
213- * and drawn into a surface.
214- *
215- * Same as windowAt(index).surface()
216- */
217- virtual MirSurfaceInterface *surfaceAt(int index) const = 0;
218-
219- /**
220- * @brief Returns the window at the given index
221- *
222- * Will always be valid
223- */
224- virtual WindowInterface *windowAt(int index) const = 0;
225-
226- /**
227- * @brief Returns the application at the given index
228- */
229- virtual ApplicationInfoInterface *applicationAt(int index) const = 0;
230-
231- /**
232- * @brief Returns the unique id of the element at the given index
233- */
234- virtual int idAt(int index) const = 0;
235-
236- /**
237- * @brief Returns the index where the row with the given id is located
238- *
239- * Returns -1 if there's no row with the given id.
240- */
241- virtual int indexForId(int id) const = 0;
242-
243- /**
244- * @brief Raises the row with the given id to the top of the window stack (index == count-1)
245- */
246- virtual void raiseId(int id) = 0;
247-
248-Q_SIGNALS:
249- /// @cond
250- void countChanged();
251- void inputMethodSurfaceChanged(unity::shell::application::MirSurfaceInterface* inputMethodSurface);
252- void focusedWindowChanged(unity::shell::application::WindowInterface *focusedWindow);
253- /// @endcond
254-
255- /**
256- * @brief Emitted when the list changes
257- *
258- * Emitted when model gains an element, loses an element or when elements exchange positions.
259- */
260- void listChanged();
261-};
262-
263-} // namespace application
264-} // namespace shell
265-} // namespace unity
266-
267-#endif // UNITY_SHELL_APPLICATION_TOPLEVELWINDOWMODELINTERFACE_H
268
269=== removed file 'include/unity/shell/application/WindowInterface.h'
270--- include/unity/shell/application/WindowInterface.h 2016-11-01 19:27:19 +0000
271+++ include/unity/shell/application/WindowInterface.h 1970-01-01 00:00:00 +0000
272@@ -1,144 +0,0 @@
273-/*
274- * Copyright (C) 2016 Canonical, Ltd.
275- *
276- * This program is free software; you can redistribute it and/or modify
277- * it under the terms of the GNU General Public License as published by
278- * the Free Software Foundation; version 3.
279- *
280- * This program is distributed in the hope that it will be useful,
281- * but WITHOUT ANY WARRANTY; without even the implied warranty of
282- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
283- * GNU General Public License for more details.
284- *
285- * You should have received a copy of the GNU General Public License
286- * along with this program. If not, see <http://www.gnu.org/licenses/>.
287- */
288-
289-#ifndef UNITY_SHELL_APPLICATION_WINDOW_H
290-#define UNITY_SHELL_APPLICATION_WINDOW_H
291-
292-#include <QObject>
293-#include <QPoint>
294-
295-#include "Mir.h"
296-
297-namespace unity
298-{
299-namespace shell
300-{
301-namespace application
302-{
303-
304-class MirSurfaceInterface;
305-
306-/**
307- @brief A slightly higher concept than MirSurface
308-
309- A Window exists before its MirSurface gets created (for splashscreen purposes)
310- and might also hang around after the backing surface is gone (In case the application
311- was killed to free up memory, as it should still remain in the window list since the user
312- did not explicitly close it).
313- */
314-class WindowInterface : public QObject
315-{
316- Q_OBJECT
317-
318- /**
319- * @brief Position of the current surface buffer, in pixels.
320- */
321- Q_PROPERTY(QPoint position READ position NOTIFY positionChanged)
322-
323- /**
324- * @brief Requested position of the current surface buffer, in pixels.
325- */
326- Q_PROPERTY(QPoint requestedPosition READ requestedPosition WRITE setRequestedPosition NOTIFY requestedPositionChanged)
327-
328- /**
329- * @brief State of the surface
330- */
331- Q_PROPERTY(Mir::State state READ state NOTIFY stateChanged)
332-
333- /**
334- * @brief Whether the surface is focused
335- *
336- * It will be true if this surface is MirFocusControllerInterface::focusedSurface
337- */
338- Q_PROPERTY(bool focused READ focused NOTIFY focusedChanged)
339-
340- /**
341- * @brief Whether the surface wants to confine the mouse pointer within its boundaries
342- *
343- * If true, the surface doesn't want the mouse pointer to leave its boundaries while it's focused.
344- */
345- Q_PROPERTY(bool confinesMousePointer READ confinesMousePointer NOTIFY confinesMousePointerChanged)
346-
347- /**
348- * @brief A unique identifier for this window.
349- * Useful for telling windows apart in a list model as they get moved around
350- */
351- Q_PROPERTY(int id READ id CONSTANT)
352-
353- /**
354- * @brief Surface backing up this window
355- * It might be null if a surface hasn't been created yet (application is starting up) or if
356- * the corresponding application has been killed (but can still get restarted to continue from
357- * where it left)
358- */
359- Q_PROPERTY(unity::shell::application::MirSurfaceInterface* surface READ surface NOTIFY surfaceChanged)
360-
361-public:
362- /// @cond
363- WindowInterface(QObject *parent = nullptr) : QObject(parent) {}
364- virtual QPoint position() const = 0;
365- virtual QPoint requestedPosition() const = 0;
366- virtual void setRequestedPosition(const QPoint &) = 0;
367- virtual Mir::State state() const = 0;
368- virtual bool focused() const = 0;
369- virtual bool confinesMousePointer() const = 0;
370- virtual int id() const = 0;
371- virtual MirSurfaceInterface* surface() const = 0;
372- /// @endcond
373-
374-public Q_SLOTS:
375- /**
376- * @brief Requests a change to the specified state
377- */
378- virtual void requestState(Mir::State state) = 0;
379-
380- /**
381- * @brief Requests focus for this surface
382- *
383- * Causes the emission of focusRequested()
384- */
385- virtual void requestFocus() = 0;
386-
387- /**
388- * @brief Sends a close request
389- *
390- */
391- virtual void close() = 0;
392-
393-Q_SIGNALS:
394- /// @cond
395- void positionChanged(QPoint position);
396- void requestedPositionChanged(QPoint position);
397- void stateChanged(Mir::State value);
398- void focusedChanged(bool value);
399- void confinesMousePointerChanged(bool value);
400- void surfaceChanged(unity::shell::application::MirSurfaceInterface *surface);
401- /// @endcond
402-
403- /**
404- * @brief Emitted in response to a requestFocus() call
405- */
406- void focusRequested();
407-};
408-
409-
410-} // namespace application
411-} // namespace shell
412-} // namespace unity
413-
414-Q_DECLARE_METATYPE(unity::shell::application::WindowInterface*)
415-
416-#endif // UNITY_SHELL_APPLICATION_WINDOw_H
417
418=== modified file 'test/qmltest/mocks/plugins/Unity/Application/Mocks/MockApplicationInfo.h'
419--- test/qmltest/mocks/plugins/Unity/Application/Mocks/MockApplicationInfo.h 2016-07-25 13:56:35 +0000
420+++ test/qmltest/mocks/plugins/Unity/Application/Mocks/MockApplicationInfo.h 2016-11-17 12:23:58 +0000
421@@ -29,6 +29,8 @@
422 public:
423 MockApplicationInfo(const QString &appId, const QString& name, const QString& comment, const QUrl& icon, QObject* parent = 0);
424
425+ void close() override {}
426+
427 QString appId() const;
428 QString name() const;
429 QString comment() const;
430
431=== modified file 'test/qmltest/mocks/plugins/Unity/Application/Mocks/MockApplicationManager.h'
432--- test/qmltest/mocks/plugins/Unity/Application/Mocks/MockApplicationManager.h 2015-06-19 12:02:05 +0000
433+++ test/qmltest/mocks/plugins/Unity/Application/Mocks/MockApplicationManager.h 2016-11-17 12:23:58 +0000
434@@ -44,6 +44,8 @@
435
436 Q_INVOKABLE unity::shell::application::ApplicationInfoInterface *findApplication(const QString &appId) const;
437
438+ ApplicationInfoInterface *findApplicationWithSurface(MirSurfaceInterface*) override { return nullptr; }
439+
440 Q_INVOKABLE bool requestFocusApplication(const QString &appId);
441
442 Q_INVOKABLE bool focusApplication(const QString &appId);

Subscribers

People subscribed via source and target branches

to all changes: