Mir

Merge lp:~vanvugt/mir/occluded-vanity into lp:mir

Proposed by Daniel van Vugt
Status: Merged
Approved by: Chris Halse Rogers
Approved revision: no longer in the source branch.
Merged at revision: 3794
Proposed branch: lp:~vanvugt/mir/occluded-vanity
Merge into: lp:mir
Diff against target: 65 lines (+27/-0)
1 file modified
src/utils/vanity.c (+27/-0)
To merge this branch: bzr merge lp:~vanvugt/mir/occluded-vanity
Reviewer Review Type Date Requested Status
Chris Halse Rogers Approve
Mir CI Bot continuous-integration Approve
Review via email: mp+309333@code.launchpad.net

Commit message

vanity: Handle VT switching and other occlusions

One problem discovered last week trying to run on a single-headed system
was that the act of VT-switching to see your results would immediately
affect the results. This tries to prevent that.

Description of the change

The workaround I landed last week was to just fix the quit keys and quit before VT-switching. But this is better.

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

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

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

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

Seems reasonable.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'src/utils/vanity.c'
--- src/utils/vanity.c 2016-10-21 07:53:23 +0000
+++ src/utils/vanity.c 2016-10-26 10:38:49 +0000
@@ -79,6 +79,7 @@
79 Buffer const* preview;79 Buffer const* preview;
80 int expected_direction;80 int expected_direction;
81 bool reset;81 bool reset;
82 bool occluded;
82} State;83} State;
8384
84static Time now()85static Time now()
@@ -133,6 +134,27 @@
133 return false;134 return false;
134}135}
135136
137static bool on_surface_event(MirSurfaceEvent const* sevent, State* state)
138{
139 MirSurfaceAttrib attrib = mir_surface_event_get_attribute(sevent);
140 int value = mir_surface_event_get_attribute_value(sevent);
141
142 if (attrib == mir_surface_attrib_visibility)
143 {
144 if (value == mir_surface_visibility_exposed)
145 {
146 state->reset = true;
147 state->occluded = false;
148 }
149 else
150 {
151 state->occluded = true;
152 }
153 }
154
155 return false; // Let eglapp handle the same event. We are passive.
156}
157
136static void on_event(MirSurface* surface, MirEvent const* event, void* context)158static void on_event(MirSurface* surface, MirEvent const* event, void* context)
137{159{
138 bool handled = true;160 bool handled = true;
@@ -150,6 +172,9 @@
150 case mir_event_type_input:172 case mir_event_type_input:
151 handled = on_input_event(mir_event_get_input_event(event), state);173 handled = on_input_event(mir_event_get_input_event(event), state);
152 break;174 break;
175 case mir_event_type_surface:
176 handled = on_surface_event(mir_event_get_surface_event(event), state);
177 break;
153 case mir_event_type_resize:178 case mir_event_type_resize:
154 state->resized = true;179 state->resized = true;
155 break;180 break;
@@ -485,6 +510,7 @@
485 int const resolution = 5;510 int const resolution = 5;
486 int see = resolution * interpret(cam, buf);511 int see = resolution * interpret(cam, buf);
487 if ( (see != last_seen_value) &&512 if ( (see != last_seen_value) &&
513 !state->occluded && // Camera is likely seeing other things
488 (acquire_time > state->last_change_time) &&514 (acquire_time > state->last_change_time) &&
489 ( (see > last_seen_value && state->expected_direction > 0) || 515 ( (see > last_seen_value && state->expected_direction > 0) ||
490 (see < last_seen_value && state->expected_direction < 0)516 (see < last_seen_value && state->expected_direction < 0)
@@ -715,6 +741,7 @@
715 0,741 0,
716 NULL,742 NULL,
717 0,743 0,
744 false,
718 false745 false
719 };746 };
720 MirSurface* surface = mir_eglapp_native_surface();747 MirSurface* surface = mir_eglapp_native_surface();

Subscribers

People subscribed via source and target branches