Mir

Merge lp:~alan-griffiths/mir/surface-states-simplification into lp:~mir-team/mir/trunk

Proposed by Alan Griffiths
Status: Superseded
Proposed branch: lp:~alan-griffiths/mir/surface-states-simplification
Merge into: lp:~mir-team/mir/trunk
Diff against target: 2159 lines (+389/-285)
63 files modified
examples/demo-inprocess-egl/inprocess_egl_client.cpp (+1/-1)
include/server/mir/frontend/protobuf_ipc_factory.h (+4/-2)
include/server/mir/frontend/session.h (+0/-3)
include/server/mir/frontend/session_mediator.h (+5/-3)
include/server/mir/frontend/shell.h (+5/-2)
include/server/mir/shell/application_session.h (+9/-7)
include/server/mir/shell/organising_surface_factory.h (+4/-1)
include/server/mir/shell/session_manager.h (+1/-1)
include/server/mir/shell/surface.h (+8/-8)
include/server/mir/shell/surface_factory.h (+9/-1)
include/server/mir/shell/surface_source.h (+4/-1)
include/shared/mir/events/event_sink.h (+6/-5)
include/test/mir_test_doubles/mock_session.h (+0/-2)
include/test/mir_test_doubles/mock_shell.h (+1/-1)
include/test/mir_test_doubles/mock_surface.h (+6/-1)
include/test/mir_test_doubles/mock_surface_factory.h (+4/-1)
include/test/mir_test_doubles/stub_ipc_factory.h (+1/-1)
include/test/mir_test_doubles/stub_session.h (+1/-1)
include/test/mir_test_doubles/stub_shell.h (+1/-1)
src/client/make_rpc_channel.h (+2/-2)
src/client/make_socket_rpc_channel.cpp (+1/-1)
src/client/mir_basic_rpc_channel.cpp (+1/-3)
src/client/mir_basic_rpc_channel.h (+6/-0)
src/client/mir_client_library.cpp (+9/-13)
src/client/mir_connection.cpp (+2/-1)
src/client/mir_connection.h (+5/-4)
src/client/mir_socket_rpc_channel.cpp (+32/-33)
src/client/mir_socket_rpc_channel.h (+4/-4)
src/server/CMakeLists.txt (+0/-1)
src/server/default_server_configuration.cpp (+2/-1)
src/server/frontend/CMakeLists.txt (+1/-0)
src/server/frontend/event_pipe.cpp (+6/-7)
src/server/frontend/event_pipe.h (+12/-10)
src/server/frontend/protobuf_message_processor.cpp (+3/-1)
src/server/frontend/protobuf_message_processor.h (+2/-2)
src/server/frontend/protobuf_socket_communicator.cpp (+4/-5)
src/server/frontend/session_mediator.cpp (+2/-3)
src/server/shell/application_session.cpp (+6/-12)
src/server/shell/organising_surface_factory.cpp (+5/-2)
src/server/shell/session_manager.cpp (+4/-2)
src/server/shell/surface.cpp (+6/-13)
src/server/shell/surface_source.cpp (+7/-2)
src/shared/protobuf/mir_protobuf_wire.proto (+3/-1)
tests/acceptance-tests/test_focus_management_api.cpp (+4/-4)
tests/behavior-tests/session_management_context.cpp (+8/-4)
tests/integration-tests/cucumber/test_session_management_context.cpp (+3/-3)
tests/integration-tests/shell/test_session_manager.cpp (+8/-7)
tests/unit-tests/CMakeLists.txt (+0/-1)
tests/unit-tests/client/test_client_mir_surface.cpp (+1/-1)
tests/unit-tests/client/test_mir_connection.cpp (+3/-1)
tests/unit-tests/event/CMakeLists.txt (+0/-5)
tests/unit-tests/frontend/CMakeLists.txt (+1/-0)
tests/unit-tests/frontend/test_event_pipe.cpp (+14/-11)
tests/unit-tests/frontend/test_session_mediator.cpp (+9/-5)
tests/unit-tests/frontend/test_session_mediator_android.cpp (+9/-3)
tests/unit-tests/frontend/test_session_mediator_gbm.cpp (+9/-3)
tests/unit-tests/shell/test_application_session.cpp (+15/-14)
tests/unit-tests/shell/test_organising_surface_factory.cpp (+6/-5)
tests/unit-tests/shell/test_registration_order_focus_sequence.cpp (+11/-10)
tests/unit-tests/shell/test_session_manager.cpp (+25/-18)
tests/unit-tests/shell/test_single_visibility_focus_mechanism.cpp (+0/-1)
tests/unit-tests/shell/test_surface.cpp (+60/-17)
tests/unit-tests/shell/test_the_session_container_implementation.cpp (+8/-6)
To merge this branch: bzr merge lp:~alan-griffiths/mir/surface-states-simplification
Reviewer Review Type Date Requested Status
PS Jenkins bot (community) continuous-integration Approve
Daniel van Vugt Needs Resubmitting
Chris Halse Rogers Needs Information
Review via email: mp+160361@code.launchpad.net

This proposal supersedes a proposal from 2013-04-19.

This proposal has been superseded by a proposal from 2013-04-24.

Commit message

frontend, shell, tests: surface-states updated to avoid supplying dependencies through public member functions.

Description of the change

frontend, shell, tests: surface-states updated to avoid supplying dependencies through public member functions.

Where possible, dependencies should be supplied as constructor arguments and held as const members.

(This required updates to a few factory interfaces to supply the dependencies.)

To post a comment you must log in.
Revision history for this message
Daniel van Vugt (vanvugt) wrote : Posted in a previous version of this proposal

Firstly, needs fixing:
Text conflict in tests/unit-tests/shell/test_application_session.cpp
1 conflicts encountered.

Secondly, I disagree with the approach. There are no strong "dependencies" here. The information in question is all optional to the class receiving it, so should not be passed in constructors. The classes can function without event sinks or surface IDs. They will work as they already do. Only event emission would not happen. So it's optional relative to those classes, and therefore not something to enforce in the constructor.

Aside from anything else, the degree of coupling introduced here looks very high. It's always better to minimize coupling. You can't call it a simplification if coupling is increased and the diff is "+205/-148".

review: Disapprove
Revision history for this message
Daniel van Vugt (vanvugt) wrote : Posted in a previous version of this proposal

Also, here's an example use-case for changing the event sink of a surface:

Windows (like the one Flash video uses in a web browser) are implemented using reparenting. If Mir was to support such a thing in future then it would be handy to be able to re-assign a surface to a different session. Hence you'd also need to be able to change a surface's event target (its session).

Revision history for this message
Alexandros Frantzis (afrantzis) wrote : Posted in a previous version of this proposal

> Secondly, I disagree with the approach. There are no strong "dependencies" here.

As mentioned in an older comment [1], they are effectively dependencies because of how Mir uses the class. That is, in all cases in production code we need to set both the id and the sink for our features to work properly.

> If Mir was to support such a thing in future then it would be handy to be able to re-assign
> a surface to a different session

The key words are "if ... in the future ...". If we need this in the future, we are free to change the code to suit our needs. Right now the values are meant to be set only once at creation time, and accepting them in the constructor enforces this restriction (and, as mentioned above, also enforces that we always get a fully working object).

[1] https://code.launchpad.net/~vanvugt/mir/surface-states/+merge/158289/comments/348068

Revision history for this message
Daniel van Vugt (vanvugt) wrote : Posted in a previous version of this proposal

There is a difference between a local dependency and a system dependency. On the local scale, the classes do not depend on EventSink to work. So on a local scale, it should not affect the constructor.

A surface can emit events. A surface can have an ID. However those are not required attributes for the surface to be created and work as a surface.

No amount of "modern C++ tradition" supersedes the basic programming ideal of low coupling.

Revision history for this message
Alan Griffiths (alan-griffiths) wrote : Posted in a previous version of this proposal

> Firstly, needs fixing:
> Text conflict in tests/unit-tests/shell/test_application_session.cpp
> 1 conflicts encountered.

Resolved.

> Secondly, I disagree with the approach. There are no strong "dependencies"
> here. The information in question is all optional to the class receiving it,
> so should not be passed in constructors. The classes can function without
> event sinks or surface IDs. They will work as they already do. Only event
> emission would not happen. So it's optional relative to those classes, and
> therefore not something to enforce in the constructor.

Arguing that a subset of the functionality works without these attributes is an argument that the subset belongs in a class providing just that subset. While we could factor that subset out, I don't think we need to that now.

> Aside from anything else, the degree of coupling introduced here looks very
> high. It's always better to minimize coupling.

I agree that coupling should be reduced - I disagree that this MP increases coupling. For example, the interface used by frontend should not need Session::set_event_sink().

> You can't call it a
> simplification if coupling is increased and the diff is "+205/-148".

You can't measure coupling (or other attributes of the resulting code) by diff size.

Revision history for this message
Daniel van Vugt (vanvugt) wrote : Posted in a previous version of this proposal

I have stated my opinions strongly. I disagree with this proposal as it significantly decreases readability and maintainability. Those are the traits of high coupling, and things I would like to avoid.

Revision history for this message
Kevin DuBois (kdub) wrote : Posted in a previous version of this proposal

> > Secondly, I disagree with the approach. There are no strong "dependencies"
> > here. The information in question is all optional to the class receiving it,
> > so should not be passed in constructors. The classes can function without
> > event sinks or surface IDs. They will work as they already do. Only event
> > emission would not happen. So it's optional relative to those classes, and
> > therefore not something to enforce in the constructor.
>
> Arguing that a subset of the functionality works without these attributes is
> an argument that the subset belongs in a class providing just that subset.
> While we could factor that subset out, I don't think we need to that now.

I think we're using the term 'coupling' too broadly to make much progress arguing :) I'll propose re-framing the argument, and then give my 2 cents

I think we can agree on this though:
1) Its better if a function call doesn't have any hidden prerequisites, like "you must call function A before you call function B". This is sort of 'coupling of calling requirements".
2) A class with a lot of constructor parameters has a lot of dependencies and might be trying to do too much. This is sort of 'coupling of object dependencies'

my 2cents...
so we have to find a way to balance.

I think that, with regards to notify_change/set_id, set_id() is a dependency that has to be called before notify_change() is called, so the id may as well be in the constructor. Another possibility (if we really don't want any more construction parameters for Surface) is to have another object with expanded functionality that takes

We've tried to mitigate the problem of #2 by having a lot of mocks and stubs and nulls that are easy to plug in and make the object easy to manipulate in test. Since its easier to read a constructor than it is to trace what the call order is, I'd rather plug in mocks/stubs to the constructor than have to trace a call order to figure out if we've fulfilled our usage requirements.

Revision history for this message
Daniel van Vugt (vanvugt) wrote : Posted in a previous version of this proposal

You are free to propose and land this directly to lp:mir.

I just don't want code like this landing in a branch with my name on it.

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
Kevin DuBois (kdub) wrote :

might be the first time there's been 2 rival reviews going on ;-)

again, seems the biggest point of contention is about 2 phase initialization and what has more or less coupling. maybe a new day will let me rephrase a bit better. :) Seems to me that (for example) in msh::Surface msh::Surface's notify_change function is coupled to having the ID, so whether you put it in the constructor or require a set_ function to be called, both depend on having an id to use notify_change() in a way. I'd rather come down on the side of putting it all dependencies in the constructor, because it allows us to see pretty quickly what a class needs, and gives us an easy-to-read signal about if a class is doing too much and needs to refactor. So, msh::Shell, might just be on the point of needing a refactor. (if its constructor is getting "too bloated" of course)

I know we had a debate similar to this one at an earlier point in the project, I hope we have another one next week :)

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

This doesn't immediately *look* like a simplification to me.

My understanding is that this is a simplification for clients of this code - ie: consumers of this class no longer have to check if the EventSink or SurfaceID is set.

My question is then - do consumers of this class need to check if the EventSink or SurfaceID is set currently? It looks like consumers of this class generally won't care - if they configure() a surface which doesn't have an EventSink set then nothing will get the event but everything else will work as expected?

review: Needs Information
Revision history for this message
Daniel van Vugt (vanvugt) wrote :

From a high-level perspective I can see two problems here:

1. It's 1000 lines bigger than my proposal. Even if you agree that's not a simplification, but for other purposes, then I think it's still a bit much to review all in one go.

2. This does not solve the problem of code I disagree with ending up in a commit with my name on it. Because once merged it would just show one commit with both our names as authors.

To keep code reviews smaller and simpler, please propose your changes separately (after) surface-states to lp:mir. I won't agree with them, but I won't block them there either.

review: Needs Resubmitting
Revision history for this message
Daniel van Vugt (vanvugt) wrote : Posted in a previous version of this proposal

Just further to Kevin's comment:

"We've tried to mitigate the problem of #2 by having a lot of mocks and stubs and nulls that are easy to plug in and make the object easy to manipulate in test. Since its easier to read a constructor than it is to trace what the call order is, I'd rather plug in mocks/stubs to the constructor than have to trace a call order to figure out if we've fulfilled our usage requirements."

This is false: "lot of mocks and stubs and nulls that are easy to plug in and make the object easy to manipulate in test". You define "easy" by how much effort it requires for someone like you guys (who have been at it for over a year) to modify the code. I define "easy" by how much effort a newcomer requires (with no prior knowledge of the code).

This is false: "Since its easier to read a constructor than it is to trace what the call order is". Constructors do not explicitly state what they're doing, unlike "set_id" or "set_event_sink". And if you did make a mistake somewhere and dereference a null shared_ptr, then the trace would be a call stack. Automatically generated and easier to read.

Revision history for this message
Daniel van Vugt (vanvugt) wrote :

If you resubmit and prerequisite the surface-states branch, I will close my eyes and happily Abstain.

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

> My question is then - do consumers of this class need to check if the
> EventSink or SurfaceID is set currently? It looks like consumers of this class
> generally won't care - if they configure() a surface which doesn't have an
> EventSink set then nothing will get the event but everything else will work as
> expected?

On this point is that consumers shouldn't even know about them - they shouldn't see these functions in the interface they use (i.e. they don't belong in frontend::Surface). Unnecessarily exposing these functions *is* increasing coupling.

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'examples/demo-inprocess-egl/inprocess_egl_client.cpp'
2--- examples/demo-inprocess-egl/inprocess_egl_client.cpp 2013-04-23 01:40:52 +0000
3+++ examples/demo-inprocess-egl/inprocess_egl_client.cpp 2013-04-24 09:03:32 +0000
4@@ -60,7 +60,7 @@
5 .of_size(surface_size)
6 .of_buffer_usage(mc::BufferUsage::hardware)
7 .of_pixel_format(geom::PixelFormat::argb_8888);
8- auto surface = surface_factory->create_surface(params);
9+ auto surface = surface_factory->create_surface(params, mf::SurfaceId(), std::shared_ptr<events::EventSink>());
10
11 surface->advance_client_buffer(); // TODO: What a wart!
12
13
14=== modified file 'include/server/mir/frontend/protobuf_ipc_factory.h'
15--- include/server/mir/frontend/protobuf_ipc_factory.h 2013-04-19 07:45:44 +0000
16+++ include/server/mir/frontend/protobuf_ipc_factory.h 2013-04-24 09:03:32 +0000
17@@ -23,8 +23,10 @@
18
19 namespace mir
20 {
21+namespace events
22+{
23 class EventSink;
24-
25+}
26 namespace protobuf
27 {
28 class DisplayServer;
29@@ -38,7 +40,7 @@
30 {
31 public:
32 virtual std::shared_ptr<protobuf::DisplayServer> make_ipc_server(
33- std::shared_ptr<EventSink> const& sink) = 0;
34+ std::shared_ptr<events::EventSink> const& sink) = 0;
35 virtual std::shared_ptr<ResourceCache> resource_cache() = 0;
36 virtual std::shared_ptr<MessageProcessorReport> report() = 0;
37
38
39=== modified file 'include/server/mir/frontend/session.h'
40--- include/server/mir/frontend/session.h 2013-04-22 03:24:56 +0000
41+++ include/server/mir/frontend/session.h 2013-04-24 09:03:32 +0000
42@@ -29,7 +29,6 @@
43
44 namespace mir
45 {
46-class EventSink;
47
48 namespace frontend
49 {
50@@ -52,8 +51,6 @@
51
52 virtual int configure_surface(SurfaceId id, MirSurfaceAttrib attrib, int value) = 0;
53
54- virtual void set_event_sink(std::shared_ptr<EventSink> const&) = 0;
55-
56 protected:
57 Session() = default;
58 Session(Session const&) = delete;
59
60=== modified file 'include/server/mir/frontend/session_mediator.h'
61--- include/server/mir/frontend/session_mediator.h 2013-04-19 07:45:44 +0000
62+++ include/server/mir/frontend/session_mediator.h 2013-04-24 09:03:32 +0000
63@@ -27,8 +27,10 @@
64
65 namespace mir
66 {
67+namespace events
68+{
69 class EventSink;
70-
71+}
72 namespace graphics
73 {
74 class Platform;
75@@ -62,7 +64,7 @@
76 std::shared_ptr<graphics::ViewableArea> const& viewable_area,
77 std::shared_ptr<compositor::GraphicBufferAllocator> const& buffer_allocator,
78 std::shared_ptr<SessionMediatorReport> const& report,
79- std::shared_ptr<EventSink> const& event_sink,
80+ std::shared_ptr<events::EventSink> const& event_sink,
81 std::shared_ptr<ResourceCache> const& resource_cache);
82
83 /* Platform independent requests */
84@@ -119,7 +121,7 @@
85 std::shared_ptr<compositor::GraphicBufferAllocator> const buffer_allocator;
86
87 std::shared_ptr<SessionMediatorReport> const report;
88- std::shared_ptr<EventSink> const event_sink;
89+ std::shared_ptr<events::EventSink> const event_sink;
90 std::shared_ptr<ResourceCache> const resource_cache;
91 std::shared_ptr<ClientBufferTracker> const client_tracker;
92
93
94=== modified file 'include/server/mir/frontend/shell.h'
95--- include/server/mir/frontend/shell.h 2013-04-22 03:24:56 +0000
96+++ include/server/mir/frontend/shell.h 2013-04-24 09:03:32 +0000
97@@ -24,7 +24,10 @@
98
99 namespace mir
100 {
101-
102+namespace events
103+{
104+class EventSink;
105+}
106 namespace frontend
107 {
108 class Session;
109@@ -35,7 +38,7 @@
110 public:
111 virtual ~Shell() {}
112
113- virtual std::shared_ptr<Session> open_session(std::string const& name) = 0;
114+ virtual std::shared_ptr<Session> open_session(std::string const& name, std::shared_ptr<events::EventSink> const& sink) = 0;
115 virtual void close_session(std::shared_ptr<Session> const& session) = 0;
116
117 virtual void tag_session_with_lightdm_id(std::shared_ptr<Session> const& session, int id) = 0;
118
119=== modified file 'include/server/mir/shell/application_session.h'
120--- include/server/mir/shell/application_session.h 2013-04-23 01:40:52 +0000
121+++ include/server/mir/shell/application_session.h 2013-04-24 09:03:32 +0000
122@@ -25,8 +25,10 @@
123
124 namespace mir
125 {
126+namespace events
127+{
128 class EventSink;
129-
130+}
131 namespace shell
132 {
133 class SurfaceFactory;
134@@ -36,8 +38,11 @@
135 class ApplicationSession : public Session
136 {
137 public:
138- explicit ApplicationSession(std::shared_ptr<SurfaceFactory> const& surface_factory,
139- std::shared_ptr<InputTargetListener> const& input_target_listener, std::string const& session_name);
140+ explicit ApplicationSession(
141+ std::shared_ptr<SurfaceFactory> const& surface_factory,
142+ std::shared_ptr<InputTargetListener> const& input_target_listener,
143+ std::string const& session_name,
144+ std::shared_ptr<events::EventSink> const& sink);
145 ~ApplicationSession();
146
147 frontend::SurfaceId create_surface(frontend::SurfaceCreationParameters const& params);
148@@ -55,8 +60,6 @@
149
150 int configure_surface(frontend::SurfaceId id, MirSurfaceAttrib attrib, int value);
151
152- void set_event_sink(std::shared_ptr<mir::EventSink> const& sink);
153-
154 protected:
155 ApplicationSession(ApplicationSession const&) = delete;
156 ApplicationSession& operator=(ApplicationSession const&) = delete;
157@@ -65,6 +68,7 @@
158 std::shared_ptr<SurfaceFactory> const surface_factory;
159 std::shared_ptr<InputTargetListener> const input_target_listener;
160 std::string const session_name;
161+ std::shared_ptr<events::EventSink> const event_sink;
162
163 frontend::SurfaceId next_id();
164
165@@ -74,8 +78,6 @@
166 Surfaces::const_iterator checked_find(frontend::SurfaceId id) const;
167 std::mutex mutable surfaces_mutex;
168 Surfaces surfaces;
169-
170- std::shared_ptr<EventSink> event_sink;
171 };
172
173 }
174
175=== modified file 'include/server/mir/shell/organising_surface_factory.h'
176--- include/server/mir/shell/organising_surface_factory.h 2013-04-16 09:16:38 +0000
177+++ include/server/mir/shell/organising_surface_factory.h 2013-04-24 09:03:32 +0000
178@@ -36,7 +36,10 @@
179 std::shared_ptr<PlacementStrategy> const& placement_strategy);
180 virtual ~OrganisingSurfaceFactory();
181
182- std::shared_ptr<Surface> create_surface(frontend::SurfaceCreationParameters const& params);
183+ std::shared_ptr<Surface> create_surface(
184+ frontend::SurfaceCreationParameters const& params,
185+ frontend::SurfaceId id,
186+ std::shared_ptr<events::EventSink> const& sink) override;
187
188 protected:
189 OrganisingSurfaceFactory(OrganisingSurfaceFactory const&) = delete;
190
191=== modified file 'include/server/mir/shell/session_manager.h'
192--- include/server/mir/shell/session_manager.h 2013-04-23 01:40:52 +0000
193+++ include/server/mir/shell/session_manager.h 2013-04-24 09:03:32 +0000
194@@ -53,7 +53,7 @@
195 std::shared_ptr<InputTargetListener> const& input_target_listener);
196 virtual ~SessionManager();
197
198- virtual std::shared_ptr<frontend::Session> open_session(std::string const& name);
199+ virtual std::shared_ptr<frontend::Session> open_session(std::string const& name, std::shared_ptr<events::EventSink> const& sink);
200 virtual void close_session(std::shared_ptr<frontend::Session> const& session);
201
202 virtual void tag_session_with_lightdm_id(std::shared_ptr<frontend::Session> const& session, int id);
203
204=== modified file 'include/server/mir/shell/surface.h'
205--- include/server/mir/shell/surface.h 2013-04-19 03:20:05 +0000
206+++ include/server/mir/shell/surface.h 2013-04-24 09:03:32 +0000
207@@ -31,9 +31,10 @@
208
209 namespace mir
210 {
211-
212+namespace events
213+{
214 class EventSink;
215-
216+}
217 namespace frontend
218 {
219 struct SurfaceCreationParameters;
220@@ -53,7 +54,9 @@
221 Surface(
222 std::shared_ptr<SurfaceBuilder> const& builder,
223 frontend::SurfaceCreationParameters const& params,
224- std::shared_ptr<input::InputChannel> const& input_channel);
225+ std::shared_ptr<input::InputChannel> const& input_channel,
226+ frontend::SurfaceId id,
227+ std::shared_ptr<events::EventSink> const& sink);
228 ~Surface();
229
230 virtual void hide();
231@@ -82,9 +85,6 @@
232 virtual MirSurfaceType type() const;
233 virtual MirSurfaceState state() const;
234
235- void set_id(frontend::SurfaceId i);
236- void set_event_target(std::shared_ptr<EventSink> const& sink);
237-
238 private:
239 bool set_type(MirSurfaceType t); // Use configure() to make public changes
240 bool set_state(MirSurfaceState s);
241@@ -94,8 +94,8 @@
242 std::shared_ptr<mir::input::InputChannel> const input_channel;
243 std::weak_ptr<mir::surfaces::Surface> const surface;
244
245- std::shared_ptr<EventSink> event_sink;
246- frontend::SurfaceId id;
247+ frontend::SurfaceId const id;
248+ std::shared_ptr<events::EventSink> const event_sink;
249
250 MirSurfaceType type_value;
251 MirSurfaceState state_value;
252
253=== modified file 'include/server/mir/shell/surface_factory.h'
254--- include/server/mir/shell/surface_factory.h 2013-04-19 03:20:05 +0000
255+++ include/server/mir/shell/surface_factory.h 2013-04-24 09:03:32 +0000
256@@ -19,10 +19,15 @@
257 #ifndef MIR_SHELL_SURFACE_FACTORY_H_
258 #define MIR_SHELL_SURFACE_FACTORY_H_
259
260+#include "mir/frontend/surface_id.h"
261 #include <memory>
262
263 namespace mir
264 {
265+namespace events
266+{
267+class EventSink;
268+}
269 namespace frontend
270 {
271 struct SurfaceCreationParameters;
272@@ -34,7 +39,10 @@
273 class SurfaceFactory
274 {
275 public:
276- virtual std::shared_ptr<Surface> create_surface(const frontend::SurfaceCreationParameters& params) = 0;
277+ virtual std::shared_ptr<Surface> create_surface(
278+ frontend::SurfaceCreationParameters const& params,
279+ frontend::SurfaceId id,
280+ std::shared_ptr<events::EventSink> const& sink) = 0;
281
282 protected:
283 virtual ~SurfaceFactory() {}
284
285=== modified file 'include/server/mir/shell/surface_source.h'
286--- include/server/mir/shell/surface_source.h 2013-04-16 09:16:38 +0000
287+++ include/server/mir/shell/surface_source.h 2013-04-24 09:03:32 +0000
288@@ -40,7 +40,10 @@
289 explicit SurfaceSource(std::shared_ptr<SurfaceBuilder> const& surface_builder, std::shared_ptr<input::InputChannelFactory> const& input_factory);
290 virtual ~SurfaceSource() {}
291
292- std::shared_ptr<Surface> create_surface(const frontend::SurfaceCreationParameters& params);
293+ std::shared_ptr<Surface> create_surface(
294+ frontend::SurfaceCreationParameters const& params,
295+ frontend::SurfaceId id,
296+ std::shared_ptr<events::EventSink> const& sink);
297
298 protected:
299 SurfaceSource(const SurfaceSource&) = delete;
300
301=== added directory 'include/shared/mir/events'
302=== renamed file 'include/shared/mir/event_sink.h' => 'include/shared/mir/events/event_sink.h'
303--- include/shared/mir/event_sink.h 2013-04-19 04:33:51 +0000
304+++ include/shared/mir/events/event_sink.h 2013-04-24 09:03:32 +0000
305@@ -16,13 +16,15 @@
306 * Authored by: Daniel van Vugt <daniel.van.vugt@canonical.com>
307 */
308
309-#ifndef MIR_EVENT_SINK_H_
310-#define MIR_EVENT_SINK_H_
311+#ifndef MIR_EVENTS_EVENT_SINK_H_
312+#define MIR_EVENTS_EVENT_SINK_H_
313
314 #include "mir_toolkit/event.h"
315
316 namespace mir
317 {
318+namespace events
319+{
320
321 class EventSink
322 {
323@@ -36,8 +38,7 @@
324 EventSink(EventSink const&) = delete;
325 EventSink& operator=(EventSink const&) = delete;
326 };
327-
328+}
329 } // namespace mir
330
331-#endif
332-
333+#endif // MIR_EVENTS_EVENT_SINK_H_
334
335=== modified file 'include/test/mir_test_doubles/mock_session.h'
336--- include/test/mir_test_doubles/mock_session.h 2013-04-19 08:03:57 +0000
337+++ include/test/mir_test_doubles/mock_session.h 2013-04-24 09:03:32 +0000
338@@ -43,8 +43,6 @@
339 MOCK_METHOD0(show, void());
340
341 MOCK_METHOD3(configure_surface, int(frontend::SurfaceId, MirSurfaceAttrib, int));
342-
343- MOCK_METHOD1(set_event_sink, void(std::shared_ptr<mir::EventSink> const&));
344 };
345
346 }
347
348=== modified file 'include/test/mir_test_doubles/mock_shell.h'
349--- include/test/mir_test_doubles/mock_shell.h 2013-04-19 03:20:05 +0000
350+++ include/test/mir_test_doubles/mock_shell.h 2013-04-24 09:03:32 +0000
351@@ -34,7 +34,7 @@
352
353 struct MockShell : public frontend::Shell
354 {
355- MOCK_METHOD1(open_session, std::shared_ptr<frontend::Session>(std::string const&));
356+ MOCK_METHOD2(open_session, std::shared_ptr<frontend::Session>(std::string const&, std::shared_ptr<events::EventSink> const&));
357 MOCK_METHOD1(close_session, void(std::shared_ptr<frontend::Session> const&));
358
359 MOCK_METHOD2(tag_session_with_lightdm_id, void(std::shared_ptr<frontend::Session> const&, int));
360
361=== modified file 'include/test/mir_test_doubles/mock_surface.h'
362--- include/test/mir_test_doubles/mock_surface.h 2013-04-19 03:20:05 +0000
363+++ include/test/mir_test_doubles/mock_surface.h 2013-04-24 09:03:32 +0000
364@@ -37,7 +37,12 @@
365 struct MockSurface : public shell::Surface
366 {
367 MockSurface(std::shared_ptr<shell::SurfaceBuilder> const& builder) :
368- shell::Surface(builder, frontend::a_surface(), std::shared_ptr<input::InputChannel>())
369+ shell::Surface(
370+ builder,
371+ frontend::a_surface(),
372+ std::shared_ptr<input::InputChannel>(),
373+ frontend::SurfaceId(),
374+ std::shared_ptr<events::EventSink>())
375 {
376 }
377
378
379=== modified file 'include/test/mir_test_doubles/mock_surface_factory.h'
380--- include/test/mir_test_doubles/mock_surface_factory.h 2013-04-16 09:16:38 +0000
381+++ include/test/mir_test_doubles/mock_surface_factory.h 2013-04-24 09:03:32 +0000
382@@ -33,7 +33,10 @@
383
384 struct MockSurfaceFactory : public shell::SurfaceFactory
385 {
386- MOCK_METHOD1(create_surface, std::shared_ptr<shell::Surface>(const frontend::SurfaceCreationParameters&));
387+ MOCK_METHOD3(create_surface, std::shared_ptr<shell::Surface>(
388+ const frontend::SurfaceCreationParameters&,
389+ frontend::SurfaceId,
390+ std::shared_ptr<events::EventSink> const&));
391 };
392
393 }
394
395=== modified file 'include/test/mir_test_doubles/stub_ipc_factory.h'
396--- include/test/mir_test_doubles/stub_ipc_factory.h 2013-04-19 07:45:44 +0000
397+++ include/test/mir_test_doubles/stub_ipc_factory.h 2013-04-24 09:03:32 +0000
398@@ -42,7 +42,7 @@
399 }
400
401 std::shared_ptr<protobuf::DisplayServer> make_ipc_server(
402- std::shared_ptr<EventSink> const&)
403+ std::shared_ptr<events::EventSink> const&)
404 {
405 return server;
406 }
407
408=== modified file 'include/test/mir_test_doubles/stub_session.h'
409--- include/test/mir_test_doubles/stub_session.h 2013-04-19 08:03:57 +0000
410+++ include/test/mir_test_doubles/stub_session.h 2013-04-24 09:03:32 +0000
411@@ -58,7 +58,7 @@
412 {
413 return 0;
414 }
415- void set_event_sink(std::shared_ptr<EventSink> const&)
416+ void set_event_sink(std::shared_ptr<events::EventSink> const&)
417 {
418 }
419 };
420
421=== modified file 'include/test/mir_test_doubles/stub_shell.h'
422--- include/test/mir_test_doubles/stub_shell.h 2013-04-19 03:20:05 +0000
423+++ include/test/mir_test_doubles/stub_shell.h 2013-04-24 09:03:32 +0000
424@@ -31,7 +31,7 @@
425
426 class StubShell : public frontend::Shell
427 {
428- std::shared_ptr<frontend::Session> open_session(std::string const& /* name */)
429+ std::shared_ptr<frontend::Session> open_session(std::string const& /* name */, std::shared_ptr<events::EventSink> const& /* sink */)
430 {
431 return std::make_shared<StubSession>();
432 }
433
434=== modified file 'src/client/make_rpc_channel.h'
435--- src/client/make_rpc_channel.h 2013-04-12 03:36:28 +0000
436+++ src/client/make_rpc_channel.h 2013-04-24 09:03:32 +0000
437@@ -19,7 +19,7 @@
438 #define MIR_CLIENT_MAKE_RPC_CHANNEL_H_
439
440 #include <memory>
441-#include "mir_protobuf.pb.h"
442+#include "mir_basic_rpc_channel.h"
443
444 namespace mir
445 {
446@@ -27,7 +27,7 @@
447 {
448 class Logger;
449
450-std::shared_ptr<google::protobuf::RpcChannel>
451+std::shared_ptr<MirBasicRpcChannel>
452 make_rpc_channel(std::string const& name, std::shared_ptr<Logger> const& log);
453 }
454 }
455
456=== modified file 'src/client/make_socket_rpc_channel.cpp'
457--- src/client/make_socket_rpc_channel.cpp 2013-04-12 03:36:28 +0000
458+++ src/client/make_socket_rpc_channel.cpp 2013-04-24 09:03:32 +0000
459@@ -21,7 +21,7 @@
460
461 namespace mcl = mir::client;
462
463-std::shared_ptr<google::protobuf::RpcChannel>
464+std::shared_ptr<mcl::MirBasicRpcChannel>
465 mcl::make_rpc_channel(std::string const& name, std::shared_ptr<Logger> const& log)
466 {
467 return std::make_shared<MirSocketRpcChannel>(name, log);
468
469=== modified file 'src/client/mir_basic_rpc_channel.cpp'
470--- src/client/mir_basic_rpc_channel.cpp 2013-04-18 04:15:05 +0000
471+++ src/client/mir_basic_rpc_channel.cpp 2013-04-24 09:03:32 +0000
472@@ -100,7 +100,5 @@
473
474 int mcl::MirBasicRpcChannel::next_id()
475 {
476- int id = next_message_id.load();
477- while (!next_message_id.compare_exchange_weak(id, id + 1)) std::this_thread::yield();
478- return id;
479+ return next_message_id.fetch_add(1);
480 }
481
482=== modified file 'src/client/mir_basic_rpc_channel.h'
483--- src/client/mir_basic_rpc_channel.h 2013-04-12 03:36:28 +0000
484+++ src/client/mir_basic_rpc_channel.h 2013-04-24 09:03:32 +0000
485@@ -33,6 +33,10 @@
486
487 namespace mir
488 {
489+namespace events
490+{
491+class EventSink;
492+}
493 namespace protobuf
494 {
495 namespace wire
496@@ -92,6 +96,8 @@
497 MirBasicRpcChannel();
498 ~MirBasicRpcChannel();
499
500+ virtual void set_event_handler(events::EventSink *sink) = 0;
501+
502 protected:
503 mir::protobuf::wire::Invocation invocation_for(const google::protobuf::MethodDescriptor* method,
504 const google::protobuf::Message* request);
505
506=== modified file 'src/client/mir_client_library.cpp'
507--- src/client/mir_client_library.cpp 2013-04-24 03:02:59 +0000
508+++ src/client/mir_client_library.cpp 2013-04-24 09:03:32 +0000
509@@ -26,7 +26,7 @@
510 #include "native_client_platform_factory.h"
511 #include "egl_native_display_container.h"
512 #include "mir_logger.h"
513-#include "mir_socket_rpc_channel.h"
514+#include "make_rpc_channel.h"
515
516 #include <set>
517 #include <unordered_set>
518@@ -60,12 +60,10 @@
519 auto log = std::make_shared<mcl::ConsoleLogger>();
520 auto client_platform_factory = std::make_shared<mcl::NativeClientPlatformFactory>();
521
522- auto rpc = std::make_shared<mcl::MirSocketRpcChannel>(sock, log);
523-
524- MirConnection* connection = new MirConnection(rpc, log,
525- client_platform_factory);
526-
527- rpc->set_event_handler(connection);
528+ MirConnection* connection = new MirConnection(
529+ mcl::make_rpc_channel(sock, log),
530+ log,
531+ client_platform_factory);
532
533 return connection->connect(name, callback, context);
534 }
535@@ -258,12 +256,10 @@
536 auto log = std::make_shared<mcl::ConsoleLogger>();
537 auto client_platform_factory = std::make_shared<mcl::NativeClientPlatformFactory>();
538
539- auto rpc = std::make_shared<mcl::MirSocketRpcChannel>(server, log);
540-
541- MirConnection* connection = new MirConnection(rpc, log,
542- client_platform_factory);
543-
544- rpc->set_event_handler(connection);
545+ MirConnection* connection = new MirConnection(
546+ mcl::make_rpc_channel(server, log),
547+ log,
548+ client_platform_factory);
549
550 return connection->connect(lightdm_id, app_name, callback, client_context);
551 }
552
553=== modified file 'src/client/mir_connection.cpp'
554--- src/client/mir_connection.cpp 2013-04-16 09:42:50 +0000
555+++ src/client/mir_connection.cpp 2013-04-24 09:03:32 +0000
556@@ -43,7 +43,7 @@
557 }
558
559 MirConnection::MirConnection(
560- std::shared_ptr<google::protobuf::RpcChannel> const& channel,
561+ std::shared_ptr<mir::client::MirBasicRpcChannel> const& channel,
562 std::shared_ptr<mcl::Logger> const & log,
563 std::shared_ptr<mcl::ClientPlatformFactory> const& client_platform_factory) :
564 channel(channel),
565@@ -52,6 +52,7 @@
566 client_platform_factory(client_platform_factory),
567 input_platform(mcli::InputPlatform::create())
568 {
569+ channel->set_event_handler(this);
570 {
571 std::lock_guard<std::mutex> lock(connection_guard);
572 valid_connections.insert(this);
573
574=== modified file 'src/client/mir_connection.h'
575--- src/client/mir_connection.h 2013-04-16 09:42:50 +0000
576+++ src/client/mir_connection.h 2013-04-24 09:03:32 +0000
577@@ -34,7 +34,7 @@
578 #include "client_context.h"
579
580 #include "mir_wait_handle.h"
581-#include "mir/event_sink.h"
582+#include "mir/events/event_sink.h"
583
584 namespace mir
585 {
586@@ -44,6 +44,8 @@
587 class Logger;
588 class ClientBufferDepository;
589 class ClientPlatformFactory;
590+class MirBasicRpcChannel;
591+
592 namespace input
593 {
594 class InputPlatform;
595@@ -51,13 +53,12 @@
596 }
597 }
598
599-struct MirConnection : public mir::client::ClientContext,
600- public mir::EventSink
601+struct MirConnection : mir::client::ClientContext, private mir::events::EventSink
602 {
603 public:
604 MirConnection();
605
606- MirConnection(std::shared_ptr<google::protobuf::RpcChannel> const& channel,
607+ MirConnection(std::shared_ptr<mir::client::MirBasicRpcChannel> const& channel,
608 std::shared_ptr<mir::client::Logger> const & log,
609 std::shared_ptr<mir::client::ClientPlatformFactory> const& client_platform_factory);
610 ~MirConnection() noexcept;
611
612=== modified file 'src/client/mir_socket_rpc_channel.cpp'
613--- src/client/mir_socket_rpc_channel.cpp 2013-04-18 04:15:05 +0000
614+++ src/client/mir_socket_rpc_channel.cpp 2013-04-24 09:03:32 +0000
615@@ -253,11 +253,12 @@
616
617 log->debug() << __PRETTY_FUNCTION__ << " result.id():" << result.id() << std::endl;
618
619- if (!result.has_id()) // It's an event sequence
620+ for (int i = 0; i != result.events_size(); ++i)
621 {
622- process_event_sequence(result);
623+ process_event_sequence(result.events(i));
624 }
625- else
626+
627+ if (result.has_id())
628 {
629 pending_calls.complete_response(result);
630 }
631@@ -269,44 +270,42 @@
632 }
633 }
634
635-void mcl::MirSocketRpcChannel::process_event_sequence(
636- mir::protobuf::wire::Result const& result)
637+void mcl::MirSocketRpcChannel::process_event_sequence(std::string const& event)
638 {
639 if (!event_handler)
640 return;
641
642 mir::protobuf::EventSequence seq;
643- if (seq.ParseFromString(result.response()))
644+
645+ seq.ParseFromString(event);
646+ int const nevents = seq.event_size();
647+ for (int i = 0; i != nevents; ++i)
648 {
649- int const nevents = seq.event_size();
650- for (int i = 0; i < nevents; i++)
651+ mir::protobuf::Event const& event = seq.event(i);
652+ if (event.has_raw())
653 {
654- mir::protobuf::Event const& event = seq.event(i);
655- if (event.has_raw())
656- {
657- std::string const& raw_event = event.raw();
658-
659- // In future, events might be compressed where possible.
660- // But that's a job for later...
661- if (raw_event.size() == sizeof(MirEvent))
662- {
663- MirEvent e;
664-
665- // Make a copy to ensure integer fields get correct memory
666- // alignment, which is critical on many non-x86
667- // architectures.
668- memcpy(&e, raw_event.data(), sizeof e);
669- event_handler->handle_event(e);
670- }
671- else
672- {
673- log->error() << __PRETTY_FUNCTION__
674- << " Received MirEvent of an unexpected size."
675- << std::endl;
676- }
677+ std::string const& raw_event = event.raw();
678+
679+ // In future, events might be compressed where possible.
680+ // But that's a job for later...
681+ if (raw_event.size() == sizeof(MirEvent))
682+ {
683+ MirEvent e;
684+
685+ // Make a copy to ensure integer fields get correct memory
686+ // alignment, which is critical on many non-x86
687+ // architectures.
688+ memcpy(&e, raw_event.data(), sizeof e);
689+ event_handler->handle_event(e);
690+ }
691+ else
692+ {
693+ log->error() << __PRETTY_FUNCTION__
694+ << " Received MirEvent of an unexpected size."
695+ << std::endl;
696 }
697 }
698- } // else protobuf will log an error
699+ }
700 }
701
702 size_t mcl::MirSocketRpcChannel::read_message_header()
703@@ -331,7 +330,7 @@
704 return result;
705 }
706
707-void mcl::MirSocketRpcChannel::set_event_handler(mir::EventSink *sink)
708+void mcl::MirSocketRpcChannel::set_event_handler(events::EventSink *sink)
709 {
710 /*
711 * Yes, these have to be regular pointers. Because ownership of the object
712
713=== modified file 'src/client/mir_socket_rpc_channel.h'
714--- src/client/mir_socket_rpc_channel.h 2013-04-18 03:54:19 +0000
715+++ src/client/mir_socket_rpc_channel.h 2013-04-24 09:03:32 +0000
716@@ -22,7 +22,7 @@
717
718 #include "mir_basic_rpc_channel.h"
719 #include "mir_logger.h"
720-#include "mir/event_sink.h"
721+#include "mir/events/event_sink.h"
722
723 #include <boost/asio.hpp>
724
725@@ -52,7 +52,7 @@
726 MirSocketRpcChannel(const std::string& endpoint, const std::shared_ptr<Logger>& log);
727 ~MirSocketRpcChannel();
728
729- void set_event_handler(EventSink *sink);
730+ void set_event_handler(events::EventSink *sink);
731
732 private:
733 virtual void CallMethod(const google::protobuf::MethodDescriptor* method, google::protobuf::RpcController*,
734@@ -75,13 +75,13 @@
735 void on_header_read(const boost::system::error_code& error);
736
737 void read_message();
738- void process_event_sequence(mir::protobuf::wire::Result const& result);
739+ void process_event_sequence(std::string const& event);
740
741 size_t read_message_header();
742
743 mir::protobuf::wire::Result read_message_body(const size_t body_size);
744
745- EventSink *event_handler;
746+ events::EventSink *event_handler;
747 };
748
749 }
750
751=== modified file 'src/server/CMakeLists.txt'
752--- src/server/CMakeLists.txt 2013-04-24 03:31:07 +0000
753+++ src/server/CMakeLists.txt 2013-04-24 09:03:32 +0000
754@@ -26,7 +26,6 @@
755 display_server.cpp
756 default_server_configuration.cpp
757 asio_main_loop.cpp
758- event_queue.cpp
759 )
760
761 set(MIRSERVER_LINKAGE SHARED)
762
763=== modified file 'src/server/default_server_configuration.cpp'
764--- src/server/default_server_configuration.cpp 2013-04-24 05:19:54 +0000
765+++ src/server/default_server_configuration.cpp 2013-04-24 09:03:32 +0000
766@@ -63,6 +63,7 @@
767 #include "mir/default_configuration.h"
768
769 namespace mc = mir::compositor;
770+namespace me = mir::events;
771 namespace geom = mir::geometry;
772 namespace mf = mir::frontend;
773 namespace mg = mir::graphics;
774@@ -109,7 +110,7 @@
775 std::shared_ptr<mc::GraphicBufferAllocator> const buffer_allocator;
776
777 virtual std::shared_ptr<mir::protobuf::DisplayServer> make_ipc_server(
778- std::shared_ptr<mir::EventSink> const& sink)
779+ std::shared_ptr<me::EventSink> const& sink)
780 {
781 return std::make_shared<mf::SessionMediator>(
782 shell,
783
784=== modified file 'src/server/frontend/CMakeLists.txt'
785--- src/server/frontend/CMakeLists.txt 2013-04-19 04:00:32 +0000
786+++ src/server/frontend/CMakeLists.txt 2013-04-24 09:03:32 +0000
787@@ -8,6 +8,7 @@
788 protobuf_message_processor.cpp
789 null_message_processor.cpp
790 surface_creation_parameters.cpp
791+ event_pipe.cpp
792
793 resource_cache.cpp
794 ${PROTO_HDRS}
795
796=== renamed file 'src/server/event_queue.cpp' => 'src/server/frontend/event_pipe.cpp'
797--- src/server/event_queue.cpp 2013-04-24 03:44:27 +0000
798+++ src/server/frontend/event_pipe.cpp 2013-04-24 09:03:32 +0000
799@@ -16,17 +16,16 @@
800 * Authored by: Daniel van Vugt <daniel.van.vugt@canonical.com>
801 */
802
803-#include "mir/event_queue.h"
804-#include "mir/event_sink.h"
805-
806-using namespace mir;
807-
808-void EventQueue::set_target(std::weak_ptr<EventSink> const& s)
809+#include "event_pipe.h"
810+
811+namespace mf = mir::frontend;
812+
813+void mf::EventPipe::set_target(std::weak_ptr<EventSink> const& s)
814 {
815 target = s;
816 }
817
818-void EventQueue::handle_event(MirEvent const& e)
819+void mf::EventPipe::handle_event(MirEvent const& e)
820 {
821 // In future, we might put e on a queue and wait for some background
822 // thread to push it through to target. But that's not required right now.
823
824=== renamed file 'include/server/mir/event_queue.h' => 'src/server/frontend/event_pipe.h'
825--- include/server/mir/event_queue.h 2013-04-16 05:46:28 +0000
826+++ src/server/frontend/event_pipe.h 2013-04-24 09:03:32 +0000
827@@ -16,25 +16,27 @@
828 * Authored by: Daniel van Vugt <daniel.van.vugt@canonical.com>
829 */
830
831-#ifndef MIR_EVENT_QUEUE_H_
832-#define MIR_EVENT_QUEUE_H_
833+#ifndef MIR_FRONTEND_EVENT_PIPE_H_
834+#define MIR_FRONTEND_EVENT_PIPE_H_
835
836 #include "mir_toolkit/event.h"
837-#include "mir/event_sink.h"
838+#include "mir/events/event_sink.h"
839 #include <memory>
840
841 namespace mir
842 {
843-class EventQueue : public EventSink
844+namespace frontend
845+{
846+class EventPipe : public events::EventSink
847 {
848 public:
849- void set_target(std::weak_ptr<EventSink> const& s);
850+ void set_target(std::weak_ptr<events::EventSink> const& s);
851 void handle_event(MirEvent const& e) override;
852
853 private:
854- std::weak_ptr<EventSink> target;
855+ std::weak_ptr<events::EventSink> target;
856 };
857-
858-} // namespace mir
859-
860-#endif
861+}
862+}
863+
864+#endif // MIR_FRONTEND_EVENT_PIPE_H_
865
866=== modified file 'src/server/frontend/protobuf_message_processor.cpp'
867--- src/server/frontend/protobuf_message_processor.cpp 2013-04-24 03:02:59 +0000
868+++ src/server/frontend/protobuf_message_processor.cpp 2013-04-24 09:03:32 +0000
869@@ -138,6 +138,8 @@
870
871 void mfd::ProtobufMessageProcessor::send_event(MirEvent const& e)
872 {
873+ // In future we might send multiple events, or insert them into messages
874+ // containing other responses, but for now we send them individually.
875 mir::protobuf::EventSequence seq;
876 mir::protobuf::Event *ev = seq.add_event();
877 ev->set_raw(&e, sizeof(MirEvent));
878@@ -146,7 +148,7 @@
879 seq.SerializeToString(&buffer);
880
881 mir::protobuf::wire::Result result;
882- result.set_response(buffer);
883+ result.add_events(buffer);
884
885 result.SerializeToString(&buffer);
886
887
888=== modified file 'src/server/frontend/protobuf_message_processor.h'
889--- src/server/frontend/protobuf_message_processor.h 2013-04-24 03:02:59 +0000
890+++ src/server/frontend/protobuf_message_processor.h 2013-04-24 09:03:32 +0000
891@@ -24,7 +24,7 @@
892
893 #include "mir_protobuf.pb.h"
894 #include "mir_protobuf_wire.pb.h"
895-#include "mir/event_sink.h"
896+#include "mir/events/event_sink.h"
897
898 #include <vector>
899 #include <memory>
900@@ -44,7 +44,7 @@
901 {
902
903 struct ProtobufMessageProcessor : MessageProcessor,
904- public EventSink
905+ public events::EventSink
906 {
907 ProtobufMessageProcessor(
908 MessageSender* sender,
909
910=== modified file 'src/server/frontend/protobuf_socket_communicator.cpp'
911--- src/server/frontend/protobuf_socket_communicator.cpp 2013-04-22 09:54:07 +0000
912+++ src/server/frontend/protobuf_socket_communicator.cpp 2013-04-24 09:03:32 +0000
913@@ -22,8 +22,7 @@
914
915 #include "mir/frontend/protobuf_ipc_factory.h"
916 #include "mir/protobuf/google_protobuf_guard.h"
917-#include "mir/event_sink.h"
918-#include "mir/event_queue.h"
919+#include "event_pipe.h"
920
921 #include <boost/signals2.hpp>
922
923@@ -51,7 +50,7 @@
924
925 void mf::ProtobufSocketCommunicator::start_accept()
926 {
927- std::shared_ptr<EventQueue> event_queue = std::make_shared<EventQueue>();
928+ auto const& event_pipe = std::make_shared<EventPipe>();
929
930 auto const& socket_session = std::make_shared<mfd::SocketSession>(
931 io_service,
932@@ -60,11 +59,11 @@
933
934 auto session = std::make_shared<detail::ProtobufMessageProcessor>(
935 socket_session.get(),
936- ipc_factory->make_ipc_server(event_queue),
937+ ipc_factory->make_ipc_server(event_pipe),
938 ipc_factory->resource_cache(),
939 ipc_factory->report());
940
941- event_queue->set_target(session);
942+ event_pipe->set_target(session);
943 socket_session->set_processor(session);
944
945 acceptor.async_accept(
946
947=== modified file 'src/server/frontend/session_mediator.cpp'
948--- src/server/frontend/session_mediator.cpp 2013-04-19 07:45:44 +0000
949+++ src/server/frontend/session_mediator.cpp 2013-04-24 09:03:32 +0000
950@@ -44,7 +44,7 @@
951 std::shared_ptr<graphics::ViewableArea> const& viewable_area,
952 std::shared_ptr<compositor::GraphicBufferAllocator> const& buffer_allocator,
953 std::shared_ptr<SessionMediatorReport> const& report,
954- std::shared_ptr<EventSink> const& event_sink,
955+ std::shared_ptr<events::EventSink> const& event_sink,
956 std::shared_ptr<ResourceCache> const& resource_cache) :
957 shell(shell),
958 graphics_platform(graphics_platform),
959@@ -65,8 +65,7 @@
960 {
961 report->session_connect_called(request->application_name());
962
963- session = shell->open_session(request->application_name());
964- session->set_event_sink(event_sink);
965+ session = shell->open_session(request->application_name(), event_sink);
966
967 auto ipc_package = graphics_platform->get_ipc_package();
968 auto platform = response->mutable_platform();
969
970=== modified file 'src/server/shell/application_session.cpp'
971--- src/server/shell/application_session.cpp 2013-04-23 01:40:52 +0000
972+++ src/server/shell/application_session.cpp 2013-04-24 09:03:32 +0000
973@@ -28,16 +28,19 @@
974 #include <cassert>
975 #include <algorithm>
976
977+namespace me = mir::events;
978 namespace mf = mir::frontend;
979 namespace msh = mir::shell;
980
981 msh::ApplicationSession::ApplicationSession(
982- std::shared_ptr<msh::SurfaceFactory> const& surface_factory,
983+ std::shared_ptr<SurfaceFactory> const& surface_factory,
984 std::shared_ptr<msh::InputTargetListener> const& input_target_listener,
985- std::string const& session_name) :
986+ std::string const& session_name,
987+ std::shared_ptr<me::EventSink> const& sink) :
988 surface_factory(surface_factory),
989 input_target_listener(input_target_listener),
990 session_name(session_name),
991+ event_sink(sink),
992 next_surface_id(0)
993 {
994 assert(surface_factory);
995@@ -53,12 +56,6 @@
996 }
997 }
998
999-void msh::ApplicationSession::set_event_sink(
1000- std::shared_ptr<mir::EventSink> const& sink)
1001-{
1002- event_sink = sink;
1003-}
1004-
1005 mf::SurfaceId msh::ApplicationSession::next_id()
1006 {
1007 return mf::SurfaceId(next_surface_id.fetch_add(1));
1008@@ -66,11 +63,8 @@
1009
1010 mf::SurfaceId msh::ApplicationSession::create_surface(const mf::SurfaceCreationParameters& params)
1011 {
1012- auto surf = surface_factory->create_surface(params);
1013 auto const id = next_id();
1014-
1015- surf->set_id(id);
1016- surf->set_event_target(event_sink);
1017+ auto surf = surface_factory->create_surface(params, id, event_sink);
1018
1019 std::unique_lock<std::mutex> lock(surfaces_mutex);
1020 surfaces[id] = surf;
1021
1022=== modified file 'src/server/shell/organising_surface_factory.cpp'
1023--- src/server/shell/organising_surface_factory.cpp 2013-04-16 09:16:38 +0000
1024+++ src/server/shell/organising_surface_factory.cpp 2013-04-24 09:03:32 +0000
1025@@ -34,10 +34,13 @@
1026 {
1027 }
1028
1029-std::shared_ptr<msh::Surface> msh::OrganisingSurfaceFactory::create_surface(const mf::SurfaceCreationParameters& params)
1030+std::shared_ptr<msh::Surface> msh::OrganisingSurfaceFactory::create_surface(
1031+ frontend::SurfaceCreationParameters const& params,
1032+ frontend::SurfaceId id,
1033+ std::shared_ptr<events::EventSink> const& sink)
1034 {
1035 auto placed_params = placement_strategy->place(params);
1036
1037- return underlying_factory->create_surface(placed_params);
1038+ return underlying_factory->create_surface(placed_params, id, sink);
1039 }
1040
1041
1042=== modified file 'src/server/shell/session_manager.cpp'
1043--- src/server/shell/session_manager.cpp 2013-04-23 01:40:52 +0000
1044+++ src/server/shell/session_manager.cpp 2013-04-24 09:03:32 +0000
1045@@ -55,9 +55,11 @@
1046 {
1047 }
1048
1049-std::shared_ptr<mf::Session> msh::SessionManager::open_session(std::string const& name)
1050+std::shared_ptr<mf::Session> msh::SessionManager::open_session(
1051+ std::string const& name,
1052+ std::shared_ptr<events::EventSink> const& sink)
1053 {
1054- auto new_session = std::make_shared<msh::ApplicationSession>(surface_factory, input_target_listener, name);
1055+ auto new_session = std::make_shared<msh::ApplicationSession>(surface_factory, input_target_listener, name, sink);
1056
1057 app_container->insert_session(new_session);
1058
1059
1060=== modified file 'src/server/shell/surface.cpp'
1061--- src/server/shell/surface.cpp 2013-04-19 03:20:05 +0000
1062+++ src/server/shell/surface.cpp 2013-04-24 09:03:32 +0000
1063@@ -20,7 +20,7 @@
1064 #include "mir/shell/surface_builder.h"
1065 #include "mir/input/input_channel.h"
1066 #include "mir_toolkit/event.h"
1067-#include "mir/event_sink.h"
1068+#include "mir/events/event_sink.h"
1069
1070 #include <boost/throw_exception.hpp>
1071
1072@@ -34,11 +34,14 @@
1073 msh::Surface::Surface(
1074 std::shared_ptr<SurfaceBuilder> const& builder,
1075 frontend::SurfaceCreationParameters const& params,
1076- std::shared_ptr<input::InputChannel> const& input_channel)
1077+ std::shared_ptr<input::InputChannel> const& input_channel,
1078+ frontend::SurfaceId id,
1079+ std::shared_ptr<events::EventSink> const& sink)
1080 : builder(builder),
1081 input_channel(input_channel),
1082 surface(builder->create_surface(params)),
1083- id(0),
1084+ id(id),
1085+ event_sink(sink),
1086 type_value(mir_surface_type_normal),
1087 state_value(mir_surface_state_restored)
1088 {
1089@@ -52,16 +55,6 @@
1090 }
1091 }
1092
1093-void msh::Surface::set_id(mir::frontend::SurfaceId i)
1094-{
1095- id = i;
1096-}
1097-
1098-void msh::Surface::set_event_target(std::shared_ptr<EventSink> const& sink)
1099-{
1100- event_sink = sink;
1101-}
1102-
1103 void msh::Surface::hide()
1104 {
1105 if (auto const& s = surface.lock())
1106
1107=== modified file 'src/server/shell/surface_source.cpp'
1108--- src/server/shell/surface_source.cpp 2013-04-16 09:16:38 +0000
1109+++ src/server/shell/surface_source.cpp 2013-04-24 09:03:32 +0000
1110@@ -39,11 +39,16 @@
1111 assert(surface_builder);
1112 }
1113
1114-std::shared_ptr<msh::Surface> msh::SurfaceSource::create_surface(const mf::SurfaceCreationParameters& params)
1115+std::shared_ptr<msh::Surface> msh::SurfaceSource::create_surface(
1116+ frontend::SurfaceCreationParameters const& params,
1117+ frontend::SurfaceId id,
1118+ std::shared_ptr<events::EventSink> const& sink)
1119 {
1120 return std::make_shared<Surface>(
1121 surface_builder,
1122 params,
1123- input_factory->make_input_channel());
1124+ input_factory->make_input_channel(),
1125+ id,
1126+ sink);
1127 }
1128
1129
1130=== modified file 'src/shared/protobuf/mir_protobuf_wire.proto'
1131--- src/shared/protobuf/mir_protobuf_wire.proto 2013-04-18 04:15:05 +0000
1132+++ src/shared/protobuf/mir_protobuf_wire.proto 2013-04-24 09:03:32 +0000
1133@@ -7,7 +7,9 @@
1134 }
1135
1136 message Result {
1137- // Invocation results have id and response. Events only have response.
1138+ // Invocation results have id and response.
1139 optional uint32 id = 1;
1140 optional bytes response = 2;
1141+ // Events are in events.
1142+ repeated bytes events = 3;
1143 }
1144
1145=== modified file 'tests/acceptance-tests/test_focus_management_api.cpp'
1146--- tests/acceptance-tests/test_focus_management_api.cpp 2013-04-22 03:24:56 +0000
1147+++ tests/acceptance-tests/test_focus_management_api.cpp 2013-04-24 09:03:32 +0000
1148@@ -126,7 +126,7 @@
1149 {
1150 using namespace ::testing;
1151 using frontend::Shell;
1152- ON_CALL(*this, open_session(_)).WillByDefault(Invoke(impl.get(), &Shell::open_session));
1153+ ON_CALL(*this, open_session(_, _)).WillByDefault(Invoke(impl.get(), &Shell::open_session));
1154 ON_CALL(*this, close_session(_)).WillByDefault(Invoke(impl.get(), &Shell::close_session));
1155
1156 ON_CALL(*this, tag_session_with_lightdm_id(_, _)).WillByDefault(Invoke(impl.get(), &Shell::tag_session_with_lightdm_id));
1157@@ -135,7 +135,7 @@
1158 ON_CALL(*this, create_surface_for(_, _)).WillByDefault(Invoke(impl.get(), &Shell::create_surface_for));
1159 }
1160
1161- MOCK_METHOD1(open_session, std::shared_ptr<mf::Session> (std::string const& name));
1162+ MOCK_METHOD2(open_session, std::shared_ptr<mf::Session> (std::string const& name, std::shared_ptr<mir::events::EventSink> const&));
1163 MOCK_METHOD1(close_session, void (std::shared_ptr<mf::Session> const& session));
1164
1165 MOCK_METHOD2(tag_session_with_lightdm_id, void (std::shared_ptr<mf::Session> const& session, int id));
1166@@ -165,13 +165,13 @@
1167
1168 Sequence s1, s2;
1169
1170- EXPECT_CALL(*mock_shell, open_session(_))
1171+ EXPECT_CALL(*mock_shell, open_session(_, _))
1172 .InSequence(s1, s2);
1173
1174 EXPECT_CALL(*mock_shell, create_surface_for(_,_))
1175 .InSequence(s1);
1176
1177- EXPECT_CALL(*mock_shell, open_session(_))
1178+ EXPECT_CALL(*mock_shell, open_session(_, _))
1179 .InSequence(s2);
1180
1181 EXPECT_CALL(*mock_shell, close_session(_))
1182
1183=== modified file 'tests/behavior-tests/session_management_context.cpp'
1184--- tests/behavior-tests/session_management_context.cpp 2013-04-22 03:24:56 +0000
1185+++ tests/behavior-tests/session_management_context.cpp 2013-04-24 09:03:32 +0000
1186@@ -66,12 +66,16 @@
1187 {
1188 }
1189
1190- std::shared_ptr<msh::Surface> create_surface(const mf::SurfaceCreationParameters& params)
1191+ std::shared_ptr<msh::Surface> create_surface(const mf::SurfaceCreationParameters& params,
1192+ frontend::SurfaceId id,
1193+ std::shared_ptr<events::EventSink> const& sink) override
1194 {
1195 return std::make_shared<msh::Surface>(
1196 mt::fake_shared(surface_builder),
1197 params,
1198- std::shared_ptr<mir::input::InputChannel>());
1199+ std::shared_ptr<mir::input::InputChannel>(),
1200+ id,
1201+ sink);
1202 }
1203
1204 mtd::StubSurfaceBuilder surface_builder;
1205@@ -152,7 +156,7 @@
1206 bool mtc::SessionManagementContext::open_window_consuming(std::string const& window_name)
1207 {
1208 auto const params = mf::a_surface().of_name(window_name);
1209- auto session = shell->open_session(window_name);
1210+ auto session = shell->open_session(window_name, std::shared_ptr<mir::events::EventSink>());
1211 auto const surface_id = session->create_surface(params);
1212
1213 open_windows[window_name] = std::make_tuple(session, surface_id);
1214@@ -164,7 +168,7 @@
1215 geom::Size const& size)
1216 {
1217 auto const params = mf::a_surface().of_name(window_name).of_size(size);
1218- auto session = shell->open_session(window_name);
1219+ auto session = shell->open_session(window_name, std::shared_ptr<mir::events::EventSink>());
1220 auto const surface_id = session->create_surface(params);
1221
1222 open_windows[window_name] = std::make_tuple(session, surface_id);
1223
1224=== modified file 'tests/integration-tests/cucumber/test_session_management_context.cpp'
1225--- tests/integration-tests/cucumber/test_session_management_context.cpp 2013-04-22 03:24:56 +0000
1226+++ tests/integration-tests/cucumber/test_session_management_context.cpp 2013-04-24 09:03:32 +0000
1227@@ -106,7 +106,7 @@
1228
1229 mtd::MockSession session;
1230
1231- EXPECT_CALL(shell, open_session(test_window_name)).Times(1)
1232+ EXPECT_CALL(shell, open_session(test_window_name, _)).Times(1)
1233 .WillOnce(Return(mt::fake_shared<mf::Session>(session)));
1234
1235 // As consuming mode is the default, omiting geometry is sufficient to request it.
1236@@ -122,7 +122,7 @@
1237
1238 mtd::MockSession session;
1239
1240- EXPECT_CALL(shell, open_session(test_window_name)).Times(1)
1241+ EXPECT_CALL(shell, open_session(test_window_name, _)).Times(1)
1242 .WillOnce(Return(mt::fake_shared<mf::Session>(session)));
1243
1244 EXPECT_CALL(session, create_surface(NamedWindowWithGeometry(test_window_name, test_window_size))).Times(1)
1245@@ -138,7 +138,7 @@
1246 mtd::MockSession session;
1247 mtd::MockSurface surface(std::make_shared<mtd::StubSurfaceBuilder>());
1248
1249- EXPECT_CALL(shell, open_session(test_window_name)).Times(1)
1250+ EXPECT_CALL(shell, open_session(test_window_name, _)).Times(1)
1251 .WillOnce(Return(mt::fake_shared<mf::Session>(session)));
1252
1253 EXPECT_CALL(session, create_surface(NamedWindowWithGeometry(test_window_name, test_window_size))).Times(1)
1254
1255=== modified file 'tests/integration-tests/shell/test_session_manager.cpp'
1256--- tests/integration-tests/shell/test_session_manager.cpp 2013-04-23 01:40:52 +0000
1257+++ tests/integration-tests/shell/test_session_manager.cpp 2013-04-24 09:03:32 +0000
1258@@ -36,6 +36,7 @@
1259 #include "mir_test_doubles/stub_input_target_listener.h"
1260
1261 namespace mc = mir::compositor;
1262+namespace me = mir::events;
1263 namespace mf = mir::frontend;
1264 namespace msh = mir::shell;
1265 namespace ms = mir::surfaces;
1266@@ -59,12 +60,12 @@
1267 mt::fake_shared(sequence),
1268 mt::fake_shared(focus_setter),
1269 mt::fake_shared(input_target_listener));
1270-
1271+
1272 EXPECT_CALL(focus_setter, set_focus_to(_)).Times(3);
1273
1274- auto session1 = session_manager.open_session("Visual Basic Studio");
1275- auto session2 = session_manager.open_session("Microsoft Access");
1276- auto session3 = session_manager.open_session("WordPerfect");
1277+ auto session1 = session_manager.open_session("Visual Basic Studio", std::shared_ptr<me::EventSink>());
1278+ auto session2 = session_manager.open_session("Microsoft Access", std::shared_ptr<me::EventSink>());
1279+ auto session3 = session_manager.open_session("WordPerfect", std::shared_ptr<me::EventSink>());
1280
1281 {
1282 InSequence seq;
1283@@ -98,9 +99,9 @@
1284
1285 EXPECT_CALL(focus_setter, set_focus_to(_)).Times(3);
1286
1287- auto session1 = session_manager.open_session("Visual Basic Studio");
1288- auto session2 = session_manager.open_session("Microsoft Access");
1289- auto session3 = session_manager.open_session("WordPerfect");
1290+ auto session1 = session_manager.open_session("Visual Basic Studio", std::shared_ptr<me::EventSink>());
1291+ auto session2 = session_manager.open_session("Microsoft Access", std::shared_ptr<me::EventSink>());
1292+ auto session3 = session_manager.open_session("WordPerfect", std::shared_ptr<me::EventSink>());
1293
1294 {
1295 InSequence seq;
1296
1297=== modified file 'tests/unit-tests/CMakeLists.txt'
1298--- tests/unit-tests/CMakeLists.txt 2013-04-10 02:48:51 +0000
1299+++ tests/unit-tests/CMakeLists.txt 2013-04-24 09:03:32 +0000
1300@@ -20,7 +20,6 @@
1301 add_subdirectory(android_input/)
1302 add_subdirectory(surfaces/)
1303 add_subdirectory(draw/)
1304-add_subdirectory(event/)
1305
1306 add_executable(unit-tests ${UNIT_TEST_SOURCES})
1307 uses_android_input(unit-tests)
1308
1309=== modified file 'tests/unit-tests/client/test_client_mir_surface.cpp'
1310--- tests/unit-tests/client/test_client_mir_surface.cpp 2013-04-22 03:24:56 +0000
1311+++ tests/unit-tests/client/test_client_mir_surface.cpp 2013-04-24 09:03:32 +0000
1312@@ -298,7 +298,7 @@
1313 test_server.reset();
1314 }
1315
1316- std::shared_ptr<google::protobuf::RpcChannel> channel;
1317+ std::shared_ptr<mcl::MirBasicRpcChannel> channel;
1318 std::shared_ptr<mcl::Logger> logger;
1319 std::shared_ptr<mcl::ClientPlatformFactory> platform_factory;
1320 std::shared_ptr<MirConnection> connection;
1321
1322=== modified file 'tests/unit-tests/client/test_mir_connection.cpp'
1323--- tests/unit-tests/client/test_mir_connection.cpp 2013-03-26 05:28:14 +0000
1324+++ tests/unit-tests/client/test_mir_connection.cpp 2013-04-24 09:03:32 +0000
1325@@ -39,7 +39,7 @@
1326 namespace
1327 {
1328
1329-struct MockRpcChannel : public google::protobuf::RpcChannel
1330+struct MockRpcChannel : public mir::client::MirBasicRpcChannel
1331 {
1332 void CallMethod(const google::protobuf::MethodDescriptor* method,
1333 google::protobuf::RpcController*,
1334@@ -63,6 +63,8 @@
1335
1336 MOCK_METHOD1(drm_auth_magic, void(const mp::DRMMagic*));
1337 MOCK_METHOD2(connect, void(mp::ConnectParameters const*,mp::Connection*));
1338+
1339+ void set_event_handler(mir::events::EventSink *) {}
1340 };
1341
1342 struct MockClientPlatform : public mcl::ClientPlatform
1343
1344=== removed directory 'tests/unit-tests/event'
1345=== removed file 'tests/unit-tests/event/CMakeLists.txt'
1346--- tests/unit-tests/event/CMakeLists.txt 2013-04-09 08:23:32 +0000
1347+++ tests/unit-tests/event/CMakeLists.txt 1970-01-01 00:00:00 +0000
1348@@ -1,5 +0,0 @@
1349-set (UNIT_TEST_SOURCES
1350- ${UNIT_TEST_SOURCES}
1351- ${CMAKE_CURRENT_SOURCE_DIR}/test_event_queue.cpp
1352- PARENT_SCOPE
1353-)
1354
1355=== modified file 'tests/unit-tests/frontend/CMakeLists.txt'
1356--- tests/unit-tests/frontend/CMakeLists.txt 2013-04-11 03:54:01 +0000
1357+++ tests/unit-tests/frontend/CMakeLists.txt 2013-04-24 09:03:32 +0000
1358@@ -6,6 +6,7 @@
1359 ${CMAKE_CURRENT_SOURCE_DIR}/test_protobuf_reports_errors.cpp
1360 ${CMAKE_CURRENT_SOURCE_DIR}/test_resource_cache.cpp
1361 ${CMAKE_CURRENT_SOURCE_DIR}/test_session_mediator.cpp
1362+ ${CMAKE_CURRENT_SOURCE_DIR}/test_event_pipe.cpp
1363 )
1364
1365 # TODO this test is a mess - something better is needed.
1366
1367=== renamed file 'tests/unit-tests/event/test_event_queue.cpp' => 'tests/unit-tests/frontend/test_event_pipe.cpp'
1368--- tests/unit-tests/event/test_event_queue.cpp 2013-04-22 03:37:28 +0000
1369+++ tests/unit-tests/frontend/test_event_pipe.cpp 2013-04-24 09:03:32 +0000
1370@@ -16,14 +16,17 @@
1371 * Authored by: Daniel van Vugt <daniel.van.vugt@canonical.com>
1372 */
1373
1374+#include "src/server/frontend/event_pipe.h"
1375+#include <cstring>
1376+
1377 #include <gtest/gtest.h>
1378-#include "mir/event_queue.h"
1379-#include "mir/event_sink.h"
1380-#include <cstring>
1381-
1382-TEST(EventQueue, no_sink)
1383+
1384+using mir::frontend::EventPipe;
1385+
1386+
1387+TEST(EventPipe, no_sink)
1388 {
1389- mir::EventQueue q;
1390+ EventPipe q;
1391 MirEvent e;
1392
1393 e.type = mir_event_type_key;
1394@@ -38,7 +41,7 @@
1395
1396 namespace
1397 {
1398- class TestSink : public mir::EventSink
1399+ class TestSink : public mir::events::EventSink
1400 {
1401 public:
1402 TestSink()
1403@@ -61,9 +64,9 @@
1404 };
1405 }
1406
1407-TEST(EventQueue, events_get_handled)
1408+TEST(EventPipe, events_get_handled)
1409 {
1410- mir::EventQueue q;
1411+ EventPipe q;
1412 std::shared_ptr<TestSink> s(new TestSink);
1413
1414 q.set_target(s);
1415@@ -84,9 +87,9 @@
1416 EXPECT_EQ(mir_event_type_surface, s->last_event_handled().type);
1417 }
1418
1419-TEST(EventQueue, sink_is_changeable)
1420+TEST(EventPipe, sink_is_changeable)
1421 {
1422- mir::EventQueue q;
1423+ EventPipe q;
1424 std::shared_ptr<TestSink> a(new TestSink);
1425 std::shared_ptr<TestSink> b(new TestSink);
1426
1427
1428=== modified file 'tests/unit-tests/frontend/test_session_mediator.cpp'
1429--- tests/unit-tests/frontend/test_session_mediator.cpp 2013-04-19 08:03:57 +0000
1430+++ tests/unit-tests/frontend/test_session_mediator.cpp 2013-04-24 09:03:32 +0000
1431@@ -34,7 +34,7 @@
1432 #include "mir_test_doubles/stub_session.h"
1433 #include "mir_test_doubles/stub_surface_builder.h"
1434 #include "mir_test/fake_shared.h"
1435-#include "mir/event_queue.h"
1436+#include "mir/events/event_sink.h"
1437 #include "mir/shell/surface.h"
1438
1439 #include <gtest/gtest.h>
1440@@ -129,7 +129,11 @@
1441 }
1442 };
1443
1444-}
1445+class NullEventSink : public mir::events::EventSink
1446+{
1447+public:
1448+ void handle_event(MirEvent const& ) override {}
1449+};
1450
1451 struct SessionMediatorTest : public ::testing::Test
1452 {
1453@@ -142,14 +146,14 @@
1454 resource_cache{std::make_shared<mf::ResourceCache>()},
1455 mediator{shell, graphics_platform, graphics_display,
1456 buffer_allocator, report,
1457- std::make_shared<mir::EventQueue>(),
1458+ std::make_shared<NullEventSink>(),
1459 resource_cache},
1460 stubbed_session{std::make_shared<StubbedSession>()},
1461 null_callback{google::protobuf::NewPermanentCallback(google::protobuf::DoNothing)}
1462 {
1463 using namespace ::testing;
1464
1465- ON_CALL(*shell, open_session(_)).WillByDefault(Return(stubbed_session));
1466+ ON_CALL(*shell, open_session(_, _)).WillByDefault(Return(stubbed_session));
1467 ON_CALL(*shell, create_surface_for(_, _)).WillByDefault(Return(mf::SurfaceId{1}));
1468 }
1469
1470@@ -164,7 +168,7 @@
1471
1472 std::unique_ptr<google::protobuf::Closure> null_callback;
1473 };
1474-
1475+}
1476
1477 TEST_F(SessionMediatorTest, disconnect_releases_session)
1478 {
1479
1480=== modified file 'tests/unit-tests/frontend/test_session_mediator_android.cpp'
1481--- tests/unit-tests/frontend/test_session_mediator_android.cpp 2013-04-22 03:35:08 +0000
1482+++ tests/unit-tests/frontend/test_session_mediator_android.cpp 2013-04-24 09:03:32 +0000
1483@@ -31,7 +31,7 @@
1484 #include "mir_test_doubles/mock_session.h"
1485 #include "mir_test_doubles/stub_shell.h"
1486
1487-#include "mir/event_queue.h"
1488+#include "mir/events/event_sink.h"
1489
1490 #include <gtest/gtest.h>
1491
1492@@ -87,7 +87,11 @@
1493 }
1494 };
1495
1496-}
1497+class NullEventSink : public mir::events::EventSink
1498+{
1499+public:
1500+ void handle_event(MirEvent const& ) override {}
1501+};
1502
1503 struct SessionMediatorAndroidTest : public ::testing::Test
1504 {
1505@@ -100,7 +104,7 @@
1506 resource_cache{std::make_shared<mf::ResourceCache>()},
1507 mediator{shell, graphics_platform, graphics_display,
1508 buffer_allocator, report,
1509- std::make_shared<mir::EventQueue>(),
1510+ std::make_shared<NullEventSink>(),
1511 resource_cache},
1512 null_callback{google::protobuf::NewPermanentCallback(google::protobuf::DoNothing)}
1513 {
1514@@ -117,6 +121,8 @@
1515 std::unique_ptr<google::protobuf::Closure> null_callback;
1516 };
1517
1518+}
1519+
1520 TEST_F(SessionMediatorAndroidTest, drm_auth_magic_throws)
1521 {
1522 mp::ConnectParameters connect_parameters;
1523
1524=== modified file 'tests/unit-tests/frontend/test_session_mediator_gbm.cpp'
1525--- tests/unit-tests/frontend/test_session_mediator_gbm.cpp 2013-04-19 08:03:57 +0000
1526+++ tests/unit-tests/frontend/test_session_mediator_gbm.cpp 2013-04-24 09:03:32 +0000
1527@@ -27,7 +27,7 @@
1528 #include "mir/graphics/drm_authenticator.h"
1529 #include "mir/graphics/platform.h"
1530 #include "mir/graphics/platform_ipc_package.h"
1531-#include "mir/event_queue.h"
1532+#include "mir/events/event_sink.h"
1533
1534 #include <boost/exception/errinfo_errno.hpp>
1535 #include <boost/throw_exception.hpp>
1536@@ -91,7 +91,11 @@
1537 MOCK_METHOD1(drm_auth_magic, void(drm_magic_t));
1538 };
1539
1540-}
1541+class NullEventSink : public mir::events::EventSink
1542+{
1543+public:
1544+ void handle_event(MirEvent const& ) override {}
1545+};
1546
1547 struct SessionMediatorGBMTest : public ::testing::Test
1548 {
1549@@ -104,7 +108,7 @@
1550 resource_cache{std::make_shared<mf::ResourceCache>()},
1551 mediator{shell, mock_platform, graphics_display,
1552 buffer_allocator, report,
1553- std::make_shared<mir::EventQueue>(),
1554+ std::make_shared<NullEventSink>(),
1555 resource_cache},
1556 null_callback{google::protobuf::NewPermanentCallback(google::protobuf::DoNothing)}
1557 {
1558@@ -121,6 +125,8 @@
1559 std::unique_ptr<google::protobuf::Closure> null_callback;
1560 };
1561
1562+}
1563+
1564 TEST_F(SessionMediatorGBMTest, drm_auth_magic_uses_drm_authenticator)
1565 {
1566 mp::ConnectParameters connect_parameters;
1567
1568=== modified file 'tests/unit-tests/shell/test_application_session.cpp'
1569--- tests/unit-tests/shell/test_application_session.cpp 2013-04-23 01:40:52 +0000
1570+++ tests/unit-tests/shell/test_application_session.cpp 2013-04-24 09:03:32 +0000
1571@@ -32,6 +32,7 @@
1572 #include <gtest/gtest.h>
1573
1574 namespace mc = mir::compositor;
1575+namespace me = mir::events;
1576 namespace mf = mir::frontend;
1577 namespace msh = mir::shell;
1578 namespace ms = mir::surfaces;
1579@@ -47,13 +48,13 @@
1580 auto const mock_surface = std::make_shared<mtd::MockSurface>(mt::fake_shared(surface_builder));
1581
1582 mtd::MockSurfaceFactory surface_factory;
1583- ON_CALL(surface_factory, create_surface(_)).WillByDefault(Return(mock_surface));
1584+ ON_CALL(surface_factory, create_surface(_, _, _)).WillByDefault(Return(mock_surface));
1585
1586- EXPECT_CALL(surface_factory, create_surface(_));
1587+ EXPECT_CALL(surface_factory, create_surface(_, _, _));
1588 EXPECT_CALL(*mock_surface, destroy());
1589
1590 mtd::StubInputTargetListener input_listener;
1591- msh::ApplicationSession session(mt::fake_shared(surface_factory), mt::fake_shared(input_listener), "Foo");
1592+ msh::ApplicationSession session(mt::fake_shared(surface_factory), mt::fake_shared(input_listener), "Foo", std::shared_ptr<me::EventSink>());
1593
1594 mf::SurfaceCreationParameters params;
1595 auto surf = session.create_surface(params);
1596@@ -69,16 +70,16 @@
1597 mtd::StubSurfaceBuilder surface_builder;
1598 {
1599 InSequence seq;
1600- EXPECT_CALL(surface_factory, create_surface(_)).Times(1)
1601- .WillOnce(Return(std::make_shared<NiceMock<mtd::MockSurface>>(mt::fake_shared(surface_builder))));
1602- EXPECT_CALL(surface_factory, create_surface(_)).Times(1)
1603- .WillOnce(Return(std::make_shared<NiceMock<mtd::MockSurface>>(mt::fake_shared(surface_builder))));
1604- EXPECT_CALL(surface_factory, create_surface(_)).Times(1)
1605+ EXPECT_CALL(surface_factory, create_surface(_, _, _)).Times(1)
1606+ .WillOnce(Return(std::make_shared<NiceMock<mtd::MockSurface>>(mt::fake_shared(surface_builder))));
1607+ EXPECT_CALL(surface_factory, create_surface(_, _, _)).Times(1)
1608+ .WillOnce(Return(std::make_shared<NiceMock<mtd::MockSurface>>(mt::fake_shared(surface_builder))));
1609+ EXPECT_CALL(surface_factory, create_surface(_, _, _)).Times(1)
1610 .WillOnce(Return(std::make_shared<NiceMock<mtd::MockSurface>>(mt::fake_shared(surface_builder))));
1611 }
1612
1613 mtd::StubInputTargetListener input_listener;
1614- msh::ApplicationSession app_session(mt::fake_shared(surface_factory), mt::fake_shared(input_listener), "Foo");
1615+ msh::ApplicationSession app_session(mt::fake_shared(surface_factory), mt::fake_shared(input_listener), "Foo", std::shared_ptr<me::EventSink>());
1616
1617 mf::SurfaceCreationParameters params;
1618 auto id1 = app_session.create_surface(params);
1619@@ -106,12 +107,12 @@
1620 auto const mock_surface = std::make_shared<mtd::MockSurface>(mt::fake_shared(surface_builder));
1621
1622 mtd::MockSurfaceFactory surface_factory;
1623- ON_CALL(surface_factory, create_surface(_)).WillByDefault(Return(mock_surface));
1624+ ON_CALL(surface_factory, create_surface(_, _, _)).WillByDefault(Return(mock_surface));
1625
1626 mtd::StubInputTargetListener input_listener;
1627- msh::ApplicationSession app_session(mt::fake_shared(surface_factory), mt::fake_shared(input_listener), "Foo");
1628+ msh::ApplicationSession app_session(mt::fake_shared(surface_factory), mt::fake_shared(input_listener), "Foo", std::shared_ptr<me::EventSink>());
1629
1630- EXPECT_CALL(surface_factory, create_surface(_));
1631+ EXPECT_CALL(surface_factory, create_surface(_, _, _));
1632
1633 {
1634 InSequence seq;
1635@@ -135,7 +136,7 @@
1636
1637 mtd::MockSurfaceFactory surface_factory;
1638 mtd::StubInputTargetListener input_listener;
1639- msh::ApplicationSession app_session(mt::fake_shared(surface_factory), mt::fake_shared(input_listener), "Foo");
1640+ msh::ApplicationSession app_session(mt::fake_shared(surface_factory), mt::fake_shared(input_listener), "Foo", std::shared_ptr<me::EventSink>());
1641 mf::SurfaceId invalid_surface_id(1);
1642
1643 EXPECT_THROW({
1644@@ -149,7 +150,7 @@
1645
1646 mtd::MockSurfaceFactory surface_factory;
1647 mtd::StubInputTargetListener input_listener;
1648- msh::ApplicationSession app_session(mt::fake_shared(surface_factory), mt::fake_shared(input_listener), "Foo");
1649+ msh::ApplicationSession app_session(mt::fake_shared(surface_factory), mt::fake_shared(input_listener), "Foo", std::shared_ptr<me::EventSink>());
1650 mf::SurfaceId invalid_surface_id(1);
1651
1652 EXPECT_THROW({
1653
1654=== modified file 'tests/unit-tests/shell/test_organising_surface_factory.cpp'
1655--- tests/unit-tests/shell/test_organising_surface_factory.cpp 2013-04-02 05:58:55 +0000
1656+++ tests/unit-tests/shell/test_organising_surface_factory.cpp 2013-04-24 09:03:32 +0000
1657@@ -25,6 +25,7 @@
1658 #include <gtest/gtest.h>
1659 #include <gmock/gmock.h>
1660
1661+namespace me = mir::events;
1662 namespace mf = mir::frontend;
1663 namespace msh = mir::shell;
1664 namespace geom = mir::geometry;
1665@@ -45,7 +46,7 @@
1666 using namespace ::testing;
1667
1668 underlying_surface_factory = std::make_shared<mtd::MockSurfaceFactory>();
1669- ON_CALL(*underlying_surface_factory, create_surface(_)).WillByDefault(Return(null_surface));
1670+ ON_CALL(*underlying_surface_factory, create_surface(_, _, _)).WillByDefault(Return(null_surface));
1671
1672 placement_strategy = std::make_shared<MockPlacementStrategy>();
1673 }
1674@@ -62,13 +63,13 @@
1675
1676 msh::OrganisingSurfaceFactory factory(underlying_surface_factory, placement_strategy);
1677
1678- EXPECT_CALL(*underlying_surface_factory, create_surface(_)).Times(1);
1679+ EXPECT_CALL(*underlying_surface_factory, create_surface(_, _, _)).Times(1);
1680
1681 auto params = mf::a_surface();
1682 EXPECT_CALL(*placement_strategy, place(Ref(params))).Times(1)
1683 .WillOnce(Return(mf::a_surface()));
1684
1685- factory.create_surface(params);
1686+ factory.create_surface(params, mf::SurfaceId(), std::shared_ptr<me::EventSink>());
1687 }
1688
1689 TEST_F(OrganisingSurfaceFactorySetup, forwards_create_surface_parameters_from_placement_strategy_to_underlying_factory)
1690@@ -83,8 +84,8 @@
1691
1692 EXPECT_CALL(*placement_strategy, place(Ref(params))).Times(1)
1693 .WillOnce(Return(placed_params));
1694- EXPECT_CALL(*underlying_surface_factory, create_surface(placed_params));
1695+ EXPECT_CALL(*underlying_surface_factory, create_surface(placed_params, mf::SurfaceId(), std::shared_ptr<me::EventSink>()));
1696
1697- factory.create_surface(params);
1698+ factory.create_surface(params, mf::SurfaceId(), std::shared_ptr<me::EventSink>());
1699 }
1700
1701
1702=== modified file 'tests/unit-tests/shell/test_registration_order_focus_sequence.cpp'
1703--- tests/unit-tests/shell/test_registration_order_focus_sequence.cpp 2013-04-23 01:40:52 +0000
1704+++ tests/unit-tests/shell/test_registration_order_focus_sequence.cpp 2013-04-24 09:03:32 +0000
1705@@ -33,6 +33,7 @@
1706 #include <string>
1707
1708 namespace mc = mir::compositor;
1709+namespace me = mir::events;
1710 namespace msh = mir::shell;
1711 namespace ms = mir::surfaces;
1712 namespace mt = mir::test;
1713@@ -65,9 +66,9 @@
1714 {
1715 using namespace ::testing;
1716
1717- auto app1 = std::make_shared<msh::ApplicationSession>(factory, mt::fake_shared(input_listener), testing_app_name1);
1718- auto app2 = std::make_shared<msh::ApplicationSession>(factory, mt::fake_shared(input_listener), testing_app_name2);
1719- auto app3 = std::make_shared<msh::ApplicationSession>(factory, mt::fake_shared(input_listener), testing_app_name3);
1720+ auto app1 = std::make_shared<msh::ApplicationSession>(factory, mt::fake_shared(input_listener), testing_app_name1, std::shared_ptr<me::EventSink>());
1721+ auto app2 = std::make_shared<msh::ApplicationSession>(factory, mt::fake_shared(input_listener), testing_app_name2, std::shared_ptr<me::EventSink>());
1722+ auto app3 = std::make_shared<msh::ApplicationSession>(factory, mt::fake_shared(input_listener), testing_app_name3, std::shared_ptr<me::EventSink>());
1723
1724 container->insert_session(app1);
1725 container->insert_session(app2);
1726@@ -83,9 +84,9 @@
1727 {
1728 using namespace ::testing;
1729
1730- auto app1 = std::make_shared<msh::ApplicationSession>(factory, mt::fake_shared(input_listener), testing_app_name1);
1731- auto app2 = std::make_shared<msh::ApplicationSession>(factory, mt::fake_shared(input_listener), testing_app_name2);
1732- auto app3 = std::make_shared<msh::ApplicationSession>(factory, mt::fake_shared(input_listener), testing_app_name3);
1733+ auto app1 = std::make_shared<msh::ApplicationSession>(factory, mt::fake_shared(input_listener), testing_app_name1, std::shared_ptr<me::EventSink>());
1734+ auto app2 = std::make_shared<msh::ApplicationSession>(factory, mt::fake_shared(input_listener), testing_app_name2, std::shared_ptr<me::EventSink>());
1735+ auto app3 = std::make_shared<msh::ApplicationSession>(factory, mt::fake_shared(input_listener), testing_app_name3, std::shared_ptr<me::EventSink>());
1736 container->insert_session(app1);
1737 container->insert_session(app2);
1738 container->insert_session(app3);
1739@@ -100,7 +101,7 @@
1740 {
1741 using namespace ::testing;
1742
1743- auto app1 = std::make_shared<msh::ApplicationSession>(factory, mt::fake_shared(input_listener), testing_app_name1);
1744+ auto app1 = std::make_shared<msh::ApplicationSession>(factory, mt::fake_shared(input_listener), testing_app_name1, std::shared_ptr<me::EventSink>());
1745 container->insert_session(app1);
1746
1747 msh::RegistrationOrderFocusSequence focus_sequence(container);
1748@@ -112,8 +113,8 @@
1749 {
1750 using namespace ::testing;
1751
1752- auto app1 = std::make_shared<msh::ApplicationSession>(factory, mt::fake_shared(input_listener), testing_app_name1);
1753- auto app2 = std::make_shared<msh::ApplicationSession>(factory, mt::fake_shared(input_listener), testing_app_name2);
1754+ auto app1 = std::make_shared<msh::ApplicationSession>(factory, mt::fake_shared(input_listener), testing_app_name1, std::shared_ptr<me::EventSink>());
1755+ auto app2 = std::make_shared<msh::ApplicationSession>(factory, mt::fake_shared(input_listener), testing_app_name2, std::shared_ptr<me::EventSink>());
1756 auto null_session = std::shared_ptr<msh::ApplicationSession>();
1757
1758 msh::RegistrationOrderFocusSequence focus_sequence(container);
1759@@ -129,7 +130,7 @@
1760 {
1761 using namespace ::testing;
1762
1763- auto invalid_session = std::make_shared<msh::ApplicationSession>(factory, mt::fake_shared(input_listener), testing_app_name1);
1764+ auto invalid_session = std::make_shared<msh::ApplicationSession>(factory, mt::fake_shared(input_listener), testing_app_name1, std::shared_ptr<me::EventSink>());
1765 auto null_session = std::shared_ptr<msh::ApplicationSession>();
1766
1767 msh::RegistrationOrderFocusSequence focus_sequence(container);
1768
1769=== modified file 'tests/unit-tests/shell/test_session_manager.cpp'
1770--- tests/unit-tests/shell/test_session_manager.cpp 2013-04-23 01:40:52 +0000
1771+++ tests/unit-tests/shell/test_session_manager.cpp 2013-04-24 09:03:32 +0000
1772@@ -41,6 +41,7 @@
1773 #include <gtest/gtest.h>
1774
1775 namespace mc = mir::compositor;
1776+namespace me = mir::events;
1777 namespace mf = mir::frontend;
1778 namespace msh = mir::shell;
1779 namespace ms = mir::surfaces;
1780@@ -101,7 +102,7 @@
1781
1782 EXPECT_CALL(focus_sequence, default_focus()).WillOnce(Return((std::shared_ptr<msh::Session>())));
1783
1784- auto session = session_manager.open_session("Visual Basic Studio");
1785+ auto session = session_manager.open_session("Visual Basic Studio", std::shared_ptr<me::EventSink>());
1786 session_manager.close_session(session);
1787 }
1788
1789@@ -109,14 +110,16 @@
1790 {
1791 using namespace ::testing;
1792
1793- EXPECT_CALL(surface_factory, create_surface(_)).Times(1);
1794+ EXPECT_CALL(surface_factory, create_surface(_, _, _)).Times(1);
1795
1796 std::shared_ptr<mi::InputChannel> null_input_channel;
1797- ON_CALL(surface_factory, create_surface(_)).WillByDefault(
1798+ ON_CALL(surface_factory, create_surface(_, _, _)).WillByDefault(
1799 Return(std::make_shared<msh::Surface>(
1800 mt::fake_shared(surface_builder),
1801 mf::a_surface(),
1802- null_input_channel)));
1803+ null_input_channel,
1804+ mf::SurfaceId(),
1805+ std::shared_ptr<me::EventSink>())));
1806
1807 EXPECT_CALL(container, insert_session(_)).Times(1);
1808 EXPECT_CALL(container, remove_session(_)).Times(1);
1809@@ -126,7 +129,7 @@
1810
1811 EXPECT_CALL(focus_sequence, default_focus()).WillOnce(Return((std::shared_ptr<msh::Session>())));
1812
1813- auto session = session_manager.open_session("Visual Basic Studio");
1814+ auto session = session_manager.open_session("Visual Basic Studio", std::shared_ptr<me::EventSink>());
1815 session->create_surface(mf::a_surface().of_size(geom::Size{geom::Width{1024}, geom::Height{768}}));
1816
1817 session_manager.close_session(session);
1818@@ -140,7 +143,7 @@
1819 EXPECT_CALL(container, insert_session(_)).Times(1);
1820 EXPECT_CALL(focus_setter, set_focus_to(_)).WillOnce(SaveArg<0>(&new_session));
1821
1822- auto session = session_manager.open_session("Visual Basic Studio");
1823+ auto session = session_manager.open_session("Visual Basic Studio", std::shared_ptr<me::EventSink>());
1824 EXPECT_EQ(session, new_session);
1825 }
1826
1827@@ -148,8 +151,8 @@
1828 {
1829 using namespace ::testing;
1830
1831- auto session1 = session_manager.open_session("Visual Basic Studio");
1832- auto session2 = session_manager.open_session("IntelliJ IDEA");
1833+ auto session1 = session_manager.open_session("Visual Basic Studio", std::shared_ptr<me::EventSink>());
1834+ auto session2 = session_manager.open_session("IntelliJ IDEA", std::shared_ptr<me::EventSink>());
1835
1836 session_manager.tag_session_with_lightdm_id(session1, 1);
1837
1838@@ -161,8 +164,8 @@
1839 {
1840 using namespace ::testing;
1841
1842- auto session1 = session_manager.open_session("Visual Basic Studio");
1843- auto session2 = session_manager.open_session("IntelliJ IDEA");
1844+ auto session1 = session_manager.open_session("Visual Basic Studio", std::shared_ptr<me::EventSink>());
1845+ auto session2 = session_manager.open_session("IntelliJ IDEA", std::shared_ptr<me::EventSink>());
1846
1847 auto shell_session1 = std::dynamic_pointer_cast<msh::Session>(session1);
1848 auto shell_session2 = std::dynamic_pointer_cast<msh::Session>(session2);
1849@@ -180,22 +183,24 @@
1850 {
1851 using namespace ::testing;
1852 std::shared_ptr<mi::InputChannel> null_input_channel;
1853- ON_CALL(surface_factory, create_surface(_)).WillByDefault(
1854+ ON_CALL(surface_factory, create_surface(_, _, _)).WillByDefault(
1855 Return(std::make_shared<msh::Surface>(
1856 mt::fake_shared(surface_builder),
1857 mf::a_surface(),
1858- null_input_channel)));
1859+ null_input_channel,
1860+ mf::SurfaceId(),
1861+ std::shared_ptr<me::EventSink>())));
1862
1863 // Once for session creation and once for surface creation
1864 {
1865 InSequence seq;
1866
1867 EXPECT_CALL(focus_setter, set_focus_to(_)).Times(1); // Session creation
1868- EXPECT_CALL(surface_factory, create_surface(_)).Times(1);
1869+ EXPECT_CALL(surface_factory, create_surface(_, _, _)).Times(1);
1870 EXPECT_CALL(focus_setter, set_focus_to(_)).Times(1); // Post Surface creation
1871 }
1872
1873- auto session1 = session_manager.open_session("Weather Report");
1874+ auto session1 = session_manager.open_session("Weather Report", std::shared_ptr<me::EventSink>());
1875 session_manager.create_surface_for(session1, mf::a_surface());
1876 }
1877
1878@@ -230,12 +235,14 @@
1879 using namespace ::testing;
1880
1881 std::shared_ptr<mi::InputChannel> null_input_channel;
1882- ON_CALL(surface_factory, create_surface(_)).WillByDefault(
1883+ ON_CALL(surface_factory, create_surface(_,_,_)).WillByDefault(
1884 Return(std::make_shared<msh::Surface>(
1885 mt::fake_shared(surface_builder),
1886 mf::a_surface(),
1887- null_input_channel)));
1888- EXPECT_CALL(surface_factory, create_surface(_)).Times(1);
1889+ null_input_channel,
1890+ mf::SurfaceId(),
1891+ std::shared_ptr<me::EventSink>())));
1892+ EXPECT_CALL(surface_factory, create_surface(_,_,_)).Times(1);
1893
1894 EXPECT_CALL(focus_sequence, default_focus()).WillOnce(Return((std::shared_ptr<msh::Session>())));
1895 {
1896@@ -252,7 +259,7 @@
1897 }
1898
1899 {
1900- auto session = session_manager.open_session("test");
1901+ auto session = session_manager.open_session("test", std::shared_ptr<me::EventSink>());
1902 auto surf = session_manager.create_surface_for(session, mf::a_surface());
1903 session->destroy_surface(surf);
1904 session_manager.close_session(session);
1905
1906=== modified file 'tests/unit-tests/shell/test_single_visibility_focus_mechanism.cpp'
1907--- tests/unit-tests/shell/test_single_visibility_focus_mechanism.cpp 2013-04-23 01:40:52 +0000
1908+++ tests/unit-tests/shell/test_single_visibility_focus_mechanism.cpp 2013-04-24 09:03:32 +0000
1909@@ -57,7 +57,6 @@
1910 MOCK_METHOD0(show, void());
1911
1912 MOCK_METHOD3(configure_surface, int(mf::SurfaceId, MirSurfaceAttrib, int));
1913- MOCK_METHOD1(set_event_sink, void(std::shared_ptr<mir::EventSink> const&));
1914 };
1915
1916 TEST(SingleVisibilityFocusMechanism, mechanism_sets_visibility)
1917
1918=== modified file 'tests/unit-tests/shell/test_surface.cpp'
1919--- tests/unit-tests/shell/test_surface.cpp 2013-04-19 03:20:05 +0000
1920+++ tests/unit-tests/shell/test_surface.cpp 2013-04-24 09:03:32 +0000
1921@@ -33,6 +33,7 @@
1922 #include <gmock/gmock.h>
1923 #include <gtest/gtest.h>
1924
1925+namespace me = mir::events;
1926 namespace ms = mir::surfaces;
1927 namespace msh = mir::shell;
1928 namespace mf = mir::frontend;
1929@@ -137,7 +138,9 @@
1930 msh::Surface test(
1931 mt::fake_shared(surface_builder),
1932 params,
1933- null_input_channel);
1934+ null_input_channel,
1935+ mf::SurfaceId(),
1936+ std::shared_ptr<me::EventSink>());
1937 }
1938
1939 TEST_F(ShellSurface, creation_throws_means_no_destroy)
1940@@ -156,7 +159,9 @@
1941 msh::Surface test(
1942 mt::fake_shared(surface_builder),
1943 params,
1944- null_input_channel);
1945+ null_input_channel,
1946+ mf::SurfaceId(),
1947+ std::shared_ptr<me::EventSink>());
1948 }, std::runtime_error);
1949 }
1950
1951@@ -172,7 +177,9 @@
1952 msh::Surface test(
1953 mt::fake_shared(surface_builder),
1954 mf::a_surface(),
1955- null_input_channel);
1956+ null_input_channel,
1957+ mf::SurfaceId(),
1958+ std::shared_ptr<me::EventSink>());
1959
1960 Mock::VerifyAndClearExpectations(&test);
1961 EXPECT_CALL(surface_builder, destroy_surface(_)).Times(1);
1962@@ -189,7 +196,9 @@
1963 msh::Surface test(
1964 mt::fake_shared(surface_builder),
1965 mf::a_surface(),
1966- null_input_channel);
1967+ null_input_channel,
1968+ mf::SurfaceId(),
1969+ std::shared_ptr<me::EventSink>());
1970
1971 EXPECT_NO_THROW({
1972 test.client_buffer();
1973@@ -207,7 +216,9 @@
1974 msh::Surface test(
1975 mt::fake_shared(surface_builder),
1976 mf::a_surface(),
1977- null_input_channel);
1978+ null_input_channel,
1979+ mf::SurfaceId(),
1980+ std::shared_ptr<me::EventSink>());
1981
1982 EXPECT_NO_THROW({
1983 test.size();
1984@@ -225,7 +236,9 @@
1985 msh::Surface test(
1986 mt::fake_shared(surface_builder),
1987 mf::a_surface(),
1988- null_input_channel);
1989+ null_input_channel,
1990+ mf::SurfaceId(),
1991+ std::shared_ptr<me::EventSink>());
1992
1993 EXPECT_NO_THROW({
1994 test.name();
1995@@ -243,7 +256,9 @@
1996 msh::Surface test(
1997 mt::fake_shared(surface_builder),
1998 mf::a_surface(),
1999- null_input_channel);
2000+ null_input_channel,
2001+ mf::SurfaceId(),
2002+ std::shared_ptr<me::EventSink>());
2003
2004 EXPECT_NO_THROW({
2005 test.pixel_format();
2006@@ -261,7 +276,9 @@
2007 msh::Surface test(
2008 mt::fake_shared(surface_builder),
2009 mf::a_surface(),
2010- null_input_channel);
2011+ null_input_channel,
2012+ mf::SurfaceId(),
2013+ std::shared_ptr<me::EventSink>());
2014
2015 EXPECT_NO_THROW({
2016 test.hide();
2017@@ -279,7 +296,9 @@
2018 msh::Surface test(
2019 mt::fake_shared(surface_builder),
2020 mf::a_surface(),
2021- null_input_channel);
2022+ null_input_channel,
2023+ mf::SurfaceId(),
2024+ std::shared_ptr<me::EventSink>());
2025
2026 EXPECT_NO_THROW({
2027 test.show();
2028@@ -297,7 +316,9 @@
2029 msh::Surface test(
2030 mt::fake_shared(surface_builder),
2031 mf::a_surface(),
2032- null_input_channel);
2033+ null_input_channel,
2034+ mf::SurfaceId(),
2035+ std::shared_ptr<me::EventSink>());
2036
2037 EXPECT_NO_THROW({
2038 test.destroy();
2039@@ -315,7 +336,9 @@
2040 msh::Surface test(
2041 mt::fake_shared(surface_builder),
2042 mf::a_surface(),
2043- null_input_channel);
2044+ null_input_channel,
2045+ mf::SurfaceId(),
2046+ std::shared_ptr<me::EventSink>());
2047
2048 EXPECT_NO_THROW({
2049 test.force_requests_to_complete();
2050@@ -333,7 +356,9 @@
2051 msh::Surface test(
2052 mt::fake_shared(surface_builder),
2053 mf::a_surface(),
2054- null_input_channel);
2055+ null_input_channel,
2056+ mf::SurfaceId(),
2057+ std::shared_ptr<me::EventSink>());
2058
2059 EXPECT_NO_THROW({
2060 test.advance_client_buffer();
2061@@ -352,8 +377,19 @@
2062 const int testing_client_fd = 17;
2063
2064 MockInputChannel mock_package;
2065- msh::Surface proxy_surface(mt::fake_shared(surface_builder), mf::a_surface(), null_input_channel);
2066- msh::Surface input_proxy_surface(mt::fake_shared(surface_builder), mf::a_surface(), mt::fake_shared(mock_package));
2067+ msh::Surface proxy_surface(
2068+ mt::fake_shared(surface_builder),
2069+ mf::a_surface(),
2070+ null_input_channel,
2071+ mf::SurfaceId(),
2072+ std::shared_ptr<me::EventSink>());
2073+
2074+ msh::Surface input_proxy_surface(
2075+ mt::fake_shared(surface_builder),
2076+ mf::a_surface(),
2077+ mt::fake_shared(mock_package),
2078+ mf::SurfaceId(),
2079+ std::shared_ptr<me::EventSink>());
2080
2081 EXPECT_CALL(mock_package, client_fd()).Times(1).WillOnce(Return(testing_client_fd));
2082
2083@@ -374,7 +410,9 @@
2084 msh::Surface surf(
2085 mt::fake_shared(surface_builder),
2086 mf::a_surface(),
2087- null_input_channel);
2088+ null_input_channel,
2089+ mf::SurfaceId(),
2090+ std::shared_ptr<me::EventSink>());
2091
2092 EXPECT_THROW({
2093 surf.configure(static_cast<MirSurfaceAttrib>(111), 222);
2094@@ -388,7 +426,9 @@
2095 msh::Surface surf(
2096 mt::fake_shared(surface_builder),
2097 mf::a_surface(),
2098- null_input_channel);
2099+ null_input_channel,
2100+ mf::SurfaceId(),
2101+ std::shared_ptr<me::EventSink>());
2102
2103 EXPECT_EQ(mir_surface_type_normal, surf.type());
2104
2105@@ -423,7 +463,9 @@
2106 msh::Surface surf(
2107 mt::fake_shared(surface_builder),
2108 mf::a_surface(),
2109- null_input_channel);
2110+ null_input_channel,
2111+ mf::SurfaceId(),
2112+ std::shared_ptr<me::EventSink>());
2113
2114 EXPECT_EQ(mir_surface_state_restored, surf.state());
2115
2116@@ -450,3 +492,4 @@
2117 mir_surface_state_fullscreen));
2118 EXPECT_EQ(mir_surface_state_fullscreen, surf.state());
2119 }
2120+
2121
2122=== modified file 'tests/unit-tests/shell/test_the_session_container_implementation.cpp'
2123--- tests/unit-tests/shell/test_the_session_container_implementation.cpp 2013-04-23 01:40:52 +0000
2124+++ tests/unit-tests/shell/test_the_session_container_implementation.cpp 2013-04-24 09:03:32 +0000
2125@@ -29,6 +29,7 @@
2126 #include <gtest/gtest.h>
2127 #include <string>
2128
2129+namespace me = mir::events;
2130 namespace mf = mir::frontend;
2131 namespace msh = mir::shell;
2132 namespace mtd = mir::test::doubles;
2133@@ -39,10 +40,8 @@
2134 auto factory = std::make_shared<mtd::MockSurfaceFactory>();
2135 msh::DefaultSessionContainer container;
2136
2137- container.insert_session(std::make_shared<msh::ApplicationSession>(factory, std::make_shared<mtd::StubInputTargetListener>(),
2138- "Visual Studio 7"));
2139- container.insert_session(std::make_shared<msh::ApplicationSession>(factory, std::make_shared<mtd::StubInputTargetListener>(),
2140- "Visual Studio 8"));
2141+ container.insert_session(std::make_shared<msh::ApplicationSession>(factory, std::make_shared<mtd::StubInputTargetListener>(), "Visual Studio 7", std::shared_ptr<me::EventSink>()));
2142+ container.insert_session(std::make_shared<msh::ApplicationSession>(factory, std::make_shared<mtd::StubInputTargetListener>(), "Visual Studio 8", std::shared_ptr<me::EventSink>()));
2143
2144 struct local
2145 {
2146@@ -67,8 +66,11 @@
2147 auto factory = std::make_shared<mtd::MockSurfaceFactory>();
2148 msh::DefaultSessionContainer container;
2149
2150- auto session = std::make_shared<msh::ApplicationSession>(factory, std::make_shared<mtd::StubInputTargetListener>(),
2151- "Visual Studio 7");
2152+ auto session = std::make_shared<msh::ApplicationSession>(
2153+ factory,
2154+ std::make_shared<mtd::StubInputTargetListener>(),
2155+ "Visual Studio 7",
2156+ std::shared_ptr<me::EventSink>());
2157 EXPECT_THROW({
2158 container.remove_session(session);
2159 }, std::logic_error);

Subscribers

People subscribed via source and target branches