Mir

Merge lp:~brandontschaefer/mir/update-pointer-confinement-v2 into lp:mir

Proposed by Brandon Schaefer on 2016-07-26
Status: Merged
Approved by: Brandon Schaefer on 2016-08-02
Approved revision: 3620
Merged at revision: 3621
Proposed branch: lp:~brandontschaefer/mir/update-pointer-confinement-v2
Merge into: lp:mir
Diff against target: 1486 lines (+641/-86)
43 files modified
doc/component_reports.md (+1/-0)
include/server/mir/input/seat_report.h (+55/-0)
include/server/mir/scene/null_surface_observer.h (+0/-1)
include/server/mir/scene/surface_observer.h (+0/-1)
include/server/mir/server.h (+7/-0)
include/server/mir/shell/abstract_shell.h (+3/-1)
include/test/mir/test/doubles/mock_seat_report.h (+52/-0)
include/test/mir_test_framework/placement_applying_shell.h (+3/-0)
src/include/platform/mir/options/configuration.h (+1/-0)
src/include/server/mir/default_server_configuration.h (+3/-0)
src/include/server/mir/scene/surface_observers.h (+0/-1)
src/platform/options/default_configuration.cpp (+3/-0)
src/platform/symbols.map (+1/-0)
src/server/input/basic_seat.cpp (+10/-2)
src/server/input/basic_seat.h (+3/-1)
src/server/input/default_configuration.cpp (+2/-1)
src/server/input/seat_input_device_tracker.cpp (+37/-11)
src/server/input/seat_input_device_tracker.h (+9/-2)
src/server/report/default_server_configuration.cpp (+9/-0)
src/server/report/logging/CMakeLists.txt (+1/-0)
src/server/report/logging/logging_report_factory.cpp (+6/-0)
src/server/report/logging/seat_report.cpp (+146/-0)
src/server/report/logging/seat_report.h (+67/-0)
src/server/report/logging_report_factory.h (+1/-0)
src/server/report/lttng/lttng_report_factory.cpp (+5/-0)
src/server/report/lttng_report_factory.h (+1/-0)
src/server/report/null/CMakeLists.txt (+1/-0)
src/server/report/null/null_report_factory.cpp (+11/-0)
src/server/report/null/seat_report.cpp (+58/-0)
src/server/report/null/seat_report.h (+50/-0)
src/server/report/null_report_factory.h (+2/-0)
src/server/report/report_factory.h (+2/-0)
src/server/scene/basic_surface.cpp (+0/-21)
src/server/scene/legacy_surface_change_notification.cpp (+0/-4)
src/server/scene/legacy_surface_change_notification.h (+0/-1)
src/server/scene/null_surface_observer.cpp (+0/-1)
src/server/server.cpp (+1/-0)
src/server/shell/abstract_shell.cpp (+34/-12)
src/server/symbols.map (+1/-1)
tests/acceptance-tests/test_confined_pointer.cpp (+47/-23)
tests/integration-tests/input/test_single_seat_setup.cpp (+3/-1)
tests/mir_test_framework/placement_applying_shell.cpp (+1/-0)
tests/unit-tests/input/test_seat_input_device_tracker.cpp (+4/-1)
To merge this branch: bzr merge lp:~brandontschaefer/mir/update-pointer-confinement-v2
Reviewer Review Type Date Requested Status
Mir CI Bot continuous-integration Approve on 2016-08-02
Alan Griffiths 2016-07-26 Approve on 2016-08-02
Andreas Pokorny (community) Approve on 2016-08-01
Review via email: mp+301231@code.launchpad.net

Commit message

Use a different way to tell the abstract shell to update its seat.

Fixes a race in the test. We update the confinement on a resized_to or a move_to in the surface observer. The order is not guaranteed or rather most cases we are getting the callback in the test that we resized before the abstract shell. Leading to a race.

To fix this, we have implemented a seat report that will report when events are done. Now we can mock this and check we got this report. This will be good for normal logging. I will finish up the rest of the events for the seat report after this branch.

Description of the change

Use a different way to tell the abstract shell to update its seat.

Fixes a race in the test. We update the confinement on a resized_to or a move_to in the surface observer. The order is not guaranteed or rather most cases we are getting the callback in the test that we resized before the abstract shell. Leading to a race.

To fix this, we have implemented a seat report that will report when events are done. Now we can mock this and check we got this report. This will be good for normal logging. I will finish up the rest of the events for the seat report after this branch.

To post a comment you must log in.
Mir CI Bot (mir-ci-bot) wrote :

PASSED: Continuous integration, rev:3613
https://mir-jenkins.ubuntu.com/job/mir-ci/1351/
Executed test runs:
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-mir/1609
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-0-fetch/1662
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-1-sourcepkg/release=vivid+overlay/1653
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-1-sourcepkg/release=xenial+overlay/1653
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-1-sourcepkg/release=yakkety/1653
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=clang,platform=mesa,release=vivid+overlay/1624
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=clang,platform=mesa,release=vivid+overlay/1624/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=xenial+overlay/1624
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=xenial+overlay/1624/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=cross-armhf,compiler=gcc,platform=android,release=vivid+overlay/1624
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=cross-armhf,compiler=gcc,platform=android,release=vivid+overlay/1624/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=i386,compiler=gcc,platform=android,release=vivid+overlay/1624
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=i386,compiler=gcc,platform=android,release=vivid+overlay/1624/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=i386,compiler=gcc,platform=mesa,release=xenial+overlay/1624
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=i386,compiler=gcc,platform=mesa,release=xenial+overlay/1624/artifact/output/*zip*/output.zip

Click here to trigger a rebuild:
https://mir-jenkins.ubuntu.com/job/mir-ci/1351/rebuild

review: Approve (continuous-integration)
Alan Griffiths (alan-griffiths) wrote :

+ // We get that a resized_to happened, but we've to wait a little bit for the seat to be updated from the
+ // observer it self. The order of the observers are not guaranteed
+ std::this_thread::sleep_for(1s);

We should use a Signal to avoid waiting longer than necessary. C.f. resized_signaled

review: Needs Fixing
Alan Griffiths (alan-griffiths) wrote :

> We should use a Signal to avoid waiting longer than necessary. C.f.
> resized_signaled

Oh. I misunderstood the problem. I still think there's a better way...

[goes to think]

Alan Griffiths (alan-griffiths) wrote :

OK, in the client API we are calling Client::handle_surface_event() so we can use that to signal that the resize has been seen by the client.

Moving the cursor only after this ought to give a strong enough ordering for the test to be stable.

review: Needs Fixing
Alan Griffiths (alan-griffiths) wrote :

Another thought: rather that repeatedly creating observers, just add a method to the shell and call that from the observer. The shell ought to know the current surface.

Brandon Schaefer (brandontschaefer) wrote :

+1 Not sure why i didnt think of that... quite a bit simpler...

3614. By Brandon Schaefer on 2016-07-28

* Add a SeatReport, which we can use to test we have set a confined region.
* Fix a multi threaded race... needed a mutex!

3615. By Brandon Schaefer on 2016-07-28

* Lets drop the std::function memeber var and just store the region

Mir CI Bot (mir-ci-bot) wrote :

PASSED: Continuous integration, rev:3614
https://mir-jenkins.ubuntu.com/job/mir-ci/1369/
Executed test runs:
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-mir/1642
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-0-fetch/1695
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-1-sourcepkg/release=vivid+overlay/1686
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-1-sourcepkg/release=xenial+overlay/1686
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-1-sourcepkg/release=yakkety/1686
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=clang,platform=mesa,release=vivid+overlay/1657
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=clang,platform=mesa,release=vivid+overlay/1657/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=xenial+overlay/1657
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=xenial+overlay/1657/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=cross-armhf,compiler=gcc,platform=android,release=vivid+overlay/1657
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=cross-armhf,compiler=gcc,platform=android,release=vivid+overlay/1657/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=i386,compiler=gcc,platform=android,release=vivid+overlay/1657
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=i386,compiler=gcc,platform=android,release=vivid+overlay/1657/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=i386,compiler=gcc,platform=mesa,release=xenial+overlay/1657
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=i386,compiler=gcc,platform=mesa,release=xenial+overlay/1657/artifact/output/*zip*/output.zip

Click here to trigger a rebuild:
https://mir-jenkins.ubuntu.com/job/mir-ci/1369/rebuild

review: Approve (continuous-integration)
Mir CI Bot (mir-ci-bot) wrote :

PASSED: Continuous integration, rev:3615
https://mir-jenkins.ubuntu.com/job/mir-ci/1370/
Executed test runs:
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-mir/1643
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-0-fetch/1696
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-1-sourcepkg/release=vivid+overlay/1687
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-1-sourcepkg/release=xenial+overlay/1687
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-1-sourcepkg/release=yakkety/1687
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=clang,platform=mesa,release=vivid+overlay/1658
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=clang,platform=mesa,release=vivid+overlay/1658/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=xenial+overlay/1658
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=xenial+overlay/1658/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=cross-armhf,compiler=gcc,platform=android,release=vivid+overlay/1658
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=cross-armhf,compiler=gcc,platform=android,release=vivid+overlay/1658/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=i386,compiler=gcc,platform=android,release=vivid+overlay/1658
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=i386,compiler=gcc,platform=android,release=vivid+overlay/1658/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=i386,compiler=gcc,platform=mesa,release=xenial+overlay/1658
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=i386,compiler=gcc,platform=mesa,release=xenial+overlay/1658/artifact/output/*zip*/output.zip

Click here to trigger a rebuild:
https://mir-jenkins.ubuntu.com/job/mir-ci/1370/rebuild

review: Approve (continuous-integration)
Alan Griffiths (alan-griffiths) wrote :

I do like the idea of a seat report as these events can be helpful in understanding system behaviour but:

1. I think it ought to report all the seat "events", not just confinement region.
2. I think the default should be a NullObject
3. Logging output ought to be a command-line option (as with other reports)
4. I don't know if the events are worth including in LTTNG

review: Needs Fixing
Brandon Schaefer (brandontschaefer) wrote :

1) I agree, I was planning on adding them after this branch (its gotten larger)
2 & 3) I think thats what this does:
+ return report_factory(options::input_report_opt)->create_seat_report();
Which turns out to be a bug and i need to make my own :)
4) Sounds reasonable... Will look at removing that.

3616. By Brandon Schaefer on 2016-07-29

* Actually add an option to turn on/off seat logging
* Remove lttng logging

3617. By Brandon Schaefer on 2016-07-29

* Algin

3618. By Brandon Schaefer on 2016-07-29

* Fix compiling error

Mir CI Bot (mir-ci-bot) wrote :

PASSED: Continuous integration, rev:3618
https://mir-jenkins.ubuntu.com/job/mir-ci/1375/
Executed test runs:
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-mir/1654
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-0-fetch/1707
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-1-sourcepkg/release=vivid+overlay/1698
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-1-sourcepkg/release=xenial+overlay/1698
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-1-sourcepkg/release=yakkety/1698
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=clang,platform=mesa,release=vivid+overlay/1669
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=clang,platform=mesa,release=vivid+overlay/1669/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=xenial+overlay/1669
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=xenial+overlay/1669/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=cross-armhf,compiler=gcc,platform=android,release=vivid+overlay/1669
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=cross-armhf,compiler=gcc,platform=android,release=vivid+overlay/1669/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=i386,compiler=gcc,platform=android,release=vivid+overlay/1669
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=i386,compiler=gcc,platform=android,release=vivid+overlay/1669/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=i386,compiler=gcc,platform=mesa,release=xenial+overlay/1669
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=i386,compiler=gcc,platform=mesa,release=xenial+overlay/1669/artifact/output/*zip*/output.zip

Click here to trigger a rebuild:
https://mir-jenkins.ubuntu.com/job/mir-ci/1375/rebuild

review: Approve (continuous-integration)
Andreas Pokorny (andreas-pokorny) wrote :

Yes I would also like to see the reports for the other events.
There is also a doc/component_reports.md that needs updating.

looks good otherwise.

review: Needs Fixing
3619. By Brandon Schaefer on 2016-07-30

* Add more events for the seat report.
  Need to update the dispatch report

Mir CI Bot (mir-ci-bot) wrote :

FAILED: Continuous integration, rev:3619
https://mir-jenkins.ubuntu.com/job/mir-ci/1376/
Executed test runs:
    FAILURE: https://mir-jenkins.ubuntu.com/job/build-mir/1655/console
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-0-fetch/1708
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-1-sourcepkg/release=vivid+overlay/1699
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-1-sourcepkg/release=xenial+overlay/1699
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-1-sourcepkg/release=yakkety/1699
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=clang,platform=mesa,release=vivid+overlay/1670
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=clang,platform=mesa,release=vivid+overlay/1670/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=xenial+overlay/1670
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=xenial+overlay/1670/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=cross-armhf,compiler=gcc,platform=android,release=vivid+overlay/1670
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=cross-armhf,compiler=gcc,platform=android,release=vivid+overlay/1670/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=i386,compiler=gcc,platform=android,release=vivid+overlay/1670
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=i386,compiler=gcc,platform=android,release=vivid+overlay/1670/artifact/output/*zip*/output.zip
    FAILURE: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=i386,compiler=gcc,platform=mesa,release=xenial+overlay/1670/console

Click here to trigger a rebuild:
https://mir-jenkins.ubuntu.com/job/mir-ci/1376/rebuild

review: Needs Fixing (continuous-integration)
Andreas Pokorny (andreas-pokorny) wrote :

Not sure whether the request for a serialized device state is a relevant event to report..

but otherwise looks good to me.

review: Approve
Alan Griffiths (alan-griffiths) wrote :

+std::string rectangle_to_string(geom::Rectangle const& rect)
+{
+ std::stringstream ss;
+ ss << "{"
+ << rect.top_left.x.as_int() << ", "
+ << rect.top_left.y.as_int() << ", "
+ << rect.size.width.as_int() << ", "
+ << rect.size.height.as_int()
+ << "}";
+
+ return ss.str();
+}
...
+ << " out_rect=" << rectangle_to_string(out_rect);

We have std::ostream& operator<<(std::ostream& out, Rectangle const& value); in /usr/include/mircommon/mir/geometry/rectangle.h. So all the above could be:

  << " out_rect=" << out_rect;

review: Needs Fixing
Alan Griffiths (alan-griffiths) wrote :

> 1) I agree, I was planning on adding them after this branch (its gotten
> larger)

The way I deal with this kind of design issue is to split out the report as a prerequisite MP.

3620. By Brandon Schaefer on 2016-08-01

* Use rect ostream overload.
* Remove unneed report function

Mir CI Bot (mir-ci-bot) wrote :

FAILED: Continuous integration, rev:3620
https://mir-jenkins.ubuntu.com/job/mir-ci/1384/
Executed test runs:
    FAILURE: https://mir-jenkins.ubuntu.com/job/build-mir/1665/console
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-0-fetch/1718
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-1-sourcepkg/release=vivid+overlay/1709
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-1-sourcepkg/release=xenial+overlay/1709
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-1-sourcepkg/release=yakkety/1709
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=clang,platform=mesa,release=vivid+overlay/1680
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=clang,platform=mesa,release=vivid+overlay/1680/artifact/output/*zip*/output.zip
    FAILURE: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=xenial+overlay/1680/console
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=cross-armhf,compiler=gcc,platform=android,release=vivid+overlay/1680
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=cross-armhf,compiler=gcc,platform=android,release=vivid+overlay/1680/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=i386,compiler=gcc,platform=android,release=vivid+overlay/1680
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=i386,compiler=gcc,platform=android,release=vivid+overlay/1680/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=i386,compiler=gcc,platform=mesa,release=xenial+overlay/1680
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=i386,compiler=gcc,platform=mesa,release=xenial+overlay/1680/artifact/output/*zip*/output.zip

Click here to trigger a rebuild:
https://mir-jenkins.ubuntu.com/job/mir-ci/1384/rebuild

review: Needs Fixing (continuous-integration)
Alan Griffiths (alan-griffiths) wrote :

OK

review: Approve
Mir CI Bot (mir-ci-bot) wrote :

PASSED: Continuous integration, rev:3620
https://mir-jenkins.ubuntu.com/job/mir-ci/1388/
Executed test runs:
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-mir/1670
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-0-fetch/1723
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-1-sourcepkg/release=vivid+overlay/1714
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-1-sourcepkg/release=xenial+overlay/1714
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-1-sourcepkg/release=yakkety/1714
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=clang,platform=mesa,release=vivid+overlay/1686
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=clang,platform=mesa,release=vivid+overlay/1686/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=xenial+overlay/1686
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=xenial+overlay/1686/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=yakkety/1686
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=yakkety/1686/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=cross-armhf,compiler=gcc,platform=android,release=vivid+overlay/1686
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=cross-armhf,compiler=gcc,platform=android,release=vivid+overlay/1686/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=i386,compiler=gcc,platform=android,release=vivid+overlay/1686
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=i386,compiler=gcc,platform=android,release=vivid+overlay/1686/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=i386,compiler=gcc,platform=mesa,release=xenial+overlay/1686
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=i386,compiler=gcc,platform=mesa,release=xenial+overlay/1686/artifact/output/*zip*/output.zip

Click here to trigger a rebuild:
https://mir-jenkins.ubuntu.com/job/mir-ci/1388/rebuild

review: Approve (continuous-integration)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'doc/component_reports.md'
2--- doc/component_reports.md 2015-04-28 07:54:10 +0000
3+++ doc/component_reports.md 2016-08-01 21:28:24 +0000
4@@ -23,6 +23,7 @@
5 display-report | log,lttng
6 input-report | log,lttng
7 legacy-input-report | log
8+seat-report | log
9 msg-processor-report | log,lttng
10 session-mediator-report | log,lttng
11 scene-report | log,lttng
12
13=== added file 'include/server/mir/input/seat_report.h'
14--- include/server/mir/input/seat_report.h 1970-01-01 00:00:00 +0000
15+++ include/server/mir/input/seat_report.h 2016-08-01 21:28:24 +0000
16@@ -0,0 +1,55 @@
17+/*
18+ * Copyright © 2016 Canonical Ltd.
19+ *
20+ * This program is free software: you can redistribute it and/or modify it
21+ * under the terms of the GNU General Public License version 3,
22+ * as published by the Free Software Foundation.
23+ *
24+ * This program is distributed in the hope that it will be useful,
25+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
26+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
27+ * GNU General Public License for more details.
28+ *
29+ * You should have received a copy of the GNU General Public License
30+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
31+ *
32+ * Authored by: Brandon Schaefer <brandon.schaefer@canonical.com>
33+ */
34+
35+
36+#ifndef MIR_INPUT_SEAT_REPORT_H_
37+#define MIR_INPUT_SEAT_REPORT_H_
38+
39+#include <string>
40+#include <vector>
41+
42+class MirEvent;
43+
44+namespace mir
45+{
46+namespace geometry
47+{
48+class Rectangles;
49+class Rectangle;
50+}
51+namespace input
52+{
53+class SeatReport
54+{
55+public:
56+ virtual ~SeatReport() = default;
57+
58+ virtual void seat_add_device(uint64_t id) = 0;
59+ virtual void seat_remove_device(uint64_t id) = 0;
60+ virtual void seat_dispatch_event(MirEvent const& event) = 0;
61+ virtual void seat_get_rectangle_for(uint64_t id, geometry::Rectangle const& out_rect) = 0;
62+ virtual void seat_set_key_state(uint64_t id, std::vector<uint32_t> const& scan_codes) = 0;
63+ virtual void seat_set_pointer_state(uint64_t id, unsigned buttons) = 0;
64+ virtual void seat_set_cursor_position(float cursor_x, float cursor_y) = 0;
65+ virtual void seat_set_confinement_region_called(geometry::Rectangles const& regions) = 0;
66+ virtual void seat_reset_confinement_regions() = 0;
67+};
68+}
69+}
70+
71+#endif /* MIR_INPUT_SEAT_REPORT_H_ */
72
73=== modified file 'include/server/mir/scene/null_surface_observer.h'
74--- include/server/mir/scene/null_surface_observer.h 2016-07-26 03:56:14 +0000
75+++ include/server/mir/scene/null_surface_observer.h 2016-08-01 21:28:24 +0000
76@@ -45,7 +45,6 @@
77 void keymap_changed(MirInputDeviceId id, std::string const& model, std::string const& layout, std::string const& variant, std::string const& options) override;
78 void renamed(char const* name) override;
79 void cursor_image_removed() override;
80- void confinement_region_updated(geometry::Rectangle const& rect) override;
81
82 protected:
83 NullSurfaceObserver(NullSurfaceObserver const&) = delete;
84
85=== modified file 'include/server/mir/scene/surface_observer.h'
86--- include/server/mir/scene/surface_observer.h 2016-07-26 03:56:14 +0000
87+++ include/server/mir/scene/surface_observer.h 2016-08-01 21:28:24 +0000
88@@ -60,7 +60,6 @@
89 std::string const& variant, std::string const& options) = 0;
90 virtual void renamed(char const* name) = 0;
91 virtual void cursor_image_removed() = 0;
92- virtual void confinement_region_updated(geometry::Rectangle const& rect) = 0;
93
94 protected:
95 SurfaceObserver() = default;
96
97=== modified file 'include/server/mir/server.h'
98--- include/server/mir/server.h 2016-07-20 04:54:07 +0000
99+++ include/server/mir/server.h 2016-08-01 21:28:24 +0000
100@@ -61,6 +61,10 @@
101 class SurfaceFactory;
102 class CoordinateTranslator;
103 }
104+namespace input
105+{
106+class SeatReport;
107+}
108
109 class Fd;
110 class MainLoop;
111@@ -283,6 +287,9 @@
112 /// Sets an override functor for creating the session mediator report.
113 void override_the_session_mediator_report(Builder<frontend::SessionMediatorReport> const& session_mediator_builder);
114
115+ /// Sets an override functor for creating the seat report.
116+ void override_the_seat_report(Builder<input::SeatReport> const& seat_report_builder);
117+
118 /// Sets an override functor for creating the shell.
119 void override_the_shell(Builder<shell::Shell> const& wrapper);
120
121
122=== modified file 'include/server/mir/shell/abstract_shell.h'
123--- include/server/mir/shell/abstract_shell.h 2016-07-26 03:56:14 +0000
124+++ include/server/mir/shell/abstract_shell.h 2016-08-01 21:28:24 +0000
125@@ -122,6 +122,8 @@
126
127 bool handle(MirEvent const& event) override;
128
129+ void update_focused_surface_confined_region();
130+
131 protected:
132 std::shared_ptr<InputTargeter> const input_targeter;
133 std::shared_ptr<SurfaceStack> const surface_stack;
134@@ -136,7 +138,7 @@
135 std::mutex mutable focus_mutex;
136 std::weak_ptr<scene::Surface> focus_surface;
137 std::weak_ptr<scene::Session> focus_session;
138- std::shared_ptr<scene::SurfaceObserver> const focus_surface_observer;
139+ std::shared_ptr<scene::SurfaceObserver> focus_surface_observer;
140
141 void set_focus_to_locked(
142 std::unique_lock<std::mutex> const& lock,
143
144=== added file 'include/test/mir/test/doubles/mock_seat_report.h'
145--- include/test/mir/test/doubles/mock_seat_report.h 1970-01-01 00:00:00 +0000
146+++ include/test/mir/test/doubles/mock_seat_report.h 2016-08-01 21:28:24 +0000
147@@ -0,0 +1,52 @@
148+/*
149+ * Copyright © 2016 Canonical Ltd.
150+ *
151+ * This program is free software: you can redistribute it and/or modify
152+ * it under the terms of the GNU General Public License version 3 as
153+ * published by the Free Software Foundation.
154+ *
155+ * This program is distributed in the hope that it will be useful,
156+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
157+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
158+ * GNU General Public License for more details.
159+ *
160+ * You should have received a copy of the GNU General Public License
161+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
162+ *
163+ * Authored by: Brandon Schaefer <brandon.schaefer@canonical.com>
164+ */
165+
166+#ifndef MIR_TEST_DOUBLES_MOCK_SEAT_REPORT_H_
167+#define MIR_TEST_DOUBLES_MOCK_SEAT_REPORT_H_
168+
169+#include "mir/input/seat_report.h"
170+#include <gmock/gmock.h>
171+
172+class MirEvent;
173+
174+namespace mir
175+{
176+namespace test
177+{
178+namespace doubles
179+{
180+
181+class MockSeatReport : public input::SeatReport
182+{
183+public:
184+ MOCK_METHOD1(seat_add_device, void(uint64_t /*id*/));
185+ MOCK_METHOD1(seat_remove_device, void(uint64_t /*id*/));
186+ MOCK_METHOD1(seat_dispatch_event, void(MirEvent const& /*event*/));
187+ MOCK_METHOD2(seat_get_rectangle_for, void(uint64_t /*id*/, geometry::Rectangle const& /*out_rect*/));
188+ MOCK_METHOD2(seat_set_key_state, void(uint64_t /*id*/, std::vector<uint32_t> const& /*scan_codes*/));
189+ MOCK_METHOD2(seat_set_pointer_state, void(uint64_t /*id*/, unsigned /*buttons*/));
190+ MOCK_METHOD2(seat_set_cursor_position, void(float /*cursor_x*/, float /*cursor_y*/));
191+ MOCK_METHOD1(seat_set_confinement_region_called, void(geometry::Rectangles const& /*regions*/));
192+ MOCK_METHOD0(seat_reset_confinement_regions, void());
193+};
194+
195+}
196+}
197+}
198+
199+#endif /* MIR_TEST_DOUBLES_MOCK_SEAT_REPORT_H_ */
200
201=== modified file 'include/test/mir_test_framework/placement_applying_shell.h'
202--- include/test/mir_test_framework/placement_applying_shell.h 2016-05-03 06:55:25 +0000
203+++ include/test/mir_test_framework/placement_applying_shell.h 2016-08-01 21:28:24 +0000
204@@ -56,6 +56,9 @@
205 mir::shell::SurfaceSpecification const& modifications) override;
206
207 bool wait_for_modify_surface(std::chrono::seconds timeout);
208+
209+ std::weak_ptr <mir::scene::Surface> latest_surface;
210+
211 private:
212 ClientInputRegions const& client_input_regions;
213 ClientPositions const& client_positions;
214
215=== modified file 'src/include/platform/mir/options/configuration.h'
216--- src/include/platform/mir/options/configuration.h 2016-07-07 11:14:26 +0000
217+++ src/include/platform/mir/options/configuration.h 2016-08-01 21:28:24 +0000
218@@ -42,6 +42,7 @@
219 extern char const* const connector_report_opt;
220 extern char const* const scene_report_opt;
221 extern char const* const input_report_opt;
222+extern char const* const seat_report_opt;
223 extern char const* const host_socket_opt;
224 extern char const* const frontend_threads_opt;
225 extern char const* const touchspots_opt;
226
227=== modified file 'src/include/server/mir/default_server_configuration.h'
228--- src/include/server/mir/default_server_configuration.h 2016-07-20 04:54:07 +0000
229+++ src/include/server/mir/default_server_configuration.h 2016-08-01 21:28:24 +0000
230@@ -122,6 +122,7 @@
231 namespace input
232 {
233 class InputReport;
234+class SeatReport;
235 class Scene;
236 class InputManager;
237 class SurfaceInputDispatcher;
238@@ -302,6 +303,7 @@
239 /** @name input configuration
240 * @{ */
241 virtual std::shared_ptr<input::InputReport> the_input_report();
242+ virtual std::shared_ptr<input::SeatReport> the_seat_report();
243 virtual std::shared_ptr<input::CompositeEventFilter> the_composite_event_filter();
244
245 virtual std::shared_ptr<input::EventFilterChainDispatcher> the_event_filter_chain_dispatcher();
246@@ -366,6 +368,7 @@
247 CachedPtr<frontend::Connector> prompt_connector;
248
249 CachedPtr<input::InputReport> input_report;
250+ CachedPtr<input::SeatReport> seat_report;
251 CachedPtr<input::EventFilterChainDispatcher> event_filter_chain_dispatcher;
252 CachedPtr<input::CompositeEventFilter> composite_event_filter;
253 CachedPtr<input::InputManager> input_manager;
254
255=== modified file 'src/include/server/mir/scene/surface_observers.h'
256--- src/include/server/mir/scene/surface_observers.h 2016-07-26 03:56:14 +0000
257+++ src/include/server/mir/scene/surface_observers.h 2016-08-01 21:28:24 +0000
258@@ -49,7 +49,6 @@
259 std::string const& variant, std::string const& options) override;
260 void renamed(char const*) override;
261 void cursor_image_removed() override;
262- void confinement_region_updated(geometry::Rectangle const& rect) override;
263 };
264
265 }
266
267=== modified file 'src/platform/options/default_configuration.cpp'
268--- src/platform/options/default_configuration.cpp 2016-07-07 11:14:26 +0000
269+++ src/platform/options/default_configuration.cpp 2016-08-01 21:28:24 +0000
270@@ -40,6 +40,7 @@
271 char const* const mo::connector_report_opt = "connector-report";
272 char const* const mo::scene_report_opt = "scene-report";
273 char const* const mo::input_report_opt = "input-report";
274+char const* const mo::seat_report_opt = "seat-report";
275 char const* const mo::shared_library_prober_report_opt = "shared-library-prober-report";
276 char const* const mo::shell_report_opt = "shell-report";
277 char const* const mo::host_socket_opt = "host-socket";
278@@ -161,6 +162,8 @@
279 "How to handle to Input report. [{log,lttng,off}]")
280 (legacy_input_report_opt, po::value<std::string>()->default_value(off_opt_value),
281 "How to handle the Legacy Input report. [{log,off}]")
282+ (seat_report_opt, po::value<std::string>()->default_value(off_opt_value),
283+ "How to handle to Seat report. [{log,off}]")
284 (session_mediator_report_opt, po::value<std::string>()->default_value(off_opt_value),
285 "How to handle the SessionMediator report. [{log,lttng,off}]")
286 (msg_processor_report_opt, po::value<std::string>()->default_value(off_opt_value),
287
288=== modified file 'src/platform/symbols.map'
289--- src/platform/symbols.map 2016-08-01 09:37:45 +0000
290+++ src/platform/symbols.map 2016-08-01 21:28:24 +0000
291@@ -124,6 +124,7 @@
292 mir::options::host_socket_opt*;
293 mir::options::input_report_opt*;
294 mir::options::legacy_input_report_opt*;
295+ mir::options::seat_report_opt*;
296 mir::options::log_opt_value*;
297 mir::options::lttng_opt_value*;
298 mir::options::msg_processor_report_opt*;
299
300=== modified file 'src/server/input/basic_seat.cpp'
301--- src/server/input/basic_seat.cpp 2016-07-01 20:32:34 +0000
302+++ src/server/input/basic_seat.cpp 2016-08-01 21:28:24 +0000
303@@ -31,8 +31,16 @@
304 std::shared_ptr<mi::CursorListener> const& cursor_listener,
305 std::shared_ptr<mi::InputRegion> const& input_region,
306 std::shared_ptr<mi::KeyMapper> const& key_mapper,
307- std::shared_ptr<time::Clock> const& clock)
308- : input_state_tracker{dispatcher, touch_visualizer, cursor_listener, input_region, key_mapper, clock}, input_region{input_region}
309+ std::shared_ptr<time::Clock> const& clock,
310+ std::shared_ptr<mi::SeatReport> const& report) :
311+ input_state_tracker{dispatcher,
312+ touch_visualizer,
313+ cursor_listener,
314+ input_region,
315+ key_mapper,
316+ clock,
317+ report},
318+ input_region{input_region}
319 {
320 }
321
322
323=== modified file 'src/server/input/basic_seat.h'
324--- src/server/input/basic_seat.h 2016-07-01 20:32:34 +0000
325+++ src/server/input/basic_seat.h 2016-08-01 21:28:24 +0000
326@@ -39,6 +39,7 @@
327 class InputRegion;
328 class InputDispatcher;
329 class KeyMapper;
330+class SeatReport;
331
332 class BasicSeat : public Seat
333 {
334@@ -48,7 +49,8 @@
335 std::shared_ptr<CursorListener> const& cursor_listener,
336 std::shared_ptr<InputRegion> const& input_region,
337 std::shared_ptr<KeyMapper> const& key_mapper,
338- std::shared_ptr<time::Clock> const& clock);
339+ std::shared_ptr<time::Clock> const& clock,
340+ std::shared_ptr<SeatReport> const& report);
341 // Seat methods:
342 void add_device(Device const& device) override;
343 void remove_device(Device const& device) override;
344
345=== modified file 'src/server/input/default_configuration.cpp'
346--- src/server/input/default_configuration.cpp 2016-06-03 08:39:59 +0000
347+++ src/server/input/default_configuration.cpp 2016-08-01 21:28:24 +0000
348@@ -333,7 +333,8 @@
349 the_cursor_listener(),
350 the_input_region(),
351 the_key_mapper(),
352- the_clock());
353+ the_clock(),
354+ the_seat_report());
355 });
356 }
357
358
359=== modified file 'src/server/input/seat_input_device_tracker.cpp'
360--- src/server/input/seat_input_device_tracker.cpp 2016-07-01 20:32:34 +0000
361+++ src/server/input/seat_input_device_tracker.cpp 2016-08-01 21:28:24 +0000
362@@ -23,6 +23,7 @@
363 #include "mir/input/input_region.h"
364 #include "mir/input/input_dispatcher.h"
365 #include "mir/input/key_mapper.h"
366+#include "mir/input/seat_report.h"
367 #include "mir/geometry/displacement.h"
368 #include "mir/events/event_builders.h"
369 #include "mir/events/event_private.h"
370@@ -46,16 +47,17 @@
371 std::shared_ptr<CursorListener> const& cursor_listener,
372 std::shared_ptr<InputRegion> const& input_region,
373 std::shared_ptr<KeyMapper> const& key_mapper,
374- std::shared_ptr<time::Clock> const& clock)
375+ std::shared_ptr<time::Clock> const& clock,
376+ std::shared_ptr<SeatReport> const& report)
377 : dispatcher{dispatcher}, touch_visualizer{touch_visualizer}, cursor_listener{cursor_listener},
378- input_region{input_region}, key_mapper{key_mapper}, clock{clock}, buttons{0},
379- confine_function{[input_region](mir::geometry::Point& pos) { input_region->confine(pos); }}
380+ input_region{input_region}, key_mapper{key_mapper}, clock{clock}, report{report}, buttons{0}
381 {
382 }
383
384 void mi::SeatInputDeviceTracker::add_device(MirInputDeviceId id)
385 {
386 device_data[id];
387+ report->seat_add_device(id);
388 }
389
390 void mi::SeatInputDeviceTracker::remove_device(MirInputDeviceId id)
391@@ -75,6 +77,8 @@
392 update_states();
393 if (spot_update_needed)
394 update_spots();
395+
396+ report->seat_remove_device(id);
397 }
398
399 void mi::SeatInputDeviceTracker::dispatch(MirEvent &event)
400@@ -99,6 +103,7 @@
401 }
402
403 dispatcher->dispatch(event);
404+ report->seat_dispatch_event(event);
405 }
406
407 bool mi::SeatInputDeviceTracker::filter_input_event(MirInputEvent const* event)
408@@ -201,16 +206,23 @@
409
410 void mi::SeatInputDeviceTracker::set_confinement_regions(geometry::Rectangles const& regions)
411 {
412- confine_function = [regions, this](mir::geometry::Point& pos)
413- {
414- input_region->confine(pos);
415- regions.confine(pos);
416- };
417+ std::lock_guard<std::mutex> lg(region_mutex);
418+ confined_region = regions;
419+ report->seat_set_confinement_region_called(regions);
420 }
421
422 void mi::SeatInputDeviceTracker::reset_confinement_regions()
423 {
424- confine_function = [this](mir::geometry::Point& pos) { input_region->confine(pos); };
425+ std::lock_guard<std::mutex> lg(region_mutex);
426+ confined_region.clear();
427+ report->seat_reset_confinement_regions();
428+}
429+
430+void mi::SeatInputDeviceTracker::confine_function(mir::geometry::Point& p) const
431+{
432+ std::lock_guard<std::mutex> lg(region_mutex);
433+ input_region->confine(p);
434+ confined_region.confine(p);
435 }
436
437 void mi::SeatInputDeviceTracker::confine_pointer()
438@@ -238,8 +250,16 @@
439 devices.reserve(device_data.size());
440 for (auto const& item : device_data)
441 devices.push_back({item.first, item.second.scan_codes, item.second.buttons});
442- return mev::make_event(
443- clock->now().time_since_epoch(), buttons, key_mapper->modifiers(), cursor_x, cursor_y, std::move(devices));
444+
445+ auto out_ev = mev::make_event(
446+ clock->now().time_since_epoch(),
447+ buttons,
448+ key_mapper->modifiers(),
449+ cursor_x,
450+ cursor_y,
451+ std::move(devices));
452+
453+ return out_ev;
454 }
455
456 void mi::SeatInputDeviceTracker::DeviceData::update_scan_codes(MirKeyboardEvent const* event)
457@@ -260,6 +280,8 @@
458
459 if (device != end(device_data))
460 device->second.scan_codes = scan_codes;
461+
462+ report->seat_set_key_state(id, scan_codes);
463 }
464
465 void mi::SeatInputDeviceTracker::set_pointer_state(MirInputDeviceId id, MirPointerButtons buttons)
466@@ -268,12 +290,16 @@
467
468 if (device != end(device_data))
469 device->second.update_button_state(buttons);
470+
471+ report->seat_set_pointer_state(id, buttons);
472 }
473
474 void mi::SeatInputDeviceTracker::set_cursor_position(float x, float y)
475 {
476 cursor_x = x;
477 cursor_y = y;
478+
479+ report->seat_set_cursor_position(x, y);
480 }
481
482 bool mi::SeatInputDeviceTracker::DeviceData::allowed_scan_code_action(MirKeyboardEvent const* event) const
483
484=== modified file 'src/server/input/seat_input_device_tracker.h'
485--- src/server/input/seat_input_device_tracker.h 2016-07-01 20:32:34 +0000
486+++ src/server/input/seat_input_device_tracker.h 2016-08-01 21:28:24 +0000
487@@ -26,6 +26,7 @@
488 #include "mir_toolkit/event.h"
489 #include <unordered_map>
490 #include <memory>
491+#include <mutex>
492
493 namespace mir
494 {
495@@ -40,6 +41,7 @@
496 class InputRegion;
497 class InputDispatcher;
498 class KeyMapper;
499+class SeatReport;
500
501 /*
502 * The SeatInputDeviceTracker bundles the input device properties of a group of devices defined by a seat:
503@@ -56,7 +58,8 @@
504 std::shared_ptr<CursorListener> const& cursor_listener,
505 std::shared_ptr<InputRegion> const& input_region,
506 std::shared_ptr<KeyMapper> const& key_mapper,
507- std::shared_ptr<time::Clock> const& clock);
508+ std::shared_ptr<time::Clock> const& clock,
509+ std::shared_ptr<SeatReport> const& report);
510 void add_device(MirInputDeviceId);
511 void remove_device(MirInputDeviceId);
512
513@@ -77,6 +80,7 @@
514 void update_spots();
515 void update_states();
516 bool filter_input_event(MirInputEvent const* event);
517+ void confine_function(mir::geometry::Point& p) const;
518 void confine_pointer();
519
520 std::shared_ptr<InputDispatcher> const dispatcher;
521@@ -85,6 +89,7 @@
522 std::shared_ptr<InputRegion> const input_region;
523 std::shared_ptr<KeyMapper> const key_mapper;
524 std::shared_ptr<time::Clock> const clock;
525+ std::shared_ptr<SeatReport> const report;
526
527 struct DeviceData
528 {
529@@ -106,7 +111,9 @@
530 MirPointerButtons buttons;
531 std::unordered_map<MirInputDeviceId, DeviceData> device_data;
532 std::vector<TouchVisualizer::Spot> spots;
533- std::function<void(mir::geometry::Point&)> confine_function;
534+ mir::geometry::Rectangles confined_region;
535+
536+ std::mutex mutable region_mutex;
537 };
538
539 }
540
541=== modified file 'src/server/report/default_server_configuration.cpp'
542--- src/server/report/default_server_configuration.cpp 2016-01-29 08:18:22 +0000
543+++ src/server/report/default_server_configuration.cpp 2016-08-01 21:28:24 +0000
544@@ -118,6 +118,15 @@
545 });
546 }
547
548+auto mir::DefaultServerConfiguration::the_seat_report() -> std::shared_ptr<mi::SeatReport>
549+{
550+ return seat_report(
551+ [this]()->std::shared_ptr<mi::SeatReport>
552+ {
553+ return report_factory(options::seat_report_opt)->create_seat_report();
554+ });
555+}
556+
557 auto mir::DefaultServerConfiguration::the_scene_report() -> std::shared_ptr<ms::SceneReport>
558 {
559 return scene_report(
560
561=== modified file 'src/server/report/logging/CMakeLists.txt'
562--- src/server/report/logging/CMakeLists.txt 2016-01-29 08:18:22 +0000
563+++ src/server/report/logging/CMakeLists.txt 2016-08-01 21:28:24 +0000
564@@ -10,6 +10,7 @@
565 input_report.cpp
566 compositor_report.cpp
567 scene_report.cpp
568+ seat_report.cpp
569 shell_report.cpp
570 shell_report.h
571 logging_report_factory.cpp
572
573=== modified file 'src/server/report/logging/logging_report_factory.cpp'
574--- src/server/report/logging/logging_report_factory.cpp 2016-01-29 08:18:22 +0000
575+++ src/server/report/logging/logging_report_factory.cpp 2016-08-01 21:28:24 +0000
576@@ -26,6 +26,7 @@
577 #include "session_mediator_report.h"
578 #include "shell_report.h"
579 #include "input_report.h"
580+#include "seat_report.h"
581 #include "mir/logging/shared_library_prober_report.h"
582
583 #include "mir/default_server_configuration.h"
584@@ -74,6 +75,11 @@
585 return std::make_shared<logging::InputReport>(logger);
586 }
587
588+std::shared_ptr<mir::input::SeatReport> mr::LoggingReportFactory::create_seat_report()
589+{
590+ return std::make_shared<logging::SeatReport>(logger);
591+}
592+
593 std::shared_ptr<mir::SharedLibraryProberReport> mr::LoggingReportFactory::create_shared_library_prober_report()
594 {
595 return std::make_shared<mir::logging::SharedLibraryProberReport>(logger);
596
597=== added file 'src/server/report/logging/seat_report.cpp'
598--- src/server/report/logging/seat_report.cpp 1970-01-01 00:00:00 +0000
599+++ src/server/report/logging/seat_report.cpp 2016-08-01 21:28:24 +0000
600@@ -0,0 +1,146 @@
601+/*
602+ * Copyright © 2016 Canonical Ltd.
603+ *
604+ * This program is free software: you can redistribute it and/or modify it
605+ * under the terms of the GNU General Public License version 3,
606+ * as published by the Free Software Foundation.
607+ *
608+ * This program is distributed in the hope that it will be useful,
609+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
610+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
611+ * GNU General Public License for more details.
612+ *
613+ * You should have received a copy of the GNU General Public License
614+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
615+ *
616+ * Authored by: Brandon Schaefer <brandon.schaefer@canonical.com>
617+ */
618+
619+#include <sstream>
620+
621+#include "seat_report.h"
622+#include "mir/events/event.h"
623+#include "mir/geometry/rectangles.h"
624+#include "mir/logging/logger.h"
625+#include "mir/input/device.h"
626+
627+namespace mi = mir::input;
628+namespace ml = mir::logging;
629+namespace mrl = mir::report::logging;
630+namespace geom = mir::geometry;
631+
632+namespace
633+{
634+char const* const component = "input::Seat";
635+
636+std::string scan_codes_to_string(std::vector<uint32_t> const& scan_codes)
637+{
638+ std::stringstream ss;
639+ ss << "{";
640+
641+ for (auto const& s : scan_codes)
642+ {
643+ ss << s << ", ";
644+ }
645+
646+ auto str = ss.str();
647+
648+ // Remove the extra , and space
649+ str.pop_back();
650+ str.pop_back();
651+
652+ return str + "}";
653+}
654+
655+}
656+
657+mrl::SeatReport::SeatReport(std::shared_ptr<ml::Logger> const& log) :
658+ log(log)
659+{
660+}
661+
662+void mrl::SeatReport::seat_add_device(uint64_t id)
663+{
664+ std::stringstream ss;
665+ ss << "Add device"
666+ << " device_id=" << id;
667+
668+ log->log(ml::Severity::informational, ss.str(), component);
669+}
670+
671+void mrl::SeatReport::seat_remove_device(uint64_t id)
672+{
673+ std::stringstream ss;
674+ ss << "Remove device"
675+ << " device_id=" << id;
676+
677+ log->log(ml::Severity::informational, ss.str(), component);
678+}
679+
680+void mrl::SeatReport::seat_dispatch_event(MirEvent const& event)
681+{
682+ std::stringstream ss;
683+ ss << "Dispatch event"
684+ << " event_type=" << event.type();
685+
686+ log->log(ml::Severity::informational, ss.str(), component);
687+}
688+
689+void mrl::SeatReport::seat_get_rectangle_for(uint64_t id, geometry::Rectangle const& out_rect)
690+{
691+ std::stringstream ss;
692+ ss << "Get rectangle for"
693+ << " device_id=" << id
694+ << " out_rect=" << out_rect;
695+
696+ log->log(ml::Severity::informational, ss.str(), component);
697+}
698+
699+void mrl::SeatReport::seat_set_key_state(uint64_t id, std::vector<uint32_t> const& scan_codes)
700+{
701+ std::stringstream ss;
702+ ss << "Set key state"
703+ << " device_id=" << id
704+ << " scan_codes=" << scan_codes_to_string(scan_codes);
705+
706+ log->log(ml::Severity::informational, ss.str(), component);
707+}
708+
709+void mrl::SeatReport::seat_set_pointer_state(uint64_t id, unsigned buttons)
710+{
711+ std::stringstream ss;
712+ ss << "Set pointer state"
713+ << " devie_id=" << id
714+ << " buttons=" << buttons;
715+
716+ log->log(ml::Severity::informational, ss.str(), component);
717+}
718+
719+void mrl::SeatReport::seat_set_cursor_position(float cursor_x, float cursor_y)
720+{
721+ std::stringstream ss;
722+ ss << "Set cursor position"
723+ << " cursor_x=" << cursor_x
724+ << " cursor_y=" << cursor_y;
725+
726+ log->log(ml::Severity::informational, ss.str(), component);
727+}
728+
729+void mrl::SeatReport::seat_set_confinement_region_called(geom::Rectangles const& regions)
730+{
731+ std::stringstream ss;
732+
733+ auto bound_rect = regions.bounding_rectangle();
734+ ss << "Set confinement region"
735+ << " regions=" << bound_rect;
736+
737+ log->log(ml::Severity::informational, ss.str(), component);
738+}
739+
740+void mrl::SeatReport::seat_reset_confinement_regions()
741+{
742+ std::stringstream ss;
743+ ss << "Reset confinement regions";
744+
745+ log->log(ml::Severity::informational, ss.str(), component);
746+}
747
748=== added file 'src/server/report/logging/seat_report.h'
749--- src/server/report/logging/seat_report.h 1970-01-01 00:00:00 +0000
750+++ src/server/report/logging/seat_report.h 2016-08-01 21:28:24 +0000
751@@ -0,0 +1,67 @@
752+/*
753+ * Copyright © 2016 Canonical Ltd.
754+ *
755+ * This program is free software: you can redistribute it and/or modify it
756+ * under the terms of the GNU General Public License version 3,
757+ * as published by the Free Software Foundation.
758+ *
759+ * This program is distributed in the hope that it will be useful,
760+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
761+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
762+ * GNU General Public License for more details.
763+ *
764+ * You should have received a copy of the GNU General Public License
765+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
766+ *
767+ * Authored by: Brandon Schaefer <brandon.schaefer@canonical.com>
768+ */
769+
770+#ifndef MIR_REPORT_LOGGING_SEAT_REPORT_H_
771+#define MIR_REPORT_LOGGING_SEAT_REPORT_H_
772+
773+#include <mir/input/seat_report.h>
774+
775+#include <memory>
776+
777+class MirEvent;
778+
779+namespace mir
780+{
781+namespace logging
782+{
783+class Logger;
784+}
785+namespace geometry
786+{
787+class Rectangles;
788+class Rectangle;
789+}
790+namespace report
791+{
792+namespace logging
793+{
794+
795+class SeatReport : public input::SeatReport
796+{
797+public:
798+ SeatReport(std::shared_ptr<mir::logging::Logger> const& log);
799+
800+ virtual void seat_add_device(uint64_t id) override;
801+ virtual void seat_remove_device(uint64_t id) override;
802+ virtual void seat_dispatch_event(MirEvent const& event) override;
803+ virtual void seat_get_rectangle_for(uint64_t id, geometry::Rectangle const& out_rect) override;
804+ virtual void seat_set_key_state(uint64_t id, std::vector<uint32_t> const& scan_codes) override;
805+ virtual void seat_set_pointer_state(uint64_t id, unsigned buttons) override;
806+ virtual void seat_set_cursor_position(float cursor_x, float cursor_y) override;
807+ virtual void seat_set_confinement_region_called(geometry::Rectangles const& regions) override;
808+ virtual void seat_reset_confinement_regions() override;
809+
810+private:
811+ std::shared_ptr<mir::logging::Logger> const log;
812+};
813+
814+}
815+}
816+}
817+
818+#endif /* MIR_REPORT_LOGGING_SEAT_REPORT_H_ */
819
820=== modified file 'src/server/report/logging_report_factory.h'
821--- src/server/report/logging_report_factory.h 2016-01-29 08:18:22 +0000
822+++ src/server/report/logging_report_factory.h 2016-08-01 21:28:24 +0000
823@@ -47,6 +47,7 @@
824 std::shared_ptr<frontend::SessionMediatorReport> create_session_mediator_report() override;
825 std::shared_ptr<frontend::MessageProcessorReport> create_message_processor_report() override;
826 std::shared_ptr<input::InputReport> create_input_report() override;
827+ std::shared_ptr<input::SeatReport> create_seat_report() override;
828 std::shared_ptr<mir::SharedLibraryProberReport> create_shared_library_prober_report() override;
829 std::shared_ptr<shell::ShellReport> create_shell_report() override;
830
831
832=== modified file 'src/server/report/lttng/lttng_report_factory.cpp'
833--- src/server/report/lttng/lttng_report_factory.cpp 2016-01-29 08:18:22 +0000
834+++ src/server/report/lttng/lttng_report_factory.cpp 2016-08-01 21:28:24 +0000
835@@ -62,6 +62,11 @@
836 return std::make_shared<lttng::InputReport>();
837 }
838
839+std::shared_ptr<mir::input::SeatReport> mir::report::LttngReportFactory::create_seat_report()
840+{
841+ BOOST_THROW_EXCEPTION(std::logic_error("Not implemented"));
842+}
843+
844 std::shared_ptr<mir::SharedLibraryProberReport> mir::report::LttngReportFactory::create_shared_library_prober_report()
845 {
846 return std::make_shared<lttng::SharedLibraryProberReport>();
847
848=== modified file 'src/server/report/lttng_report_factory.h'
849--- src/server/report/lttng_report_factory.h 2016-01-29 08:18:22 +0000
850+++ src/server/report/lttng_report_factory.h 2016-08-01 21:28:24 +0000
851@@ -35,6 +35,7 @@
852 std::shared_ptr<frontend::SessionMediatorReport> create_session_mediator_report() override;
853 std::shared_ptr<frontend::MessageProcessorReport> create_message_processor_report() override;
854 std::shared_ptr<input::InputReport> create_input_report() override;
855+ std::shared_ptr<input::SeatReport> create_seat_report() override;
856 std::shared_ptr<SharedLibraryProberReport> create_shared_library_prober_report() override;
857 std::shared_ptr<shell::ShellReport> create_shell_report() override;
858 };
859
860=== modified file 'src/server/report/null/CMakeLists.txt'
861--- src/server/report/null/CMakeLists.txt 2016-01-29 08:18:22 +0000
862+++ src/server/report/null/CMakeLists.txt 2016-08-01 21:28:24 +0000
863@@ -8,6 +8,7 @@
864 message_processor_report.cpp
865 null_report_factory.cpp
866 scene_report.cpp
867+ seat_report.cpp
868 session_mediator_report.cpp
869 shell_report.cpp
870 shell_report.h
871
872=== modified file 'src/server/report/null/null_report_factory.cpp'
873--- src/server/report/null/null_report_factory.cpp 2016-01-29 08:18:22 +0000
874+++ src/server/report/null/null_report_factory.cpp 2016-08-01 21:28:24 +0000
875@@ -24,6 +24,7 @@
876 #include "session_mediator_report.h"
877 #include "display_report.h"
878 #include "input_report.h"
879+#include "seat_report.h"
880 #include "shell_report.h"
881 #include "scene_report.h"
882 #include "mir/logging/null_shared_library_prober_report.h"
883@@ -63,6 +64,11 @@
884 return std::make_shared<null::InputReport>();
885 }
886
887+std::shared_ptr<mir::input::SeatReport> mir::report::NullReportFactory::create_seat_report()
888+{
889+ return std::make_shared<null::SeatReport>();
890+}
891+
892 std::shared_ptr<mir::SharedLibraryProberReport> mir::report::NullReportFactory::create_shared_library_prober_report()
893 {
894 return std::make_shared<logging::NullSharedLibraryProberReport>();
895@@ -107,3 +113,8 @@
896 {
897 return NullReportFactory{}.create_input_report();
898 }
899+
900+std::shared_ptr<mir::input::SeatReport> mir::report::null_seat_report()
901+{
902+ return NullReportFactory{}.create_seat_report();
903+}
904
905=== added file 'src/server/report/null/seat_report.cpp'
906--- src/server/report/null/seat_report.cpp 1970-01-01 00:00:00 +0000
907+++ src/server/report/null/seat_report.cpp 2016-08-01 21:28:24 +0000
908@@ -0,0 +1,58 @@
909+/*
910+ * Copyright © 2016 Canonical Ltd.
911+ *
912+ * This program is free software: you can redistribute it and/or modify it
913+ * under the terms of the GNU General Public License version 3,
914+ * as published by the Free Software Foundation.
915+ *
916+ * This program is distributed in the hope that it will be useful,
917+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
918+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
919+ * GNU General Public License for more details.
920+ *
921+ * You should have received a copy of the GNU General Public License
922+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
923+ *
924+ * Authored by: Brandon Schaefer <brandon.schaefer@canonical.com>
925+ */
926+
927+#include "seat_report.h"
928+
929+namespace mrn = mir::report::null;
930+namespace geom = mir::geometry;
931+
932+void mrn::SeatReport::seat_add_device(uint64_t /*id*/)
933+{
934+}
935+
936+void mrn::SeatReport::seat_remove_device(uint64_t /*id*/)
937+{
938+}
939+
940+void mrn::SeatReport::seat_dispatch_event(MirEvent const& /*event*/)
941+{
942+}
943+
944+void mrn::SeatReport::seat_get_rectangle_for(uint64_t /*id*/, geometry::Rectangle const& /*out_rect*/)
945+{
946+}
947+
948+void mrn::SeatReport::seat_set_key_state(uint64_t /*id*/, std::vector<uint32_t> const& /*scan_codes*/)
949+{
950+}
951+
952+void mrn::SeatReport::seat_set_pointer_state(uint64_t /*id*/, unsigned /*buttons*/)
953+{
954+}
955+
956+void mrn::SeatReport::seat_set_cursor_position(float /*cursor_x*/, float /*cursor_y*/)
957+{
958+}
959+
960+void mrn::SeatReport::seat_set_confinement_region_called(geom::Rectangles const& /*regions*/)
961+{
962+}
963+
964+void mrn::SeatReport::seat_reset_confinement_regions()
965+{
966+}
967
968=== added file 'src/server/report/null/seat_report.h'
969--- src/server/report/null/seat_report.h 1970-01-01 00:00:00 +0000
970+++ src/server/report/null/seat_report.h 2016-08-01 21:28:24 +0000
971@@ -0,0 +1,50 @@
972+/*
973+ * Copyright © 2016 Canonical Ltd.
974+ *
975+ * This program is free software: you can redistribute it and/or modify it
976+ * under the terms of the GNU General Public License version 3,
977+ * as published by the Free Software Foundation.
978+ *
979+ * This program is distributed in the hope that it will be useful,
980+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
981+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
982+ * GNU General Public License for more details.
983+ *
984+ * You should have received a copy of the GNU General Public License
985+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
986+ *
987+ * Authored by: Brandon Schaefer <brandon.schaefer@canonical.com>
988+ */
989+
990+
991+#ifndef MIR_REPORT_NULL_SEAT_REPORT_H_
992+#define MIR_REPORT_NULL_SEAT_REPORT_H_
993+
994+#include "mir/input/seat_report.h"
995+
996+namespace mir
997+{
998+namespace report
999+{
1000+namespace null
1001+{
1002+
1003+class SeatReport : public input::SeatReport
1004+{
1005+public:
1006+ virtual void seat_add_device(uint64_t id) override;
1007+ virtual void seat_remove_device(uint64_t id) override;
1008+ virtual void seat_dispatch_event(MirEvent const& event) override;
1009+ virtual void seat_get_rectangle_for(uint64_t id, geometry::Rectangle const& out_rect) override;
1010+ virtual void seat_set_key_state(uint64_t id, std::vector<uint32_t> const& scan_codes) override;
1011+ virtual void seat_set_pointer_state(uint64_t id, unsigned buttons) override;
1012+ virtual void seat_set_cursor_position(float cursor_x, float cursor_y) override;
1013+ virtual void seat_set_confinement_region_called(geometry::Rectangles const& regions) override;
1014+ virtual void seat_reset_confinement_regions() override;
1015+};
1016+
1017+}
1018+}
1019+}
1020+
1021+#endif /* MIR_REPORT_NULL_SEAT_REPORT_H_ */
1022
1023=== modified file 'src/server/report/null_report_factory.h'
1024--- src/server/report/null_report_factory.h 2016-01-29 08:18:22 +0000
1025+++ src/server/report/null_report_factory.h 2016-08-01 21:28:24 +0000
1026@@ -35,6 +35,7 @@
1027 std::shared_ptr<frontend::SessionMediatorReport> create_session_mediator_report() override;
1028 std::shared_ptr<frontend::MessageProcessorReport> create_message_processor_report() override;
1029 std::shared_ptr<input::InputReport> create_input_report() override;
1030+ std::shared_ptr<input::SeatReport> create_seat_report() override;
1031 std::shared_ptr<mir::SharedLibraryProberReport> create_shared_library_prober_report() override;
1032 std::shared_ptr<shell::ShellReport> create_shell_report() override;
1033 };
1034@@ -46,6 +47,7 @@
1035 std::shared_ptr<frontend::SessionMediatorReport> null_session_mediator_report();
1036 std::shared_ptr<frontend::MessageProcessorReport> null_message_processor_report();
1037 std::shared_ptr<input::InputReport> null_input_report();
1038+std::shared_ptr<input::SeatReport> null_seat_report();
1039 std::shared_ptr<mir::SharedLibraryProberReport> null_shared_library_prober_report();
1040
1041 }
1042
1043=== modified file 'src/server/report/report_factory.h'
1044--- src/server/report/report_factory.h 2016-01-29 08:18:22 +0000
1045+++ src/server/report/report_factory.h 2016-08-01 21:28:24 +0000
1046@@ -41,6 +41,7 @@
1047 namespace input
1048 {
1049 class InputReport;
1050+class SeatReport;
1051 }
1052 namespace scene
1053 {
1054@@ -61,6 +62,7 @@
1055 virtual std::shared_ptr<frontend::SessionMediatorReport> create_session_mediator_report() = 0;
1056 virtual std::shared_ptr<frontend::MessageProcessorReport> create_message_processor_report() = 0;
1057 virtual std::shared_ptr<input::InputReport> create_input_report() = 0;
1058+ virtual std::shared_ptr<input::SeatReport> create_seat_report() = 0;
1059 virtual std::shared_ptr<SharedLibraryProberReport> create_shared_library_prober_report() = 0;
1060 virtual std::shared_ptr<shell::ShellReport> create_shell_report() = 0;
1061
1062
1063=== modified file 'src/server/scene/basic_surface.cpp'
1064--- src/server/scene/basic_surface.cpp 2016-07-26 03:56:14 +0000
1065+++ src/server/scene/basic_surface.cpp 2016-08-01 21:28:24 +0000
1066@@ -131,12 +131,6 @@
1067 { observer->cursor_image_removed(); });
1068 }
1069
1070-void ms::SurfaceObservers::confinement_region_updated(geom::Rectangle const& rect)
1071-{
1072- for_each([rect](std::shared_ptr<SurfaceObserver> const& observer)
1073- { observer->confinement_region_updated(rect); });
1074-}
1075-
1076 struct ms::CursorStreamImageAdapter
1077 {
1078 CursorStreamImageAdapter(ms::BasicSurface &surface)
1079@@ -288,11 +282,6 @@
1080 surface_rect.top_left = top_left;
1081 }
1082 observers.moved_to(top_left);
1083-
1084- if (confine_pointer_state_ == mir_pointer_confined_to_surface)
1085- {
1086- observers.confinement_region_updated(surface_rect);
1087- }
1088 }
1089
1090 float ms::BasicSurface::alpha() const
1091@@ -375,11 +364,6 @@
1092 surface_rect.size = new_size;
1093 }
1094 observers.resized_to(new_size);
1095-
1096- if (confine_pointer_state_ == mir_pointer_confined_to_surface)
1097- {
1098- observers.confinement_region_updated(surface_rect);
1099- }
1100 }
1101
1102 geom::Point ms::BasicSurface::top_left() const
1103@@ -911,11 +895,6 @@
1104 });
1105 }
1106 observers.moved_to(surface_rect.top_left);
1107-
1108- if (confine_pointer_state_ == mir_pointer_confined_to_surface)
1109- {
1110- observers.confinement_region_updated(surface_rect);
1111- }
1112 }
1113
1114 mg::RenderableList ms::BasicSurface::generate_renderables(mc::CompositorID id) const
1115
1116=== modified file 'src/server/scene/legacy_surface_change_notification.cpp'
1117--- src/server/scene/legacy_surface_change_notification.cpp 2016-07-26 03:56:14 +0000
1118+++ src/server/scene/legacy_surface_change_notification.cpp 2016-08-01 21:28:24 +0000
1119@@ -100,7 +100,3 @@
1120 {
1121 notify_scene_change();
1122 }
1123-
1124-void ms::LegacySurfaceChangeNotification::confinement_region_updated(geometry::Rectangle const&)
1125-{
1126-}
1127
1128=== modified file 'src/server/scene/legacy_surface_change_notification.h'
1129--- src/server/scene/legacy_surface_change_notification.h 2016-07-26 03:56:14 +0000
1130+++ src/server/scene/legacy_surface_change_notification.h 2016-08-01 21:28:24 +0000
1131@@ -49,7 +49,6 @@
1132 std::string const& variant, std::string const& options) override;
1133 void renamed(char const*) override;
1134 void cursor_image_removed() override;
1135- void confinement_region_updated(geometry::Rectangle const& rect) override;
1136
1137 private:
1138 std::function<void()> const notify_scene_change;
1139
1140=== modified file 'src/server/scene/null_surface_observer.cpp'
1141--- src/server/scene/null_surface_observer.cpp 2016-07-26 03:56:14 +0000
1142+++ src/server/scene/null_surface_observer.cpp 2016-08-01 21:28:24 +0000
1143@@ -39,4 +39,3 @@
1144 }
1145 void ms::NullSurfaceObserver::renamed(char const*) {}
1146 void ms::NullSurfaceObserver::cursor_image_removed() {}
1147-void ms::NullSurfaceObserver::confinement_region_updated(geometry::Rectangle const& /*rect*/) {}
1148
1149=== modified file 'src/server/server.cpp'
1150--- src/server/server.cpp 2016-07-20 04:54:07 +0000
1151+++ src/server/server.cpp 2016-08-01 21:28:24 +0000
1152@@ -99,6 +99,7 @@
1153 MACRO(session_authorizer)\
1154 MACRO(session_listener)\
1155 MACRO(session_mediator_report)\
1156+ MACRO(seat_report)\
1157 MACRO(shell)\
1158 MACRO(application_not_responding_detector)\
1159 MACRO(cookie_authority)\
1160
1161=== modified file 'src/server/shell/abstract_shell.cpp'
1162--- src/server/shell/abstract_shell.cpp 2016-08-01 07:44:10 +0000
1163+++ src/server/shell/abstract_shell.cpp 2016-08-01 21:28:24 +0000
1164@@ -41,17 +41,28 @@
1165
1166 struct UpdateConfinementOnSurfaceChanges : ms::NullSurfaceObserver
1167 {
1168- UpdateConfinementOnSurfaceChanges(std::shared_ptr<mi::Seat> seat) :
1169- seat(seat)
1170- {
1171- }
1172-
1173- void confinement_region_updated(geom::Rectangle const& rect)
1174- {
1175- seat->set_confinement_regions({rect});
1176- }
1177-
1178- std::shared_ptr<mi::Seat> seat;
1179+ UpdateConfinementOnSurfaceChanges(msh::AbstractShell* shell) :
1180+ shell(shell)
1181+ {
1182+ }
1183+
1184+ void resized_to(geom::Size const& /*size*/) override
1185+ {
1186+ update_confinement_region();
1187+ }
1188+
1189+ void moved_to(geom::Point const& /*top_left*/) override
1190+ {
1191+ update_confinement_region();
1192+ }
1193+
1194+private:
1195+ void update_confinement_region()
1196+ {
1197+ shell->update_focused_surface_confined_region();
1198+ }
1199+
1200+ msh::AbstractShell* shell;
1201 };
1202 }
1203
1204@@ -70,7 +81,7 @@
1205 window_manager(wm_builder(this)),
1206 seat(seat),
1207 report(report),
1208- focus_surface_observer(std::make_shared<UpdateConfinementOnSurfaceChanges>(seat))
1209+ focus_surface_observer(std::make_shared<UpdateConfinementOnSurfaceChanges>(this))
1210 {
1211 }
1212
1213@@ -78,6 +89,16 @@
1214 {
1215 }
1216
1217+void msh::AbstractShell::update_focused_surface_confined_region()
1218+{
1219+ auto const current_focus = focus_surface.lock();
1220+
1221+ if (current_focus && current_focus->confine_pointer_state() == mir_pointer_confined_to_surface)
1222+ {
1223+ seat->set_confinement_regions({current_focus->input_bounds()});
1224+ }
1225+}
1226+
1227 std::shared_ptr<ms::Session> msh::AbstractShell::open_session(
1228 pid_t client_pid,
1229 std::string const& name,
1230@@ -357,3 +378,4 @@
1231 surface_stack->raise(surfaces);
1232 report->surfaces_raised(surfaces);
1233 }
1234+
1235
1236=== modified file 'src/server/symbols.map'
1237--- src/server/symbols.map 2016-07-28 03:39:52 +0000
1238+++ src/server/symbols.map 2016-08-01 21:28:24 +0000
1239@@ -839,6 +839,6 @@
1240 MIR_SERVER_0.25 {
1241 global:
1242 extern "C++" {
1243- mir::scene::NullSurfaceObserver::confinement_region_updated*;
1244+ mir::Server::override_the_seat_report*;
1245 };
1246 } MIR_SERVER_0.24;
1247
1248=== modified file 'tests/acceptance-tests/test_confined_pointer.cpp'
1249--- tests/acceptance-tests/test_confined_pointer.cpp 2016-07-26 03:56:14 +0000
1250+++ tests/acceptance-tests/test_confined_pointer.cpp 2016-08-01 21:28:24 +0000
1251@@ -16,15 +16,19 @@
1252 * Authored by: Brandon Schaefer <brandon.schaefer@canonical.com>
1253 */
1254
1255+#include "mir/scene/null_surface_observer.h"
1256+#include "mir/input/input_device_info.h"
1257+#include "mir/geometry/rectangles.h"
1258+
1259 #include "mir/test/event_matchers.h"
1260-#include "mir/input/input_device_info.h"
1261+#include "mir/test/fake_shared.h"
1262+#include "mir/test/signal.h"
1263+#include "mir/test/doubles/mock_seat_report.h"
1264 #include "mir_test_framework/fake_input_device.h"
1265+#include "mir_test_framework/headless_in_process_server.h"
1266+#include "mir_test_framework/placement_applying_shell.h"
1267 #include "mir_test_framework/stub_server_platform_factory.h"
1268
1269-#include "mir/test/signal.h"
1270-#include "mir_test_framework/placement_applying_shell.h"
1271-#include "mir_test_framework/headless_in_process_server.h"
1272-
1273 #include "mir_toolkit/mir_client_library.h"
1274
1275 #include <gtest/gtest.h>
1276@@ -32,19 +36,26 @@
1277
1278 #include <boost/throw_exception.hpp>
1279
1280-
1281+namespace mtd = mir::test::doubles;
1282 namespace mt = mir::test;
1283 namespace mi = mir::input;
1284+namespace ms = mir::scene;
1285 namespace mis = mir::input::synthesis;
1286 namespace mtf = mir_test_framework;
1287 namespace geom = mir::geometry;
1288
1289 using namespace std::chrono_literals;
1290+using namespace testing;
1291
1292 namespace
1293 {
1294 int const surface_width = 100;
1295 int const surface_height = 100;
1296+
1297+struct MockSurfaceObserver : public ms::NullSurfaceObserver
1298+{
1299+ MOCK_METHOD1(resized_to, void(geom::Size const&));
1300+};
1301 }
1302
1303 void null_event_handler(MirSurface*, MirEvent const*, void*)
1304@@ -96,12 +107,6 @@
1305
1306 mir_surface_apply_spec(surface, spec);
1307 mir_surface_spec_release(spec);
1308-
1309- received_resize.wait_for(1s);
1310- if (!received_resize.raised())
1311- {
1312- BOOST_THROW_EXCEPTION(std::runtime_error("Timeout waiting for surface to become resized"));
1313- }
1314 }
1315
1316 void handle_surface_event(MirSurfaceEvent const* event)
1317@@ -133,9 +138,6 @@
1318 case mir_event_type_input:
1319 client->handle_input(ev);
1320 break;
1321- case mir_event_type_resize:
1322- client->received_resize.raise();
1323- break;
1324 default:
1325 break;
1326 }
1327@@ -154,7 +156,6 @@
1328 MirConnection* connection;
1329 mir::test::Signal ready_to_accept_events;
1330 mir::test::Signal all_events_received;
1331- mir::test::Signal received_resize;
1332 bool exposed = false;
1333 bool focused = false;
1334 };
1335@@ -168,21 +169,40 @@
1336 server.wrap_shell(
1337 [this](std::shared_ptr<mir::shell::Shell> const& wrapped)
1338 {
1339- //return wrapped;
1340 shell = std::make_shared<mtf::PlacementApplyingShell>(wrapped, input_regions, positions);
1341 return shell;
1342 });
1343
1344+ server.override_the_seat_report([this]
1345+ {
1346+ mock_seat_report = std::make_shared<NiceMock<mtd::MockSeatReport>>();
1347+ return mock_seat_report;
1348+ });
1349+
1350 HeadlessInProcessServer::SetUp();
1351
1352 positions[first] = geom::Rectangle{{0,0}, {surface_width, surface_height}};
1353 }
1354
1355+ std::shared_ptr<ms::Surface> latest_shell_surface() const
1356+ {
1357+ auto const result = shell->latest_surface.lock();
1358+// ASSERT_THAT(result, NotNull()); //<= doesn't compile!?
1359+ EXPECT_THAT(result, NotNull());
1360+ return result;
1361+ }
1362+
1363+ void change_observed() { resized_signaled.raise(); }
1364+
1365 std::string const mouse_name = "mouse";
1366 std::string const mouse_unique_id = "mouse-uid";
1367 std::unique_ptr<mtf::FakeInputDevice> fake_mouse{
1368 mtf::add_fake_input_device(mi::InputDeviceInfo{mouse_name, mouse_unique_id, mi::DeviceCapability::pointer})};
1369
1370+ NiceMock<MockSurfaceObserver> surface_observer;
1371+ mir::test::Signal resized_signaled;
1372+
1373+ std::shared_ptr<mtd::MockSeatReport> mock_seat_report;
1374 std::shared_ptr<mtf::PlacementApplyingShell> shell;
1375 geom::Rectangle screen_geometry{{0,0}, {800,600}};
1376 mtf::ClientInputRegions input_regions;
1377@@ -193,8 +213,6 @@
1378
1379 TEST_F(PointerConfinement, test_we_hit_pointer_confined_boundary)
1380 {
1381- using namespace ::testing;
1382-
1383 positions[first] = geom::Rectangle{{0,0}, {surface_width, surface_height}};
1384 Client client(new_connection(), first);
1385
1386@@ -216,8 +234,6 @@
1387
1388 TEST_F(PointerConfinement, test_we_generate_relative_after_boundary)
1389 {
1390- using namespace ::testing;
1391-
1392 positions[first] = geom::Rectangle{{0,0}, {surface_width, surface_height}};
1393 Client client(new_connection(), first);
1394
1395@@ -235,12 +251,20 @@
1396
1397 TEST_F(PointerConfinement, test_we_update_our_confined_region_on_a_resize)
1398 {
1399- using namespace ::testing;
1400-
1401 positions[first] = geom::Rectangle{{0,0}, {surface_width, surface_height}};
1402 Client client(new_connection(), first);
1403
1404+ auto fake = mt::fake_shared(surface_observer);
1405+ latest_shell_surface()->add_observer(fake);
1406+
1407+ geom::Size new_size = {surface_width + 100, surface_height};
1408+ EXPECT_CALL(surface_observer, resized_to(new_size)).Times(1);
1409+
1410+ EXPECT_CALL(*mock_seat_report, seat_set_confinement_region_called(_)).
1411+ WillRepeatedly(InvokeWithoutArgs([&] { change_observed(); }));
1412+
1413 client.resize(surface_width + 100, surface_height);
1414+ resized_signaled.wait_for(1s);
1415
1416 InSequence seq;
1417 EXPECT_CALL(client, handle_input(mt::PointerEnterEvent()));
1418
1419=== modified file 'tests/integration-tests/input/test_single_seat_setup.cpp'
1420--- tests/integration-tests/input/test_single_seat_setup.cpp 2016-07-07 09:59:19 +0000
1421+++ tests/integration-tests/input/test_single_seat_setup.cpp 2016-08-01 21:28:24 +0000
1422@@ -26,6 +26,7 @@
1423 #include "mir/test/doubles/mock_touch_visualizer.h"
1424 #include "mir/test/doubles/mock_cursor_listener.h"
1425 #include "mir/test/doubles/mock_event_sink.h"
1426+#include "mir/test/doubles/mock_seat_report.h"
1427 #include "mir/test/doubles/triggered_main_loop.h"
1428 #include "mir/test/event_matchers.h"
1429 #include "mir/test/doubles/advanceable_clock.h"
1430@@ -80,12 +81,13 @@
1431 std::shared_ptr<mir::cookie::Authority> cookie_authority = mir::cookie::Authority::create();
1432 NiceMock<mtd::MockCursorListener> mock_cursor_listener;
1433 NiceMock<mtd::MockTouchVisualizer> mock_visualizer;
1434+ NiceMock<mtd::MockSeatReport> mock_seat_report;
1435 mi::receiver::XKBMapper key_mapper;
1436 mir::dispatch::MultiplexingDispatchable multiplexer;
1437 mtd::AdvanceableClock clock;
1438 mi::BasicSeat seat{
1439 mt::fake_shared(mock_dispatcher),mt::fake_shared(mock_visualizer), mt::fake_shared(mock_cursor_listener),
1440- mt::fake_shared(mock_region), mt::fake_shared(key_mapper), mt::fake_shared(clock)};
1441+ mt::fake_shared(mock_region), mt::fake_shared(key_mapper), mt::fake_shared(clock), mt::fake_shared(mock_seat_report)};
1442 mi::DefaultInputDeviceHub hub{
1443 mt::fake_shared(mock_sink), mt::fake_shared(seat), mt::fake_shared(multiplexer), mt::fake_shared(observer_loop),
1444 cookie_authority, mt::fake_shared(key_mapper)};
1445
1446=== modified file 'tests/mir_test_framework/placement_applying_shell.cpp'
1447--- tests/mir_test_framework/placement_applying_shell.cpp 2016-05-03 06:55:25 +0000
1448+++ tests/mir_test_framework/placement_applying_shell.cpp 2016-08-01 21:28:24 +0000
1449@@ -41,6 +41,7 @@
1450
1451 auto const id = wrapped->create_surface(session, creation_parameters, sink);
1452 auto const surface = session->surface(id);
1453+ latest_surface = surface;
1454
1455 auto position= client_positions.find(params.name);
1456 if (position != client_positions.end())
1457
1458=== modified file 'tests/unit-tests/input/test_seat_input_device_tracker.cpp'
1459--- tests/unit-tests/input/test_seat_input_device_tracker.cpp 2016-07-01 20:32:34 +0000
1460+++ tests/unit-tests/input/test_seat_input_device_tracker.cpp 2016-08-01 21:28:24 +0000
1461@@ -26,6 +26,7 @@
1462 #include "mir/test/doubles/mock_cursor_listener.h"
1463 #include "mir/test/doubles/mock_touch_visualizer.h"
1464 #include "mir/test/doubles/mock_input_seat.h"
1465+#include "mir/test/doubles/mock_seat_report.h"
1466 #include "mir/test/doubles/advanceable_clock.h"
1467 #include "mir/test/event_matchers.h"
1468 #include "mir/test/fake_shared.h"
1469@@ -56,6 +57,7 @@
1470 Nice<mtd::MockCursorListener> mock_cursor_listener;
1471 Nice<mtd::MockTouchVisualizer> mock_visualizer;
1472 Nice<mtd::MockInputSeat> mock_seat;
1473+ Nice<mtd::MockSeatReport> mock_seat_report;
1474 MirInputDeviceId some_device{8712};
1475 MirInputDeviceId another_device{1246};
1476 MirInputDeviceId third_device{86};
1477@@ -68,7 +70,8 @@
1478 mi::receiver::XKBMapper mapper;
1479 mi::SeatInputDeviceTracker tracker{
1480 mt::fake_shared(mock_dispatcher), mt::fake_shared(mock_visualizer), mt::fake_shared(mock_cursor_listener),
1481- mt::fake_shared(mock_region), mt::fake_shared(mapper), mt::fake_shared(clock)};
1482+ mt::fake_shared(mock_region), mt::fake_shared(mapper), mt::fake_shared(clock),
1483+ mt::fake_shared(mock_seat_report)};
1484
1485 std::chrono::nanoseconds arbitrary_timestamp;
1486 };

Subscribers

People subscribed via source and target branches