Mir

Merge lp://qastaging/~raof/mir/report-invalid-window-state into lp://qastaging/mir

Proposed by Chris Halse Rogers
Status: Rejected
Rejected by: Chris Halse Rogers
Proposed branch: lp://qastaging/~raof/mir/report-invalid-window-state
Merge into: lp://qastaging/mir
Diff against target: 863 lines (+389/-21) (has conflicts)
31 files modified
include/client/mir/events/event_builders.h (+3/-0)
include/client/mir_toolkit/client_types.h (+24/-0)
include/client/mir_toolkit/events/error_event.h (+42/-0)
include/client/mir_toolkit/events/event.h (+5/-0)
include/common/mir/mir_error.h (+3/-3)
include/server/mir/scene/surface_observer.h (+2/-0)
src/capnproto/mir_event.capnp (+7/-0)
src/client/CMakeLists.txt (+1/-2)
src/client/event.cpp (+14/-0)
src/client/events/event_builders.cpp (+10/-0)
src/client/mir_connection.cpp (+1/-1)
src/client/mir_error_api.cpp (+1/-1)
src/client/mir_surface.cpp (+0/-2)
src/client/rpc/mir_protobuf_rpc_channel.cpp (+1/-1)
src/client/symbols.map (+6/-0)
src/common/CMakeLists.txt (+5/-1)
src/common/events/CMakeLists.txt (+4/-1)
src/common/events/error_event.cpp (+52/-0)
src/common/events/event.cpp (+8/-0)
src/common/mir_error.cpp (+1/-1)
src/common/symbols.map (+15/-0)
src/include/common/mir/events/error_event.h (+32/-0)
src/include/common/mir/events/event.h (+25/-1)
src/include/common/mir/events/event_private.h (+1/-0)
src/server/input/android/input_sender.cpp (+2/-1)
src/server/scene/basic_surface.cpp (+4/-0)
src/server/shell/CMakeLists.txt (+10/-4)
src/server/shell/abstract_shell.cpp (+37/-0)
tests/acceptance-tests/test_client_library.cpp (+71/-0)
tests/mir_test_framework/headless_test.cpp (+1/-1)
tests/unit-tests/client/test_client_mir_error.cpp (+1/-1)
Text conflict in include/client/mir_toolkit/client_types.h
Text conflict in tests/acceptance-tests/test_client_library.cpp
To merge this branch: bzr merge lp://qastaging/~raof/mir/report-invalid-window-state
Reviewer Review Type Date Requested Status
Alan Griffiths Disapprove
Mir CI Bot continuous-integration Needs Fixing
Review via email: mp+315864@code.qastaging.launchpad.net

Commit message

(Asynchronously) Report invalid window-state errors.

Description of the change

This is the first part of a replacement for MirWaitHandle in mir_window_set_sate() - ensuring the client either gets a mir_event_type_window event changing it to the requested state or an error event.

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

FAILED: Continuous integration, rev:3974
https://mir-jenkins.ubuntu.com/job/mir-ci/2894/
Executed test runs:
    FAILURE: https://mir-jenkins.ubuntu.com/job/build-mir/3822/console
    FAILURE: https://mir-jenkins.ubuntu.com/job/build-0-fetch/3901/console
    FAILURE: https://mir-jenkins.ubuntu.com/job/build-1-sourcepkg/release=vivid+overlay/3891/console
    FAILURE: https://mir-jenkins.ubuntu.com/job/build-1-sourcepkg/release=xenial+overlay/3891/console
    FAILURE: https://mir-jenkins.ubuntu.com/job/build-1-sourcepkg/release=zesty/3891/console
    FAILURE: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=clang,platform=mesa,release=zesty/3849/console
    FAILURE: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=xenial+overlay/3849/console
    FAILURE: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=zesty/3849/console
    FAILURE: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=cross-armhf,compiler=gcc,platform=android,release=vivid+overlay/3849/console
    FAILURE: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=i386,compiler=gcc,platform=android,release=vivid+overlay/3849/console
    FAILURE: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=i386,compiler=gcc,platform=mesa,release=xenial+overlay/3849/console

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

review: Needs Fixing (continuous-integration)
Revision history for this message
Alan Griffiths (alan-griffiths) wrote :

"This is the first part of a replacement for MirWaitHandle in mir_window_set_sate()..."

The legacy wait handle in mir_surface_set_state() is useless, because the only guarantee it can provide is that the server has received the request. In particular, Unity8 passes the decision off to another thread while the RPC completes.

Because it would be useless mir_window_set_state() does *not* provide a wait handle.

"...ensuring the client either gets a mir_event_type_window event changing it to the requested state or an error event."

Is this a reasonable expectation?

The validation introduced in msh::AbstractShell::set_surface_attribute() happens before invoking the window management policy. Window managers can decide to reinterpret the request as neither the requested state nor an error. Or even chose a different state.

In any case, msh::AbstractShell::set_surface_attribute() is the wrong place to detect an "error" as acting on the request may occur on another thread (e.g. Unity8). There is no simple way to know that a surface state change actioned by Unity8 is related to a client request.

Finally, the client can make a similar request using a WindowSpec, that doesn't give the same guarantees.

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

> "This is the first part of a replacement for MirWaitHandle in
> mir_window_set_sate()..."
>
> The legacy wait handle in mir_surface_set_state() is useless, because the only
> guarantee it can provide is that the server has received the request. In
> particular, Unity8 passes the decision off to another thread while the RPC
> completes.
>
> Because it would be useless mir_window_set_state() does *not* provide a wait
> handle.
>
> "...ensuring the client either gets a mir_event_type_window event changing it
> to the requested state or an error event."
>
> Is this a reasonable expectation?

A bunch of our acceptance tests require that they know when a set_state call has succeeded or failed. It's plausible to me that non-test clients would also want to know this information.

>
> The validation introduced in msh::AbstractShell::set_surface_attribute()
> happens before invoking the window management policy. Window managers can
> decide to reinterpret the request as neither the requested state nor an error.
> Or even chose a different state.

The current validation is ‘is this a valid MirWindowState value’, which the window manager should not be able to ignore, and which we should filter out before the window manager gets to act.

>
> In any case, msh::AbstractShell::set_surface_attribute() is the wrong place to
> detect an "error" as acting on the request may occur on another thread (e.g.
> Unity8). There is no simple way to know that a surface state change actioned
> by Unity8 is related to a client request.

So, this suggests two things:
1) set_surface_attribute() incorrectly returns a value, and
2) My follow-up branch to send a state_change_rejected event needs to be to unity8 as well as Mir.

>
> Finally, the client can make a similar request using a WindowSpec, that
> doesn't give the same guarantees.

That is indeed a required follow up branch, yes :)

Unmerged revisions

3974. By Chris Halse Rogers

(Asynchronously) Report invalid window-state errors.

3973. By Chris Halse Rogers

Add the ability to store a blob of data in MirEvent.

This is only scratch space, tied to the process' MirEvent object, not serialised
or sent over the wire.

It is useful for interfaces which require translation between what's natively possible
with the CapnProto structs and the mirclient interface.

3972. By Chris Halse Rogers

Move MirError into common.

I want to add a MirErrorEvent variant to MirEvent, and that requires MirError
be in common.

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