Merge lp:~ricmm/unity-mir/sidestage-reenable into lp:unity-mir

Proposed by Ricardo Mendoza
Status: Merged
Approved by: Gerry Boland
Approved revision: 164
Merged at revision: 164
Proposed branch: lp:~ricmm/unity-mir/sidestage-reenable
Merge into: lp:unity-mir
Diff against target: 594 lines (+211/-59)
10 files modified
src/modules/Unity/Application/application_manager.cpp (+138/-12)
src/modules/Unity/Application/application_manager.h (+19/-2)
src/modules/Unity/Application/applicationscreenshotprovider.cpp (+2/-29)
src/modules/Unity/Application/mirsurface.cpp (+2/-2)
src/modules/Unity/Application/mirsurfacemanager.cpp (+10/-1)
src/unity-mir/focussetter.cpp (+1/-0)
src/unity-mir/initialsurfaceplacementstrategy.cpp (+15/-10)
src/unity-mir/initialsurfaceplacementstrategy.h (+14/-3)
src/unity-mir/shellserverconfiguration.cpp (+8/-0)
src/unity-mir/shellserverconfiguration.h (+2/-0)
To merge this branch: bzr merge lp:~ricmm/unity-mir/sidestage-reenable
Reviewer Review Type Date Requested Status
Gerry Boland (community) Approve
PS Jenkins bot (community) continuous-integration Approve
Review via email: mp+198489@code.launchpad.net

Commit message

Re-enable Sidestage as it was under SF

To post a comment you must log in.
Revision history for this message
Gerry Boland (gerboland) wrote :

+ Application* m_mainStageApplication;
+ Application* m_sideStageApplication;
+ Application* m_msApplicationToBeFocused; // placeholder store for async
focusing
+ Application* m_ssApplicationToBeFocused; // placeholder store for async focusing
Is there no way you can keep the idea of "stages" out of unity-mir? Stages are more a window management concept, so I was hoping to keep it out of unity-mir entirely.

You've moved panelHeight calculation into ApplicationManager - makes sense.

- m_mirServer->the_focus_controller()->set_focus_to(application->session());
+ if(application->session())
+ m_mirServer->the_focus_controller()->set_focus_to(application->session());
Wasn't expecting this to need the check, Application should only be attempted to be focused once it has a session associated. I mess up?

- if (app->state() == Application::Stopped || app->state() == Application::Starting) {
+ if (app->state() == Application::Stopped || app->state() == Application::Starting || app->state() == Application::Suspended) {
Actually hadn't checked this, but had expected that if app suspended, then it still has a Mir session and so has an output buffer that can be screenshotted.

- snapshot.size.height.as_int() - yOffset,
+ snapshot.size.height.as_int(),
I removed the yOffset to clip the area of the application under the panel. This not needed any more?

Revision history for this message
Ricardo Mendoza (ricmm) wrote :

> + Application* m_mainStageApplication;
> + Application* m_sideStageApplication;
> + Application* m_msApplicationToBeFocused; // placeholder store for async
> focusing
> + Application* m_ssApplicationToBeFocused; // placeholder store for async
> focusing
> Is there no way you can keep the idea of "stages" out of unity-mir? Stages are
> more a window management concept, so I was hoping to keep it out of unity-mir
> entirely.

I will give this some thought today.

> You've moved panelHeight calculation into ApplicationManager - makes sense.
>
> - m_mirServer->the_focus_controller()->set_focus_to(application->session());
> + if(application->session())
> + m_mirServer->the_focus_controller()->set_focus_to(application->session());
> Wasn't expecting this to need the check, Application should only be attempted
> to be focused once it has a session associated. I mess up?

The shell actually sometimes tries to focusApplication() a NULL session, for some reason. It has something to do with the gimmicks and tricks it does to maintain stage consistency in multi-stage scenarios.

Of course this goes bad when hitting the unity-mir focusApplication(0x0)

> - if (app->state() == Application::Stopped || app->state() ==
> Application::Starting) {
> + if (app->state() == Application::Stopped || app->state() ==
> Application::Starting || app->state() == Application::Suspended) {
> Actually hadn't checked this, but had expected that if app suspended, then it
> still has a Mir session and so has an output buffer that can be screenshotted.

Thats true, the buffer can still be screenshotted. I had added this for some other reason, but I will figure out if it can be removed. Stale code.

> - snapshot.size.height.as_int() - yOffset,
> + snapshot.size.height.as_int(),
> I removed the yOffset to clip the area of the application under the panel.
> This not needed any more?

Not needed anymore as currently surface buffers are created with the visible geometry provided to the application. Before all surfaces were full-geometry according to Mir (wrong creation params). Now they actually specify creation dimensions (platform-api branch).

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

> > You've moved panelHeight calculation into ApplicationManager - makes sense.
> >
> > - m_mirServer->the_focus_controller()->set_focus_to(application->session());
> > + if(application->session())
> > + m_mirServer->the_focus_controller()->set_focus_to(application->session());
> > Wasn't expecting this to need the check, Application should only be
> attempted
> > to be focused once it has a session associated. I mess up?
>
> The shell actually sometimes tries to focusApplication() a NULL session, for
> some reason. It has something to do with the gimmicks and tricks it does to
> maintain stage consistency in multi-stage scenarios.
>
> Of course this goes bad when hitting the unity-mir focusApplication(0x0)

set_focus_to(0x0) should tell Mir to unfocus all sessions, so that only the shell gets input. I can see yeah that breaks stuff when sidestage going. Must check that phone isn't relying on this behaviour.

> > - if (app->state() == Application::Stopped || app->state() ==
> > Application::Starting) {
> > + if (app->state() == Application::Stopped || app->state() ==
> > Application::Starting || app->state() == Application::Suspended) {
> > Actually hadn't checked this, but had expected that if app suspended, then
> it
> > still has a Mir session and so has an output buffer that can be
> screenshotted.
>
> Thats true, the buffer can still be screenshotted. I had added this for some
> other reason, but I will figure out if it can be removed. Stale code.

Ok

>
> > - snapshot.size.height.as_int() - yOffset,
> > + snapshot.size.height.as_int(),
> > I removed the yOffset to clip the area of the application under the panel.
> > This not needed any more?
>
> Not needed anymore as currently surface buffers are created with the visible
> geometry provided to the application. Before all surfaces were full-geometry
> according to Mir (wrong creation params). Now they actually specify creation
> dimensions (platform-api branch).

Aha cool, in that case m_panelHeight it totally unneeded in the screenshot provider.

Revision history for this message
MichaƂ Sawicz (saviq) wrote :

Made "Needs review" to get packages out of CI.

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
160. By kevin gunn

bump debian version dependency for mir to 0.1.3 to force rebuild

161. By PS Jenkins bot

Releasing 0.2+14.04.20140108.1-0ubuntu1 (revision 160 from lp:unity-mir).

Approved by PS Jenkins bot.

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

+++ src/unity-mir/surfacefactory.h
+ void requestDepthForSession(mir::shell::Session const* session, mir::scene::DepthId &depth);

I don't see this being used anywhere. It's only usage is commented out:
+ //Q_EMIT requestDepthForSession(session, newParams.depth);

<pedantic>
+ if(application->session())
missing the space after the "if"
</pedantic>

Is pity that app man has to learn concept of main and side stage apps, but as it unblocks sidestage with mir, it will do. With revamp of window manager code, then this can go away again.

In conclusion, code looks good, functions correctly and with these small fixes am happy to approve.

review: Needs Fixing
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
Gerry Boland (gerboland) wrote :

I'm having problems with this and AP, not sure if it's my problem but here's the log output: http://pastebin.ubuntu.com/6727470/
Seems like the greeter isn't being swiped away - but I seldom see anything on screen!

Also want to do full test of all AP test suites before approving.

162. By Thomas Voß

Switch to cmake.

Approved by Gerry Boland, PS Jenkins bot, Albert Astals Cid, Jussi Pakkanen.

163. By Ricardo Mendoza

merge

164. By Ricardo Mendoza

Fix uninitialized var code path when using non-live application plugins

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

Working well, AP tests all pass on phone

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/modules/Unity/Application/application_manager.cpp'
2--- src/modules/Unity/Application/application_manager.cpp 2013-11-23 06:11:07 +0000
3+++ src/modules/Unity/Application/application_manager.cpp 2014-01-14 06:02:15 +0000
4@@ -25,6 +25,8 @@
5 #include "shellserverconfiguration.h"
6 #include "sessionlistener.h"
7 #include "sessionauthorizer.h"
8+#include "initialsurfaceplacementstrategy.h"
9+#include "surfacefactory.h"
10 #include "taskcontroller.h"
11 #include "logging.h"
12
13@@ -32,10 +34,16 @@
14 #include <mir/shell/session.h>
15 #include <mir/shell/focus_controller.h>
16 #include <mir/shell/surface.h>
17+#include <mir/graphics/display.h>
18+#include <mir/graphics/display_buffer.h>
19+#include <mircommon/mir/geometry/rectangles.h>
20
21 // Qt
22 #include <QCoreApplication>
23
24+// Default element sizes
25+#define SIDE_STAGE_WIDTH_GU 40
26+
27 namespace msh = mir::shell;
28
29 using namespace unity::shell::application;
30@@ -53,10 +61,15 @@
31 ApplicationManager::ApplicationManager(QObject *parent)
32 : ApplicationManagerInterface(parent)
33 , m_focusedApplication(nullptr)
34-, m_applicationToBeFocused(nullptr)
35+, m_mainStageApplication(nullptr)
36+, m_sideStageApplication(nullptr)
37+, m_msApplicationToBeFocused(nullptr)
38+, m_ssApplicationToBeFocused(nullptr)
39 , m_lifecycleExceptions(QStringList() << "com.ubuntu.music")
40 , m_taskController(TaskController::singleton())
41+, m_gridUnitPx(8)
42 , m_fenceNext(false)
43+, m_panelHeight(54)
44 {
45 DLOG("ApplicationManager::ApplicationManager (this=%p)", this);
46
47@@ -73,13 +86,15 @@
48 QObject::connect(m_mirServer->sessionListener(), &SessionListener::sessionStopping,
49 this, &ApplicationManager::onSessionStopping);
50 QObject::connect(m_mirServer->sessionListener(), &SessionListener::sessionFocused,
51- this, &ApplicationManager::onSessionFocused);
52+ this, &ApplicationManager::onSessionFocused, Qt::QueuedConnection);
53 QObject::connect(m_mirServer->sessionListener(), &SessionListener::sessionUnfocused,
54 this, &ApplicationManager::onSessionUnfocused);
55 QObject::connect(m_mirServer->sessionListener(), &SessionListener::sessionCreatedSurface,
56 this, &ApplicationManager::onSessionCreatedSurface);
57 QObject::connect(m_mirServer->sessionAuthorizer(), &SessionAuthorizer::requestAuthorizationForSession,
58 this, &ApplicationManager::authorizeSession, Qt::BlockingQueuedConnection);
59+ QObject::connect(m_mirServer->placementStrategy(), &InitialSurfacePlacementStrategy::requestPlacementForSession,
60+ this, &ApplicationManager::placeSession, Qt::DirectConnection);
61
62 QObject::connect(m_taskController.data(), &TaskController::processStartReport,
63 this, &ApplicationManager::onProcessStartReportReceived);
64@@ -91,6 +106,35 @@
65 this, &ApplicationManager::onResumeRequested);
66
67 m_dbusWindowStack = new DBusWindowStack(this);
68+
69+ std::shared_ptr<mir::graphics::Display> mirDisplay = m_mirServer->the_display();
70+
71+ // Obtain display size
72+ mir::geometry::Rectangles view_area;
73+ mirDisplay->for_each_display_buffer(
74+ [&view_area](mir::graphics::DisplayBuffer const& db)
75+ {
76+ view_area.add(db.view_area());
77+ });
78+
79+ m_displaySize = QSize(
80+ view_area.bounding_rectangle().size.width.as_uint32_t(),
81+ view_area.bounding_rectangle().size.height.as_uint32_t()
82+ );
83+
84+ // Setup panel height
85+ QByteArray gridUnitString = qgetenv("GRID_UNIT_PX");
86+ if (!gridUnitString.isEmpty()) {
87+ bool ok;
88+ int value = gridUnitString.toInt(&ok);
89+ if (ok) {
90+ m_gridUnitPx = value;
91+ }
92+ }
93+
94+ int densityPixelPx = qFloor( (float)m_gridUnitPx / 8 );
95+
96+ m_panelHeight = 3 * m_gridUnitPx + 2 * densityPixelPx;
97 }
98
99 ApplicationManager::~ApplicationManager()
100@@ -98,6 +142,11 @@
101 DLOG("ApplicationManager::~ApplicationManager");
102 }
103
104+int ApplicationManager::panelHeight()
105+{
106+ return m_panelHeight;
107+}
108+
109 int ApplicationManager::rowCount(const QModelIndex &parent) const
110 {
111 return !parent.isValid() ? m_applications.size() : 0;
112@@ -163,9 +212,17 @@
113 DLOG("No such running application '%s'", qPrintable(appId));
114 return false;
115 }
116-
117- m_applicationToBeFocused = application;
118-
119+
120+ if (application->stage() == Application::MainStage && m_sideStageApplication &&
121+ (m_sideStageApplication->state() == Application::Running)) {
122+ m_sideStageApplication->setState(Application::Suspended);
123+ }
124+
125+ if (application->stage() == Application::MainStage)
126+ m_msApplicationToBeFocused = application;
127+ else
128+ m_ssApplicationToBeFocused = application;
129+
130 if (application->state() == Application::Stopped) {
131 // Respawning this app, move to end of application list so onSessionStarting works ok
132 // FIXME: this happens pretty late, shell could request respawn earlier
133@@ -173,7 +230,8 @@
134 int from = m_applications.indexOf(application);
135 move(from, m_applications.length()-1);
136 } else {
137- m_mirServer->the_focus_controller()->set_focus_to(application->session());
138+ if (application->session())
139+ m_mirServer->the_focus_controller()->set_focus_to(application->session());
140 }
141
142 // FIXME(dandrader): lying here. The operation is async. So we will only know whether
143@@ -186,7 +244,15 @@
144 {
145 DLOG("ApplicationManager::unfocusCurrentApplication (this=%p)", this);
146
147- m_applicationToBeFocused = nullptr;
148+ if (m_sideStageApplication)
149+ m_sideStageApplication->setState(Application::Suspended);
150+
151+ if (m_mainStageApplication)
152+ m_mainStageApplication->setState(Application::Suspended);
153+
154+ // Clear both stages
155+ m_msApplicationToBeFocused = nullptr;
156+ m_ssApplicationToBeFocused = nullptr;
157 m_mirServer->the_focus_controller()->set_focus_to(NULL); //FIXME(greyback)
158 }
159
160@@ -260,6 +326,11 @@
161 Q_EMIT focusedApplicationIdChanged();
162 }
163
164+ if (application == m_mainStageApplication)
165+ m_mainStageApplication = nullptr;
166+ if (application == m_sideStageApplication)
167+ m_sideStageApplication = nullptr;
168+
169 remove(application);
170 m_dbusWindowStack->WindowDestroyed(0, application->appId());
171
172@@ -419,7 +490,7 @@
173
174 // if stage supplied in CLI, fetch that
175 Application::Stage stage = Application::MainStage;
176- pattern = QRegularExpression::escape("--stage=") + "(\\S+)";
177+ pattern = QRegularExpression::escape("--stage_hint=") + "(\\S+)";
178 regExp.setPattern(pattern);
179 regExpMatch = regExp.match(command);
180
181@@ -438,6 +509,33 @@
182 authorized = true;
183 }
184
185+void ApplicationManager::placeSession(msh::Session const* session, uint32_t &x, uint32_t &y)
186+{
187+ DLOG("ApplicationManager::placeSession (this=%p, session=%p)", this, session);
188+
189+ Application* application = findApplicationWithSession(session);
190+
191+ // Application defaults
192+ x = 0;
193+ y = m_panelHeight;
194+
195+ // Shell client override
196+ if (!session) {
197+ y = 0;
198+ return;
199+ }
200+
201+ // Fullscreen applications override
202+ if (application && application->fullscreen())
203+ y = 0;
204+
205+ // SideStage override
206+ if (application && application->stage() == Application::SideStage)
207+ x = m_displaySize.width() - (SIDE_STAGE_WIDTH_GU * m_gridUnitPx);
208+
209+ DLOG("ApplicationManager::placeSession (x=%d, y=%d)", x, y);
210+}
211+
212 void ApplicationManager::onSessionStarting(std::shared_ptr<msh::Session> const& session)
213 {
214 DLOG("ApplicationManager::onSessionStarting (this=%p, application=%s)", this, session->name().c_str());
215@@ -452,7 +550,10 @@
216 Application* application = findLastExecutedApplication();
217 if (application && application->state() != Application::Running) {
218 application->setSession(session);
219- m_applicationToBeFocused = application;
220+ if (application->stage() == Application::MainStage)
221+ m_msApplicationToBeFocused = application;
222+ else
223+ m_ssApplicationToBeFocused = application;
224 } else {
225 DLOG("ApplicationManager::onSessionStarting - unauthorized application!!");
226 }
227@@ -469,6 +570,12 @@
228 application->setSession(nullptr);
229 m_dbusWindowStack->WindowDestroyed(0, application->appId());
230
231+ if (m_mainStageApplication == application)
232+ m_mainStageApplication = nullptr;
233+
234+ if (m_sideStageApplication == application)
235+ m_sideStageApplication = nullptr;
236+
237 if (application == m_focusedApplication) {
238 // TODO(greyback) What to do?? Focus next app, or unfocus everything??
239 m_focusedApplication = NULL;
240@@ -481,12 +588,14 @@
241
242 void ApplicationManager::onSessionFocused(std::shared_ptr<msh::Session> const& session)
243 {
244- DLOG("ApplicationManager::onSessionFocused (this=%p, application=%s)", this, session->name().c_str());
245+ DLOG("ApplicationManager::onSessionFocused (this=%p, session=%p)", this, session.get());
246 Application* application = findApplicationWithSession(session);
247
248 // Don't give application focus until it has created it's surface, when it is set as state "Running"
249 // and only notify shell of focus changes that it actually expects
250- if (application && application->state() != Application::Starting && application == m_applicationToBeFocused
251+ if (application && application->state() != Application::Starting &&
252+ (application == m_msApplicationToBeFocused ||
253+ application == m_ssApplicationToBeFocused)
254 && application != m_focusedApplication) {
255 setFocused(application);
256 QModelIndex appIndex = findIndex(application);
257@@ -546,9 +655,16 @@
258
259 // set state of previously focused app to suspended
260 if (m_focusedApplication && m_lifecycleExceptions.filter(m_focusedApplication->appId().section('_',0,0)).empty()) {
261- m_focusedApplication->setState(Application::Suspended);
262+ Application *lastApplication = applicationForStage(application->stage());
263+ if (lastApplication && lastApplication->state() == Application::Running)
264+ lastApplication->setState(Application::Suspended);
265 }
266
267+ if (application->stage() == Application::MainStage)
268+ m_mainStageApplication = application;
269+ else
270+ m_sideStageApplication = application;
271+
272 m_focusedApplication = application;
273 m_focusedApplication->setFocused(true);
274 m_focusedApplication->setState(Application::Running);
275@@ -593,6 +709,16 @@
276 }
277 }
278
279+Application* ApplicationManager::applicationForStage(Application::Stage stage)
280+{
281+ DLOG("ApplicationManager::focusedApplicationForStage(this=%p)", this);
282+
283+ if (stage == Application::MainStage)
284+ return m_mainStageApplication;
285+ else
286+ return m_sideStageApplication;
287+}
288+
289 void ApplicationManager::add(Application* application)
290 {
291 DASSERT(application != NULL);
292
293=== modified file 'src/modules/Unity/Application/application_manager.h'
294--- src/modules/Unity/Application/application_manager.h 2013-11-20 14:39:50 +0000
295+++ src/modules/Unity/Application/application_manager.h 2014-01-14 06:02:15 +0000
296@@ -30,12 +30,17 @@
297 // local
298 #include "application.h"
299
300+#include <mir/scene/depth_id.h>
301+
302 class ShellServerConfiguration;
303 class DBusWindowStack;
304 class MirSurfaceManager;
305 class TaskController;
306
307 namespace mir {
308+ namespace geometry {
309+ class Size;
310+ }
311 namespace shell {
312 class Session;
313 class Surface;
314@@ -80,9 +85,14 @@
315 const QList<Application*> &list() const { return m_applications; }
316 Application* findApplicationWithPid(const qint64 pid);
317
318+ // Internal helpers
319+ int panelHeight();
320+ QSize displaySize() const { return m_displaySize; }
321+
322 public Q_SLOTS:
323 void authorizeSession(const quint64 pid, bool &authorized);
324-
325+ void placeSession(mir::shell::Session const*, uint32_t &x, uint32_t &y);
326+
327 void onSessionStarting(std::shared_ptr<mir::shell::Session> const& session);
328 void onSessionStopping(std::shared_ptr<mir::shell::Session> const& session);
329 void onSessionFocused(std::shared_ptr<mir::shell::Session> const& session);
330@@ -105,17 +115,24 @@
331 Application* findApplicationWithSession(const std::shared_ptr<mir::shell::Session> &session);
332 Application* findApplicationWithSession(const mir::shell::Session *session);
333 Application* findLastExecutedApplication();
334+ Application* applicationForStage(Application::Stage stage);
335 QModelIndex findIndex(Application* application);
336
337 QList<Application*> m_applications;
338 Application* m_focusedApplication; // remove as Mir has API for this
339- Application* m_applicationToBeFocused; // a basic form of focus stealing prevention
340+ Application* m_mainStageApplication;
341+ Application* m_sideStageApplication;
342+ Application* m_msApplicationToBeFocused; // placeholder store for async focusing
343+ Application* m_ssApplicationToBeFocused; // placeholder store for async focusing
344 QStringList m_lifecycleExceptions;
345 ShellServerConfiguration* m_mirServer;
346 DBusWindowStack* m_dbusWindowStack;
347 QScopedPointer<TaskController> m_taskController;
348 static ApplicationManager* the_application_manager;
349+ int m_gridUnitPx;
350 bool m_fenceNext;
351+ QSize m_displaySize;
352+ int m_panelHeight;
353
354 friend class DBusWindowStack;
355 friend class MirSurfaceManager;
356
357=== modified file 'src/modules/Unity/Application/applicationscreenshotprovider.cpp'
358--- src/modules/Unity/Application/applicationscreenshotprovider.cpp 2013-11-26 10:32:56 +0000
359+++ src/modules/Unity/Application/applicationscreenshotprovider.cpp 2014-01-14 06:02:15 +0000
360@@ -25,29 +25,11 @@
361 // mir
362 #include "mirserver/mir/shell/session.h"
363
364-// fallback grid unit used if GRID_UNIT_PX is not in the environment.
365-const int defaultGridUnitPx = 8;
366-
367 ApplicationScreenshotProvider::ApplicationScreenshotProvider(ApplicationManager *appManager)
368 : QQuickImageProvider(QQuickImageProvider::Image)
369 , m_appManager(appManager)
370- , m_panelHeight(54)
371+ , m_panelHeight(m_appManager->panelHeight())
372 {
373- // See below to explain why this is needed for now.
374- int gridUnitPx = defaultGridUnitPx;
375-
376- QByteArray gridUnitString = qgetenv("GRID_UNIT_PX");
377- if (!gridUnitString.isEmpty()) {
378- bool ok;
379- int value = gridUnitString.toInt(&ok);
380- if (ok) {
381- gridUnitPx = value;
382- }
383- }
384-
385- int densityPixelPx = qFloor( (float)gridUnitPx / defaultGridUnitPx );
386-
387- m_panelHeight = 3 * gridUnitPx + 2 * densityPixelPx;
388 }
389
390 QQmlImageProviderBase::Flags ApplicationScreenshotProvider::flags() const
391@@ -79,15 +61,6 @@
392 return QImage();
393 }
394
395- /* Workaround for bug https://bugs.launchpad.net/qtubuntu/+bug/1209216 - currently all qtubuntu
396- * based applications are allocated a fullscreen Mir surface, but draw in a geometry excluding
397- * the panel's rectangle. Mir snapshots thus have a white rectangle which the panel hides.
398- * So need to clip this rectangle from the snapshot. */
399- int yOffset = 0;
400- if (!app->fullscreen()) {
401- yOffset = m_panelHeight;
402- }
403-
404 QMutex mutex;
405 QWaitCondition wait;
406 mutex.lock();
407@@ -102,7 +75,7 @@
408
409 image = QImage( (const uchar*)snapshot.pixels, // since we mirror, no need to offset starting position
410 snapshot.size.width.as_int(),
411- snapshot.size.height.as_int() - yOffset,
412+ snapshot.size.height.as_int(),
413 QImage::Format_ARGB32_Premultiplied).mirrored();
414 wait.wakeOne();
415 });
416
417=== modified file 'src/modules/Unity/Application/mirsurface.cpp'
418--- src/modules/Unity/Application/mirsurface.cpp 2013-10-23 16:00:09 +0000
419+++ src/modules/Unity/Application/mirsurface.cpp 2014-01-14 06:02:15 +0000
420@@ -101,7 +101,7 @@
421 Size size = m_surface->size();
422 if (size.width.as_int() != (int) widthValue) {
423 size.width = Width{widthValue};
424-// m_surface->set_size(size); //MISSING FROM API
425+ m_surface->resize(size);
426 Q_EMIT widthChanged();
427 }
428 }
429@@ -113,7 +113,7 @@
430 Size size = m_surface->size();
431 if (size.height.as_int() != (int) heightValue) {
432 size.height = Height{heightValue};
433-// m_surface->set_size(size); //MISSING FROM API
434+ m_surface->resize(size);
435 Q_EMIT heightChanged();
436 }
437 }
438
439=== modified file 'src/modules/Unity/Application/mirsurfacemanager.cpp'
440--- src/modules/Unity/Application/mirsurfacemanager.cpp 2013-11-15 17:57:20 +0000
441+++ src/modules/Unity/Application/mirsurfacemanager.cpp 2014-01-14 06:02:15 +0000
442@@ -148,7 +148,16 @@
443 it.value()->setAttribute(attribute, value);
444 if (attribute == mir_surface_attrib_state &&
445 value == mir_surface_state_fullscreen) {
446- it.value()->application()->setFullscreen(static_cast<bool>(value));
447+ // Only screen-wide applications are allowed to go fullscreen
448+ if (it.value()->application()->stage() == Application::MainStage) {
449+ it.value()->application()->setFullscreen(static_cast<bool>(value));
450+ ApplicationManager* appMgr = static_cast<ApplicationManager*>(ApplicationManager::singleton());
451+ QSize displaySize = appMgr->displaySize();
452+ it.value()->setWidth(displaySize.width());
453+ it.value()->setHeight(displaySize.height());
454+ it.value()->setX(0);
455+ it.value()->setY(0);
456+ }
457 }
458 }
459 }
460
461=== modified file 'src/unity-mir/focussetter.cpp'
462--- src/unity-mir/focussetter.cpp 2013-10-07 21:52:28 +0000
463+++ src/unity-mir/focussetter.cpp 2014-01-14 06:02:15 +0000
464@@ -34,6 +34,7 @@
465
466 void FocusSetter::set_focus_to(std::shared_ptr<msh::Session> const& session)
467 {
468+ DLOG("FocusSetter::set_focus_to(session=%p):%d", session.get(), __LINE__);
469 // Ensure we always call the underlying setter to dispatch focus/unfocus notifications.
470 underlying_setter->set_focus_to(session);
471 if (session == nullptr)
472
473=== modified file 'src/unity-mir/initialsurfaceplacementstrategy.cpp'
474--- src/unity-mir/initialsurfaceplacementstrategy.cpp 2013-08-26 23:45:40 +0000
475+++ src/unity-mir/initialsurfaceplacementstrategy.cpp 2014-01-14 06:02:15 +0000
476@@ -16,6 +16,7 @@
477
478 // local
479 #include "initialsurfaceplacementstrategy.h"
480+#include "logging.h"
481
482 // mir
483 #include "mir/shell/surface_creation_parameters.h"
484@@ -23,23 +24,27 @@
485
486 namespace msh = mir::shell;
487
488-InitialSurfacePlacementStrategy::InitialSurfacePlacementStrategy(std::shared_ptr<msh::DisplayLayout> const& displayLayout)
489- : m_displayLayout(displayLayout)
490+InitialSurfacePlacementStrategy::InitialSurfacePlacementStrategy(std::shared_ptr<msh::DisplayLayout> const& displayLayout, QObject *parent)
491+ : QObject(parent),
492+ m_displayLayout(displayLayout)
493+{
494+}
495+
496+InitialSurfacePlacementStrategy::~InitialSurfacePlacementStrategy()
497 {
498 }
499
500 msh::SurfaceCreationParameters
501-InitialSurfacePlacementStrategy::place(msh::Session const& /*session*/, msh::SurfaceCreationParameters const& requestParameters)
502+InitialSurfacePlacementStrategy::place(msh::Session const& session, msh::SurfaceCreationParameters const& requestParameters)
503 {
504 using namespace mir::geometry;
505 auto placedParameters = requestParameters;
506-
507- Rectangle rect{placedParameters.top_left, placedParameters.size};
508- m_displayLayout->size_to_output(rect);
509- placedParameters.size = rect.size;
510-
511- // position surface initially off-screen, until ready to be animated in
512-// placedParameters.top_left = Point{ X{rect.size.width.as_int()}, Y{0}};
513+ uint32_t x = 0;
514+ uint32_t y = 0;
515+
516+ Q_EMIT requestPlacementForSession(&session, x, y);
517+
518+ placedParameters.top_left = Point{ X{x}, Y{y} };
519
520 return placedParameters;
521 }
522
523=== modified file 'src/unity-mir/initialsurfaceplacementstrategy.h'
524--- src/unity-mir/initialsurfaceplacementstrategy.h 2013-08-26 23:45:40 +0000
525+++ src/unity-mir/initialsurfaceplacementstrategy.h 2014-01-14 06:02:15 +0000
526@@ -21,15 +21,26 @@
527
528 #include "mirserver/mir/shell/placement_strategy.h"
529 #include "mirserver/mir/shell/display_layout.h"
530-
531-class InitialSurfacePlacementStrategy : public mir::shell::PlacementStrategy
532+#include "mir/shell/session.h"
533+#include "mir/scene/depth_id.h"
534+
535+#include <QObject>
536+
537+class InitialSurfacePlacementStrategy : public QObject, public mir::shell::PlacementStrategy
538 {
539+ Q_OBJECT
540+
541 public:
542- InitialSurfacePlacementStrategy(std::shared_ptr<mir::shell::DisplayLayout> const& displayLayout);
543+ InitialSurfacePlacementStrategy(std::shared_ptr<mir::shell::DisplayLayout> const& displayLayout,
544+ QObject *parent = 0);
545+ ~InitialSurfacePlacementStrategy();
546
547 mir::shell::SurfaceCreationParameters place(mir::shell::Session const& session,
548 mir::shell::SurfaceCreationParameters const& requestParameters) override;
549
550+Q_SIGNALS:
551+ void requestPlacementForSession(mir::shell::Session const* session, uint32_t &x, uint32_t &y);
552+
553 private:
554 std::shared_ptr<mir::shell::DisplayLayout> const m_displayLayout;
555 };
556
557=== modified file 'src/unity-mir/shellserverconfiguration.cpp'
558--- src/unity-mir/shellserverconfiguration.cpp 2013-11-27 10:45:09 +0000
559+++ src/unity-mir/shellserverconfiguration.cpp 2014-01-14 06:02:15 +0000
560@@ -125,6 +125,14 @@
561 // scope the unique pointer will be destroyed so we return 0
562 //
563
564+InitialSurfacePlacementStrategy *ShellServerConfiguration::placementStrategy()
565+{
566+ auto sharedPtr = the_shell_placement_strategy();
567+ if (sharedPtr.unique()) return 0;
568+
569+ return static_cast<InitialSurfacePlacementStrategy*>(sharedPtr.get());
570+}
571+
572 SessionAuthorizer *ShellServerConfiguration::sessionAuthorizer()
573 {
574 auto sharedPtr = the_session_authorizer();
575
576=== modified file 'src/unity-mir/shellserverconfiguration.h'
577--- src/unity-mir/shellserverconfiguration.h 2013-11-18 16:05:56 +0000
578+++ src/unity-mir/shellserverconfiguration.h 2014-01-14 06:02:15 +0000
579@@ -26,6 +26,7 @@
580 class SessionAuthorizer;
581 class SurfaceFactory;
582 class SurfaceConfigurator;
583+class InitialSurfacePlacementStrategy;
584
585 class ShellServerConfiguration : public QObject, public mir::DefaultServerConfiguration
586 {
587@@ -51,6 +52,7 @@
588
589 /* qt specific */
590 // getters
591+ InitialSurfacePlacementStrategy *placementStrategy();
592 SessionAuthorizer *sessionAuthorizer();
593 SessionListener *sessionListener();
594 SurfaceConfigurator *surfaceConfigurator();

Subscribers

People subscribed via source and target branches