Merge lp:~unity-team/qtmir/low_crome_mode into lp:qtmir

Proposed by Nick Dedekind
Status: Work in progress
Proposed branch: lp:~unity-team/qtmir/low_crome_mode
Merge into: lp:qtmir
Diff against target: 340 lines (+55/-7)
12 files modified
CMakeLists.txt (+3/-3)
src/common/debughelpers.cpp (+2/-0)
src/modules/Unity/Application/application.cpp (+9/-0)
src/modules/Unity/Application/application.h (+3/-0)
src/modules/Unity/Application/application_manager.cpp (+5/-0)
src/modules/Unity/Application/application_manager.h (+1/-0)
src/modules/Unity/Application/mirsurface.cpp (+1/-0)
src/modules/Unity/Application/session.cpp (+19/-3)
src/modules/Unity/Application/session.h (+4/-1)
src/modules/Unity/Application/session_interface.h (+4/-0)
tests/modules/common/fake_session.h (+2/-0)
tests/modules/common/mock_session.h (+2/-0)
To merge this branch: bzr merge lp:~unity-team/qtmir/low_crome_mode
Reviewer Review Type Date Requested Status
Mir development team Pending
Review via email: mp+283826@code.launchpad.net

Commit message

Separate fullscreen and low crome modes

Description of the change

* Are there any related MPs required for this MP to build/function as expected? Please list.
https://code.launchpad.net/~nick-dedekind/qtubuntu/low_crome_mode/+merge/283827
https://code.launchpad.net/~nick-dedekind/unity8/low_crome_mode/+merge/283828

 * Did you perform an exploratory manual test run of your code change and any related functionality?
Yes

 * If you changed the packaging (debian), did you subscribe the ubuntu-unity team to this MP?
N/A

To post a comment you must log in.

Unmerged revisions

437. By Nick Dedekind

hideDecorations

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'CMakeLists.txt'
2--- CMakeLists.txt 2015-12-07 12:23:29 +0000
3+++ CMakeLists.txt 2016-01-25 16:01:14 +0000
4@@ -60,9 +60,9 @@
5
6 find_package(Threads REQUIRED)
7
8-pkg_check_modules(MIRSERVER mirserver>=0.17 REQUIRED)
9-pkg_check_modules(MIRCLIENT mirclient>=0.17 REQUIRED)
10-pkg_check_modules(MIRRENDERERGLDEV mir-renderer-gl-dev>=0.17 REQUIRED)
11+pkg_check_modules(MIRSERVER mirserver>=0.18 REQUIRED)
12+pkg_check_modules(MIRCLIENT mirclient>=0.18 REQUIRED)
13+pkg_check_modules(MIRRENDERERGLDEV mir-renderer-gl-dev>=0.18 REQUIRED)
14
15 pkg_check_modules(GLIB glib-2.0 REQUIRED)
16 pkg_check_modules(PROCESS_CPP process-cpp REQUIRED)
17
18=== modified file 'src/common/debughelpers.cpp'
19--- src/common/debughelpers.cpp 2015-11-10 11:07:23 +0000
20+++ src/common/debughelpers.cpp 2016-01-25 16:01:14 +0000
21@@ -147,6 +147,8 @@
22 return "vertmaximized";
23 case mir_surface_state_fullscreen:
24 return "fullscreen";
25+ case mir_surface_state_horizmaximized:
26+ return "nobars";
27 default:
28 return "???";
29 }
30
31=== modified file 'src/modules/Unity/Application/application.cpp'
32--- src/modules/Unity/Application/application.cpp 2016-01-22 16:32:39 +0000
33+++ src/modules/Unity/Application/application.cpp 2016-01-25 16:01:14 +0000
34@@ -393,6 +393,11 @@
35 return m_session ? m_session->fullscreen() : false;
36 }
37
38+bool Application::hideDecorations() const
39+{
40+ return m_session ? m_session->hideDecorations() : false;
41+}
42+
43 bool Application::canBeResumed() const
44 {
45 return m_processState != ProcessUnknown;
46@@ -465,6 +470,7 @@
47 }
48
49 bool oldFullscreen = fullscreen();
50+ bool oldHideDecorations = hideDecorations();
51 m_session = newSession;
52
53 if (m_session) {
54@@ -491,9 +497,12 @@
55
56 connect(m_session, &SessionInterface::stateChanged, this, &Application::onSessionStateChanged);
57 connect(m_session, &SessionInterface::fullscreenChanged, this, &Application::fullscreenChanged);
58+ connect(m_session, &SessionInterface::hideDecorationsChanged, this, &Application::hideDecorationsChanged);
59
60 if (oldFullscreen != fullscreen())
61 Q_EMIT fullscreenChanged(fullscreen());
62+ if (oldHideDecorations != hideDecorations())
63+ Q_EMIT hideDecorationsChanged(hideDecorations());
64 } else {
65 // this can only happen after the session has stopped and QML code called Session::release()
66 Q_ASSERT(m_state == InternalState::Stopped || m_state == InternalState::StoppedResumable);
67
68=== modified file 'src/modules/Unity/Application/application.h'
69--- src/modules/Unity/Application/application.h 2015-12-07 12:23:29 +0000
70+++ src/modules/Unity/Application/application.h 2016-01-25 16:01:14 +0000
71@@ -51,6 +51,7 @@
72 Q_PROPERTY(QString desktopFile READ desktopFile CONSTANT)
73 Q_PROPERTY(QString exec READ exec CONSTANT)
74 Q_PROPERTY(bool fullscreen READ fullscreen NOTIFY fullscreenChanged)
75+ Q_PROPERTY(bool hideDecorations READ hideDecorations NOTIFY hideDecorationsChanged)
76 Q_PROPERTY(Stage stage READ stage WRITE setStage NOTIFY stageChanged)
77 Q_PROPERTY(SessionInterface* session READ session NOTIFY sessionChanged DESIGNABLE false)
78
79@@ -124,6 +125,7 @@
80 QString desktopFile() const;
81 QString exec() const;
82 bool fullscreen() const;
83+ bool hideDecorations() const;
84
85 Stages supportedStages() const;
86
87@@ -136,6 +138,7 @@
88
89 Q_SIGNALS:
90 void fullscreenChanged(bool fullscreen);
91+ void hideDecorationsChanged(bool hideDecorations);
92 void stageChanged(Stage stage);
93 void sessionChanged(SessionInterface *session);
94
95
96=== modified file 'src/modules/Unity/Application/application_manager.cpp'
97--- src/modules/Unity/Application/application_manager.cpp 2016-01-22 16:32:39 +0000
98+++ src/modules/Unity/Application/application_manager.cpp 2016-01-25 16:01:14 +0000
99@@ -196,6 +196,7 @@
100
101 m_roleNames.insert(RoleSession, "session");
102 m_roleNames.insert(RoleFullscreen, "fullscreen");
103+ m_roleNames.insert(RoleHideDecorations, "hideDecorations");
104 }
105
106 ApplicationManager::~ApplicationManager()
107@@ -235,6 +236,8 @@
108 return QVariant::fromValue(application->session());
109 case RoleFullscreen:
110 return QVariant::fromValue(application->fullscreen());
111+ case RoleHideDecorations:
112+ return QVariant::fromValue(application->hideDecorations());
113 default:
114 return QVariant();
115 }
116@@ -737,6 +740,7 @@
117 qCDebug(QTMIR_APPLICATIONS) << "ApplicationManager::add - appId=" << application->appId();
118
119 connect(application, &Application::fullscreenChanged, this, [this](bool) { onAppDataChanged(RoleFullscreen); });
120+ connect(application, &Application::hideDecorationsChanged, this, [this](bool) { onAppDataChanged(RoleHideDecorations); });
121 connect(application, &Application::focusedChanged, this, [this](bool) { onAppDataChanged(RoleFocused); });
122 connect(application, &Application::stateChanged, this, [this](Application::State) { onAppDataChanged(RoleState); });
123 connect(application, &Application::stageChanged, this, [this](Application::Stage) { onAppDataChanged(RoleStage); });
124@@ -788,6 +792,7 @@
125 qCDebug(QTMIR_APPLICATIONS) << "ApplicationManager::remove - appId=" << application->appId();
126
127 disconnect(application, &Application::fullscreenChanged, this, 0);
128+ disconnect(application, &Application::hideDecorationsChanged, this, 0);
129 disconnect(application, &Application::focusedChanged, this, 0);
130 disconnect(application, &Application::stateChanged, this, 0);
131 disconnect(application, &Application::stageChanged, this, 0);
132
133=== modified file 'src/modules/Unity/Application/application_manager.h'
134--- src/modules/Unity/Application/application_manager.h 2015-12-07 12:23:29 +0000
135+++ src/modules/Unity/Application/application_manager.h 2016-01-25 16:01:14 +0000
136@@ -70,6 +70,7 @@
137 enum MoreRoles {
138 RoleSession = RoleExemptFromLifecycle+1,
139 RoleFullscreen,
140+ RoleHideDecorations,
141 };
142
143 // Mapping enums to Ubuntu Platform API enums.
144
145=== modified file 'src/modules/Unity/Application/mirsurface.cpp'
146--- src/modules/Unity/Application/mirsurface.cpp 2015-12-10 13:08:43 +0000
147+++ src/modules/Unity/Application/mirsurface.cpp 2016-01-25 16:01:14 +0000
148@@ -555,6 +555,7 @@
149 break;
150 }
151
152+ DEBUG_MSG << "() state=" << mirSurfaceStateToStr(mirState);
153 m_shell->set_surface_attribute(m_session->session(), m_surface, mir_surface_attrib_state, mirState);
154 }
155
156
157=== modified file 'src/modules/Unity/Application/session.cpp'
158--- src/modules/Unity/Application/session.cpp 2016-01-22 16:32:39 +0000
159+++ src/modules/Unity/Application/session.cpp 2016-01-25 16:01:14 +0000
160@@ -71,6 +71,7 @@
161 , m_parentSession(nullptr)
162 , m_children(new SessionModel(this))
163 , m_fullscreen(false)
164+ , m_hideDecorations(false)
165 , m_state(State::Starting)
166 , m_live(true)
167 , m_released(false)
168@@ -195,6 +196,11 @@
169 return m_fullscreen;
170 }
171
172+bool Session::hideDecorations() const
173+{
174+ return m_hideDecorations;
175+}
176+
177 bool Session::live() const
178 {
179 return m_live;
180@@ -227,7 +233,7 @@
181 qCDebug(QTMIR_SESSIONS) << "Session::appendSurface - session=" << name() << "surface=" << newSurface;
182
183 connect(newSurface, &MirSurfaceInterface::stateChanged,
184- this, &Session::updateFullscreenProperty);
185+ this, &Session::updateScreenProperties);
186
187 m_surfaces.insert(m_surfaces.rowCount(), newSurface);
188
189@@ -237,7 +243,7 @@
190 setState(Running);
191 }
192
193- updateFullscreenProperty();
194+ updateScreenProperties();
195 }
196
197 void Session::removeSurface(MirSurfaceInterface* surface)
198@@ -255,11 +261,12 @@
199 }
200 }
201
202-void Session::updateFullscreenProperty()
203+void Session::updateScreenProperties()
204 {
205 if (m_surfaces.rowCount() > 0) {
206 // TODO: Figure out something better
207 setFullscreen(m_surfaces.list().at(0)->state() == Mir::FullscreenState);
208+ setHideDecorations(m_surfaces.list().at(0)->state() == Mir::HorizMaximizedState);
209 } else {
210 // Keep the current value of the fullscreen property until we get a new
211 // surface
212@@ -275,6 +282,15 @@
213 }
214 }
215
216+void Session::setHideDecorations(bool hideDecorations)
217+{
218+ qCDebug(QTMIR_SESSIONS) << "Session::setHideDecorations - session=" << this << "hideDecorations=" << hideDecorations;
219+ if (m_hideDecorations != hideDecorations) {
220+ m_hideDecorations = hideDecorations;
221+ Q_EMIT hideDecorationsChanged(m_hideDecorations);
222+ }
223+}
224+
225 void Session::suspend()
226 {
227 qCDebug(QTMIR_SESSIONS) << "Session::suspend - session=" << this << "state=" << sessionStateToString(m_state);
228
229=== modified file 'src/modules/Unity/Application/session.h'
230--- src/modules/Unity/Application/session.h 2016-01-22 16:32:39 +0000
231+++ src/modules/Unity/Application/session.h 2016-01-25 16:01:14 +0000
232@@ -57,6 +57,7 @@
233 SessionInterface* parentSession() const override;
234 State state() const override;
235 bool fullscreen() const override;
236+ bool hideDecorations() const override;
237 bool live() const override;
238
239 void setApplication(unity::shell::application::ApplicationInfoInterface* item) override;
240@@ -82,6 +83,7 @@
241 SessionModel* childSessions() const override;
242
243 void setFullscreen(bool fullscreen) override;
244+ void setHideDecorations(bool hideDecorations) override;
245 void setLive(const bool) override;
246 void appendPromptSession(const std::shared_ptr<mir::scene::PromptSession>& session) override;
247 void removePromptSession(const std::shared_ptr<mir::scene::PromptSession>& session) override;
248@@ -91,7 +93,7 @@
249 void doSuspend();
250
251 private Q_SLOTS:
252- void updateFullscreenProperty();
253+ void updateScreenProperties();
254
255 protected:
256 void setParentSession(Session* session);
257@@ -108,6 +110,7 @@
258 SessionInterface* m_parentSession;
259 SessionModel* m_children;
260 bool m_fullscreen;
261+ bool m_hideDecorations;
262 State m_state;
263 bool m_live;
264 bool m_released;
265
266=== modified file 'src/modules/Unity/Application/session_interface.h'
267--- src/modules/Unity/Application/session_interface.h 2015-12-07 12:02:48 +0000
268+++ src/modules/Unity/Application/session_interface.h 2016-01-25 16:01:14 +0000
269@@ -53,6 +53,7 @@
270 Q_PROPERTY(SessionInterface* parentSession READ parentSession NOTIFY parentSessionChanged DESIGNABLE false)
271 Q_PROPERTY(SessionModel* childSessions READ childSessions DESIGNABLE false CONSTANT)
272 Q_PROPERTY(bool fullscreen READ fullscreen NOTIFY fullscreenChanged)
273+ Q_PROPERTY(bool hideDecorations READ hideDecorations NOTIFY hideDecorationsChanged)
274 Q_PROPERTY(bool live READ live NOTIFY liveChanged)
275 public:
276 SessionInterface(QObject *parent = 0) : QObject(parent) {}
277@@ -77,6 +78,7 @@
278 virtual SessionModel* childSessions() const = 0;
279 virtual State state() const = 0;
280 virtual bool fullscreen() const = 0;
281+ virtual bool hideDecorations() const = 0;
282 virtual bool live() const = 0;
283
284 virtual std::shared_ptr<mir::scene::Session> session() const = 0;
285@@ -105,6 +107,7 @@
286 virtual void foreachPromptSession(std::function<void(const std::shared_ptr<mir::scene::PromptSession>&)> f) const = 0;
287
288 virtual void setFullscreen(bool fullscreen) = 0;
289+ virtual void setHideDecorations(bool hideDecorations) = 0;
290 virtual void setLive(const bool) = 0;
291 virtual void appendPromptSession(const std::shared_ptr<mir::scene::PromptSession>& session) = 0;
292 virtual void removePromptSession(const std::shared_ptr<mir::scene::PromptSession>& session) = 0;
293@@ -114,6 +117,7 @@
294 void applicationChanged(unity::shell::application::ApplicationInfoInterface* application);
295 void stateChanged(State state);
296 void fullscreenChanged(bool fullscreen);
297+ void hideDecorationsChanged(bool hideDecorations);
298 void liveChanged(bool live);
299 void lastSurfaceChanged(MirSurfaceInterface* surface);
300 };
301
302=== modified file 'tests/modules/common/fake_session.h'
303--- tests/modules/common/fake_session.h 2015-12-07 12:02:48 +0000
304+++ tests/modules/common/fake_session.h 2016-01-25 16:01:14 +0000
305@@ -45,6 +45,7 @@
306 SessionModel* childSessions() const override { return nullptr; }
307 State state() const override { return m_state; }
308 bool fullscreen() const override { return false; }
309+ bool hideDecorations() const override { return false; }
310 bool live() const override { return true; }
311
312 std::shared_ptr<mir::scene::Session> session() const override { return nullptr; }
313@@ -92,6 +93,7 @@
314 void foreachPromptSession(std::function<void(const std::shared_ptr<mir::scene::PromptSession>&)>) const override {}
315
316 void setFullscreen(bool) override {}
317+ void setHideDecorations(bool) override {}
318 void setLive(const bool) override {}
319 void appendPromptSession(const std::shared_ptr<mir::scene::PromptSession>&) override {}
320 void removePromptSession(const std::shared_ptr<mir::scene::PromptSession>&) override {}
321
322=== modified file 'tests/modules/common/mock_session.h'
323--- tests/modules/common/mock_session.h 2015-12-07 12:02:48 +0000
324+++ tests/modules/common/mock_session.h 2016-01-25 16:01:14 +0000
325@@ -44,6 +44,7 @@
326 MOCK_CONST_METHOD0(state, State());
327
328 MOCK_CONST_METHOD0(fullscreen, bool());
329+ MOCK_CONST_METHOD0(hideDecorations, bool());
330 MOCK_CONST_METHOD0(live, bool());
331
332 MOCK_CONST_METHOD0(session, std::shared_ptr<mir::scene::Session>());
333@@ -92,6 +93,7 @@
334
335 protected:
336 MOCK_METHOD1(setFullscreen, void(bool fullscreen));
337+ MOCK_METHOD1(setHideDecorations, void(bool hideDecorations));
338 MOCK_METHOD1(setLive, void(const bool));
339 MOCK_METHOD1(appendPromptSession, void(const std::shared_ptr<mir::scene::PromptSession>& session));
340 MOCK_METHOD1(removePromptSession, void(const std::shared_ptr<mir::scene::PromptSession>& session));

Subscribers

People subscribed via source and target branches