Mir

Merge lp://qastaging/~brandontschaefer/mir/pointer-confinement into lp://qastaging/mir

Proposed by Brandon Schaefer
Status: Merged
Approved by: Cemil Azizoglu
Approved revision: no longer in the source branch.
Merged at revision: 3560
Proposed branch: lp://qastaging/~brandontschaefer/mir/pointer-confinement
Merge into: lp://qastaging/mir
Diff against target: 1159 lines (+429/-17)
36 files modified
examples/server_example_canonical_window_manager.cpp (+5/-0)
include/server/mir/scene/surface.h (+3/-0)
include/server/mir/scene/surface_creation_parameters.h (+1/-0)
include/server/mir/shell/abstract_shell.h (+7/-1)
include/test/mir/test/doubles/stub_surface.h (+2/-0)
src/client/mir_connection.cpp (+1/-0)
src/include/server/mir/input/seat.h (+3/-0)
src/include/server/mir/shell/window_management_info.h (+1/-1)
src/protobuf/mir_protobuf.proto (+1/-0)
src/server/frontend/session_mediator.cpp (+1/-0)
src/server/input/basic_seat.cpp (+10/-0)
src/server/input/basic_seat.h (+2/-0)
src/server/input/seat_input_device_tracker.cpp (+29/-7)
src/server/input/seat_input_device_tracker.h (+6/-0)
src/server/scene/basic_surface.cpp (+14/-1)
src/server/scene/basic_surface.h (+6/-0)
src/server/scene/surface_allocator.cpp (+2/-0)
src/server/shell/abstract_shell.cpp (+23/-1)
src/server/shell/canonical_window_manager.cpp (+5/-0)
src/server/shell/default_configuration.cpp (+2/-1)
tests/acceptance-tests/CMakeLists.txt (+1/-0)
tests/acceptance-tests/test_confined_pointer.cpp (+214/-0)
tests/acceptance-tests/test_surface_placement.cpp (+1/-0)
tests/include/mir/test/doubles/mock_input_seat.h (+3/-0)
tests/include/mir/test/doubles/mock_surface.h (+1/-0)
tests/include/mir/test/doubles/stub_scene_surface.h (+3/-0)
tests/integration-tests/surface_composition.cpp (+1/-0)
tests/integration-tests/test_surface_stack_with_compositor.cpp (+1/-0)
tests/mir_test_framework/stub_surface.cpp (+10/-0)
tests/unit-tests/input/test_seat_input_device_tracker.cpp (+36/-0)
tests/unit-tests/scene/test_abstract_shell.cpp (+4/-1)
tests/unit-tests/scene/test_basic_surface.cpp (+8/-2)
tests/unit-tests/scene/test_session_manager.cpp (+1/-0)
tests/unit-tests/scene/test_surface.cpp (+4/-1)
tests/unit-tests/scene/test_surface_impl.cpp (+3/-1)
tests/unit-tests/scene/test_surface_stack.cpp (+14/-0)
To merge this branch: bzr merge lp://qastaging/~brandontschaefer/mir/pointer-confinement
Reviewer Review Type Date Requested Status
Mir CI Bot continuous-integration Approve
Cemil Azizoglu (community) Approve
Kevin DuBois (community) Approve
Chris Halse Rogers Approve
Andreas Pokorny (community) Approve
Review via email: mp+297941@code.qastaging.launchpad.net

Commit message

Implements pointer confinement for a surface as a spec.

Only works for a focus windows. The window manager is in charge of actually setting the surface to have pointer confinement if the spec is updated. Right now we need to depend on setting the seat in the abstract shell since its where we need to update the mouse events.

Description of the change

Implements pointer confinement for a surface as a spec.

Only works for a focus windows. The window manager is in charge of actually setting the surface to have pointer confinement if the spec is updated. Right now we need to depend on setting the seat in the abstract shell since its where we need to update the mouse events.

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

PASSED: Continuous integration, rev:3537
https://mir-jenkins.ubuntu.com/job/mir-ci/1167/
Executed test runs:
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-mir/1314
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-0-fetch/1365
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-1-sourcepkg/release=vivid+overlay/1356
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-1-sourcepkg/release=xenial/1356
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=clang,platform=mesa,release=vivid+overlay/1326
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=clang,platform=mesa,release=vivid+overlay/1326/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=xenial/1326
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=xenial/1326/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/1326
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=cross-armhf,compiler=gcc,platform=android,release=vivid+overlay/1326/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/1326
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=i386,compiler=gcc,platform=android,release=vivid+overlay/1326/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=i386,compiler=gcc,platform=mesa,release=xenial/1326
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=i386,compiler=gcc,platform=mesa,release=xenial/1326/artifact/output/*zip*/output.zip

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

review: Approve (continuous-integration)
Revision history for this message
Brandon Schaefer (brandontschaefer) wrote :

Need to implement this for SurfaceSpecParams (ie. the creation parms which are different then the normal SurfaceSpec struct!)

Revision history for this message
Mir CI Bot (mir-ci-bot) wrote :

PASSED: Continuous integration, rev:3538
https://mir-jenkins.ubuntu.com/job/mir-ci/1168/
Executed test runs:
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-mir/1315
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-0-fetch/1366
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-1-sourcepkg/release=vivid+overlay/1357
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-1-sourcepkg/release=xenial/1357
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=clang,platform=mesa,release=vivid+overlay/1328
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=clang,platform=mesa,release=vivid+overlay/1328/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=xenial/1328
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=xenial/1328/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/1328
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=cross-armhf,compiler=gcc,platform=android,release=vivid+overlay/1328/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/1328
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=i386,compiler=gcc,platform=android,release=vivid+overlay/1328/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=i386,compiler=gcc,platform=mesa,release=xenial/1328
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=i386,compiler=gcc,platform=mesa,release=xenial/1328/artifact/output/*zip*/output.zip

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

review: Approve (continuous-integration)
Revision history for this message
Mir CI Bot (mir-ci-bot) wrote :

FAILED: Continuous integration, rev:3539
https://mir-jenkins.ubuntu.com/job/mir-ci/1169/
Executed test runs:
    FAILURE: https://mir-jenkins.ubuntu.com/job/build-mir/1316/console
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-0-fetch/1367
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-1-sourcepkg/release=vivid+overlay/1358
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-1-sourcepkg/release=xenial/1358
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=clang,platform=mesa,release=vivid+overlay/1329
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=clang,platform=mesa,release=vivid+overlay/1329/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=xenial/1329
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=xenial/1329/artifact/output/*zip*/output.zip
    FAILURE: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=cross-armhf,compiler=gcc,platform=android,release=vivid+overlay/1329/console
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=cross-armhf,compiler=gcc,platform=android,release=vivid+overlay/1329/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/1329
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=i386,compiler=gcc,platform=android,release=vivid+overlay/1329/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=i386,compiler=gcc,platform=mesa,release=xenial/1329
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=i386,compiler=gcc,platform=mesa,release=xenial/1329/artifact/output/*zip*/output.zip

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

review: Needs Fixing (continuous-integration)
Revision history for this message
Andreas Pokorny (andreas-pokorny) wrote :

Not blocking: A piece is missing here: the handling of surface movements... I.e. imagine a window manager short cut that changes the window position on screen i.e. toggles form full screen to windows or back - without loosing focus.

I am not sure who should be in charge of that. In the past in mirserver we would use a surface change observer. With AbstractShell we might want to have a move_resize_surface_to(...) that handles that and more things...

Codewise a suggestion:

void mi::SeatInputDeviceTracker::set_confinement_regions(geometry::Rectangles const& regions)
+{
+ confine_function = [regions,this](mir::geometry::Point& pos)
+ {
+ regions.confine(pos);
+ input_region->confine(pos);
+ };
+}
+
+void mi::SeatInputDeviceTracker::reset_confinement_regions()
+{
+ confine_function = [this](geometry::Point& pos) {input_region->confine(pos);};
+}
+
+void mi::SeatInputDeviceTracker::confine_pointer()
+{
     mir::geometry::Point const old{cursor_x, cursor_y};
     auto confined = old;
- input_region->confine(confined);
+ confine_function(confined);
     if (confined.x != old.x) cursor_x = confined.x.as_int();
     if (confined.y != old.y) cursor_y = confined.y.as_int();
+}
+
+void mi::SeatInputDeviceTracker::update_cursor(MirPointerEvent const* event)
+{
+ cursor_x += mir_pointer_event_axis_value(event, mir_pointer_axis_relative_x);
+ cursor_y += mir_pointer_event_axis_value(event, mir_pointer_axis_relative_y);
+
+ confine_pointer();

and just let confine_function be a std::function<void(geometry::Point&)> confine_function initialized like reset_confinement_regions.

hmm is that a needs fixing..

Revision history for this message
Brandon Schaefer (brandontschaefer) wrote :

O i like that!

Revision history for this message
Mir CI Bot (mir-ci-bot) wrote :

FAILED: Continuous integration, rev:3542
https://mir-jenkins.ubuntu.com/job/mir-ci/1183/
Executed test runs:
    FAILURE: https://mir-jenkins.ubuntu.com/job/build-mir/1338/console
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-0-fetch/1389
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-1-sourcepkg/release=vivid+overlay/1380
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-1-sourcepkg/release=xenial/1380
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=clang,platform=mesa,release=vivid+overlay/1352
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=clang,platform=mesa,release=vivid+overlay/1352/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=xenial/1352
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=xenial/1352/artifact/output/*zip*/output.zip
    FAILURE: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=cross-armhf,compiler=gcc,platform=android,release=vivid+overlay/1352/console
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=cross-armhf,compiler=gcc,platform=android,release=vivid+overlay/1352/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/1352
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=i386,compiler=gcc,platform=android,release=vivid+overlay/1352/artifact/output/*zip*/output.zip
    FAILURE: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=i386,compiler=gcc,platform=mesa,release=xenial/1352/console

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

review: Needs Fixing (continuous-integration)
Revision history for this message
Andreas Pokorny (andreas-pokorny) wrote :

lgtm

review: Approve
Revision history for this message
Chris Halse Rogers (raof) wrote :

747 -#include <gmock/gmock.h>
747 +#include "mir/input/device.h"
748 +#include "mir/test/gmock_fixes.h"

You've accidentally removed <gmock/gmock.h> and replaced it with (the unnecessary, I think?) gmock_fixes.h.

Not blocking, but if you need to update it for any other reason, please fix.

Other than that, looks fine.

review: Approve
Revision history for this message
Kevin DuBois (kdub) wrote :

lgtm too

review: Approve
Revision history for this message
Cemil Azizoglu (cemil-azizoglu) wrote :

25 + virtual void set_confine_pointer(MirPointerConfinementState state) = 0;

set_confine_pointer_state would be more consistent, IMO.
-----------------------------------------------------

285 + geometry::Rectangles pointer_confinment_regions;

s/pointer_confinment_regions/pointer_confinement_regions

review: Needs Fixing
Revision history for this message
Cemil Azizoglu (cemil-azizoglu) wrote :

Looks good

review: Approve
Revision history for this message
Mir CI Bot (mir-ci-bot) wrote :

PASSED: Continuous integration, rev:3544
https://mir-jenkins.ubuntu.com/job/mir-ci/1203/
Executed test runs:
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-mir/1376
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-0-fetch/1427
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-1-sourcepkg/release=vivid+overlay/1418
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-1-sourcepkg/release=xenial/1418
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=clang,platform=mesa,release=vivid+overlay/1390
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=clang,platform=mesa,release=vivid+overlay/1390/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=xenial/1390
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=xenial/1390/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/1390
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=cross-armhf,compiler=gcc,platform=android,release=vivid+overlay/1390/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/1390
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=i386,compiler=gcc,platform=android,release=vivid+overlay/1390/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=i386,compiler=gcc,platform=mesa,release=xenial/1390
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=i386,compiler=gcc,platform=mesa,release=xenial/1390/artifact/output/*zip*/output.zip

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

review: Approve (continuous-integration)

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