Merge lp://qastaging/~mzanetti/unity-mir/screenshotting-focusing-api into lp://qastaging/unity-mir

Proposed by Michael Zanetti
Status: Merged
Approved by: Gerry Boland
Approved revision: 188
Merged at revision: 207
Proposed branch: lp://qastaging/~mzanetti/unity-mir/screenshotting-focusing-api
Merge into: lp://qastaging/unity-mir
Diff against target: 672 lines (+270/-103)
13 files modified
debian/control (+3/-1)
debian/libunity-mir1.install (+1/-1)
src/modules/Unity/Application/ApplicationImage.qml (+0/-44)
src/modules/Unity/Application/CMakeLists.txt (+10/-7)
src/modules/Unity/Application/application.cpp (+28/-0)
src/modules/Unity/Application/application.h (+6/-0)
src/modules/Unity/Application/application_manager.cpp (+110/-1)
src/modules/Unity/Application/application_manager.h (+10/-0)
src/modules/Unity/Application/applicationscreenshotprovider.cpp (+15/-45)
src/modules/Unity/Application/applicationscreenshotprovider.h (+0/-2)
src/modules/Unity/Application/plugin.cpp (+1/-1)
tests/CMakeLists.txt (+2/-1)
tests/application_manager_test.cpp (+84/-0)
To merge this branch: bzr merge lp://qastaging/~mzanetti/unity-mir/screenshotting-focusing-api
Reviewer Review Type Date Requested Status
Michał Sawicz Approve
Gerry Boland (community) Approve
PS Jenkins bot (community) continuous-integration Needs Fixing
Ubuntu Unity PS integration team packaging Pending
Review via email: mp+199811@code.qastaging.launchpad.net

Commit message

Implement API changes for the screenshotting and focusing api

Description of the change

* Are there any related MPs required for this MP to build/function as expected? Please list.

https://code.launchpad.net/~mzanetti/unity-api/new-screenshot-and-focusing-api/+merge/199810
https://code.launchpad.net/~mzanetti/unity8/right-edge-2/+merge/204798

 * 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?

Yes

 * If you changed the UI, has there been a design review?

N/A

To post a comment you must log in.
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
Gerry Boland (gerboland) wrote :

=== removed file 'src/modules/Unity/Application/ApplicationImage.qml'
This will break SurfaceFlinger support. We good with that?

review: Needs Information
Revision history for this message
Michael Zanetti (mzanetti) wrote :

> === removed file 'src/modules/Unity/Application/ApplicationImage.qml'
> This will break SurfaceFlinger support. We good with that?

I asked around about that in January and answer from Kevin was yes. I'll get a confirmation that we're good to merge this now (effectively breaking SF support).

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

+void ApplicationManager::screenshotUpdated()
+ if (!m_nextFocusedAppId.isEmpty()) {
+ Q_EMIT focusRequested(m_nextFocusedAppId);
+ m_nextFocusedAppId.clear();
+ }
I don't follow this. Why emit a focusRequest after screenshot is updated? Is it just the best time to do it?

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

+ engine->addImageProvider(QLatin1String("application"), new ApplicationScreenshotProvider(appManager));

If I see a QUrl like "application://calculator-app" - is that a url for a url dispatcher? Or a url for that app's screenshot? I'm just a tad worried about duplicate purposes of urls of that form. Thought?

180. By Michael Zanetti

update according to latest changes in unity-api

Revision history for this message
Michael Zanetti (mzanetti) wrote :

> > === removed file 'src/modules/Unity/Application/ApplicationImage.qml'
> > This will break SurfaceFlinger support. We good with that?
>
> I asked around about that in January and answer from Kevin was yes. I'll get a
> confirmation that we're good to merge this now (effectively breaking SF
> support).

Confirmed. Good to go.

Revision history for this message
Michael Zanetti (mzanetti) wrote :

> +void ApplicationManager::screenshotUpdated()
> + if (!m_nextFocusedAppId.isEmpty()) {
> + Q_EMIT focusRequested(m_nextFocusedAppId);
> + m_nextFocusedAppId.clear();
> + }
> I don't follow this. Why emit a focusRequest after screenshot is updated? Is
> it just the best time to do it?

In order to make the QML code less complex, when someone calls requestFocusApplication() (formerly activateApplication()), I first update the screenshot, and then emit the requestFocus() signal. So the QML code has everything in place to start animating, instead of having to do the updateScreenshot() stuff from there.

Revision history for this message
Michael Zanetti (mzanetti) wrote :

> + engine->addImageProvider(QLatin1String("application"), new
> ApplicationScreenshotProvider(appManager));
>
> If I see a QUrl like "application://calculator-app" - is that a url for a url
> dispatcher? Or a url for that app's screenshot?

that's a url-dispatcher url :)

the imageprovider's url is

image://application/calculator-app/12345678

> I'm just a tad worried about
> duplicate purposes of urls of that form. Thought?

After clearing the confusion, does it still sound too similar to you?

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

> After clearing the confusion, does it still sound too similar to you?
/me idiot. You're right. Plz ignore

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

> > +void ApplicationManager::screenshotUpdated()
> > + if (!m_nextFocusedAppId.isEmpty()) {
> > + Q_EMIT focusRequested(m_nextFocusedAppId);
> > + m_nextFocusedAppId.clear();
> > + }
> > I don't follow this. Why emit a focusRequest after screenshot is updated? Is
> > it just the best time to do it?
>
> In order to make the QML code less complex, when someone calls
> requestFocusApplication() (formerly activateApplication()), I first update the
> screenshot, and then emit the requestFocus() signal. So the QML code has
> everything in place to start animating, instead of having to do the
> updateScreenshot() stuff from there.

Okay am understanding the why. But this method is strange to read, so it needs at least a comment justifying it. Might a second slot, connected to Application::screenshotChanged make the logic a little more obvious?

Also using "sender()" to get the signal originator always feels dangerous to me, I'm not definite if the pointer returned always exists, does it?

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
181. By Michael Zanetti

improve comments, make sure we don't crash if the app disappears before the screenshotUpdated() signal is delivered

Revision history for this message
Michael Zanetti (mzanetti) wrote :

> Okay am understanding the why. But this method is strange to read, so it needs
> at least a comment justifying it. Might a second slot, connected to
> Application::screenshotChanged make the logic a little more obvious?
>
> Also using "sender()" to get the signal originator always feels dangerous to
> me, I'm not definite if the pointer returned always exists, does it?

I've added some comments describing why this happens here. You are right about the sender() thing. Thinking about it, it could happen that the Application is gone by the time this signal is delivered, given that the signal emission happens in a mir thread and hence the connection a queued one. - I've fixed it to make sure the we don't crash.

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

Ok, that'll do. I just need to test this with your unity8 work, before I can approve

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
182. By Michael Zanetti

merge trunk

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
183. By Michael Zanetti

make it compile again

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
Andreas Pokorny (andreas-pokorny) wrote :

since I managed to break ApplicationManager easily in the past - it would be nice if you could add tests that cover suspend / resume and the changes to focusing..

184. By Michael Zanetti

ouch...

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
185. By Michael Zanetti

add a test that checks if calling applicationManager.setSuspended(true) suspends the running app

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
Michael Zanetti (mzanetti) wrote :

> since I managed to break ApplicationManager easily in the past - it would be
> nice if you could add tests that cover suspend / resume and the changes to
> focusing..

Absolutely. Test for the suspended added.

Btw. I noticed that the QtTests in there are not executed and broken/outdated. I tried to add a test for the requestFocus, but as we're using google test to test a Qt api instead of QtTest here I can't use QSignalSpy to verify it emits focusRequested.

186. By Michael Zanetti

merge trunk

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
Michał Sawicz (saviq) wrote :

Bump?

187. By Michael Zanetti

depend on latest libunity-api-dev package

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
188. By Michael Zanetti

added a test for focusRequested

Revision history for this message
Michael Zanetti (mzanetti) wrote :

turns out, QSignalSpy does work after all. No idea why I failed to get anything into it on my first attempt.

All the comments are fixed now. Good to go?

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

LGTM

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

* Did you perform an exploratory manual test run of the code change and any related functionality?
Yes, works fine
* Did CI run pass? If not, please explain why.
MR depends on this landing first: https://code.launchpad.net/~mzanetti/unity-api/new-screenshot-and-focusing-api

189. By Michael Zanetti

update install dir for unity-application plugin

190. By Michael Zanetti

fix plugin installing

191. By Michael Zanetti

update install path

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

+1 on the plugin installation dirs.

review: Approve
192. By Michael Zanetti

also provide the virtual application-impl

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
The diff is not available at this time. You can reload the page or download it.

Subscribers

People subscribed via source and target branches