Mir

Merge lp:~alan-griffiths/mir/request-with-authority into lp:mir

Proposed by Alan Griffiths
Status: Merged
Approved by: Alan Griffiths
Approved revision: no longer in the source branch.
Merged at revision: 4122
Proposed branch: lp:~alan-griffiths/mir/request-with-authority
Merge into: lp:mir
Diff against target: 530 lines (+111/-157)
12 files modified
src/client/mir_surface.cpp (+16/-22)
src/client/mir_surface.h (+1/-1)
src/client/rpc/mir_display_server.cpp (+2/-10)
src/client/rpc/mir_display_server.h (+2/-6)
src/include/common/mir/protobuf/display_server.h (+2/-6)
src/protobuf/mir_protobuf.proto (+7/-5)
src/protobuf/symbols.map (+21/-20)
src/server/frontend/protobuf_message_processor.cpp (+2/-6)
src/server/frontend/session_mediator.cpp (+16/-25)
src/server/frontend/session_mediator.h (+2/-6)
tests/include/mir/test/doubles/stub_display_server.h (+36/-48)
tests/unit-tests/frontend/test_session_mediator.cpp (+4/-2)
To merge this branch: bzr merge lp:~alan-griffiths/mir/request-with-authority
Reviewer Review Type Date Requested Status
Andreas Pokorny (community) Approve
Mir CI Bot continuous-integration Approve
Review via email: mp+320825@code.launchpad.net

Commit message

Refactor RPC to provide a more generic approach to window management requests that need authorization.

Description of the change

Refactor RPC to provide a more generic approach to window management requests that need authorization.

My intention is to support new APIs using this RPC. Vis:

void mir_window_request_user_move(MirWindow* window, MirCookie const* cookie);
void mir_window_request_user_resize(MirWindow* window, MirCookie const* cookie);

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

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

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

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

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

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

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

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

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

review: Needs Fixing (continuous-integration)
Revision history for this message
Alan Griffiths (alan-griffiths) wrote :
Revision history for this message
Mir CI Bot (mir-ci-bot) wrote :

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

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

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

I assume you plan to track MirCookie -> down-move-up gestures in mirserver - so stating the MirCookie is sufficient to identify the specific touch contact on the touchscreen or the specific pointing device, that when successfully matched will be tracked for motion?

lgtm otherwise

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

> I assume you plan to track MirCookie -> down-move-up gestures in mirserver -
> so stating the MirCookie is sufficient to identify the specific touch contact
> on the touchscreen or the specific pointing device, that when successfully
> matched will be tracked for motion?

Agreed, the window management policy needs the event to correctly interpret the request.

I didn't fancy introducing a transport mechanism to forward input events from the client to the server. Tracking the latest event (like the existing tracking of its timestamp) on the server seems far simpler.

Revision history for this message
Andreas Pokorny (andreas-pokorny) wrote :

> > I assume you plan to track MirCookie -> down-move-up gestures in mirserver -
> > so stating the MirCookie is sufficient to identify the specific touch
> contact
> > on the touchscreen or the specific pointing device, that when successfully
> > matched will be tracked for motion?
>
> Agreed, the window management policy needs the event to correctly interpret
> the request.
>
> I didn't fancy introducing a transport mechanism to forward input events from
> the client to the server. Tracking the latest event (like the existing
> tracking of its timestamp) on the server seems far simpler.

yes...

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/client/mir_surface.cpp'
2--- src/client/mir_surface.cpp 2017-03-23 17:23:58 +0000
3+++ src/client/mir_surface.cpp 2017-03-24 10:59:54 +0000
4@@ -585,34 +585,28 @@
5
6 void MirSurface::raise_surface(MirCookie const* cookie)
7 {
8- mp::RaiseRequest raise_request;
9-
10- std::unique_lock<decltype(mutex)> lock(mutex);
11- raise_request.mutable_surface_id()->set_value(surface->id().value());
12-
13- auto const event_cookie = raise_request.mutable_cookie();
14-
15- event_cookie->set_cookie(cookie->cookie().data(), cookie->size());
16-
17- server->raise_surface(
18- &raise_request,
19- void_response.get(),
20- google::protobuf::NewCallback(google::protobuf::DoNothing));
21+ request_operation(cookie, mp::RequestOperation::MAKE_ACTIVE);
22 }
23
24 void MirSurface::request_drag_and_drop(MirCookie const* cookie)
25 {
26- mp::RequestAuthority authority;
27+ request_operation(cookie, mp::RequestOperation::START_DRAG_AND_DROP);
28+}
29+
30+void MirSurface::request_operation(MirCookie const* cookie, mir::protobuf::RequestOperation operation) const
31+{
32+ mir::protobuf::RequestWithAuthority request;
33+ request.set_operation(operation);
34
35 std::unique_lock<decltype(mutex)> lock(mutex);
36- authority.mutable_surface_id()->set_value(surface->id().value());
37-
38- auto const event_cookie = authority.mutable_cookie();
39-
40- event_cookie->set_cookie(cookie->cookie().data(), cookie->size());
41-
42- server->request_drag_and_drop(
43- &authority,
44+ request.mutable_surface_id()->set_value(surface->id().value());
45+
46+ auto const event_authority = request.mutable_authority();
47+
48+ event_authority->set_cookie(cookie->cookie().data(), cookie->size());
49+
50+ server->request_operation(
51+ &request,
52 void_response.get(),
53 google::protobuf::NewCallback(google::protobuf::DoNothing));
54 }
55
56=== modified file 'src/client/mir_surface.h'
57--- src/client/mir_surface.h 2017-03-23 17:23:58 +0000
58+++ src/client/mir_surface.h 2017-03-24 10:59:54 +0000
59@@ -229,6 +229,7 @@
60 void on_configured();
61 void on_cursor_configured();
62 void acquired_persistent_id(MirWindowIdCallback callback, void* context);
63+ void request_operation(MirCookie const* cookie, mir::protobuf::RequestOperation operation) const;
64
65 mir::client::rpc::DisplayServer* const server{nullptr};
66 mir::client::rpc::DisplayServerDebug* const debug{nullptr};
67@@ -274,7 +275,6 @@
68 MirPixelFormat format;
69 MirBufferUsage usage;
70 uint32_t output_id;
71-
72 };
73
74 #pragma GCC diagnostic pop
75
76=== modified file 'src/client/rpc/mir_display_server.cpp'
77--- src/client/rpc/mir_display_server.cpp 2017-03-08 12:13:23 +0000
78+++ src/client/rpc/mir_display_server.cpp 2017-03-24 10:59:54 +0000
79@@ -231,16 +231,8 @@
80 {
81 channel->call_method(std::string(__func__), request, response, done);
82 }
83-void mclr::DisplayServer::raise_surface(
84- mir::protobuf::RaiseRequest const* request,
85- mir::protobuf::Void* response,
86- google::protobuf::Closure* done)
87-{
88- channel->call_method(std::string(__func__), request, response, done);
89-}
90-
91-void mclr::DisplayServer::request_drag_and_drop(
92- mir::protobuf::RequestAuthority const* request,
93+void mclr::DisplayServer::request_operation(
94+ mir::protobuf::RequestWithAuthority const* request,
95 mir::protobuf::Void* response,
96 google::protobuf::Closure* done)
97 {
98
99=== modified file 'src/client/rpc/mir_display_server.h'
100--- src/client/rpc/mir_display_server.h 2017-03-08 12:13:23 +0000
101+++ src/client/rpc/mir_display_server.h 2017-03-24 10:59:54 +0000
102@@ -151,12 +151,8 @@
103 mir::protobuf::StreamConfiguration const* request,
104 mir::protobuf::Void* response,
105 google::protobuf::Closure* done) override;
106- void raise_surface(
107- mir::protobuf::RaiseRequest const* request,
108- mir::protobuf::Void* response,
109- google::protobuf::Closure* done) override;
110- void request_drag_and_drop(
111- mir::protobuf::RequestAuthority const* request,
112+ void request_operation(
113+ mir::protobuf::RequestWithAuthority const* request,
114 mir::protobuf::Void* response,
115 google::protobuf::Closure* done) override;
116 void apply_input_configuration(
117
118=== modified file 'src/include/common/mir/protobuf/display_server.h'
119--- src/include/common/mir/protobuf/display_server.h 2017-03-08 12:13:23 +0000
120+++ src/include/common/mir/protobuf/display_server.h 2017-03-24 10:59:54 +0000
121@@ -147,12 +147,8 @@
122 mir::protobuf::StreamConfiguration const* request,
123 mir::protobuf::Void* response,
124 google::protobuf::Closure* done) = 0;
125- virtual void raise_surface(
126- mir::protobuf::RaiseRequest const* request,
127- mir::protobuf::Void* response,
128- google::protobuf::Closure* done) = 0;
129- virtual void request_drag_and_drop(
130- mir::protobuf::RequestAuthority const* request,
131+ virtual void request_operation(
132+ mir::protobuf::RequestWithAuthority const* request,
133 mir::protobuf::Void* response,
134 google::protobuf::Closure* done) = 0;
135 virtual void apply_input_configuration(
136
137=== modified file 'src/protobuf/mir_protobuf.proto'
138--- src/protobuf/mir_protobuf.proto 2017-03-15 09:30:18 +0000
139+++ src/protobuf/mir_protobuf.proto 2017-03-24 10:59:54 +0000
140@@ -439,14 +439,16 @@
141 required bytes cookie = 1;
142 }
143
144-message RaiseRequest {
145- required Cookie cookie = 1;
146- required SurfaceId surface_id = 2;
147+enum RequestOperation {
148+ UNKNOWN = 0;
149+ START_DRAG_AND_DROP = 1;
150+ MAKE_ACTIVE = 2;
151 }
152
153-message RequestAuthority {
154- required Cookie cookie = 1;
155+message RequestWithAuthority {
156+ required Cookie authority = 1;
157 required SurfaceId surface_id = 2;
158+ required RequestOperation operation = 3;
159 }
160
161 message InputDevices {
162
163=== modified file 'src/protobuf/symbols.map'
164--- src/protobuf/symbols.map 2017-03-08 12:13:23 +0000
165+++ src/protobuf/symbols.map 2017-03-24 10:59:54 +0000
166@@ -1116,25 +1116,26 @@
167 MIR_PROTOBUF_0.27 {
168 global:
169 extern "C++" {
170- mir::protobuf::RequestAuthority::ByteSize*;
171- mir::protobuf::RequestAuthority::CheckTypeAndMergeFrom*;
172- mir::protobuf::RequestAuthority::Clear*;
173- mir::protobuf::RequestAuthority::CopyFrom*;
174- mir::protobuf::RequestAuthority::default_instance*;
175- mir::protobuf::RequestAuthority::DiscardUnknownFields*;
176- mir::protobuf::RequestAuthority::GetTypeName*;
177- mir::protobuf::RequestAuthority::IsInitialized*;
178- mir::protobuf::RequestAuthority::kCookieFieldNumber*;
179- mir::protobuf::RequestAuthority::kSurfaceIdFieldNumber*;
180- mir::protobuf::RequestAuthority::MergeFrom*;
181- mir::protobuf::RequestAuthority::MergePartialFromCodedStream*;
182- mir::protobuf::RequestAuthority::New*;
183- mir::protobuf::RequestAuthority::?RequestAuthority*;
184- mir::protobuf::RequestAuthority::RequestAuthority*;
185- mir::protobuf::RequestAuthority::SerializeWithCachedSizes*;
186- mir::protobuf::RequestAuthority::Swap*;
187- non-virtual?thunk?to?mir::protobuf::RequestAuthority::?RequestAuthority*;
188- typeinfo?for?mir::protobuf::RequestAuthority;
189- vtable?for?mir::protobuf::RequestAuthority;
190+ mir::protobuf::RequestOperation_IsValid*;
191+ mir::protobuf::RequestWithAuthority::ByteSize*;
192+ mir::protobuf::RequestWithAuthority::CheckTypeAndMergeFrom*;
193+ mir::protobuf::RequestWithAuthority::Clear*;
194+ mir::protobuf::RequestWithAuthority::CopyFrom*;
195+ mir::protobuf::RequestWithAuthority::default_instance*;
196+ mir::protobuf::RequestWithAuthority::DiscardUnknownFields*;
197+ mir::protobuf::RequestWithAuthority::GetTypeName*;
198+ mir::protobuf::RequestWithAuthority::IsInitialized*;
199+ mir::protobuf::RequestWithAuthority::kCookieFieldNumber*;
200+ mir::protobuf::RequestWithAuthority::kSurfaceIdFieldNumber*;
201+ mir::protobuf::RequestWithAuthority::MergeFrom*;
202+ mir::protobuf::RequestWithAuthority::MergePartialFromCodedStream*;
203+ mir::protobuf::RequestWithAuthority::New*;
204+ mir::protobuf::RequestWithAuthority::?RequestWithAuthority*;
205+ mir::protobuf::RequestWithAuthority::RequestWithAuthority*;
206+ mir::protobuf::RequestWithAuthority::SerializeWithCachedSizes*;
207+ mir::protobuf::RequestWithAuthority::Swap*;
208+ non-virtual?thunk?to?mir::protobuf::RequestWithAuthority::?RequestWithAuthority*;
209+ typeinfo?for?mir::protobuf::RequestWithAuthority;
210+ vtable?for?mir::protobuf::RequestWithAuthority;
211 };
212 } MIR_PROTOBUF_0.26;
213
214=== modified file 'src/server/frontend/protobuf_message_processor.cpp'
215--- src/server/frontend/protobuf_message_processor.cpp 2017-03-09 12:42:29 +0000
216+++ src/server/frontend/protobuf_message_processor.cpp 2017-03-24 10:59:54 +0000
217@@ -305,9 +305,9 @@
218 {
219 invoke(this, display_server.get(), &protobuf::DisplayServer::stop_prompt_session, invocation);
220 }
221- else if ("request_drag_and_drop" == invocation.method_name())
222+ else if ("request_operation" == invocation.method_name())
223 {
224- invoke(this, display_server.get(), &protobuf::DisplayServer::request_drag_and_drop, invocation);
225+ invoke(this, display_server.get(), &protobuf::DisplayServer::request_operation, invocation);
226 }
227 else if ("disconnect" == invocation.method_name())
228 {
229@@ -322,10 +322,6 @@
230 {
231 invoke(this, display_server.get(), &DisplayServer::configure_buffer_stream, invocation);
232 }
233- else if ("raise_surface" == invocation.method_name())
234- {
235- invoke(this, display_server.get(), &DisplayServer::raise_surface, invocation);
236- }
237 else if ("translate_surface_to_screen" == invocation.method_name())
238 {
239 try
240
241=== modified file 'src/server/frontend/session_mediator.cpp'
242--- src/server/frontend/session_mediator.cpp 2017-03-15 09:30:18 +0000
243+++ src/server/frontend/session_mediator.cpp 2017-03-24 10:59:54 +0000
244@@ -1153,36 +1153,15 @@
245 done->Run();
246 }
247
248-void mf::SessionMediator::raise_surface(
249- mir::protobuf::RaiseRequest const* request,
250- mir::protobuf::Void*,
251- google::protobuf::Closure* done)
252-{
253- auto const session = weak_session.lock();
254- if (!session)
255- BOOST_THROW_EXCEPTION(std::logic_error("Invalid application session"));
256-
257- auto const cookie = request->cookie();
258- auto const surface_id = request->surface_id();
259-
260- auto cookie_string = cookie.cookie();
261-
262- std::vector<uint8_t> cookie_bytes(cookie_string.begin(), cookie_string.end());
263- auto const cookie_ptr = cookie_authority->make_cookie(cookie_bytes);
264-
265- shell->raise_surface(session, mf::SurfaceId{surface_id.value()}, cookie_ptr->timestamp());
266-
267- done->Run();
268-}
269-
270-void mir::frontend::SessionMediator::request_drag_and_drop(mir::protobuf::RequestAuthority const* request,
271+void mir::frontend::SessionMediator::request_operation(
272+ mir::protobuf::RequestWithAuthority const* request,
273 mir::protobuf::Void*, google::protobuf::Closure* done)
274 {
275 auto const session = weak_session.lock();
276 if (!session)
277 BOOST_THROW_EXCEPTION(std::logic_error("Invalid application session"));
278
279- auto const cookie = request->cookie();
280+ auto const cookie = request->authority();
281 auto const surface_id = request->surface_id();
282
283 auto cookie_string = cookie.cookie();
284@@ -1190,7 +1169,19 @@
285 std::vector<uint8_t> cookie_bytes(cookie_string.begin(), cookie_string.end());
286 auto const cookie_ptr = cookie_authority->make_cookie(cookie_bytes);
287
288- shell->request_drag_and_drop(session, mf::SurfaceId{surface_id.value()}, cookie_ptr->timestamp());
289+ switch (request->operation())
290+ {
291+ case mir::protobuf::RequestOperation::START_DRAG_AND_DROP:
292+ shell->request_drag_and_drop(session, mf::SurfaceId{surface_id.value()}, cookie_ptr->timestamp());
293+ break;
294+
295+ case mir::protobuf::RequestOperation::MAKE_ACTIVE:
296+ shell->raise_surface(session, mf::SurfaceId{surface_id.value()}, cookie_ptr->timestamp());
297+ break;
298+
299+ default:
300+ break;
301+ }
302
303 done->Run();
304 }
305
306=== modified file 'src/server/frontend/session_mediator.h'
307--- src/server/frontend/session_mediator.h 2017-03-15 09:30:18 +0000
308+++ src/server/frontend/session_mediator.h 2017-03-24 10:59:54 +0000
309@@ -245,12 +245,8 @@
310 mir::protobuf::StreamConfiguration const* request,
311 mir::protobuf::Void*,
312 google::protobuf::Closure* done) override;
313- void raise_surface(
314- mir::protobuf::RaiseRequest const* request,
315- mir::protobuf::Void*,
316- google::protobuf::Closure* done) override;
317- void request_drag_and_drop(
318- mir::protobuf::RequestAuthority const* request,
319+ void request_operation(
320+ mir::protobuf::RequestWithAuthority const* request,
321 mir::protobuf::Void*,
322 google::protobuf::Closure* done) override;
323 void apply_input_configuration(
324
325=== modified file 'tests/include/mir/test/doubles/stub_display_server.h'
326--- tests/include/mir/test/doubles/stub_display_server.h 2017-03-08 12:13:23 +0000
327+++ tests/include/mir/test/doubles/stub_display_server.h 2017-03-24 10:59:54 +0000
328@@ -29,147 +29,135 @@
329 {
330 struct StubDisplayServer : public mir::frontend::detail::DisplayServer
331 {
332- void client_pid(int /*pid*/) {}
333+ void client_pid(int /*pid*/) override {}
334 void connect(
335 mir::protobuf::ConnectParameters const* /*request*/,
336 mir::protobuf::Connection* /*response*/,
337- google::protobuf::Closure* /*done*/) {}
338+ google::protobuf::Closure* /*done*/) override {}
339 void disconnect(
340 mir::protobuf::Void const* /*request*/,
341 mir::protobuf::Void* /*response*/,
342- google::protobuf::Closure* /*done*/) {}
343+ google::protobuf::Closure* /*done*/) override {}
344 void create_surface(
345 mir::protobuf::SurfaceParameters const* /*request*/,
346 mir::protobuf::Surface* /*response*/,
347- google::protobuf::Closure* /*done*/) {}
348+ google::protobuf::Closure* /*done*/) override {}
349 void modify_surface(
350 mir::protobuf::SurfaceModifications const* /*request*/,
351 mir::protobuf::Void* /*response*/,
352- google::protobuf::Closure* /*done*/) {}
353- void swap_buffers(
354- mir::protobuf::SurfaceId const* /*request*/,
355- mir::protobuf::Buffer* /*response*/,
356- google::protobuf::Closure* /*done*/) {}
357+ google::protobuf::Closure* /*done*/) override {}
358 void release_surface(
359 mir::protobuf::SurfaceId const* /*request*/,
360 mir::protobuf::Void* /*response*/,
361- google::protobuf::Closure* /*done*/) {}
362+ google::protobuf::Closure* /*done*/) override {}
363 void platform_operation(
364 mir::protobuf::PlatformOperationMessage const* /*request*/,
365 mir::protobuf::PlatformOperationMessage* /*response*/,
366- google::protobuf::Closure* /*done*/) {}
367+ google::protobuf::Closure* /*done*/) override {}
368 void configure_surface(
369 mir::protobuf::SurfaceSetting const* /*request*/,
370 mir::protobuf::SurfaceSetting* /*response*/,
371- google::protobuf::Closure* /*done*/) {}
372+ google::protobuf::Closure* /*done*/) override {}
373 void configure_display(
374 mir::protobuf::DisplayConfiguration const* /*request*/,
375 mir::protobuf::DisplayConfiguration* /*response*/,
376- google::protobuf::Closure* /*done*/) {}
377+ google::protobuf::Closure* /*done*/) override {}
378 void remove_session_configuration(
379 mir::protobuf::Void const* /*request*/,
380 mir::protobuf::Void* /*response*/,
381- google::protobuf::Closure* /*done*/) {}
382+ google::protobuf::Closure* /*done*/) override {}
383 void set_base_display_configuration(
384 mir::protobuf::DisplayConfiguration const* /*request*/,
385 mir::protobuf::Void* /*response*/,
386- google::protobuf::Closure* /*done*/) {}
387+ google::protobuf::Closure* /*done*/) override {}
388 void preview_base_display_configuration(
389 mir::protobuf::PreviewConfiguration const* /*request*/,
390 mir::protobuf::Void* /*response*/,
391- google::protobuf::Closure* /*done*/) {}
392+ google::protobuf::Closure* /*done*/) override {}
393 void confirm_base_display_configuration(
394 mir::protobuf::DisplayConfiguration const* /*request*/,
395 mir::protobuf::Void* /*response*/,
396- google::protobuf::Closure* /*done*/) {}
397+ google::protobuf::Closure* /*done*/) override {}
398 void cancel_base_display_configuration_preview(
399 mir::protobuf::Void const* /*request*/,
400 mir::protobuf::Void* /*response*/,
401- google::protobuf::Closure* /*done*/) {}
402+ google::protobuf::Closure* /*done*/) override {}
403 void create_screencast(
404 mir::protobuf::ScreencastParameters const* /*request*/,
405 mir::protobuf::Screencast* /*response*/,
406- google::protobuf::Closure* /*done*/) {}
407+ google::protobuf::Closure* /*done*/) override {}
408 void screencast_buffer(
409 mir::protobuf::ScreencastId const* /*request*/,
410 mir::protobuf::Buffer* /*response*/,
411- google::protobuf::Closure* /*done*/) {}
412+ google::protobuf::Closure* /*done*/) override {}
413 void screencast_to_buffer(
414 mir::protobuf::ScreencastRequest const*,
415 mir::protobuf::Void*,
416- google::protobuf::Closure*) {}
417+ google::protobuf::Closure*) override {}
418 void release_screencast(
419 mir::protobuf::ScreencastId const* /*request*/,
420 mir::protobuf::Void* /*response*/,
421- google::protobuf::Closure* /*done*/) {}
422+ google::protobuf::Closure* /*done*/) override {}
423 void create_buffer_stream(
424 mir::protobuf::BufferStreamParameters const* /*request*/,
425 mir::protobuf::BufferStream* /*response*/,
426- google::protobuf::Closure* /*done*/) {}
427+ google::protobuf::Closure* /*done*/) override {}
428 void release_buffer_stream(
429 mir::protobuf::BufferStreamId const* /*request*/,
430 mir::protobuf::Void* /*response*/,
431- google::protobuf::Closure* /*done*/) {}
432+ google::protobuf::Closure* /*done*/) override {}
433 void configure_cursor(
434 mir::protobuf::CursorSetting const* /*request*/,
435 mir::protobuf::Void* /*response*/,
436- google::protobuf::Closure* /*done*/) {}
437+ google::protobuf::Closure* /*done*/) override {}
438 void new_fds_for_prompt_providers(
439 mir::protobuf::SocketFDRequest const* /*request*/,
440 mir::protobuf::SocketFD* /*response*/,
441- google::protobuf::Closure* /*done*/) {}
442+ google::protobuf::Closure* /*done*/) override {}
443 void start_prompt_session(
444 mir::protobuf::PromptSessionParameters const* /*request*/,
445 mir::protobuf::PromptSession* /*response*/,
446- google::protobuf::Closure* /*done*/) {}
447+ google::protobuf::Closure* /*done*/) override {}
448 void stop_prompt_session(
449 mir::protobuf::PromptSession const* /*request*/,
450 mir::protobuf::Void* /*response*/,
451- google::protobuf::Closure* /*done*/) {}
452- void exchange_buffer(
453- mir::protobuf::BufferRequest const* /*request*/,
454- mir::protobuf::Buffer* /*response*/,
455- google::protobuf::Closure* /*done*/) {}
456+ google::protobuf::Closure* /*done*/) override {}
457 void submit_buffer(
458 mir::protobuf::BufferRequest const* /*request*/,
459 mir::protobuf::Void* /*response*/,
460- google::protobuf::Closure* /*done*/) {}
461+ google::protobuf::Closure* /*done*/) override {}
462 void allocate_buffers(
463 mir::protobuf::BufferAllocation const* /*request*/,
464 mir::protobuf::Void* /*response*/,
465- google::protobuf::Closure* /*done*/) {}
466+ google::protobuf::Closure* /*done*/) override {}
467 void release_buffers(
468 mir::protobuf::BufferRelease const* /*request*/,
469 mir::protobuf::Void* /*response*/,
470- google::protobuf::Closure* /*done*/) {}
471+ google::protobuf::Closure* /*done*/) override {}
472 void request_persistent_surface_id(
473 mir::protobuf::SurfaceId const* /*request*/,
474 mir::protobuf::PersistentSurfaceId* /*response*/,
475- google::protobuf::Closure* /*done*/) {}
476+ google::protobuf::Closure* /*done*/) override {}
477 void pong(
478 mir::protobuf::PingEvent const* /*request*/,
479 mir::protobuf::Void* /*response*/,
480- google::protobuf::Closure* /*done*/) {}
481+ google::protobuf::Closure* /*done*/) override {}
482 void configure_buffer_stream(
483 mir::protobuf::StreamConfiguration const* /*request*/,
484 mir::protobuf::Void* /*response*/,
485- google::protobuf::Closure* /*done*/) {}
486- void raise_surface(
487- mir::protobuf::RaiseRequest const* /*request*/,
488- mir::protobuf::Void* /*response*/,
489- google::protobuf::Closure* /*done*/) {}
490- void request_drag_and_drop(
491- mir::protobuf::RequestAuthority const* /*request*/,
492- mir::protobuf::Void* /*response*/,
493- google::protobuf::Closure* /*done*/) {}
494+ google::protobuf::Closure* /*done*/) override {}
495+ void request_operation(
496+ mir::protobuf::RequestWithAuthority const* /*request*/,
497+ mir::protobuf::Void* /*response*/,
498+ google::protobuf::Closure* /*done*/) override {}
499 void apply_input_configuration(
500 mir::protobuf::InputConfigurationRequest const* /*request*/,
501 mir::protobuf::Void* /*response*/,
502- google::protobuf::Closure* /*done*/) {}
503+ google::protobuf::Closure* /*done*/) override {}
504 void set_base_input_configuration(
505 mir::protobuf::InputConfigurationRequest const* /*request*/,
506 mir::protobuf::Void* /*response*/,
507- google::protobuf::Closure* /*done*/) {}
508+ google::protobuf::Closure* /*done*/) override {}
509
510 };
511
512
513=== modified file 'tests/unit-tests/frontend/test_session_mediator.cpp'
514--- tests/unit-tests/frontend/test_session_mediator.cpp 2017-03-14 04:41:33 +0000
515+++ tests/unit-tests/frontend/test_session_mediator.cpp 2017-03-24 10:59:54 +0000
516@@ -946,11 +946,13 @@
517
518 TEST_F(SessionMediator, raise_with_invalid_cookie_throws)
519 {
520- mp::RaiseRequest raise_request;
521+ mp::RequestWithAuthority raise_request;
522+ raise_request.set_operation(mp::RequestOperation::MAKE_ACTIVE);
523+
524 mediator.connect(&connect_parameters, &connection, null_callback.get());
525
526 EXPECT_THROW({
527- mediator.raise_surface(&raise_request, &void_response, null_callback.get());
528+ mediator.request_operation(&raise_request, &void_response, null_callback.get());
529 }, mir::cookie::SecurityCheckError);
530 }
531

Subscribers

People subscribed via source and target branches