Merge lp:~lukas-kde/qtmir/fix-app-request-focus-lp1672337 into lp:qtmir

Proposed by Lukáš Tinkl
Status: Merged
Approved by: Daniel d'Andrada
Approved revision: 624
Merged at revision: 626
Proposed branch: lp:~lukas-kde/qtmir/fix-app-request-focus-lp1672337
Merge into: lp:qtmir
Diff against target: 22 lines (+9/-3)
1 file modified
src/modules/Unity/Application/application.cpp (+9/-3)
To merge this branch: bzr merge lp:~lukas-kde/qtmir/fix-app-request-focus-lp1672337
Reviewer Review Type Date Requested Status
Daniel d'Andrada (community) Approve
Unity8 CI Bot (community) continuous-integration Approve
Review via email: mp+320626@code.launchpad.net

Commit message

Raise (activate) windows when an app focus is requested

Description of the change

Raise (activate) windows when an app focus is requested

Fixes lp:1672337

To post a comment you must log in.
Revision history for this message
Unity8 CI Bot (unity8-ci-bot) wrote :

PASSED: Continuous integration, rev:622
https://unity8-jenkins.ubuntu.com/job/lp-qtmir-ci/631/
Executed test runs:
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build/4687
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-0-fetch/4715
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=xenial+overlay/4538
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=xenial+overlay/4538/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=zesty/4538
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=zesty/4538/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=xenial+overlay/4538
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=xenial+overlay/4538/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=zesty/4538
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=zesty/4538/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=xenial+overlay/4538
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=xenial+overlay/4538/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=zesty/4538
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=zesty/4538/artifact/output/*zip*/output.zip

Click here to trigger a rebuild:
https://unity8-jenkins.ubuntu.com/job/lp-qtmir-ci/631/rebuild

review: Approve (continuous-integration)
Revision history for this message
Daniel d'Andrada (dandrader) wrote :

1- you should call surface->requestFocus(), not surface->active(). Shell is the one who ultimately decides to activate a surface. And that also allows shell to do any needed scene preparation before calling surface->activate()

2- Surface list doesn't contain null surfaces. So there's no reason to check for null.

3- Call the temp surface something more accurate, like surface, instead of "iface"

4 - No need for this code anymore:

"""
auto surface = static_cast<MirSurfaceInterface*>(m_proxySurfaceList->get(0));
surface->requestFocus();
"""

------------------------

Having said that, this looks like something that miral should be doing. When you minimize the top-level, the child should *at least* loose focus. But I don't see that happening in the logs.

review: Needs Fixing
623. By Lukáš Tinkl

address review comments

Revision history for this message
Lukáš Tinkl (lukas-kde) wrote :

> 1- you should call surface->requestFocus(), not surface->active(). Shell is
> the one who ultimately decides to activate a surface. And that also allows
> shell to do any needed scene preparation before calling surface->activate()
>
> 2- Surface list doesn't contain null surfaces. So there's no reason to check
> for null.
>
> 3- Call the temp surface something more accurate, like surface, instead of
> "iface"
>
> 4 - No need for this code anymore:
>
> """
> auto surface = static_cast<MirSurfaceInterface*>(m_proxySurfaceList->get(0));
> surface->requestFocus();
> """

Done

>
> Having said that, this looks like something that miral should be doing. When
> you minimize the top-level, the child should *at least* loose focus. But I
> don't see that happening in the logs.

Yeah, Gerry had an idea of a more future-proof solution (for later), most likely involving miral

Revision history for this message
Unity8 CI Bot (unity8-ci-bot) wrote :

PASSED: Continuous integration, rev:623
https://unity8-jenkins.ubuntu.com/job/lp-qtmir-ci/634/
Executed test runs:
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build/4695
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-0-fetch/4723
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=xenial+overlay/4546
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=xenial+overlay/4546/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=zesty/4546
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=zesty/4546/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=xenial+overlay/4546
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=xenial+overlay/4546/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=zesty/4546
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=zesty/4546/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=xenial+overlay/4546
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=xenial+overlay/4546/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=zesty/4546
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=zesty/4546/artifact/output/*zip*/output.zip

Click here to trigger a rebuild:
https://unity8-jenkins.ubuntu.com/job/lp-qtmir-ci/634/rebuild

review: Approve (continuous-integration)
Revision history for this message
Daniel d'Andrada (dandrader) wrote :

"""
INFO_MSG << "() - Requesting focus for toplevel app surface";
"""

s/toplevel/most recent top-level

"""
// raise the whole tree beneath
"""

Don't think that comment applies.

624. By Lukáš Tinkl

fix comments/debug

Revision history for this message
Lukáš Tinkl (lukas-kde) wrote :

> """
> INFO_MSG << "() - Requesting focus for toplevel app surface";
> """
>
> s/toplevel/most recent top-level
>
>
> """
> // raise the whole tree beneath
> """
>
> Don't think that comment applies.

Done

Revision history for this message
Unity8 CI Bot (unity8-ci-bot) wrote :

FAILED: Continuous integration, rev:624
https://unity8-jenkins.ubuntu.com/job/lp-qtmir-ci/635/
Executed test runs:
    FAILURE: https://unity8-jenkins.ubuntu.com/job/build/4696/console
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-0-fetch/4724
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=xenial+overlay/4547
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=xenial+overlay/4547/artifact/output/*zip*/output.zip
    FAILURE: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=zesty/4547/console
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=xenial+overlay/4547
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=xenial+overlay/4547/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=zesty/4547
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=zesty/4547/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=xenial+overlay/4547
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=xenial+overlay/4547/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=zesty/4547
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=zesty/4547/artifact/output/*zip*/output.zip

Click here to trigger a rebuild:
https://unity8-jenkins.ubuntu.com/job/lp-qtmir-ci/635/rebuild

review: Needs Fixing (continuous-integration)
Revision history for this message
Unity8 CI Bot (unity8-ci-bot) wrote :

PASSED: Continuous integration, rev:624
https://unity8-jenkins.ubuntu.com/job/lp-qtmir-ci/636/
Executed test runs:
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build/4697
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-0-fetch/4725
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=xenial+overlay/4548
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=xenial+overlay/4548/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=zesty/4548
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=zesty/4548/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=xenial+overlay/4548
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=xenial+overlay/4548/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=zesty/4548
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=zesty/4548/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=xenial+overlay/4548
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=xenial+overlay/4548/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=zesty/4548
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=zesty/4548/artifact/output/*zip*/output.zip

Click here to trigger a rebuild:
https://unity8-jenkins.ubuntu.com/job/lp-qtmir-ci/636/rebuild

review: Approve (continuous-integration)
Revision history for this message
Daniel d'Andrada (dandrader) wrote :

Not sure we would need to do that if miral behaved properly in the use case mentioned in the bug but I guess this change won't hurt either.

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.cpp'
2--- src/modules/Unity/Application/application.cpp 2017-02-07 20:59:34 +0000
3+++ src/modules/Unity/Application/application.cpp 2017-03-24 21:21:21 +0000
4@@ -869,9 +869,15 @@
5 void Application::requestFocus()
6 {
7 if (m_proxySurfaceList->rowCount() > 0) {
8- INFO_MSG << "() - Requesting focus for most recent app surface";
9- auto surface = static_cast<MirSurfaceInterface*>(m_proxySurfaceList->get(0));
10- surface->requestFocus();
11+ INFO_MSG << "() - Requesting focus for most recent toplevel app surface";
12+
13+ for (int i = 0; i < m_proxySurfaceList->count(); ++i) {
14+ auto surface = static_cast<MirSurfaceInterface*>(m_proxySurfaceList->get(i));
15+ if (!surface->parentSurface()) {
16+ surface->requestFocus();
17+ break;
18+ }
19+ }
20 } else {
21 INFO_MSG << "() - emitting focusRequested()";
22 Q_EMIT focusRequested();

Subscribers

People subscribed via source and target branches