Mir

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

Proposed by Alan Griffiths
Status: Superseded
Proposed branch: lp:~alan-griffiths/mir/surface-states-simplification
Merge into: lp:~vanvugt/mir/surface-states
Diff against target: 4891 lines (+1736/-576) (has conflicts)
104 files modified
CMakeLists.txt (+8/-0)
doc/building_source_for_android.md (+33/-19)
doc/footer.html (+1/-1)
doc/mainpage.md (+8/-0)
examples/demo-inprocess-egl/demo_inprocess_egl.cpp (+12/-0)
examples/demo-inprocess-egl/inprocess_egl_client.cpp (+10/-6)
examples/demo_client.c (+22/-32)
examples/demo_client_accelerated.cpp (+1/-1)
examples/demo_client_unaccelerated.c (+1/-1)
examples/eglapp.c (+3/-4)
examples/render_surfaces.cpp (+131/-25)
include/client/mir_toolkit/mir_client_library.h (+4/-2)
include/server/mir/default_server_configuration.h (+3/-3)
include/server/mir/frontend/protobuf_ipc_factory.h (+12/-0)
include/server/mir/frontend/session.h (+3/-0)
include/server/mir/frontend/session_mediator.h (+15/-0)
include/server/mir/frontend/shell.h (+5/-2)
include/server/mir/input/input_manager.h (+0/-1)
include/server/mir/input/null_input_manager.h (+0/-5)
include/server/mir/input/null_input_target_listener.h (+26/-11)
include/server/mir/shell/application_session.h (+15/-1)
include/server/mir/shell/input_focus_selector.h (+0/-52)
include/server/mir/shell/input_target_listener.h (+59/-0)
include/server/mir/shell/organising_surface_factory.h (+4/-1)
include/server/mir/shell/session.h (+1/-0)
include/server/mir/shell/session_manager.h (+6/-3)
include/server/mir/shell/single_visibility_focus_mechanism.h (+1/-4)
include/server/mir/shell/surface.h (+23/-4)
include/server/mir/shell/surface_factory.h (+9/-1)
include/server/mir/shell/surface_source.h (+4/-1)
include/shared/mir/default_configuration.h (+29/-0)
include/shared/mir/events/event_sink.h (+47/-0)
include/shared/mir/graphics/android/sync_object.h (+1/-1)
include/test/mir_test_doubles/mock_android_buffer.h (+2/-2)
include/test/mir_test_doubles/mock_display_support_provider.h (+2/-2)
include/test/mir_test_doubles/mock_fb_device.h (+2/-2)
include/test/mir_test_doubles/mock_input_configuration.h (+3/-3)
include/test/mir_test_doubles/mock_input_dispatcher.h (+3/-3)
include/test/mir_test_doubles/mock_input_focus_selector.h (+0/-40)
include/test/mir_test_doubles/mock_input_target_listener.h (+49/-0)
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/null_virtual_terminal.h (+2/-2)
include/test/mir_test_doubles/stub_input_target_listener.h (+59/-0)
include/test/mir_test_doubles/stub_ipc_factory.h (+5/-0)
include/test/mir_test_doubles/stub_session.h (+6/-0)
include/test/mir_test_doubles/stub_shell.h (+1/-1)
include/test/mir_test_framework/testing_server_configuration.h (+1/-1)
src/client/client_buffer_depository.h (+2/-2)
src/client/mir_client_library.cpp (+3/-0)
src/client/mir_connection.h (+8/-0)
src/client/mir_socket_rpc_channel.cpp (+13/-0)
src/client/mir_socket_rpc_channel.h (+14/-0)
src/server/default_server_configuration.cpp (+16/-9)
src/server/display_server.cpp (+1/-1)
src/server/frontend/CMakeLists.txt (+1/-0)
src/server/frontend/event_pipe.cpp (+39/-0)
src/server/frontend/event_pipe.h (+45/-0)
src/server/frontend/protobuf_message_processor.cpp (+0/-8)
src/server/frontend/protobuf_message_processor.h (+9/-4)
src/server/frontend/protobuf_socket_communicator.cpp (+17/-0)
src/server/frontend/session_mediator.cpp (+8/-0)
src/server/graphics/gbm/linux_virtual_terminal.cpp (+2/-2)
src/server/graphics/gbm/linux_virtual_terminal.h (+2/-2)
src/server/graphics/gbm/virtual_terminal.h (+2/-2)
src/server/input/android/android_dispatcher_controller.cpp (+76/-26)
src/server/input/android/android_dispatcher_controller.h (+22/-9)
src/server/input/android/default_android_input_configuration.cpp (+6/-1)
src/server/input/android/default_android_input_configuration.h (+2/-0)
src/server/input/android/event_filter_dispatcher_policy.cpp (+4/-3)
src/server/input/android/event_filter_dispatcher_policy.h (+2/-1)
src/server/shell/application_session.cpp (+10/-3)
src/server/shell/organising_surface_factory.cpp (+5/-2)
src/server/shell/session_manager.cpp (+30/-11)
src/server/shell/single_visibility_focus_mechanism.cpp (+2/-7)
src/server/shell/surface.cpp (+15/-1)
src/server/shell/surface_source.cpp (+7/-2)
tests/acceptance-tests/test_client_input.cpp (+5/-6)
tests/acceptance-tests/test_focus_management_api.cpp (+4/-4)
tests/acceptance-tests/test_focus_selection.cpp (+21/-21)
tests/behavior-tests/session_management_context.cpp (+8/-4)
tests/death-tests/test_application_manager_death.cpp (+4/-3)
tests/integration-tests/cucumber/test_session_management_context.cpp (+3/-3)
tests/integration-tests/input/android/test_android_input_manager.cpp (+70/-12)
tests/integration-tests/input/android/test_fake_event_hub_to_event_filter.cpp (+1/-1)
tests/integration-tests/shell/test_session_manager.cpp (+34/-26)
tests/mir_test_framework/testing_server_options.cpp (+3/-11)
tests/unit-tests/CMakeLists.txt (+4/-0)
tests/unit-tests/frontend/CMakeLists.txt (+1/-0)
tests/unit-tests/frontend/test_event_pipe.cpp (+119/-0)
tests/unit-tests/frontend/test_session_mediator.cpp (+17/-3)
tests/unit-tests/frontend/test_session_mediator_android.cpp (+18/-1)
tests/unit-tests/frontend/test_session_mediator_gbm.cpp (+17/-1)
tests/unit-tests/input/android/test_android_dispatcher_controller.cpp (+148/-21)
tests/unit-tests/input/android/test_event_filter_input_dispatcher_policy.cpp (+1/-1)
tests/unit-tests/shell/test_application_session.cpp (+23/-16)
tests/unit-tests/shell/test_organising_surface_factory.cpp (+6/-5)
tests/unit-tests/shell/test_registration_order_focus_sequence.cpp (+17/-11)
tests/unit-tests/shell/test_session_manager.cpp (+94/-22)
tests/unit-tests/shell/test_single_visibility_focus_mechanism.cpp (+1/-24)
tests/unit-tests/shell/test_surface.cpp (+97/-16)
tests/unit-tests/shell/test_the_session_container_implementation.cpp (+9/-4)
tools/setup-partial-armhf-chroot.sh (+5/-24)
Text conflict in examples/render_surfaces.cpp
Path conflict: include/server/mir/event_queue.h / src/server/frontend/event_pipe.h
Text conflict in include/server/mir/frontend/protobuf_ipc_factory.h
Text conflict in include/server/mir/frontend/session.h
Text conflict in include/server/mir/frontend/session_mediator.h
Text conflict in include/server/mir/shell/application_session.h
Text conflict in include/server/mir/shell/surface.h
Path conflict: include/shared/mir/event_sink.h / include/shared/mir/events/event_sink.h
Text conflict in include/shared/mir/events/event_sink.h
Text conflict in include/test/mir_test_doubles/stub_ipc_factory.h
Text conflict in include/test/mir_test_doubles/stub_session.h
Text conflict in src/client/mir_connection.h
Text conflict in src/client/mir_socket_rpc_channel.cpp
Text conflict in src/client/mir_socket_rpc_channel.h
Text conflict in src/server/default_server_configuration.cpp
Path conflict: src/server/event_queue.cpp / src/server/frontend/event_pipe.cpp
Text conflict in src/server/frontend/event_pipe.cpp
Text conflict in src/server/frontend/event_pipe.h
Text conflict in src/server/frontend/protobuf_message_processor.h
Text conflict in src/server/frontend/protobuf_socket_communicator.cpp
Text conflict in src/server/frontend/session_mediator.cpp
Text conflict in src/server/shell/surface.cpp
Text conflict in tests/unit-tests/CMakeLists.txt
Path conflict: tests/unit-tests/event/test_event_queue.cpp / tests/unit-tests/frontend/test_event_pipe.cpp
Text conflict in tests/unit-tests/frontend/test_event_pipe.cpp
Text conflict in tests/unit-tests/frontend/test_session_mediator.cpp
Text conflict in tests/unit-tests/frontend/test_session_mediator_android.cpp
Text conflict in tests/unit-tests/frontend/test_session_mediator_gbm.cpp
Text conflict in tests/unit-tests/shell/test_surface.cpp
To merge this branch: bzr merge lp:~alan-griffiths/mir/surface-states-simplification
Reviewer Review Type Date Requested Status
Daniel van Vugt Disapprove
Review via email: mp+159837@code.launchpad.net

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

Commit message

frontend, shell, tests: Avoid supplying dependencies through public member functions.

Description of the change

frontend, shell, tests: 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 :

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 :

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 :

> 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 :

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 :

> 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 :

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 :

> > 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 :

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
Daniel van Vugt (vanvugt) wrote :

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.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'CMakeLists.txt'
--- CMakeLists.txt 2013-04-19 03:20:05 +0000
+++ CMakeLists.txt 2013-04-23 12:15:34 +0000
@@ -205,4 +205,12 @@
205add_subdirectory(guides/)205add_subdirectory(guides/)
206add_subdirectory(cmake/)206add_subdirectory(cmake/)
207207
208# There's no nice way to format this. Thanks CMake.
209add_test(LGPL-required
210 /bin/sh -c "! grep -rl 'GNU General' ${PROJECT_SOURCE_DIR}/src/client ${PROJECT_SOURCE_DIR}/include/client ${PROJECT_SOURCE_DIR}/src/shared ${PROJECT_SOURCE_DIR}/include/shared"
211)
212add_test(GPL-required
213 /bin/sh -c "! grep -rl 'GNU Lesser' ${PROJECT_SOURCE_DIR}/src/server ${PROJECT_SOURCE_DIR}/include/server ${PROJECT_SOURCE_DIR}/include/test ${PROJECT_SOURCE_DIR}/tests ${PROJECT_SOURCE_DIR}/examples"
214)
215
208enable_coverage_report(mirserver)216enable_coverage_report(mirserver)
209217
=== modified file 'doc/building_source_for_android.md'
--- doc/building_source_for_android.md 2013-04-04 06:50:04 +0000
+++ doc/building_source_for_android.md 2013-04-23 12:15:34 +0000
@@ -33,12 +33,12 @@
3333
34From within the armhf system:34From within the armhf system:
3535
361. Set up Dependencies36- Set up Dependencies
3737
38 $ apt-get install devscripts equivs cmake38 $ apt-get install devscripts equivs cmake
39 $ mk-build-deps --install --tool "apt-get -y" --build-dep debian/control39 $ mk-build-deps --install --tool "apt-get -y" --build-dep debian/control
4040
412. Build41- Build
4242
43 $ bzr branch lp:mir43 $ bzr branch lp:mir
44 $ mkdir mir/build; cd mir/build44 $ mkdir mir/build; cd mir/build
@@ -51,23 +51,37 @@
51ubuntu package) to produce armhf code. This is typically the quickest way to51ubuntu package) to produce armhf code. This is typically the quickest way to
52compile and run code, and is well suited for a development workflow.52compile and run code, and is well suited for a development workflow.
5353
541. Be sure that the cross compiler that you are using matches the target54- Be sure that the cross compiler that you are using matches the target
55 environment. (eg, make sure you're using the quantal toolchain if you're55 environment. (eg, make sure you're using the raring toolchain if you're
56 targeting a quantal phablet image)56 targeting a raring phablet image) You can specify the toolchain version
5757 thusly:
582. Set up a chroot with the mir dependencies installed. At the moment, you58
59 can look at the script and instructions in lp:mir as an59 $ apt-get install g++-4.7-arm-linux-gnueabihf/raring
60 example of how to set up a partial chroot you can build mir against.60
6161- Get access to armhf packages via apt-get. On an amd64/ia32 system, you can
623. There are a few ways to do this, but here is an example of how to build mir for android62 do this by adding a file like the one below to /etc/apt/sources.list.d/
6363
64 $ bzr branch lp:mir64 #example sources.list with armhf dependencies
65 deb [arch=armhf] http://ports.ubuntu.com/ubuntu-ports/ raring main restricted universe multiverse
66 deb [arch=armhf] http://ppa.launchpad.net/phablet-team/ppa/ubuntu raring main #for hybris packages
67
68 Then you should run:
69
70 $ dpkg --add-architecture armhf
71 $ apt-get update
72
73 To test, try downloading a package like this:
74
75 $ apt-get download my-package:armhf
76
77- Once you're able to download armhf packages from the repository, the
78 cross-compile-chroot.sh script provides an example of how to download
79 a partial chroot with the mir dependencies, and compile the source for
80 android targets.
81
82 The script sets up a partial chroot via tools/setup-partial-armhf-chroot.sh
83 and then runs build commands similar to this:
84
65 $ mkdir mir/build; cd mir/build85 $ mkdir mir/build; cd mir/build
66 $ MIR_NDK_PATH=/path/to/depenendcies/chroot cmake -DCMAKE_TOOLCHAIN_FILE=../cmake/LinuxCrossCompile.cmake -DBoost_COMPILER=-gcc -DMIR_ENABLE_DEATH_TESTS=NO -DMIR_PLATFORM=android ..86 $ MIR_NDK_PATH=/path/to/depenendcies/chroot cmake -DCMAKE_TOOLCHAIN_FILE=../cmake/LinuxCrossCompile.cmake -DBoost_COMPILER=-gcc -DMIR_ENABLE_DEATH_TESTS=NO -DMIR_PLATFORM=android ..
67 $ make87 $ make
68
69N.B. The `cross-compile-android.sh` script in mir's top level directory
70provides a scripting example of how to cross compile.
71The 'setup-partial-armhf-chroot.sh' will attempt to download all the arm
72dependencies you need. You have to have your APT sources.list files pointed at
73arm repositories.
7488
=== modified file 'doc/footer.html'
--- doc/footer.html 2012-12-28 08:57:38 +0000
+++ doc/footer.html 2013-04-23 12:15:34 +0000
@@ -1,2 +1,2 @@
1<hr>1<hr>
2<p align="center">Copyright &copy; 2012 Canonical Ltd.</p>2<p align="center">Copyright &copy; 2012,2013 Canonical Ltd.</p>
33
=== modified file 'doc/mainpage.md'
--- doc/mainpage.md 2013-04-22 09:50:06 +0000
+++ doc/mainpage.md 2013-04-23 12:15:34 +0000
@@ -57,7 +57,15 @@
5757
58 - \ref mir_toolkit "Mir API Documentation"58 - \ref mir_toolkit "Mir API Documentation"
59 - \subpage demo_client.c "demo_client.c: A simple mir client"59 - \subpage demo_client.c "demo_client.c: A simple mir client"
60
61Writing server applications
62---------------------------
63
64Mir server is written as a library which allows the server code to be adapted
65for bespoke applications.
66
60 - \subpage render_surfaces-example "render_surfaces.cpp: A simple program using the mir library"67 - \subpage render_surfaces-example "render_surfaces.cpp: A simple program using the mir library"
68 - \ref demo_inprocess_egl
6169
62Working on Mir code70Working on Mir code
63-------------------71-------------------
6472
=== modified file 'examples/demo-inprocess-egl/demo_inprocess_egl.cpp'
--- examples/demo-inprocess-egl/demo_inprocess_egl.cpp 2013-04-19 03:20:05 +0000
+++ examples/demo-inprocess-egl/demo_inprocess_egl.cpp 2013-04-23 12:15:34 +0000
@@ -26,9 +26,20 @@
2626
27namespace me = mir::examples;27namespace me = mir::examples;
2828
29///\page demo_inprocess_egl demo_inprocess_egl.cpp: A simple use of egl in process
30///\section main main
31/// The main() function uses a default configuration for Mir and sets up an InprocessEGLClient
32/// that accesses the graphics platform and surface factory.
33/// \snippet demo_inprocess_egl.cpp main_tag
34/// This InprocessEGLClient sets up a single surface
35/// \snippet inprocess_egl_client.cpp setup_tag
36/// And loops updating the surface
37/// \snippet inprocess_egl_client.cpp loop_tag
38
29int main(int argc, char const* argv[])39int main(int argc, char const* argv[])
30try40try
31{41{
42 ///\internal [main_tag]
32 mir::DefaultServerConfiguration config(argc, argv);43 mir::DefaultServerConfiguration config(argc, argv);
3344
34 std::shared_ptr<me::InprocessEGLClient> client;45 std::shared_ptr<me::InprocessEGLClient> client;
@@ -38,6 +49,7 @@
38 config.the_graphics_platform(),49 config.the_graphics_platform(),
39 config.the_shell_surface_factory());50 config.the_shell_surface_factory());
40 });51 });
52 ///\internal [main_tag]
4153
42 return 0;54 return 0;
43}55}
4456
=== modified file 'examples/demo-inprocess-egl/inprocess_egl_client.cpp'
--- examples/demo-inprocess-egl/inprocess_egl_client.cpp 2013-04-16 09:16:38 +0000
+++ examples/demo-inprocess-egl/inprocess_egl_client.cpp 2013-04-23 12:15:34 +0000
@@ -54,24 +54,27 @@
54{54{
55 geom::Size const surface_size = geom::Size{geom::Width{512},55 geom::Size const surface_size = geom::Size{geom::Width{512},
56 geom::Height{512}};56 geom::Height{512}};
57 57
58 ///\internal [setup_tag]
58 auto params = mf::a_surface().of_name("Inprocess EGL Demo")59 auto params = mf::a_surface().of_name("Inprocess EGL Demo")
59 .of_size(surface_size)60 .of_size(surface_size)
60 .of_buffer_usage(mc::BufferUsage::hardware)61 .of_buffer_usage(mc::BufferUsage::hardware)
61 .of_pixel_format(geom::PixelFormat::argb_8888);62 .of_pixel_format(geom::PixelFormat::argb_8888);
62 auto surface = surface_factory->create_surface(params);63 auto surface = surface_factory->create_surface(params, mf::SurfaceId(), std::shared_ptr<events::EventSink>());
63 64
64 surface->advance_client_buffer(); // TODO: What a wart!65 surface->advance_client_buffer(); // TODO: What a wart!
65 66
66 auto native_display = graphics_platform->shell_egl_display();67 auto native_display = graphics_platform->shell_egl_display();
67 me::EGLHelper helper(reinterpret_cast<EGLNativeDisplayType>(native_display), reinterpret_cast<EGLNativeWindowType>(surface.get()));68 me::EGLHelper helper(reinterpret_cast<EGLNativeDisplayType>(native_display), reinterpret_cast<EGLNativeWindowType>(surface.get()));
6869
69 auto rc = eglMakeCurrent(helper.the_display(), helper.the_surface(), helper.the_surface(), helper.the_context());70 auto rc = eglMakeCurrent(helper.the_display(), helper.the_surface(), helper.the_surface(), helper.the_context());
70 assert(rc == EGL_TRUE);71 assert(rc == EGL_TRUE);
71 72
72 mir::draw::glAnimationBasic gl_animation;73 mir::draw::glAnimationBasic gl_animation;
73 gl_animation.init_gl();74 gl_animation.init_gl();
74 75 ///\internal [setup_tag]
76
77 ///\internal [loop_tag]
75 for(;;)78 for(;;)
76 {79 {
77 gl_animation.render_gl();80 gl_animation.render_gl();
@@ -80,4 +83,5 @@
8083
81 gl_animation.step();84 gl_animation.step();
82 }85 }
86 ///\internal [loop_tag]
83}87}
8488
=== modified file 'examples/demo_client.c'
--- examples/demo_client.c 2013-04-18 04:23:56 +0000
+++ examples/demo_client.c 2013-04-23 12:15:34 +0000
@@ -25,14 +25,30 @@
25#include <getopt.h>25#include <getopt.h>
2626
27///\page demo_client.c demo_client.c: A simple mir client27///\page demo_client.c demo_client.c: A simple mir client
28/// demo_client shows the use of mir API28/// demo_client shows the use of mir API.
29/// This program opens a mir connection and creates a surface.
30///\section demo_client demo_client()
31/// Opens a mir connection and creates a surface and advances the
32/// current buffer before closing the surface and connection.
33///\subsection connect request and wait for connection handle
34/// \snippet demo_client.c connect_tag
35///\subsection surface_create request and wait for surface handle
36/// \snippet demo_client.c surface_create_tag
37///\subsection next_buffer exchange the current buffer for a new one
38/// \snippet demo_client.c next_buffer_tag
39///\subsection surface_release We release our surface
40/// \snippet demo_client.c surface_release_tag
41///\subsection connection_release We release our connection
42/// \snippet demo_client.c connection_release_tag
29/// \example demo_client.c A simple mir client43/// \example demo_client.c A simple mir client
30
31///\page demo_client.c
32///\section MirDemoState MirDemoState44///\section MirDemoState MirDemoState
33/// This program opens a mir connection and creates a surface. The handles45/// The handles needs to be accessible both to callbacks and to the control function.
34/// needs to be accessible both to callbacks and to the control function.
35/// \snippet demo_client.c MirDemoState_tag46/// \snippet demo_client.c MirDemoState_tag
47///\section Callbacks Callbacks
48/// This program opens a mir connection and creates a surface. The handles
49/// needs to be accessible both to callbacks and to the control function.
50/// \snippet demo_client.c Callback_tag
51
36///\internal [MirDemoState_tag]52///\internal [MirDemoState_tag]
37// Utility structure for the state of a single surface session.53// Utility structure for the state of a single surface session.
38typedef struct MirDemoState54typedef struct MirDemoState
@@ -42,11 +58,6 @@
42} MirDemoState;58} MirDemoState;
43///\internal [MirDemoState_tag]59///\internal [MirDemoState_tag]
4460
45///\page demo_client.c
46///\section Callbacks Callbacks
47/// This program opens a mir connection and creates a surface. The handles
48/// needs to be accessible both to callbacks and to the control function.
49/// \snippet demo_client.c Callback_tag
50///\internal [Callback_tag]61///\internal [Callback_tag]
51// Callback to update MirDemoState on connection62// Callback to update MirDemoState on connection
52static void connection_callback(MirConnection *new_connection, void *context)63static void connection_callback(MirConnection *new_connection, void *context)
@@ -75,11 +86,6 @@
75}86}
76///\internal [Callback_tag]87///\internal [Callback_tag]
7788
78
79///\page demo_client.c
80///\section demo_client demo_client()
81/// Opens a mir connection and creates a surface and advances the
82/// current buffer before closing the surface and connection.
83void demo_client(const char* server, int buffer_swap_count)89void demo_client(const char* server, int buffer_swap_count)
84{90{
85 MirDemoState mcd;91 MirDemoState mcd;
@@ -88,9 +94,6 @@
8894
89 puts("Starting");95 puts("Starting");
9096
91 ///\page demo_client.c
92 ///\subsection connect request and wait for connection handle
93 /// \snippet demo_client.c connect_tag
94 ///\internal [connect_tag]97 ///\internal [connect_tag]
95 // Call mir_connect and wait for callback to complete.98 // Call mir_connect and wait for callback to complete.
96 mir_wait_for(mir_connect(server, __PRETTY_FUNCTION__, connection_callback, &mcd));99 mir_wait_for(mir_connect(server, __PRETTY_FUNCTION__, connection_callback, &mcd));
@@ -124,9 +127,6 @@
124 MirSurfaceParameters const request_params =127 MirSurfaceParameters const request_params =
125 {__PRETTY_FUNCTION__, 640, 480, pixel_format, mir_buffer_usage_hardware};128 {__PRETTY_FUNCTION__, 640, 480, pixel_format, mir_buffer_usage_hardware};
126129
127 ///\page demo_client.c
128 ///\subsection surface_create request and wait for surface handle
129 /// \snippet demo_client.c surface_create_tag
130 ///\internal [surface_create_tag]130 ///\internal [surface_create_tag]
131 // ...we create a surface using that format and wait for callback to complete.131 // ...we create a surface using that format and wait for callback to complete.
132 mir_wait_for(mir_connection_create_surface(mcd.connection, &request_params, surface_create_callback, &mcd));132 mir_wait_for(mir_connection_create_surface(mcd.connection, &request_params, surface_create_callback, &mcd));
@@ -166,39 +166,29 @@
166 // In a real application we'd render into the current buffer166 // In a real application we'd render into the current buffer
167 }167 }
168168
169 ///\page demo_client.c
170 ///\subsection next_buffer exchange the current buffer for a new one
171 /// \snippet demo_client.c next_buffer_tag
172 ///\internal [next_buffer_tag]169 ///\internal [next_buffer_tag]
173 mir_wait_for(mir_surface_next_buffer(mcd.surface, surface_next_buffer_callback, &mcd));170 mir_wait_for(mir_surface_next_buffer(mcd.surface, surface_next_buffer_callback, &mcd));
174 ///\internal [next_buffer_tag]171 ///\internal [next_buffer_tag]
175 }172 }
176173
177 ///\page demo_client.c
178 ///\subsection surface_release We release our surface
179 /// \snippet demo_client.c surface_release_tag
180 ///\internal [surface_release_tag]174 ///\internal [surface_release_tag]
181 // We should release our surface175 // We should release our surface
182 mir_wait_for(mir_surface_release(mcd.surface, surface_release_callback, &mcd));176 mir_wait_for(mir_surface_release(mcd.surface, surface_release_callback, &mcd));
183 puts("Surface released");177 puts("Surface released");
184 ///\internal [surface_release_tag]178 ///\internal [surface_release_tag]
185179
186 ///\page demo_client.c
187 ///\subsection connection_release We release our connection
188 /// \snippet demo_client.c connection_release_tag
189 ///\internal [connection_release_tag]180 ///\internal [connection_release_tag]
190 // We should release our connection181 // We should release our connection
191 mir_connection_release(mcd.connection);182 mir_connection_release(mcd.connection);
192 puts("Connection released");183 puts("Connection released");
193 ///\internal [connection_release_tag]184 ///\internal [connection_release_tag]
194}185}
195///\page demo_client.c
196186
197// The main() function deals with parsing arguments and defaults187// The main() function deals with parsing arguments and defaults
198int main(int argc, char* argv[])188int main(int argc, char* argv[])
199{189{
200 // Some variables for holding command line options190 // Some variables for holding command line options
201 char const *server = "/tmp/mir_socket";191 char const *server = NULL;
202 int buffer_swap_count = 0;192 int buffer_swap_count = 0;
203193
204 // Parse the command line194 // Parse the command line
205195
=== modified file 'examples/demo_client_accelerated.cpp'
--- examples/demo_client_accelerated.cpp 2013-04-18 04:23:56 +0000
+++ examples/demo_client_accelerated.cpp 2013-04-23 12:15:34 +0000
@@ -28,7 +28,7 @@
28#include <EGL/egl.h>28#include <EGL/egl.h>
29#include <GLES2/gl2.h>29#include <GLES2/gl2.h>
3030
31static char const *socket_file = "/tmp/mir_socket";31static char const *socket_file = NULL;
3232
33int main(int argc, char* argv[])33int main(int argc, char* argv[])
34{34{
3535
=== modified file 'examples/demo_client_unaccelerated.c'
--- examples/demo_client_unaccelerated.c 2013-04-18 04:23:56 +0000
+++ examples/demo_client_unaccelerated.c 2013-04-23 12:15:34 +0000
@@ -26,7 +26,7 @@
26#include <getopt.h>26#include <getopt.h>
27#include <stdint.h>27#include <stdint.h>
2828
29static char const *socket_file = "/tmp/mir_socket";29static char const *socket_file = NULL;
3030
31static void render_pattern(MirGraphicsRegion *region, uint32_t pf)31static void render_pattern(MirGraphicsRegion *region, uint32_t pf)
32{32{
3333
=== modified file 'examples/eglapp.c'
--- examples/eglapp.c 2013-04-18 04:23:56 +0000
+++ examples/eglapp.c 2013-04-23 12:15:34 +0000
@@ -26,7 +26,6 @@
2626
27#include <xkbcommon/xkbcommon-keysyms.h>27#include <xkbcommon/xkbcommon-keysyms.h>
2828
29static const char servername[] = "/tmp/mir_socket";
30static const char appname[] = "egldemo";29static const char appname[] = "egldemo";
3130
32static MirConnection *connection;31static MirConnection *connection;
@@ -128,13 +127,13 @@
128 EGLContext eglctx;127 EGLContext eglctx;
129 EGLBoolean ok;128 EGLBoolean ok;
130129
131 connection = mir_connect_sync(servername, appname);130 connection = mir_connect_sync(NULL, appname);
132 CHECK(mir_connection_is_valid(connection), "Can't get connection");131 CHECK(mir_connection_is_valid(connection), "Can't get connection");
133132
134 mir_connection_get_display_info(connection, &dinfo);133 mir_connection_get_display_info(connection, &dinfo);
135134
136 printf("Connected to display %s: %dx%d, supports %d pixel formats\n",135 printf("Connected to display: %dx%d, supports %d pixel formats\n",
137 servername, dinfo.width, dinfo.height,136 dinfo.width, dinfo.height,
138 dinfo.supported_pixel_format_items);137 dinfo.supported_pixel_format_items);
139138
140 surfaceparm.width = *width > 0 ? *width : dinfo.width;139 surfaceparm.width = *width > 0 ? *width : dinfo.width;
141140
=== modified file 'examples/render_surfaces.cpp'
--- examples/render_surfaces.cpp 2013-04-22 09:50:06 +0000
+++ examples/render_surfaces.cpp 2013-04-23 12:15:34 +0000
@@ -28,6 +28,7 @@
28#include "mir/surfaces/surface.h"28#include "mir/surfaces/surface.h"
29#include "mir/default_server_configuration.h"29#include "mir/default_server_configuration.h"
30#include "mir/run_mir.h"30#include "mir/run_mir.h"
31#include "mir/abnormal_exit.h"
3132
32#include "mir_image.h"33#include "mir_image.h"
33#include "buffer_render_target.h"34#include "buffer_render_target.h"
@@ -54,13 +55,27 @@
54///\page render_surfaces-example render_surfaces.cpp: A simple program using the mir library.55///\page render_surfaces-example render_surfaces.cpp: A simple program using the mir library.
55///\tableofcontents56///\tableofcontents
56///render_surfaces shows the use of mir to render some moving surfaces57///render_surfaces shows the use of mir to render some moving surfaces
58///\section main main()
59/// The main() function uses a RenderSurfacesServerConfiguration to initialize and run mir.
60/// \snippet render_surfaces.cpp main_tag
61///\section RenderSurfacesServerConfiguration RenderSurfacesServerConfiguration
62/// The configuration stubs out client connectivity and input.
63/// \snippet render_surfaces.cpp RenderSurfacesServerConfiguration_stubs_tag
64/// it also provides a bespoke buffer initializer
65/// \snippet render_surfaces.cpp RenderResourcesBufferInitializer_tag
66/// and a bespoke compositing strategy
67/// \snippet render_surfaces.cpp RenderSurfacesCompositingStrategy_tag
68///\section Utilities Utility classes
69/// For smooth animation we need to track time and move surfaces accordingly
70///\subsection StopWatch StopWatch
71/// \snippet render_surfaces.cpp StopWatch_tag
72///\subsection Moveable Moveable
73/// \snippet render_surfaces.cpp Moveable_tag
74
57///\example render_surfaces.cpp A simple program using the mir library.75///\example render_surfaces.cpp A simple program using the mir library.
5876
59namespace77namespace
60{78{
61///\page render_surfaces-example
62///\section StopWatch StopWatch
63/// \snippet render_surfaces.cpp StopWatch_tag
64///\internal [StopWatch_tag]79///\internal [StopWatch_tag]
65// tracks elapsed time - for animation.80// tracks elapsed time - for animation.
66class StopWatch81class StopWatch
@@ -103,9 +118,6 @@
103};118};
104///\internal [StopWatch_tag]119///\internal [StopWatch_tag]
105120
106///\page render_surfaces-example
107///\section Moveable Moveable
108/// \snippet render_surfaces.cpp Moveable_tag
109///\internal [Moveable_tag]121///\internal [Moveable_tag]
110// Adapter to support movement of surfaces.122// Adapter to support movement of surfaces.
111class Moveable123class Moveable
@@ -175,9 +187,6 @@
175};187};
176///\internal [Moveable_tag]188///\internal [Moveable_tag]
177189
178///\page render_surfaces-example
179///\section RenderSurfacesServerConfiguration RenderSurfacesServerConfiguration
180/// \snippet render_surfaces.cpp RenderSurfacesServerConfiguration_tag
181///\internal [RenderSurfacesServerConfiguration_tag]190///\internal [RenderSurfacesServerConfiguration_tag]
182// Extend the default configuration to manage moveables.191// Extend the default configuration to manage moveables.
183class RenderSurfacesServerConfiguration : public mir::DefaultServerConfiguration192class RenderSurfacesServerConfiguration : public mir::DefaultServerConfiguration
@@ -189,17 +198,103 @@
189 {198 {
190 }199 }
191200
192 // Override to stub out the default201 ///\internal [RenderSurfacesServerConfiguration_stubs_tag]
193 std::shared_ptr<mf::Communicator> the_communicator() override;202 // Stub out server connectivity.
194203 std::shared_ptr<mf::Communicator> the_communicator() override
195 // Override to stub out the default204 {
196 std::shared_ptr<mi::InputManager> the_input_manager() override;205 struct NullCommunicator : public mf::Communicator
197206 {
198 // Override for a bespoke initializer207 void start() {}
199 std::shared_ptr<mg::BufferInitializer> the_buffer_initializer() override;208 void stop() {}
200209 };
201 // Override for a bespoke compositing strategy210
202 std::shared_ptr<mc::CompositingStrategy> the_compositing_strategy() override;211 return std::make_shared<NullCommunicator>();
212 }
213
214 // Stub out input.
215 std::shared_ptr<mi::InputManager> the_input_manager() override
216 {
217 return std::make_shared<mi::NullInputManager>();
218 }
219 ///\internal [RenderSurfacesServerConfiguration_stubs_tag]
220
221 ///\internal [RenderResourcesBufferInitializer_tag]
222 // Override for a bespoke buffer initializer
223 std::shared_ptr<mg::BufferInitializer> the_buffer_initializer() override
224 {
225 class RenderResourcesBufferInitializer : public mg::BufferInitializer
226 {
227 public:
228 RenderResourcesBufferInitializer()
229 : img_renderer{mir_image.pixel_data,
230 geom::Size{geom::Width{mir_image.width},
231 geom::Height{mir_image.height}},
232 mir_image.bytes_per_pixel}
233 {
234 }
235
236 void operator()(mc::Buffer& buffer)
237 {
238 mt::BufferRenderTarget brt{buffer};
239 brt.make_current();
240 img_renderer.render();
241 }
242
243 private:
244 mt::ImageRenderer img_renderer;
245 };
246
247 return std::make_shared<RenderResourcesBufferInitializer>();
248 }
249 ///\internal [RenderResourcesBufferInitializer_tag]
250
251 ///\internal [RenderSurfacesCompositingStrategy_tag]
252 // Decorate the DefaultCompositingStrategy in order to move surfaces.
253 std::shared_ptr<mc::CompositingStrategy> the_compositing_strategy() override
254 {
255 class RenderSurfacesCompositingStrategy : public mc::CompositingStrategy
256 {
257 public:
258 RenderSurfacesCompositingStrategy(std::shared_ptr<mc::Renderables> const& renderables,
259 std::shared_ptr<mg::Renderer> const& renderer,
260 std::vector<Moveable>& moveables)
261 : default_compositing_strategy{renderables, renderer},
262 frames{0},
263 moveables(moveables)
264 {
265 }
266
267 void render(mg::DisplayBuffer& display_buffer)
268 {
269 stop_watch.stop();
270 if (stop_watch.elapsed_seconds_since_last_restart() >= 1)
271 {
272 std::cout << "FPS: " << frames << " Frame Time: " << 1.0 / frames << std::endl;
273 frames = 0;
274 stop_watch.restart();
275 }
276
277 glClearColor(0.0, 1.0, 0.0, 1.0);
278 default_compositing_strategy.render(display_buffer);
279
280 for (auto& m : moveables)
281 m.step();
282
283 frames++;
284 }
285
286 private:
287 mc::DefaultCompositingStrategy default_compositing_strategy;
288 StopWatch stop_watch;
289 uint32_t frames;
290 std::vector<Moveable>& moveables;
291 };
292
293 return std::make_shared<RenderSurfacesCompositingStrategy>(the_renderables(),
294 the_renderer(),
295 moveables);
296 }
297 ///\internal [RenderSurfacesCompositingStrategy_tag]
203298
204 // New function to initialize moveables with surfaces299 // New function to initialize moveables with surfaces
205 void create_surfaces()300 void create_surfaces()
@@ -248,13 +343,10 @@
248///\internal [RenderSurfacesServerConfiguration_tag]343///\internal [RenderSurfacesServerConfiguration_tag]
249}344}
250345
251///\page render_surfaces-example
252///\section main main()
253/// \snippet render_surfaces.cpp main_tag
254///\internal [main_tag]
255// Pull the bits together.
256int main(int argc, char **argv)346int main(int argc, char **argv)
347try
257{348{
349 ///\internal [main_tag]
258 /* Parse the command line */350 /* Parse the command line */
259 unsigned int num_moveables{5};351 unsigned int num_moveables{5};
260352
@@ -269,9 +361,11 @@
269 RenderSurfacesServerConfiguration conf{num_moveables};361 RenderSurfacesServerConfiguration conf{num_moveables};
270362
271 mir::run_mir(conf, [&](mir::DisplayServer&) {conf.create_surfaces();});363 mir::run_mir(conf, [&](mir::DisplayServer&) {conf.create_surfaces();});
364 ///\internal [main_tag]
272365
273 return 0;366 return 0;
274}367}
368<<<<<<< TREE
275///\internal [main_tag]369///\internal [main_tag]
276370
277///\page render_surfaces-example371///\page render_surfaces-example
@@ -384,3 +478,15 @@
384 return std::make_shared<mi::NullInputManager>();478 return std::make_shared<mi::NullInputManager>();
385}479}
386///\internal [NullInputManager_tag]480///\internal [NullInputManager_tag]
481=======
482catch (mir::AbnormalExit const& error)
483{
484 std::cerr << error.what() << std::endl;
485 return 1;
486}
487catch (std::exception const& error)
488{
489 std::cerr << "ERROR: " << error.what() << std::endl;
490 return 1;
491}
492>>>>>>> MERGE-SOURCE
387493
=== modified file 'include/client/mir_toolkit/mir_client_library.h'
--- include/client/mir_toolkit/mir_client_library.h 2013-04-18 04:23:56 +0000
+++ include/client/mir_toolkit/mir_client_library.h 2013-04-23 12:15:34 +0000
@@ -35,7 +35,8 @@
35 * Request a connection to the Mir server. The supplied callback is called when35 * Request a connection to the Mir server. The supplied callback is called when
36 * the connection is established, or fails. The returned wait handle remains36 * the connection is established, or fails. The returned wait handle remains
37 * valid until the connection has been released.37 * valid until the connection has been released.
38 * \param [in] server A name identifying the server38 * \param [in] server File path of the server socket to connect to, or
39 * NULL to choose the default server
39 * \param [in] app_name A name referring to the application40 * \param [in] app_name A name referring to the application
40 * \param [in] callback Callback function to be invoked when request41 * \param [in] callback Callback function to be invoked when request
41 * completes42 * completes
@@ -50,7 +51,8 @@
5051
51/**52/**
52 * Perform a mir_connect() but also wait for and return the result.53 * Perform a mir_connect() but also wait for and return the result.
53 * \param [in] server A name identifying the server54 * \param [in] server File path of the server socket to connect to, or
55 * NULL to choose the default server
54 * \param [in] app_name A name referring to the application56 * \param [in] app_name A name referring to the application
55 * \return The resulting MirConnection57 * \return The resulting MirConnection
56 */58 */
5759
=== modified file 'include/server/mir/default_server_configuration.h'
--- include/server/mir/default_server_configuration.h 2013-04-22 03:24:56 +0000
+++ include/server/mir/default_server_configuration.h 2013-04-23 12:15:34 +0000
@@ -50,7 +50,7 @@
50{50{
51class SurfaceFactory;51class SurfaceFactory;
52class SurfaceBuilder;52class SurfaceBuilder;
53class InputFocusSelector;53class InputTargetListener;
54class SessionContainer;54class SessionContainer;
55class FocusSetter;55class FocusSetter;
56class FocusSequence;56class FocusSequence;
@@ -156,7 +156,6 @@
156 /** @name shell configuration - dependencies156 /** @name shell configuration - dependencies
157 * dependencies of shell on the rest of the Mir157 * dependencies of shell on the rest of the Mir
158 * @{ */158 * @{ */
159 virtual std::shared_ptr<shell::InputFocusSelector> the_input_focus_selector();
160 virtual std::shared_ptr<shell::SurfaceBuilder> the_surface_builder();159 virtual std::shared_ptr<shell::SurfaceBuilder> the_surface_builder();
161 /** @} */160 /** @} */
162161
@@ -178,6 +177,7 @@
178 * @{ */177 * @{ */
179 virtual std::shared_ptr<input::android::InputConfiguration> the_input_configuration();178 virtual std::shared_ptr<input::android::InputConfiguration> the_input_configuration();
180 virtual std::initializer_list<std::shared_ptr<input::EventFilter> const> the_event_filters();179 virtual std::initializer_list<std::shared_ptr<input::EventFilter> const> the_event_filters();
180 virtual std::shared_ptr<shell::InputTargetListener> the_input_target_listener();
181 /** @} */181 /** @} */
182182
183 /** @name logging configuration - customization183 /** @name logging configuration - customization
@@ -197,7 +197,7 @@
197 CachedPtr<frontend::Shell> session_manager;197 CachedPtr<frontend::Shell> session_manager;
198 std::shared_ptr<input::android::InputConfiguration> input_configuration;198 std::shared_ptr<input::android::InputConfiguration> input_configuration;
199 CachedPtr<input::InputManager> input_manager;199 CachedPtr<input::InputManager> input_manager;
200 CachedPtr<shell::InputFocusSelector> input_focus_selector;200 CachedPtr<shell::InputTargetListener> input_target_listener;
201 CachedPtr<graphics::Platform> graphics_platform;201 CachedPtr<graphics::Platform> graphics_platform;
202 CachedPtr<graphics::BufferInitializer> buffer_initializer;202 CachedPtr<graphics::BufferInitializer> buffer_initializer;
203 CachedPtr<compositor::GraphicBufferAllocator> buffer_allocator;203 CachedPtr<compositor::GraphicBufferAllocator> buffer_allocator;
204204
=== modified file 'include/server/mir/frontend/protobuf_ipc_factory.h'
--- include/server/mir/frontend/protobuf_ipc_factory.h 2013-04-19 07:45:44 +0000
+++ include/server/mir/frontend/protobuf_ipc_factory.h 2013-04-23 12:15:34 +0000
@@ -23,8 +23,15 @@
2323
24namespace mir24namespace mir
25{25{
26<<<<<<< TREE
26class EventSink;27class EventSink;
2728
29=======
30namespace events
31{
32class EventSink;
33}
34>>>>>>> MERGE-SOURCE
28namespace protobuf35namespace protobuf
29{36{
30class DisplayServer;37class DisplayServer;
@@ -37,8 +44,13 @@
37class ProtobufIpcFactory44class ProtobufIpcFactory
38{45{
39public:46public:
47<<<<<<< TREE
40 virtual std::shared_ptr<protobuf::DisplayServer> make_ipc_server(48 virtual std::shared_ptr<protobuf::DisplayServer> make_ipc_server(
41 std::shared_ptr<EventSink> const& sink) = 0;49 std::shared_ptr<EventSink> const& sink) = 0;
50=======
51 virtual std::shared_ptr<protobuf::DisplayServer> make_ipc_server(
52 std::shared_ptr<events::EventSink> const& sink) = 0;
53>>>>>>> MERGE-SOURCE
42 virtual std::shared_ptr<ResourceCache> resource_cache() = 0;54 virtual std::shared_ptr<ResourceCache> resource_cache() = 0;
43 virtual std::shared_ptr<MessageProcessorReport> report() = 0;55 virtual std::shared_ptr<MessageProcessorReport> report() = 0;
4456
4557
=== modified file 'include/server/mir/frontend/session.h'
--- include/server/mir/frontend/session.h 2013-04-22 03:24:56 +0000
+++ include/server/mir/frontend/session.h 2013-04-23 12:15:34 +0000
@@ -29,8 +29,11 @@
2929
30namespace mir30namespace mir
31{31{
32<<<<<<< TREE
32class EventSink;33class EventSink;
3334
35=======
36>>>>>>> MERGE-SOURCE
34namespace frontend37namespace frontend
35{38{
36class Surface;39class Surface;
3740
=== modified file 'include/server/mir/frontend/session_mediator.h'
--- include/server/mir/frontend/session_mediator.h 2013-04-19 07:45:44 +0000
+++ include/server/mir/frontend/session_mediator.h 2013-04-23 12:15:34 +0000
@@ -27,8 +27,15 @@
2727
28namespace mir28namespace mir
29{29{
30<<<<<<< TREE
30class EventSink;31class EventSink;
3132
33=======
34namespace events
35{
36class EventSink;
37}
38>>>>>>> MERGE-SOURCE
32namespace graphics39namespace graphics
33{40{
34class Platform;41class Platform;
@@ -62,7 +69,11 @@
62 std::shared_ptr<graphics::ViewableArea> const& viewable_area,69 std::shared_ptr<graphics::ViewableArea> const& viewable_area,
63 std::shared_ptr<compositor::GraphicBufferAllocator> const& buffer_allocator,70 std::shared_ptr<compositor::GraphicBufferAllocator> const& buffer_allocator,
64 std::shared_ptr<SessionMediatorReport> const& report,71 std::shared_ptr<SessionMediatorReport> const& report,
72<<<<<<< TREE
65 std::shared_ptr<EventSink> const& event_sink,73 std::shared_ptr<EventSink> const& event_sink,
74=======
75 std::shared_ptr<events::EventSink> const& event_sink,
76>>>>>>> MERGE-SOURCE
66 std::shared_ptr<ResourceCache> const& resource_cache);77 std::shared_ptr<ResourceCache> const& resource_cache);
6778
68 /* Platform independent requests */79 /* Platform independent requests */
@@ -119,7 +130,11 @@
119 std::shared_ptr<compositor::GraphicBufferAllocator> const buffer_allocator;130 std::shared_ptr<compositor::GraphicBufferAllocator> const buffer_allocator;
120131
121 std::shared_ptr<SessionMediatorReport> const report;132 std::shared_ptr<SessionMediatorReport> const report;
133<<<<<<< TREE
122 std::shared_ptr<EventSink> const event_sink;134 std::shared_ptr<EventSink> const event_sink;
135=======
136 std::shared_ptr<events::EventSink> const event_sink;
137>>>>>>> MERGE-SOURCE
123 std::shared_ptr<ResourceCache> const resource_cache;138 std::shared_ptr<ResourceCache> const resource_cache;
124 std::shared_ptr<ClientBufferTracker> const client_tracker;139 std::shared_ptr<ClientBufferTracker> const client_tracker;
125140
126141
=== modified file 'include/server/mir/frontend/shell.h'
--- include/server/mir/frontend/shell.h 2013-04-22 03:24:56 +0000
+++ include/server/mir/frontend/shell.h 2013-04-23 12:15:34 +0000
@@ -24,7 +24,10 @@
2424
25namespace mir25namespace mir
26{26{
2727namespace events
28{
29class EventSink;
30}
28namespace frontend31namespace frontend
29{32{
30class Session;33class Session;
@@ -35,7 +38,7 @@
35public:38public:
36 virtual ~Shell() {}39 virtual ~Shell() {}
3740
38 virtual std::shared_ptr<Session> open_session(std::string const& name) = 0;41 virtual std::shared_ptr<Session> open_session(std::string const& name, std::shared_ptr<events::EventSink> const& sink) = 0;
39 virtual void close_session(std::shared_ptr<Session> const& session) = 0;42 virtual void close_session(std::shared_ptr<Session> const& session) = 0;
4043
41 virtual void tag_session_with_lightdm_id(std::shared_ptr<Session> const& session, int id) = 0;44 virtual void tag_session_with_lightdm_id(std::shared_ptr<Session> const& session, int id) = 0;
4245
=== modified file 'include/server/mir/input/input_manager.h'
--- include/server/mir/input/input_manager.h 2013-04-16 09:16:38 +0000
+++ include/server/mir/input/input_manager.h 2013-04-23 12:15:34 +0000
@@ -21,7 +21,6 @@
21#define MIR_INPUT_INPUT_MANAGER_H_21#define MIR_INPUT_INPUT_MANAGER_H_
2222
23#include "mir/input/input_channel_factory.h"23#include "mir/input/input_channel_factory.h"
24#include "mir/shell/input_focus_selector.h"
2524
26#include <memory>25#include <memory>
2726
2827
=== modified file 'include/server/mir/input/null_input_manager.h'
--- include/server/mir/input/null_input_manager.h 2013-04-16 09:16:38 +0000
+++ include/server/mir/input/null_input_manager.h 2013-04-23 12:15:34 +0000
@@ -40,11 +40,6 @@
40 return std::shared_ptr<InputChannel>();40 return std::shared_ptr<InputChannel>();
41 }41 }
4242
43 virtual void set_input_focus_to(std::shared_ptr<input::SessionTarget> const& /* session */,
44 std::shared_ptr<input::SurfaceTarget> const& /* surface */)
45 {
46 }
47
48protected:43protected:
49 NullInputManager(const NullInputManager&) = delete;44 NullInputManager(const NullInputManager&) = delete;
50 NullInputManager& operator=(const NullInputManager&) = delete;45 NullInputManager& operator=(const NullInputManager&) = delete;
5146
=== renamed file 'include/server/mir/input/null_input_focus_selector.h' => 'include/server/mir/input/null_input_target_listener.h'
--- include/server/mir/input/null_input_focus_selector.h 2013-04-17 02:04:35 +0000
+++ include/server/mir/input/null_input_target_listener.h 2013-04-23 12:15:34 +0000
@@ -16,33 +16,48 @@
16 * Authored by: Robert Carr <robert.carr@canonical.com>16 * Authored by: Robert Carr <robert.carr@canonical.com>
17 */17 */
1818
19#ifndef MIR_INPUT_NULL_INPUT_FOCUS_SELECTOR_H_19#ifndef MIR_INPUT_NULL_INPUT_TARGET_LISTENER_H_
20#define MIR_INPUT_NULL_INPUT_FOCUS_SELECTOR_H_20#define MIR_INPUT_NULL_INPUT_TARGET_LISTENER_H_
2121
22#include "mir/shell/input_focus_selector.h"22#include "mir/shell/input_target_listener.h"
2323
24namespace mir24namespace mir
25{25{
26namespace input26namespace input
27{27{
2828
29class NullInputFocusSelector : public shell::InputFocusSelector29class NullInputTargetListener : public shell::InputTargetListener
30{30{
31public:31public:
32 NullInputFocusSelector() {};32 NullInputTargetListener() {};
33 virtual ~NullInputFocusSelector() {}33 virtual ~NullInputTargetListener() noexcept(true) {}
34 34
35 virtual void set_input_focus_to(std::shared_ptr<input::SessionTarget> const&,35 virtual void input_application_opened(std::shared_ptr<input::SessionTarget> const&)
36 std::shared_ptr<input::SurfaceTarget> const&)36 {
37 }
38 virtual void input_application_closed(std::shared_ptr<input::SessionTarget> const&)
39 {
40 }
41 virtual void input_surface_opened(std::shared_ptr<input::SessionTarget> const&,
42 std::shared_ptr<input::SurfaceTarget> const&)
43 {
44 }
45 virtual void input_surface_closed(std::shared_ptr<input::SurfaceTarget> const&)
46 {
47 }
48 virtual void focus_changed(std::shared_ptr<input::SurfaceTarget> const&)
49 {
50 }
51 virtual void focus_cleared()
37 {52 {
38 }53 }
3954
40protected:55protected:
41 NullInputFocusSelector(const NullInputFocusSelector&) = delete;56 NullInputTargetListener(const NullInputTargetListener&) = delete;
42 NullInputFocusSelector& operator=(const NullInputFocusSelector&) = delete;57 NullInputTargetListener& operator=(const NullInputTargetListener&) = delete;
43};58};
4459
45}60}
46}61}
4762
48#endif // MIR_INPUT_NULL_INPUT_FOCUS_SELECTOR_H_63#endif // MIR_INPUT_NULL_INPUT_TARGET_LISTENER_H_
4964
=== modified file 'include/server/mir/shell/application_session.h'
--- include/server/mir/shell/application_session.h 2013-04-19 08:03:57 +0000
+++ include/server/mir/shell/application_session.h 2013-04-23 12:15:34 +0000
@@ -25,17 +25,29 @@
2525
26namespace mir26namespace mir
27{27{
28<<<<<<< TREE
28class EventSink;29class EventSink;
2930
31=======
32namespace events
33{
34class EventSink;
35}
36>>>>>>> MERGE-SOURCE
30namespace shell37namespace shell
31{38{
32class SurfaceFactory;39class SurfaceFactory;
33class Surface;40class Surface;
41class InputTargetListener;
3442
35class ApplicationSession : public Session43class ApplicationSession : public Session
36{44{
37public:45public:
38 explicit ApplicationSession(std::shared_ptr<SurfaceFactory> const& surface_factory, std::string const& session_name);46 explicit ApplicationSession(
47 std::shared_ptr<SurfaceFactory> const& surface_factory,
48 std::shared_ptr<InputTargetListener> const& input_target_listener,
49 std::string const& session_name,
50 std::shared_ptr<events::EventSink> const& sink);
39 ~ApplicationSession();51 ~ApplicationSession();
4052
41 frontend::SurfaceId create_surface(frontend::SurfaceCreationParameters const& params);53 frontend::SurfaceId create_surface(frontend::SurfaceCreationParameters const& params);
@@ -61,7 +73,9 @@
6173
62private:74private:
63 std::shared_ptr<SurfaceFactory> const surface_factory;75 std::shared_ptr<SurfaceFactory> const surface_factory;
76 std::shared_ptr<InputTargetListener> const input_target_listener;
64 std::string const session_name;77 std::string const session_name;
78 std::shared_ptr<events::EventSink> const event_sink;
6579
66 frontend::SurfaceId next_id();80 frontend::SurfaceId next_id();
6781
6882
=== removed file 'include/server/mir/shell/input_focus_selector.h'
--- include/server/mir/shell/input_focus_selector.h 2013-04-16 09:16:38 +0000
+++ include/server/mir/shell/input_focus_selector.h 1970-01-01 00:00:00 +0000
@@ -1,52 +0,0 @@
1/*
2 * Copyright © 2013 Canonical Ltd.
3 *
4 * This program is free software: you can redistribute it and/or modify it
5 * under the terms of the GNU General Public License version 3,
6 * as published by the Free Software Foundation.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 *
16 * Authored by: Robert Carr <robert.carr@canonical.com>
17 */
18
19#ifndef MIR_SHELL_INPUT_FOCUS_SELECTOR_H_
20#define MIR_SHELL_INPUT_FOCUS_SELECTOR_H_
21
22#include <memory>
23
24namespace mir
25{
26namespace input
27{
28class SessionTarget;
29class SurfaceTarget;
30}
31
32namespace shell
33{
34
35class InputFocusSelector
36{
37public:
38 virtual ~InputFocusSelector() {}
39
40 virtual void set_input_focus_to(std::shared_ptr<input::SessionTarget> const& focus_application,
41 std::shared_ptr<input::SurfaceTarget> const& focus_surface) = 0;
42
43protected:
44 InputFocusSelector() = default;
45 InputFocusSelector(InputFocusSelector const&) = delete;
46 InputFocusSelector& operator=(InputFocusSelector const&) = delete;
47};
48
49}
50} // namespace mir
51
52#endif // MIR_SHELL_INPUT_FOCUS_SELECTOR_H_
530
=== added file 'include/server/mir/shell/input_target_listener.h'
--- include/server/mir/shell/input_target_listener.h 1970-01-01 00:00:00 +0000
+++ include/server/mir/shell/input_target_listener.h 2013-04-23 12:15:34 +0000
@@ -0,0 +1,59 @@
1/*
2 * Copyright © 2013 Canonical Ltd.
3 *
4 * This program is free software: you can redistribute it and/or modify it
5 * under the terms of the GNU General Public License version 3,
6 * as published by the Free Software Foundation.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 *
16 * Authored by: Robert Carr <robert.carr@canonical.com>
17 */
18
19#ifndef MIR_SHELL_INPUT_TARGET_LISTENER_H_
20#define MIR_SHELL_INPUT_TARGET_LISTENER_H_
21
22#include <memory>
23
24namespace mir
25{
26namespace input
27{
28class SessionTarget;
29class SurfaceTarget;
30}
31
32namespace shell
33{
34
35class InputTargetListener
36{
37public:
38 virtual ~InputTargetListener() = default;
39
40 virtual void input_application_opened(std::shared_ptr<input::SessionTarget> const& application) = 0;
41 virtual void input_application_closed(std::shared_ptr<input::SessionTarget> const& application) = 0;
42
43 virtual void input_surface_opened(std::shared_ptr<input::SessionTarget> const& application,
44 std::shared_ptr<input::SurfaceTarget> const& opened_surface) = 0;
45 virtual void input_surface_closed(std::shared_ptr<input::SurfaceTarget> const& closed_surface) = 0;
46
47 virtual void focus_changed(std::shared_ptr<input::SurfaceTarget> const& focus_surface) = 0;
48 virtual void focus_cleared() = 0;
49
50protected:
51 InputTargetListener() = default;
52 InputTargetListener(InputTargetListener const&) = delete;
53 InputTargetListener& operator=(InputTargetListener const&) = delete;
54};
55
56}
57} // namespace mir
58
59#endif // MIR_SHELL_INPUT_TARGET_LISTENER_H_
060
=== modified file 'include/server/mir/shell/organising_surface_factory.h'
--- include/server/mir/shell/organising_surface_factory.h 2013-04-16 09:16:38 +0000
+++ include/server/mir/shell/organising_surface_factory.h 2013-04-23 12:15:34 +0000
@@ -36,7 +36,10 @@
36 std::shared_ptr<PlacementStrategy> const& placement_strategy);36 std::shared_ptr<PlacementStrategy> const& placement_strategy);
37 virtual ~OrganisingSurfaceFactory();37 virtual ~OrganisingSurfaceFactory();
3838
39 std::shared_ptr<Surface> create_surface(frontend::SurfaceCreationParameters const& params);39 std::shared_ptr<Surface> create_surface(
40 frontend::SurfaceCreationParameters const& params,
41 frontend::SurfaceId id,
42 std::shared_ptr<events::EventSink> const& sink) override;
4043
41protected:44protected:
42 OrganisingSurfaceFactory(OrganisingSurfaceFactory const&) = delete;45 OrganisingSurfaceFactory(OrganisingSurfaceFactory const&) = delete;
4346
=== modified file 'include/server/mir/shell/session.h'
--- include/server/mir/shell/session.h 2013-04-22 03:24:56 +0000
+++ include/server/mir/shell/session.h 2013-04-23 12:15:34 +0000
@@ -32,6 +32,7 @@
32class Session : public frontend::Session, public input::SessionTarget32class Session : public frontend::Session, public input::SessionTarget
33{33{
34public:34public:
35 virtual std::string name() const = 0;
35 virtual void force_requests_to_complete() = 0;36 virtual void force_requests_to_complete() = 0;
3637
37 virtual std::shared_ptr<Surface> default_surface() const = 0;38 virtual std::shared_ptr<Surface> default_surface() const = 0;
3839
=== modified file 'include/server/mir/shell/session_manager.h'
--- include/server/mir/shell/session_manager.h 2013-04-22 03:24:56 +0000
+++ include/server/mir/shell/session_manager.h 2013-04-23 12:15:34 +0000
@@ -40,18 +40,20 @@
40class SessionContainer;40class SessionContainer;
41class FocusSequence;41class FocusSequence;
42class FocusSetter;42class FocusSetter;
43class InputTargetListener;
43class Session;44class Session;
4445
45class SessionManager : public frontend::Shell46class SessionManager : public frontend::Shell
46{47{
47public:48public:
48 explicit SessionManager(std::shared_ptr<SurfaceFactory> const& surface_factory,49 explicit SessionManager(std::shared_ptr<SurfaceFactory> const& surface_factory,
49 std::shared_ptr<SessionContainer> const& session_container,50 std::shared_ptr<SessionContainer> const& app_container,
50 std::shared_ptr<FocusSequence> const& focus_sequence,51 std::shared_ptr<FocusSequence> const& focus_sequence,
51 std::shared_ptr<FocusSetter> const& focus_setter);52 std::shared_ptr<FocusSetter> const& focus_setter,
53 std::shared_ptr<InputTargetListener> const& input_target_listener);
52 virtual ~SessionManager();54 virtual ~SessionManager();
5355
54 virtual std::shared_ptr<frontend::Session> open_session(std::string const& name);56 virtual std::shared_ptr<frontend::Session> open_session(std::string const& name, std::shared_ptr<events::EventSink> const& sink);
55 virtual void close_session(std::shared_ptr<frontend::Session> const& session);57 virtual void close_session(std::shared_ptr<frontend::Session> const& session);
5658
57 virtual void tag_session_with_lightdm_id(std::shared_ptr<frontend::Session> const& session, int id);59 virtual void tag_session_with_lightdm_id(std::shared_ptr<frontend::Session> const& session, int id);
@@ -71,6 +73,7 @@
71 std::shared_ptr<SessionContainer> const app_container;73 std::shared_ptr<SessionContainer> const app_container;
72 std::shared_ptr<FocusSequence> const focus_sequence;74 std::shared_ptr<FocusSequence> const focus_sequence;
73 std::shared_ptr<FocusSetter> const focus_setter;75 std::shared_ptr<FocusSetter> const focus_setter;
76 std::shared_ptr<InputTargetListener> const input_target_listener;
7477
75 std::mutex mutex;78 std::mutex mutex;
76 std::weak_ptr<Session> focus_application;79 std::weak_ptr<Session> focus_application;
7780
=== modified file 'include/server/mir/shell/single_visibility_focus_mechanism.h'
--- include/server/mir/shell/single_visibility_focus_mechanism.h 2013-04-16 09:16:38 +0000
+++ include/server/mir/shell/single_visibility_focus_mechanism.h 2013-04-23 12:15:34 +0000
@@ -28,13 +28,11 @@
28namespace shell28namespace shell
29{29{
30class SessionContainer;30class SessionContainer;
31class InputFocusSelector;
3231
33class SingleVisibilityFocusMechanism : public FocusSetter32class SingleVisibilityFocusMechanism : public FocusSetter
34{33{
35public:34public:
36 explicit SingleVisibilityFocusMechanism(std::shared_ptr<SessionContainer> const& app_container,35 explicit SingleVisibilityFocusMechanism(std::shared_ptr<SessionContainer> const& app_container);
37 std::shared_ptr<shell::InputFocusSelector> const& input_selector);
38 virtual ~SingleVisibilityFocusMechanism() {}36 virtual ~SingleVisibilityFocusMechanism() {}
3937
40 void set_focus_to(std::shared_ptr<shell::Session> const& new_focus);38 void set_focus_to(std::shared_ptr<shell::Session> const& new_focus);
@@ -44,7 +42,6 @@
44 SingleVisibilityFocusMechanism& operator=(const SingleVisibilityFocusMechanism&) = delete;42 SingleVisibilityFocusMechanism& operator=(const SingleVisibilityFocusMechanism&) = delete;
45private:43private:
46 std::shared_ptr<SessionContainer> const app_container;44 std::shared_ptr<SessionContainer> const app_container;
47 std::shared_ptr<shell::InputFocusSelector> const input_selector;
48};45};
4946
50}47}
5148
=== modified file 'include/server/mir/shell/surface.h'
--- include/server/mir/shell/surface.h 2013-04-19 03:20:05 +0000
+++ include/server/mir/shell/surface.h 2013-04-23 12:15:34 +0000
@@ -31,9 +31,16 @@
3131
32namespace mir32namespace mir
33{33{
3434<<<<<<< TREE
35class EventSink;35
3636class EventSink;
37
38=======
39namespace events
40{
41class EventSink;
42}
43>>>>>>> MERGE-SOURCE
37namespace frontend44namespace frontend
38{45{
39struct SurfaceCreationParameters;46struct SurfaceCreationParameters;
@@ -53,7 +60,9 @@
53 Surface(60 Surface(
54 std::shared_ptr<SurfaceBuilder> const& builder,61 std::shared_ptr<SurfaceBuilder> const& builder,
55 frontend::SurfaceCreationParameters const& params,62 frontend::SurfaceCreationParameters const& params,
56 std::shared_ptr<input::InputChannel> const& input_channel);63 std::shared_ptr<input::InputChannel> const& input_channel,
64 frontend::SurfaceId id,
65 std::shared_ptr<events::EventSink> const& sink);
57 ~Surface();66 ~Surface();
5867
59 virtual void hide();68 virtual void hide();
@@ -80,10 +89,14 @@
8089
81 virtual int configure(MirSurfaceAttrib attrib, int value);90 virtual int configure(MirSurfaceAttrib attrib, int value);
82 virtual MirSurfaceType type() const;91 virtual MirSurfaceType type() const;
92<<<<<<< TREE
83 virtual MirSurfaceState state() const;93 virtual MirSurfaceState state() const;
8494
85 void set_id(frontend::SurfaceId i);95 void set_id(frontend::SurfaceId i);
86 void set_event_target(std::shared_ptr<EventSink> const& sink);96 void set_event_target(std::shared_ptr<EventSink> const& sink);
97=======
98 virtual MirSurfaceState state() const;
99>>>>>>> MERGE-SOURCE
87100
88private:101private:
89 bool set_type(MirSurfaceType t); // Use configure() to make public changes102 bool set_type(MirSurfaceType t); // Use configure() to make public changes
@@ -94,9 +107,15 @@
94 std::shared_ptr<mir::input::InputChannel> const input_channel;107 std::shared_ptr<mir::input::InputChannel> const input_channel;
95 std::weak_ptr<mir::surfaces::Surface> const surface;108 std::weak_ptr<mir::surfaces::Surface> const surface;
96109
110<<<<<<< TREE
97 std::shared_ptr<EventSink> event_sink;111 std::shared_ptr<EventSink> event_sink;
98 frontend::SurfaceId id;112 frontend::SurfaceId id;
99113
114=======
115 frontend::SurfaceId const id;
116 std::shared_ptr<events::EventSink> const event_sink;
117
118>>>>>>> MERGE-SOURCE
100 MirSurfaceType type_value;119 MirSurfaceType type_value;
101 MirSurfaceState state_value;120 MirSurfaceState state_value;
102};121};
103122
=== modified file 'include/server/mir/shell/surface_factory.h'
--- include/server/mir/shell/surface_factory.h 2013-04-19 03:20:05 +0000
+++ include/server/mir/shell/surface_factory.h 2013-04-23 12:15:34 +0000
@@ -19,10 +19,15 @@
19#ifndef MIR_SHELL_SURFACE_FACTORY_H_19#ifndef MIR_SHELL_SURFACE_FACTORY_H_
20#define MIR_SHELL_SURFACE_FACTORY_H_20#define MIR_SHELL_SURFACE_FACTORY_H_
2121
22#include "mir/frontend/surface_id.h"
22#include <memory>23#include <memory>
2324
24namespace mir25namespace mir
25{26{
27namespace events
28{
29class EventSink;
30}
26namespace frontend31namespace frontend
27{32{
28struct SurfaceCreationParameters;33struct SurfaceCreationParameters;
@@ -34,7 +39,10 @@
34class SurfaceFactory39class SurfaceFactory
35{40{
36public:41public:
37 virtual std::shared_ptr<Surface> create_surface(const frontend::SurfaceCreationParameters& params) = 0;42 virtual std::shared_ptr<Surface> create_surface(
43 frontend::SurfaceCreationParameters const& params,
44 frontend::SurfaceId id,
45 std::shared_ptr<events::EventSink> const& sink) = 0;
3846
39protected:47protected:
40 virtual ~SurfaceFactory() {}48 virtual ~SurfaceFactory() {}
4149
=== modified file 'include/server/mir/shell/surface_source.h'
--- include/server/mir/shell/surface_source.h 2013-04-16 09:16:38 +0000
+++ include/server/mir/shell/surface_source.h 2013-04-23 12:15:34 +0000
@@ -40,7 +40,10 @@
40 explicit SurfaceSource(std::shared_ptr<SurfaceBuilder> const& surface_builder, std::shared_ptr<input::InputChannelFactory> const& input_factory);40 explicit SurfaceSource(std::shared_ptr<SurfaceBuilder> const& surface_builder, std::shared_ptr<input::InputChannelFactory> const& input_factory);
41 virtual ~SurfaceSource() {}41 virtual ~SurfaceSource() {}
4242
43 std::shared_ptr<Surface> create_surface(const frontend::SurfaceCreationParameters& params);43 std::shared_ptr<Surface> create_surface(
44 frontend::SurfaceCreationParameters const& params,
45 frontend::SurfaceId id,
46 std::shared_ptr<events::EventSink> const& sink);
4447
45protected:48protected:
46 SurfaceSource(const SurfaceSource&) = delete;49 SurfaceSource(const SurfaceSource&) = delete;
4750
=== added file 'include/shared/mir/default_configuration.h'
--- include/shared/mir/default_configuration.h 1970-01-01 00:00:00 +0000
+++ include/shared/mir/default_configuration.h 2013-04-23 12:15:34 +0000
@@ -0,0 +1,29 @@
1/*
2 * Private internal defaults shared by client and server code.
3 *
4 * Copyright © 2013 Canonical Ltd.
5 *
6 * This program is free software: you can redistribute it and/or modify
7 * it under the terms of the GNU Lesser General Public License version 3 as
8 * published by the Free Software Foundation.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU Lesser General Public License for more details.
14 *
15 * You should have received a copy of the GNU Lesser General Public License
16 * along with this program. If not, see <http://www.gnu.org/licenses/>.
17 *
18 * Author: Daniel van Vugt <daniel.van.vugt@canonical.com>
19 */
20
21#ifndef MIR_DEFAULT_CONFIGURATION_
22#define MIR_DEFAULT_CONFIGURATION_
23
24namespace mir
25{
26const char default_server_socket[] = "/tmp/mir_socket";
27}
28
29#endif
030
=== added directory 'include/shared/mir/events'
=== renamed file 'include/shared/mir/event_sink.h' => 'include/shared/mir/events/event_sink.h'
--- include/shared/mir/event_sink.h 2013-04-19 04:33:51 +0000
+++ include/shared/mir/events/event_sink.h 2013-04-23 12:15:34 +0000
@@ -1,3 +1,4 @@
1<<<<<<< TREE
1/*2/*
2 * Copyright © 2013 Canonical Ltd.3 * Copyright © 2013 Canonical Ltd.
3 *4 *
@@ -41,3 +42,49 @@
4142
42#endif43#endif
4344
45=======
46/*
47 * Copyright © 2013 Canonical Ltd.
48 *
49 * This program is free software: you can redistribute it and/or modify
50 * it under the terms of the GNU Lesser General Public License version 3 as
51 * published by the Free Software Foundation.
52 *
53 * This program is distributed in the hope that it will be useful,
54 * but WITHOUT ANY WARRANTY; without even the implied warranty of
55 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
56 * GNU Lesser General Public License for more details.
57 *
58 * You should have received a copy of the GNU Lesser General Public License
59 * along with this program. If not, see <http://www.gnu.org/licenses/>.
60 *
61 * Authored by: Daniel van Vugt <daniel.van.vugt@canonical.com>
62 */
63
64#ifndef MIR_EVENTS_EVENT_SINK_H_
65#define MIR_EVENTS_EVENT_SINK_H_
66
67#include "mir_toolkit/event.h"
68
69namespace mir
70{
71namespace events
72{
73
74class EventSink
75{
76public:
77 virtual ~EventSink() = default;
78
79 virtual void handle_event(MirEvent const& e) = 0;
80
81protected:
82 EventSink() = default;
83 EventSink(EventSink const&) = delete;
84 EventSink& operator=(EventSink const&) = delete;
85};
86}
87} // namespace mir
88
89#endif // MIR_EVENTS_EVENT_SINK_H_
90>>>>>>> MERGE-SOURCE
4491
=== modified file 'include/shared/mir/graphics/android/sync_object.h'
--- include/shared/mir/graphics/android/sync_object.h 2013-04-12 16:28:32 +0000
+++ include/shared/mir/graphics/android/sync_object.h 2013-04-23 12:15:34 +0000
@@ -8,7 +8,7 @@
8 * This program is distributed in the hope that it will be useful,8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.11 * GNU Lesser General Public License for more details.
12 *12 *
13 * You should have received a copy of the GNU Lesser General Public License13 * You should have received a copy of the GNU Lesser General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
1515
=== modified file 'include/test/mir_test_doubles/mock_android_buffer.h'
--- include/test/mir_test_doubles/mock_android_buffer.h 2013-04-11 22:20:59 +0000
+++ include/test/mir_test_doubles/mock_android_buffer.h 2013-04-23 12:15:34 +0000
@@ -2,7 +2,7 @@
2 * Copyright © 2012 Canonical Ltd.2 * Copyright © 2012 Canonical Ltd.
3 *3 *
4 * This program is free software: you can redistribute it and/or modify it4 * This program is free software: you can redistribute it and/or modify it
5 * under the terms of the GNU Lesser General Public License version 3,5 * under the terms of the GNU General Public License version 3,
6 * as published by the Free Software Foundation.6 * as published by the Free Software Foundation.
7 *7 *
8 * This program is distributed in the hope that it will be useful,8 * This program is distributed in the hope that it will be useful,
@@ -10,7 +10,7 @@
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.11 * GNU General Public License for more details.
12 *12 *
13 * You should have received a copy of the GNU Lesser General Public License13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 *15 *
16 * Authored by: Thomas Voss <thomas.voss@canonical.com>16 * Authored by: Thomas Voss <thomas.voss@canonical.com>
1717
=== modified file 'include/test/mir_test_doubles/mock_display_support_provider.h'
--- include/test/mir_test_doubles/mock_display_support_provider.h 2013-04-12 16:28:32 +0000
+++ include/test/mir_test_doubles/mock_display_support_provider.h 2013-04-23 12:15:34 +0000
@@ -2,7 +2,7 @@
2 * Copyright © 2013 Canonical Ltd.2 * Copyright © 2013 Canonical Ltd.
3 *3 *
4 * This program is free software: you can redistribute it and/or modify it4 * This program is free software: you can redistribute it and/or modify it
5 * under the terms of the GNU Lesser General Public License version 3,5 * under the terms of the GNU General Public License version 3,
6 * as published by the Free Software Foundation.6 * as published by the Free Software Foundation.
7 *7 *
8 * This program is distributed in the hope that it will be useful,8 * This program is distributed in the hope that it will be useful,
@@ -10,7 +10,7 @@
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.11 * GNU General Public License for more details.
12 *12 *
13 * You should have received a copy of the GNU Lesser General Public License13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 *15 *
16 * Authored by: Kevin DuBois <kevin.dubois@canonical.com>16 * Authored by: Kevin DuBois <kevin.dubois@canonical.com>
1717
=== modified file 'include/test/mir_test_doubles/mock_fb_device.h'
--- include/test/mir_test_doubles/mock_fb_device.h 2013-04-22 03:24:56 +0000
+++ include/test/mir_test_doubles/mock_fb_device.h 2013-04-23 12:15:34 +0000
@@ -2,7 +2,7 @@
2 * Copyright © 2013 Canonical Ltd.2 * Copyright © 2013 Canonical Ltd.
3 *3 *
4 * This program is free software: you can redistribute it and/or modify it4 * This program is free software: you can redistribute it and/or modify it
5 * under the terms of the GNU Lesser General Public License version 3,5 * under the terms of the GNU General Public License version 3,
6 * as published by the Free Software Foundation.6 * as published by the Free Software Foundation.
7 *7 *
8 * This program is distributed in the hope that it will be useful,8 * This program is distributed in the hope that it will be useful,
@@ -10,7 +10,7 @@
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.11 * GNU General Public License for more details.
12 *12 *
13 * You should have received a copy of the GNU Lesser General Public License13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 *15 *
16 * Authored by: Kevin DuBois <kevin.dubois@canonical.com>16 * Authored by: Kevin DuBois <kevin.dubois@canonical.com>
1717
=== modified file 'include/test/mir_test_doubles/mock_input_configuration.h'
--- include/test/mir_test_doubles/mock_input_configuration.h 2013-04-12 16:35:06 +0000
+++ include/test/mir_test_doubles/mock_input_configuration.h 2013-04-23 12:15:34 +0000
@@ -2,15 +2,15 @@
2 * Copyright © 2013 Canonical Ltd.2 * Copyright © 2013 Canonical Ltd.
3 *3 *
4 * This program is free software: you can redistribute it and/or modify it4 * This program is free software: you can redistribute it and/or modify it
5 * under the terms of the GNU Lesser General Public License version 3,5 * under the terms of the GNU General Public License version 3,
6 * as published by the Free Software Foundation.6 * as published by the Free Software Foundation.
7 *7 *
8 * This program is distributed in the hope that it will be useful,8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU Lesser General Public License for more details.11 * GNU General Public License for more details.
12 *12 *
13 * You should have received a copy of the GNU Lesser General Public License13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 *15 *
16 * Authored by: Robert Carr <robert.carr@canonical.com>16 * Authored by: Robert Carr <robert.carr@canonical.com>
1717
=== modified file 'include/test/mir_test_doubles/mock_input_dispatcher.h'
--- include/test/mir_test_doubles/mock_input_dispatcher.h 2013-04-11 23:04:18 +0000
+++ include/test/mir_test_doubles/mock_input_dispatcher.h 2013-04-23 12:15:34 +0000
@@ -2,15 +2,15 @@
2 * Copyright © 2013 Canonical Ltd.2 * Copyright © 2013 Canonical Ltd.
3 *3 *
4 * This program is free software: you can redistribute it and/or modify it4 * This program is free software: you can redistribute it and/or modify it
5 * under the terms of the GNU Lesser General Public License version 3,5 * under the terms of the GNU General Public License version 3,
6 * as published by the Free Software Foundation.6 * as published by the Free Software Foundation.
7 *7 *
8 * This program is distributed in the hope that it will be useful,8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU Lesser General Public License for more details.11 * GNU General Public License for more details.
12 *12 *
13 * You should have received a copy of the GNU Lesser General Public License13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 *15 *
16 * Authored by: Robert Carr <robert.carr@canonical.com>16 * Authored by: Robert Carr <robert.carr@canonical.com>
1717
=== removed file 'include/test/mir_test_doubles/mock_input_focus_selector.h'
--- include/test/mir_test_doubles/mock_input_focus_selector.h 2013-04-16 09:16:38 +0000
+++ include/test/mir_test_doubles/mock_input_focus_selector.h 1970-01-01 00:00:00 +0000
@@ -1,40 +0,0 @@
1/*
2 * Copyright © 2013 Canonical Ltd.
3 *
4 * This program is free software: you can redistribute it and/or modify it
5 * under the terms of the GNU General Public License version 3,
6 * as published by the Free Software Foundation.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 *
16 * Authored by: Robert Carr <robert.carr@canonical.com>
17 */
18
19#ifndef MIR_TEST_DOUBLES_MOCK_INPUT_FOCUS_SELECTOR_H_
20#define MIR_TEST_DOUBLES_MOCK_INPUT_FOCUS_SELECTOR_H_
21
22#include "mir/shell/input_focus_selector.h"
23
24namespace mir
25{
26namespace test
27{
28namespace doubles
29{
30
31struct MockInputFocusSelector : public shell::InputFocusSelector
32{
33 MOCK_METHOD2(set_input_focus_to, void(std::shared_ptr<input::SessionTarget> const&, std::shared_ptr<input::SurfaceTarget> const&));
34};
35
36}
37}
38} // namespace mir
39
40#endif // MIR_TEST_DOUBLES_MOCK_INPUT_FOCUS_SELECTOR_H_
410
=== added file 'include/test/mir_test_doubles/mock_input_target_listener.h'
--- include/test/mir_test_doubles/mock_input_target_listener.h 1970-01-01 00:00:00 +0000
+++ include/test/mir_test_doubles/mock_input_target_listener.h 2013-04-23 12:15:34 +0000
@@ -0,0 +1,49 @@
1/*
2 * Copyright © 2013 Canonical Ltd.
3 *
4 * This program is free software: you can redistribute it and/or modify it
5 * under the terms of the GNU General Public License version 3,
6 * as published by the Free Software Foundation.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 *
16 * Authored by: Robert Carr <robert.carr@canonical.com>
17 */
18
19#ifndef MIR_TEST_DOUBLES_MOCK_INPUT_TARGET_LISTENER_H_
20#define MIR_TEST_DOUBLES_MOCK_INPUT_TARGET_LISTENER_H_
21
22#include "mir/shell/input_target_listener.h"
23
24#include <gmock/gmock.h>
25
26namespace mir
27{
28namespace test
29{
30namespace doubles
31{
32
33struct MockInputTargetListener : public shell::InputTargetListener
34{
35 virtual ~MockInputTargetListener() noexcept(true) {}
36 MOCK_METHOD1(input_application_opened, void(std::shared_ptr<input::SessionTarget> const& application));
37 MOCK_METHOD1(input_application_closed, void(std::shared_ptr<input::SessionTarget> const& application));
38 MOCK_METHOD2(input_surface_opened, void(std::shared_ptr<input::SessionTarget> const& application,
39 std::shared_ptr<input::SurfaceTarget> const& opened_surface));
40 MOCK_METHOD1(input_surface_closed, void(std::shared_ptr<input::SurfaceTarget> const& closed_surface));
41 MOCK_METHOD1(focus_changed, void(std::shared_ptr<input::SurfaceTarget> const& focus_surface));
42 MOCK_METHOD0(focus_cleared, void());
43};
44
45}
46}
47} // namespace mir
48
49#endif // MIR_TEST_DOUBLES_MOCK_INPUT_TARGET_LISTENER_H_
050
=== modified file 'include/test/mir_test_doubles/mock_shell.h'
--- include/test/mir_test_doubles/mock_shell.h 2013-04-19 03:20:05 +0000
+++ include/test/mir_test_doubles/mock_shell.h 2013-04-23 12:15:34 +0000
@@ -34,7 +34,7 @@
3434
35struct MockShell : public frontend::Shell35struct MockShell : public frontend::Shell
36{36{
37 MOCK_METHOD1(open_session, std::shared_ptr<frontend::Session>(std::string const&));37 MOCK_METHOD2(open_session, std::shared_ptr<frontend::Session>(std::string const&, std::shared_ptr<events::EventSink> const&));
38 MOCK_METHOD1(close_session, void(std::shared_ptr<frontend::Session> const&));38 MOCK_METHOD1(close_session, void(std::shared_ptr<frontend::Session> const&));
3939
40 MOCK_METHOD2(tag_session_with_lightdm_id, void(std::shared_ptr<frontend::Session> const&, int));40 MOCK_METHOD2(tag_session_with_lightdm_id, void(std::shared_ptr<frontend::Session> const&, int));
4141
=== modified file 'include/test/mir_test_doubles/mock_surface.h'
--- include/test/mir_test_doubles/mock_surface.h 2013-04-19 03:20:05 +0000
+++ include/test/mir_test_doubles/mock_surface.h 2013-04-23 12:15:34 +0000
@@ -37,7 +37,12 @@
37struct MockSurface : public shell::Surface37struct MockSurface : public shell::Surface
38{38{
39 MockSurface(std::shared_ptr<shell::SurfaceBuilder> const& builder) :39 MockSurface(std::shared_ptr<shell::SurfaceBuilder> const& builder) :
40 shell::Surface(builder, frontend::a_surface(), std::shared_ptr<input::InputChannel>())40 shell::Surface(
41 builder,
42 frontend::a_surface(),
43 std::shared_ptr<input::InputChannel>(),
44 frontend::SurfaceId(),
45 std::shared_ptr<events::EventSink>())
41 {46 {
42 }47 }
4348
4449
=== modified file 'include/test/mir_test_doubles/mock_surface_factory.h'
--- include/test/mir_test_doubles/mock_surface_factory.h 2013-04-16 09:16:38 +0000
+++ include/test/mir_test_doubles/mock_surface_factory.h 2013-04-23 12:15:34 +0000
@@ -33,7 +33,10 @@
3333
34struct MockSurfaceFactory : public shell::SurfaceFactory34struct MockSurfaceFactory : public shell::SurfaceFactory
35{35{
36 MOCK_METHOD1(create_surface, std::shared_ptr<shell::Surface>(const frontend::SurfaceCreationParameters&));36 MOCK_METHOD3(create_surface, std::shared_ptr<shell::Surface>(
37 const frontend::SurfaceCreationParameters&,
38 frontend::SurfaceId,
39 std::shared_ptr<events::EventSink> const&));
37};40};
3841
39}42}
4043
=== modified file 'include/test/mir_test_doubles/null_virtual_terminal.h'
--- include/test/mir_test_doubles/null_virtual_terminal.h 2013-04-22 03:24:56 +0000
+++ include/test/mir_test_doubles/null_virtual_terminal.h 2013-04-23 12:15:34 +0000
@@ -2,7 +2,7 @@
2 * Copyright © 2013 Canonical Ltd.2 * Copyright © 2013 Canonical Ltd.
3 *3 *
4 * This program is free software: you can redistribute it and/or modify it4 * This program is free software: you can redistribute it and/or modify it
5 * under the terms of the GNU Lesser General Public License version 3,5 * under the terms of the GNU General Public License version 3,
6 * as published by the Free Software Foundation.6 * as published by the Free Software Foundation.
7 *7 *
8 * This program is distributed in the hope that it will be useful,8 * This program is distributed in the hope that it will be useful,
@@ -10,7 +10,7 @@
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.11 * GNU General Public License for more details.
12 *12 *
13 * You should have received a copy of the GNU Lesser General Public License13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 *15 *
16 * Authored by: Alexandros Frantzis <alexandros.frantzis@canonical.com>16 * Authored by: Alexandros Frantzis <alexandros.frantzis@canonical.com>
1717
=== added file 'include/test/mir_test_doubles/stub_input_target_listener.h'
--- include/test/mir_test_doubles/stub_input_target_listener.h 1970-01-01 00:00:00 +0000
+++ include/test/mir_test_doubles/stub_input_target_listener.h 2013-04-23 12:15:34 +0000
@@ -0,0 +1,59 @@
1/*
2 * Copyright © 2013 Canonical Ltd.
3 *
4 * This program is free software: you can redistribute it and/or modify it
5 * under the terms of the GNU General Public License version 3,
6 * as published by the Free Software Foundation.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 *
16 * Authored by: Robert Carr <robert.carr@canonical.com>
17 */
18
19#ifndef MIR_TEST_DOUBLES_STUB_INPUT_LISTENER_H_
20#define MIR_TEST_DOUBLES_STUB_INPUT_LISTENER_H_
21
22#include "mir/shell/input_target_listener.h"
23
24namespace mir
25{
26namespace test
27{
28namespace doubles
29{
30
31struct StubInputTargetListener : public shell::InputTargetListener
32{
33 void input_application_opened(std::shared_ptr<input::SessionTarget> const&)
34 {
35 }
36 void input_application_closed(std::shared_ptr<input::SessionTarget> const&)
37 {
38 }
39 void input_surface_opened(std::shared_ptr<input::SessionTarget> const&,
40 std::shared_ptr<input::SurfaceTarget> const&)
41 {
42 }
43 void input_surface_closed(std::shared_ptr<input::SurfaceTarget> const&)
44 {
45 }
46 void focus_changed(std::shared_ptr<input::SurfaceTarget> const&)
47 {
48 }
49
50 void focus_cleared()
51 {
52 }
53};
54
55}
56}
57} // namespace mir
58
59#endif // MIR_TEST_DOUBLES_STUB_INPUT_LISTENER_H_
060
=== modified file 'include/test/mir_test_doubles/stub_ipc_factory.h'
--- include/test/mir_test_doubles/stub_ipc_factory.h 2013-04-19 07:45:44 +0000
+++ include/test/mir_test_doubles/stub_ipc_factory.h 2013-04-23 12:15:34 +0000
@@ -41,8 +41,13 @@
41 {41 {
42 }42 }
4343
44<<<<<<< TREE
44 std::shared_ptr<protobuf::DisplayServer> make_ipc_server(45 std::shared_ptr<protobuf::DisplayServer> make_ipc_server(
45 std::shared_ptr<EventSink> const&)46 std::shared_ptr<EventSink> const&)
47=======
48 std::shared_ptr<protobuf::DisplayServer> make_ipc_server(
49 std::shared_ptr<events::EventSink> const&)
50>>>>>>> MERGE-SOURCE
46 {51 {
47 return server;52 return server;
48 }53 }
4954
=== modified file 'include/test/mir_test_doubles/stub_session.h'
--- include/test/mir_test_doubles/stub_session.h 2013-04-19 08:03:57 +0000
+++ include/test/mir_test_doubles/stub_session.h 2013-04-23 12:15:34 +0000
@@ -58,9 +58,15 @@
58 {58 {
59 return 0;59 return 0;
60 }60 }
61<<<<<<< TREE
61 void set_event_sink(std::shared_ptr<EventSink> const&)62 void set_event_sink(std::shared_ptr<EventSink> const&)
62 {63 {
63 }64 }
65=======
66 void set_event_sink(std::shared_ptr<events::EventSink> const&)
67 {
68 }
69>>>>>>> MERGE-SOURCE
64};70};
6571
66}72}
6773
=== modified file 'include/test/mir_test_doubles/stub_shell.h'
--- include/test/mir_test_doubles/stub_shell.h 2013-04-19 03:20:05 +0000
+++ include/test/mir_test_doubles/stub_shell.h 2013-04-23 12:15:34 +0000
@@ -31,7 +31,7 @@
3131
32class StubShell : public frontend::Shell32class StubShell : public frontend::Shell
33{33{
34 std::shared_ptr<frontend::Session> open_session(std::string const& /* name */)34 std::shared_ptr<frontend::Session> open_session(std::string const& /* name */, std::shared_ptr<events::EventSink> const& /* sink */)
35 {35 {
36 return std::make_shared<StubSession>();36 return std::make_shared<StubSession>();
37 }37 }
3838
=== modified file 'include/test/mir_test_framework/testing_server_configuration.h'
--- include/test/mir_test_framework/testing_server_configuration.h 2013-04-16 09:16:38 +0000
+++ include/test/mir_test_framework/testing_server_configuration.h 2013-04-23 12:15:34 +0000
@@ -49,7 +49,7 @@
49 // to avoid starting and stopping the full android input stack for tests49 // to avoid starting and stopping the full android input stack for tests
50 // which do not leverage input.50 // which do not leverage input.
51 std::shared_ptr<input::InputManager> the_input_manager();51 std::shared_ptr<input::InputManager> the_input_manager();
52 std::shared_ptr<shell::InputFocusSelector> the_input_focus_selector();52 std::shared_ptr<shell::InputTargetListener> the_input_target_listener();
5353
54 virtual std::string the_socket_file() const;54 virtual std::string the_socket_file() const;
55 using DefaultServerConfiguration::the_options;55 using DefaultServerConfiguration::the_options;
5656
=== modified file 'src/client/client_buffer_depository.h'
--- src/client/client_buffer_depository.h 2013-04-12 03:36:28 +0000
+++ src/client/client_buffer_depository.h 2013-04-23 12:15:34 +0000
@@ -48,9 +48,9 @@
4848
49 /// \param factory is the ClientBufferFactory that will be used to convert IPC data to ClientBuffers49 /// \param factory is the ClientBufferFactory that will be used to convert IPC data to ClientBuffers
50 /// \param max_buffers is the number of buffers the depository will cache. After the client has received50 /// \param max_buffers is the number of buffers the depository will cache. After the client has received
51 /// its initial buffers the ClientBufferDepository will always have the last \ref max_buffers buffers51 /// its initial buffers the ClientBufferDepository will always have the last max_buffers buffers
52 /// cached.52 /// cached.
53 /// \note The server relies on the depository caching \ref max_buffers buffers to optimise away buffer53 /// \note The server relies on the depository caching max_buffers buffers to optimise away buffer
54 /// passing. As such, this number needs to be shared between the server and client libraries.54 /// passing. As such, this number needs to be shared between the server and client libraries.
55 ClientBufferDepository(std::shared_ptr<ClientBufferFactory> const& factory, int max_buffers);55 ClientBufferDepository(std::shared_ptr<ClientBufferFactory> const& factory, int max_buffers);
5656
5757
=== modified file 'src/client/mir_client_library.cpp'
--- src/client/mir_client_library.cpp 2013-04-18 04:23:56 +0000
+++ src/client/mir_client_library.cpp 2013-04-23 12:15:34 +0000
@@ -16,6 +16,7 @@
16 * Authored by: Thomas Guest <thomas.guest@canonical.com>16 * Authored by: Thomas Guest <thomas.guest@canonical.com>
17 */17 */
1818
19#include "mir/default_configuration.h"
19#include "mir_toolkit/mir_client_library.h"20#include "mir_toolkit/mir_client_library.h"
20#include "mir_toolkit/mir_client_library_drm.h"21#include "mir_toolkit/mir_client_library_drm.h"
21#include "mir_toolkit/mir_client_library_lightdm.h"22#include "mir_toolkit/mir_client_library_lightdm.h"
@@ -54,6 +55,8 @@
5455
55 try56 try
56 {57 {
58 const std::string sock = socket_file ? socket_file :
59 mir::default_server_socket;
57 auto log = std::make_shared<mcl::ConsoleLogger>();60 auto log = std::make_shared<mcl::ConsoleLogger>();
58 auto client_platform_factory = std::make_shared<mcl::NativeClientPlatformFactory>();61 auto client_platform_factory = std::make_shared<mcl::NativeClientPlatformFactory>();
5962
6063
=== modified file 'src/client/mir_connection.h'
--- src/client/mir_connection.h 2013-04-16 09:42:50 +0000
+++ src/client/mir_connection.h 2013-04-23 12:15:34 +0000
@@ -34,7 +34,11 @@
34#include "client_context.h"34#include "client_context.h"
3535
36#include "mir_wait_handle.h"36#include "mir_wait_handle.h"
37<<<<<<< TREE
37#include "mir/event_sink.h"38#include "mir/event_sink.h"
39=======
40#include "mir/events/event_sink.h"
41>>>>>>> MERGE-SOURCE
3842
39namespace mir43namespace mir
40{44{
@@ -51,8 +55,12 @@
51}55}
52}56}
5357
58<<<<<<< TREE
54struct MirConnection : public mir::client::ClientContext,59struct MirConnection : public mir::client::ClientContext,
55 public mir::EventSink60 public mir::EventSink
61=======
62struct MirConnection : mir::client::ClientContext, mir::events::EventSink
63>>>>>>> MERGE-SOURCE
56{64{
57public:65public:
58 MirConnection();66 MirConnection();
5967
=== modified file 'src/client/mir_socket_rpc_channel.cpp'
--- src/client/mir_socket_rpc_channel.cpp 2013-04-18 04:15:05 +0000
+++ src/client/mir_socket_rpc_channel.cpp 2013-04-23 12:15:34 +0000
@@ -330,6 +330,7 @@
330 result.ParseFromIstream(&in);330 result.ParseFromIstream(&in);
331 return result;331 return result;
332}332}
333<<<<<<< TREE
333334
334void mcl::MirSocketRpcChannel::set_event_handler(mir::EventSink *sink)335void mcl::MirSocketRpcChannel::set_event_handler(mir::EventSink *sink)
335{336{
@@ -340,3 +341,15 @@
340 */341 */
341 event_handler = sink;342 event_handler = sink;
342}343}
344=======
345
346void mcl::MirSocketRpcChannel::set_event_handler(events::EventSink *sink)
347{
348 /*
349 * Yes, these have to be regular pointers. Because ownership of the object
350 * (which is actually a MirConnection) is the responsibility of the calling
351 * client. So out of our control.
352 */
353 event_handler = sink;
354}
355>>>>>>> MERGE-SOURCE
343356
=== modified file 'src/client/mir_socket_rpc_channel.h'
--- src/client/mir_socket_rpc_channel.h 2013-04-18 03:54:19 +0000
+++ src/client/mir_socket_rpc_channel.h 2013-04-23 12:15:34 +0000
@@ -22,7 +22,11 @@
2222
23#include "mir_basic_rpc_channel.h"23#include "mir_basic_rpc_channel.h"
24#include "mir_logger.h"24#include "mir_logger.h"
25<<<<<<< TREE
25#include "mir/event_sink.h"26#include "mir/event_sink.h"
27=======
28#include "mir/events/event_sink.h"
29>>>>>>> MERGE-SOURCE
2630
27#include <boost/asio.hpp>31#include <boost/asio.hpp>
2832
@@ -52,8 +56,13 @@
52 MirSocketRpcChannel(const std::string& endpoint, const std::shared_ptr<Logger>& log);56 MirSocketRpcChannel(const std::string& endpoint, const std::shared_ptr<Logger>& log);
53 ~MirSocketRpcChannel();57 ~MirSocketRpcChannel();
5458
59<<<<<<< TREE
55 void set_event_handler(EventSink *sink);60 void set_event_handler(EventSink *sink);
5661
62=======
63 void set_event_handler(events::EventSink *sink);
64
65>>>>>>> MERGE-SOURCE
57private:66private:
58 virtual void CallMethod(const google::protobuf::MethodDescriptor* method, google::protobuf::RpcController*,67 virtual void CallMethod(const google::protobuf::MethodDescriptor* method, google::protobuf::RpcController*,
59 const google::protobuf::Message* parameters, google::protobuf::Message* response,68 const google::protobuf::Message* parameters, google::protobuf::Message* response,
@@ -80,8 +89,13 @@
80 size_t read_message_header();89 size_t read_message_header();
8190
82 mir::protobuf::wire::Result read_message_body(const size_t body_size);91 mir::protobuf::wire::Result read_message_body(const size_t body_size);
92<<<<<<< TREE
8393
84 EventSink *event_handler;94 EventSink *event_handler;
95=======
96
97 events::EventSink *event_handler;
98>>>>>>> MERGE-SOURCE
85};99};
86100
87}101}
88102
=== modified file 'src/server/default_server_configuration.cpp'
--- src/server/default_server_configuration.cpp 2013-04-22 03:24:56 +0000
+++ src/server/default_server_configuration.cpp 2013-04-23 12:15:34 +0000
@@ -45,7 +45,7 @@
45#include "mir/graphics/buffer_initializer.h"45#include "mir/graphics/buffer_initializer.h"
46#include "mir/graphics/null_display_report.h"46#include "mir/graphics/null_display_report.h"
47#include "mir/input/null_input_manager.h"47#include "mir/input/null_input_manager.h"
48#include "mir/input/null_input_focus_selector.h"48#include "mir/input/null_input_target_listener.h"
49#include "input/android/default_android_input_configuration.h"49#include "input/android/default_android_input_configuration.h"
50#include "input/android/android_input_manager.h"50#include "input/android/android_input_manager.h"
51#include "input/android/android_dispatcher_controller.h"51#include "input/android/android_dispatcher_controller.h"
@@ -59,8 +59,10 @@
59#include "mir/surfaces/surface_stack.h"59#include "mir/surfaces/surface_stack.h"
60#include "mir/surfaces/surface_controller.h"60#include "mir/surfaces/surface_controller.h"
61#include "mir/time/high_resolution_clock.h"61#include "mir/time/high_resolution_clock.h"
62#include "mir/default_configuration.h"
6263
63namespace mc = mir::compositor;64namespace mc = mir::compositor;
65namespace me = mir::events;
64namespace geom = mir::geometry;66namespace geom = mir::geometry;
65namespace mf = mir::frontend;67namespace mf = mir::frontend;
66namespace mg = mir::graphics;68namespace mg = mir::graphics;
@@ -106,8 +108,13 @@
106 std::shared_ptr<mg::ViewableArea> const graphics_display;108 std::shared_ptr<mg::ViewableArea> const graphics_display;
107 std::shared_ptr<mc::GraphicBufferAllocator> const buffer_allocator;109 std::shared_ptr<mc::GraphicBufferAllocator> const buffer_allocator;
108110
111<<<<<<< TREE
109 virtual std::shared_ptr<mir::protobuf::DisplayServer> make_ipc_server(112 virtual std::shared_ptr<mir::protobuf::DisplayServer> make_ipc_server(
110 std::shared_ptr<mir::EventSink> const& sink)113 std::shared_ptr<mir::EventSink> const& sink)
114=======
115 virtual std::shared_ptr<mir::protobuf::DisplayServer> make_ipc_server(
116 std::shared_ptr<me::EventSink> const& sink)
117>>>>>>> MERGE-SOURCE
111 {118 {
112 return std::make_shared<mf::SessionMediator>(119 return std::make_shared<mf::SessionMediator>(
113 shell,120 shell,
@@ -230,7 +237,7 @@
230237
231std::string mir::DefaultServerConfiguration::the_socket_file() const238std::string mir::DefaultServerConfiguration::the_socket_file() const
232{239{
233 return the_options()->get("file", "/tmp/mir_socket");240 return the_options()->get("file", mir::default_server_socket);
234}241}
235242
236std::shared_ptr<mir::options::Option> mir::DefaultServerConfiguration::the_options() const243std::shared_ptr<mir::options::Option> mir::DefaultServerConfiguration::the_options() const
@@ -312,8 +319,7 @@
312 [this]319 [this]
313 {320 {
314 return std::make_shared<msh::SingleVisibilityFocusMechanism>(321 return std::make_shared<msh::SingleVisibilityFocusMechanism>(
315 the_shell_session_container(),322 the_shell_session_container());
316 the_input_focus_selector());
317 });323 });
318}324}
319325
@@ -349,7 +355,8 @@
349 the_shell_surface_factory(),355 the_shell_surface_factory(),
350 the_shell_session_container(),356 the_shell_session_container(),
351 the_shell_focus_sequence(),357 the_shell_focus_sequence(),
352 the_shell_focus_setter());358 the_shell_focus_setter(),
359 the_input_target_listener());
353 });360 });
354}361}
355362
@@ -564,15 +571,15 @@
564 return the_input_manager();571 return the_input_manager();
565}572}
566573
567std::shared_ptr<msh::InputFocusSelector> mir::DefaultServerConfiguration::the_input_focus_selector()574std::shared_ptr<msh::InputTargetListener> mir::DefaultServerConfiguration::the_input_target_listener()
568{575{
569 return input_focus_selector(576 return input_target_listener(
570 [&]() -> std::shared_ptr<msh::InputFocusSelector>577 [&]() -> std::shared_ptr<msh::InputTargetListener>
571 {578 {
572 if (the_options()->get("enable-input", false))579 if (the_options()->get("enable-input", false))
573 return std::make_shared<mia::DispatcherController>(the_input_configuration());580 return std::make_shared<mia::DispatcherController>(the_input_configuration());
574 else581 else
575 return std::make_shared<mi::NullInputFocusSelector>();582 return std::make_shared<mi::NullInputTargetListener>();
576 });583 });
577}584}
578585
579586
=== modified file 'src/server/display_server.cpp'
--- src/server/display_server.cpp 2013-04-22 09:50:06 +0000
+++ src/server/display_server.cpp 2013-04-23 12:15:34 +0000
@@ -31,9 +31,9 @@
3131
32namespace mc = mir::compositor;32namespace mc = mir::compositor;
33namespace mf = mir::frontend;33namespace mf = mir::frontend;
34namespace msh = mir::shell;
35namespace mg = mir::graphics;34namespace mg = mir::graphics;
36namespace mi = mir::input;35namespace mi = mir::input;
36namespace msh = mir::shell;
3737
38namespace38namespace
39{39{
4040
=== modified file 'src/server/frontend/CMakeLists.txt'
--- src/server/frontend/CMakeLists.txt 2013-04-19 04:00:32 +0000
+++ src/server/frontend/CMakeLists.txt 2013-04-23 12:15:34 +0000
@@ -8,6 +8,7 @@
8 protobuf_message_processor.cpp8 protobuf_message_processor.cpp
9 null_message_processor.cpp9 null_message_processor.cpp
10 surface_creation_parameters.cpp10 surface_creation_parameters.cpp
11 event_pipe.cpp
1112
12 resource_cache.cpp13 resource_cache.cpp
13 ${PROTO_HDRS}14 ${PROTO_HDRS}
1415
=== renamed file 'src/server/event_queue.cpp' => 'src/server/frontend/event_pipe.cpp'
--- src/server/event_queue.cpp 2013-04-16 05:46:28 +0000
+++ src/server/frontend/event_pipe.cpp 2013-04-23 12:15:34 +0000
@@ -1,3 +1,4 @@
1<<<<<<< TREE
1/*2/*
2 * Copyright © 2013 Canonical Ltd.3 * Copyright © 2013 Canonical Ltd.
3 *4 *
@@ -35,3 +36,41 @@
35 if (p)36 if (p)
36 p->handle_event(e);37 p->handle_event(e);
37}38}
39=======
40/*
41 * Copyright © 2013 Canonical Ltd.
42 *
43 * This program is free software: you can redistribute it and/or modify
44 * it under the terms of the GNU General Public License version 3 as
45 * published by the Free Software Foundation.
46 *
47 * This program is distributed in the hope that it will be useful,
48 * but WITHOUT ANY WARRANTY; without even the implied warranty of
49 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
50 * GNU General Public License for more details.
51 *
52 * You should have received a copy of the GNU General Public License
53 * along with this program. If not, see <http://www.gnu.org/licenses/>.
54 *
55 * Authored by: Daniel van Vugt <daniel.van.vugt@canonical.com>
56 */
57
58#include "event_pipe.h"
59
60namespace mf = mir::frontend;
61
62void mf::EventPipe::set_target(std::weak_ptr<EventSink> const& s)
63{
64 target = s;
65}
66
67void mf::EventPipe::handle_event(MirEvent const& e)
68{
69 // In future, post might put e on a queue and wait for some background
70 // thread to push it through to sink. But that's not required right now.
71
72 std::shared_ptr<EventSink> p = target.lock();
73 if (p)
74 p->handle_event(e);
75}
76>>>>>>> MERGE-SOURCE
3877
=== renamed file 'include/server/mir/event_queue.h' => 'src/server/frontend/event_pipe.h'
--- include/server/mir/event_queue.h 2013-04-16 05:46:28 +0000
+++ src/server/frontend/event_pipe.h 2013-04-23 12:15:34 +0000
@@ -1,3 +1,4 @@
1<<<<<<< TREE
1/*2/*
2 * Copyright © 2013 Canonical Ltd.3 * Copyright © 2013 Canonical Ltd.
3 *4 *
@@ -38,3 +39,47 @@
38} // namespace mir39} // namespace mir
3940
40#endif41#endif
42=======
43/*
44 * Copyright © 2013 Canonical Ltd.
45 *
46 * This program is free software: you can redistribute it and/or modify
47 * it under the terms of the GNU General Public License version 3 as
48 * published by the Free Software Foundation.
49 *
50 * This program is distributed in the hope that it will be useful,
51 * but WITHOUT ANY WARRANTY; without even the implied warranty of
52 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
53 * GNU General Public License for more details.
54 *
55 * You should have received a copy of the GNU General Public License
56 * along with this program. If not, see <http://www.gnu.org/licenses/>.
57 *
58 * Authored by: Daniel van Vugt <daniel.van.vugt@canonical.com>
59 */
60
61#ifndef MIR_FRONTEND_EVENT_PIPE_H_
62#define MIR_FRONTEND_EVENT_PIPE_H_
63
64#include "mir_toolkit/event.h"
65#include "mir/events/event_sink.h"
66#include <memory>
67
68namespace mir
69{
70namespace frontend
71{
72class EventPipe : public events::EventSink
73{
74public:
75 void set_target(std::weak_ptr<events::EventSink> const& s);
76 void handle_event(MirEvent const& e) override;
77
78private:
79 std::weak_ptr<events::EventSink> target;
80};
81}
82}
83
84#endif // MIR_FRONTEND_EVENT_PIPE_H_
85>>>>>>> MERGE-SOURCE
4186
=== modified file 'src/server/frontend/protobuf_message_processor.cpp'
--- src/server/frontend/protobuf_message_processor.cpp 2013-04-18 04:15:05 +0000
+++ src/server/frontend/protobuf_message_processor.cpp 2013-04-23 12:15:34 +0000
@@ -53,14 +53,6 @@
53 resource_cache->free_resource(response);53 resource_cache->free_resource(response);
54}54}
5555
56void mfd::ProtobufMessageProcessor::send_response(::google::protobuf::uint32 id, mir::protobuf::Platform* response)
57{
58 const auto& fd = extract_fds_from(response);
59 send_response(id, static_cast<google::protobuf::Message*>(response));
60 sender->send_fds(fd);
61 resource_cache->free_resource(response);
62}
63
64void mfd::ProtobufMessageProcessor::send_response(::google::protobuf::uint32 id, mir::protobuf::Connection* response)56void mfd::ProtobufMessageProcessor::send_response(::google::protobuf::uint32 id, mir::protobuf::Connection* response)
65{57{
66 const auto& fd = response->has_platform() ?58 const auto& fd = response->has_platform() ?
6759
=== modified file 'src/server/frontend/protobuf_message_processor.h'
--- src/server/frontend/protobuf_message_processor.h 2013-04-18 04:15:05 +0000
+++ src/server/frontend/protobuf_message_processor.h 2013-04-23 12:15:34 +0000
@@ -24,7 +24,11 @@
2424
25#include "mir_protobuf.pb.h"25#include "mir_protobuf.pb.h"
26#include "mir_protobuf_wire.pb.h"26#include "mir_protobuf_wire.pb.h"
27<<<<<<< TREE
27#include "mir/event_sink.h"28#include "mir/event_sink.h"
29=======
30#include "mir/events/event_sink.h"
31>>>>>>> MERGE-SOURCE
2832
29#include <vector>33#include <vector>
30#include <memory>34#include <memory>
@@ -43,8 +47,13 @@
43namespace detail47namespace detail
44{48{
4549
50<<<<<<< TREE
46struct ProtobufMessageProcessor : MessageProcessor,51struct ProtobufMessageProcessor : MessageProcessor,
47 public EventSink52 public EventSink
53=======
54struct ProtobufMessageProcessor : MessageProcessor,
55 public events::EventSink
56>>>>>>> MERGE-SOURCE
48{57{
49 ProtobufMessageProcessor(58 ProtobufMessageProcessor(
50 MessageSender* sender,59 MessageSender* sender,
@@ -64,10 +73,6 @@
6473
65 // TODO detecting the message type to see if we send FDs seems a bit of a frig.74 // TODO detecting the message type to see if we send FDs seems a bit of a frig.
66 // OTOH until we have a real requirement it is hard to see how best to generalise.75 // OTOH until we have a real requirement it is hard to see how best to generalise.
67 void send_response(::google::protobuf::uint32 id, mir::protobuf::Platform* response);
68
69 // TODO detecting the message type to see if we send FDs seems a bit of a frig.
70 // OTOH until we have a real requirement it is hard to see how best to generalise.
71 void send_response(::google::protobuf::uint32 id, mir::protobuf::Connection* response);76 void send_response(::google::protobuf::uint32 id, mir::protobuf::Connection* response);
7277
73 // TODO detecting the message type to see if we send FDs seems a bit of a frig.78 // TODO detecting the message type to see if we send FDs seems a bit of a frig.
7479
=== modified file 'src/server/frontend/protobuf_socket_communicator.cpp'
--- src/server/frontend/protobuf_socket_communicator.cpp 2013-04-22 09:54:07 +0000
+++ src/server/frontend/protobuf_socket_communicator.cpp 2013-04-23 12:15:34 +0000
@@ -22,8 +22,12 @@
2222
23#include "mir/frontend/protobuf_ipc_factory.h"23#include "mir/frontend/protobuf_ipc_factory.h"
24#include "mir/protobuf/google_protobuf_guard.h"24#include "mir/protobuf/google_protobuf_guard.h"
25<<<<<<< TREE
25#include "mir/event_sink.h"26#include "mir/event_sink.h"
26#include "mir/event_queue.h"27#include "mir/event_queue.h"
28=======
29#include "event_pipe.h"
30>>>>>>> MERGE-SOURCE
2731
28#include <boost/signals2.hpp>32#include <boost/signals2.hpp>
2933
@@ -51,8 +55,13 @@
5155
52void mf::ProtobufSocketCommunicator::start_accept()56void mf::ProtobufSocketCommunicator::start_accept()
53{57{
58<<<<<<< TREE
54 std::shared_ptr<EventQueue> event_queue = std::make_shared<EventQueue>();59 std::shared_ptr<EventQueue> event_queue = std::make_shared<EventQueue>();
5560
61=======
62 auto const& event_pipe = std::make_shared<EventPipe>();
63
64>>>>>>> MERGE-SOURCE
56 auto const& socket_session = std::make_shared<mfd::SocketSession>(65 auto const& socket_session = std::make_shared<mfd::SocketSession>(
57 io_service,66 io_service,
58 next_id(),67 next_id(),
@@ -60,11 +69,19 @@
6069
61 auto session = std::make_shared<detail::ProtobufMessageProcessor>(70 auto session = std::make_shared<detail::ProtobufMessageProcessor>(
62 socket_session.get(),71 socket_session.get(),
72<<<<<<< TREE
63 ipc_factory->make_ipc_server(event_queue),73 ipc_factory->make_ipc_server(event_queue),
74=======
75 ipc_factory->make_ipc_server(event_pipe),
76>>>>>>> MERGE-SOURCE
64 ipc_factory->resource_cache(),77 ipc_factory->resource_cache(),
65 ipc_factory->report());78 ipc_factory->report());
6679
80<<<<<<< TREE
67 event_queue->set_target(session);81 event_queue->set_target(session);
82=======
83 event_pipe->set_target(session);
84>>>>>>> MERGE-SOURCE
68 socket_session->set_processor(session);85 socket_session->set_processor(session);
6986
70 acceptor.async_accept(87 acceptor.async_accept(
7188
=== modified file 'src/server/frontend/session_mediator.cpp'
--- src/server/frontend/session_mediator.cpp 2013-04-19 07:45:44 +0000
+++ src/server/frontend/session_mediator.cpp 2013-04-23 12:15:34 +0000
@@ -44,7 +44,11 @@
44 std::shared_ptr<graphics::ViewableArea> const& viewable_area,44 std::shared_ptr<graphics::ViewableArea> const& viewable_area,
45 std::shared_ptr<compositor::GraphicBufferAllocator> const& buffer_allocator,45 std::shared_ptr<compositor::GraphicBufferAllocator> const& buffer_allocator,
46 std::shared_ptr<SessionMediatorReport> const& report,46 std::shared_ptr<SessionMediatorReport> const& report,
47<<<<<<< TREE
47 std::shared_ptr<EventSink> const& event_sink,48 std::shared_ptr<EventSink> const& event_sink,
49=======
50 std::shared_ptr<events::EventSink> const& event_sink,
51>>>>>>> MERGE-SOURCE
48 std::shared_ptr<ResourceCache> const& resource_cache) :52 std::shared_ptr<ResourceCache> const& resource_cache) :
49 shell(shell),53 shell(shell),
50 graphics_platform(graphics_platform),54 graphics_platform(graphics_platform),
@@ -65,8 +69,12 @@
65{69{
66 report->session_connect_called(request->application_name());70 report->session_connect_called(request->application_name());
6771
72<<<<<<< TREE
68 session = shell->open_session(request->application_name());73 session = shell->open_session(request->application_name());
69 session->set_event_sink(event_sink);74 session->set_event_sink(event_sink);
75=======
76 session = shell->open_session(request->application_name(), event_sink);
77>>>>>>> MERGE-SOURCE
7078
71 auto ipc_package = graphics_platform->get_ipc_package();79 auto ipc_package = graphics_platform->get_ipc_package();
72 auto platform = response->mutable_platform();80 auto platform = response->mutable_platform();
7381
=== modified file 'src/server/graphics/gbm/linux_virtual_terminal.cpp'
--- src/server/graphics/gbm/linux_virtual_terminal.cpp 2013-04-22 03:24:56 +0000
+++ src/server/graphics/gbm/linux_virtual_terminal.cpp 2013-04-23 12:15:34 +0000
@@ -2,7 +2,7 @@
2 * Copyright © 2013 Canonical Ltd.2 * Copyright © 2013 Canonical Ltd.
3 *3 *
4 * This program is free software: you can redistribute it and/or modify it4 * This program is free software: you can redistribute it and/or modify it
5 * under the terms of the GNU Lesser General Public License version 3,5 * under the terms of the GNU General Public License version 3,
6 * as published by the Free Software Foundation.6 * as published by the Free Software Foundation.
7 *7 *
8 * This program is distributed in the hope that it will be useful,8 * This program is distributed in the hope that it will be useful,
@@ -10,7 +10,7 @@
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.11 * GNU General Public License for more details.
12 *12 *
13 * You should have received a copy of the GNU Lesser General Public License13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 *15 *
16 * Authored by: Alexandros Frantzis <alexandros.frantzis@canonical.com>16 * Authored by: Alexandros Frantzis <alexandros.frantzis@canonical.com>
1717
=== modified file 'src/server/graphics/gbm/linux_virtual_terminal.h'
--- src/server/graphics/gbm/linux_virtual_terminal.h 2013-04-22 03:24:56 +0000
+++ src/server/graphics/gbm/linux_virtual_terminal.h 2013-04-23 12:15:34 +0000
@@ -2,7 +2,7 @@
2 * Copyright © 2013 Canonical Ltd.2 * Copyright © 2013 Canonical Ltd.
3 *3 *
4 * This program is free software: you can redistribute it and/or modify it4 * This program is free software: you can redistribute it and/or modify it
5 * under the terms of the GNU Lesser General Public License version 3,5 * under the terms of the GNU General Public License version 3,
6 * as published by the Free Software Foundation.6 * as published by the Free Software Foundation.
7 *7 *
8 * This program is distributed in the hope that it will be useful,8 * This program is distributed in the hope that it will be useful,
@@ -10,7 +10,7 @@
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.11 * GNU General Public License for more details.
12 *12 *
13 * You should have received a copy of the GNU Lesser General Public License13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 *15 *
16 * Authored by: Alexandros Frantzis <alexandros.frantzis@canonical.com>16 * Authored by: Alexandros Frantzis <alexandros.frantzis@canonical.com>
1717
=== modified file 'src/server/graphics/gbm/virtual_terminal.h'
--- src/server/graphics/gbm/virtual_terminal.h 2013-04-22 03:24:56 +0000
+++ src/server/graphics/gbm/virtual_terminal.h 2013-04-23 12:15:34 +0000
@@ -2,7 +2,7 @@
2 * Copyright © 2013 Canonical Ltd.2 * Copyright © 2013 Canonical Ltd.
3 *3 *
4 * This program is free software: you can redistribute it and/or modify it4 * This program is free software: you can redistribute it and/or modify it
5 * under the terms of the GNU Lesser General Public License version 3,5 * under the terms of the GNU General Public License version 3,
6 * as published by the Free Software Foundation.6 * as published by the Free Software Foundation.
7 *7 *
8 * This program is distributed in the hope that it will be useful,8 * This program is distributed in the hope that it will be useful,
@@ -10,7 +10,7 @@
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.11 * GNU General Public License for more details.
12 *12 *
13 * You should have received a copy of the GNU Lesser General Public License13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 *15 *
16 * Authored by: Alexandros Frantzis <alexandros.frantzis@canonical.com>16 * Authored by: Alexandros Frantzis <alexandros.frantzis@canonical.com>
1717
=== modified file 'src/server/input/android/android_dispatcher_controller.cpp'
--- src/server/input/android/android_dispatcher_controller.cpp 2013-04-11 23:06:12 +0000
+++ src/server/input/android/android_dispatcher_controller.cpp 2013-04-23 12:15:34 +0000
@@ -2,15 +2,15 @@
2 * Copyright © 2013 Canonical Ltd.2 * Copyright © 2013 Canonical Ltd.
3 *3 *
4 * This program is free software: you can redistribute it and/or modify it4 * This program is free software: you can redistribute it and/or modify it
5 * under the terms of the GNU Lesser General Public License version 3,5 * under the terms of the GNU General Public License version 3,
6 * as published by the Free Software Foundation.6 * as published by the Free Software Foundation.
7 *7 *
8 * This program is distributed in the hope that it will be useful,8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU Lesser General Public License for more details.11 * GNU General Public License for more details.
12 *12 *
13 * You should have received a copy of the GNU Lesser General Public License13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 *15 *
16 * Authored by: Robert Carr <robert.carr@canonical.com>16 * Authored by: Robert Carr <robert.carr@canonical.com>
@@ -25,35 +25,85 @@
2525
26#include <InputDispatcher.h>26#include <InputDispatcher.h>
2727
28#include <boost/throw_exception.hpp>
29
30#include <stdexcept>
31#include <mutex>
32
28namespace mi = mir::input;33namespace mi = mir::input;
29namespace mia = mi::android;34namespace mia = mi::android;
3035
31mia::DispatcherController::DispatcherController(std::shared_ptr<mia::InputConfiguration> const& config) :36mia::DispatcherController::DispatcherController(std::shared_ptr<mia::InputConfiguration> const& config) :
32 input_dispatcher(config->the_dispatcher()),37 input_dispatcher(config->the_dispatcher())
33 focused_window_handle(0),38{
34 focused_application_handle(0)39}
35{40
36}41void mia::DispatcherController::input_application_opened(std::shared_ptr<mi::SessionTarget> const& session)
3742{
38void mia::DispatcherController::set_input_focus_to(std::shared_ptr<mi::SessionTarget> const& session,43 std::unique_lock<std::mutex> lock(handles_mutex);
39 std::shared_ptr<mi::SurfaceTarget> const& surface)44 if (application_handles.find(session) != application_handles.end())
40{45 BOOST_THROW_EXCEPTION(std::logic_error("An application was opened twice"));
41 if (focused_window_handle.get())46 application_handles[session] = new mia::InputApplicationHandle(session);
42 {47}
43 input_dispatcher->unregisterInputChannel(focused_window_handle->getInfo()->inputChannel);48
44 focused_window_handle.clear();49void mia::DispatcherController::input_application_closed(std::shared_ptr<mi::SessionTarget> const& session)
45 focused_application_handle.clear();50{
46 }51 std::unique_lock<std::mutex> lock(handles_mutex);
52 if (application_handles.find(session) == application_handles.end())
53 BOOST_THROW_EXCEPTION(std::logic_error("An application was closed twice"));
54 application_handles.erase(session);
55}
56
57void mia::DispatcherController::input_surface_opened(std::shared_ptr<mi::SessionTarget> const& session,
58 std::shared_ptr<input::SurfaceTarget> const& opened_surface)
59{
60 std::unique_lock<std::mutex> lock(handles_mutex);
61 auto application_handle = application_handles.find(session);
62 if (application_handle == application_handles.end())
63 BOOST_THROW_EXCEPTION(std::logic_error("A surface was opened for an unopened application"));
64 if (window_handles.find(opened_surface) != window_handles.end())
65 BOOST_THROW_EXCEPTION(std::logic_error("A surface was opened twice"));
66
67 droidinput::sp<droidinput::InputWindowHandle> window_handle = new mia::InputWindowHandle(application_handle->second, opened_surface);
68 input_dispatcher->registerInputChannel(window_handle->getInfo()->inputChannel, window_handle, false);
69
70 window_handles[opened_surface] = window_handle;
71}
72
73void mia::DispatcherController::input_surface_closed(std::shared_ptr<input::SurfaceTarget> const& closed_surface)
74{
75 std::unique_lock<std::mutex> lock(handles_mutex);
76 auto it = window_handles.find(closed_surface);
77 if (it == window_handles.end())
78 BOOST_THROW_EXCEPTION(std::logic_error("A surface was closed twice"));
79
80 input_dispatcher->unregisterInputChannel(it->second->getInfo()->inputChannel);
81 window_handles.erase(it);
82}
83
84void mia::DispatcherController::focus_cleared()
85{
86 droidinput::Vector<droidinput::sp<droidinput::InputWindowHandle>> empty_windows;
87 droidinput::sp<droidinput::InputApplicationHandle> null_application = nullptr;
88
89 input_dispatcher->setFocusedApplication(null_application);
90 input_dispatcher->setInputWindows(empty_windows);
91}
92
93void mia::DispatcherController::focus_changed(std::shared_ptr<mi::SurfaceTarget> const& surface)
94{
95 std::unique_lock<std::mutex> lock(handles_mutex);
96
97 auto window_handle = window_handles[surface];
98
99 if (!window_handle.get())
100 BOOST_THROW_EXCEPTION(std::logic_error("Focus changed to an unopened surface"));
101 auto application_handle = window_handle->inputApplicationHandle;
102
103 input_dispatcher->setFocusedApplication(application_handle);
47104
48 droidinput::Vector<droidinput::sp<droidinput::InputWindowHandle>> windows;105 droidinput::Vector<droidinput::sp<droidinput::InputWindowHandle>> windows;
49 if (surface)106 windows.push_back(window_handle);
50 {
51 focused_application_handle = new mia::InputApplicationHandle(session);
52 focused_window_handle = new mia::InputWindowHandle(focused_application_handle, surface);
53 input_dispatcher->setFocusedApplication(focused_application_handle);
54107
55 input_dispatcher->registerInputChannel(focused_window_handle->getInfo()->inputChannel, focused_window_handle, false);
56 windows.push_back(focused_window_handle);
57 }
58 input_dispatcher->setInputWindows(windows);108 input_dispatcher->setInputWindows(windows);
59}109}
60110
=== modified file 'src/server/input/android/android_dispatcher_controller.h'
--- src/server/input/android/android_dispatcher_controller.h 2013-04-11 23:06:12 +0000
+++ src/server/input/android/android_dispatcher_controller.h 2013-04-23 12:15:34 +0000
@@ -2,15 +2,15 @@
2 * Copyright © 2013 Canonical Ltd.2 * Copyright © 2013 Canonical Ltd.
3 *3 *
4 * This program is free software: you can redistribute it and/or modify it4 * This program is free software: you can redistribute it and/or modify it
5 * under the terms of the GNU Lesser General Public License version 3,5 * under the terms of the GNU General Public License version 3,
6 * as published by the Free Software Foundation.6 * as published by the Free Software Foundation.
7 *7 *
8 * This program is distributed in the hope that it will be useful,8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU Lesser General Public License for more details.11 * GNU General Public License for more details.
12 *12 *
13 * You should have received a copy of the GNU Lesser General Public License13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 *15 *
16 * Authored by: Robert Carr <robert.carr@canonical.com>16 * Authored by: Robert Carr <robert.carr@canonical.com>
@@ -19,10 +19,13 @@
19#ifndef MIR_INPUT_ANDROID_DISPATCHER_CONTROLLER_H_19#ifndef MIR_INPUT_ANDROID_DISPATCHER_CONTROLLER_H_
20#define MIR_INPUT_ANDROID_DISPATCHER_CONTROLLER_H_20#define MIR_INPUT_ANDROID_DISPATCHER_CONTROLLER_H_
2121
22#include "mir/shell/input_focus_selector.h"22#include "mir/shell/input_target_listener.h"
2323
24#include <utils/StrongPointer.h>24#include <utils/StrongPointer.h>
2525
26#include <map>
27#include <mutex>
28
26namespace android29namespace android
27{30{
28class InputDispatcherInterface;31class InputDispatcherInterface;
@@ -40,13 +43,21 @@
40{43{
41class InputConfiguration;44class InputConfiguration;
4245
43class DispatcherController : public shell::InputFocusSelector46class DispatcherController : public shell::InputTargetListener
44{47{
45public:48public:
46 explicit DispatcherController(std::shared_ptr<InputConfiguration> const& input_configuration);49 explicit DispatcherController(std::shared_ptr<InputConfiguration> const& input_configuration);
47 virtual ~DispatcherController() = default;50 virtual ~DispatcherController() noexcept(true) {}
48 51
49 void set_input_focus_to(std::shared_ptr<input::SessionTarget> const& session, std::shared_ptr<input::SurfaceTarget> const& surface);52 void input_application_opened(std::shared_ptr<input::SessionTarget> const& application);
53 void input_application_closed(std::shared_ptr<input::SessionTarget> const& application);
54
55 void input_surface_opened(std::shared_ptr<input::SessionTarget> const& application,
56 std::shared_ptr<input::SurfaceTarget> const& opened_surface);
57 void input_surface_closed(std::shared_ptr<input::SurfaceTarget> const& closed_surface);
58
59 void focus_changed(std::shared_ptr<input::SurfaceTarget> const& focus_surface);
60 void focus_cleared();
5061
51protected:62protected:
52 DispatcherController(const DispatcherController&) = delete;63 DispatcherController(const DispatcherController&) = delete;
@@ -55,8 +66,10 @@
55private:66private:
56 droidinput::sp<droidinput::InputDispatcherInterface> input_dispatcher;67 droidinput::sp<droidinput::InputDispatcherInterface> input_dispatcher;
5768
58 droidinput::sp<droidinput::InputWindowHandle> focused_window_handle;69 std::map<std::shared_ptr<input::SessionTarget>, droidinput::sp<droidinput::InputApplicationHandle>> application_handles;
59 droidinput::sp<droidinput::InputApplicationHandle> focused_application_handle;70 std::map<std::shared_ptr<input::SurfaceTarget>, droidinput::sp<droidinput::InputWindowHandle>> window_handles;
71
72 std::mutex handles_mutex;
60};73};
6174
62}75}
6376
=== modified file 'src/server/input/android/default_android_input_configuration.cpp'
--- src/server/input/android/default_android_input_configuration.cpp 2013-04-16 09:16:38 +0000
+++ src/server/input/android/default_android_input_configuration.cpp 2013-04-23 12:15:34 +0000
@@ -98,7 +98,7 @@
98 return dispatcher_policy(98 return dispatcher_policy(
99 [this]()99 [this]()
100 {100 {
101 return new mia::EventFilterDispatcherPolicy(filter_chain);101 return new mia::EventFilterDispatcherPolicy(filter_chain, is_key_repeat_enabled());
102 });102 });
103}103}
104104
@@ -149,3 +149,8 @@
149 new droidinput::InputReaderThread(the_reader()));149 new droidinput::InputReaderThread(the_reader()));
150 });150 });
151}151}
152
153bool mia::DefaultInputConfiguration::is_key_repeat_enabled()
154{
155 return true;
156}
152157
=== modified file 'src/server/input/android/default_android_input_configuration.h'
--- src/server/input/android/default_android_input_configuration.h 2013-04-16 09:16:38 +0000
+++ src/server/input/android/default_android_input_configuration.h 2013-04-23 12:15:34 +0000
@@ -69,6 +69,8 @@
6969
70 virtual droidinput::sp<droidinput::InputDispatcherPolicyInterface> the_dispatcher_policy();70 virtual droidinput::sp<droidinput::InputDispatcherPolicyInterface> the_dispatcher_policy();
71 virtual droidinput::sp<droidinput::InputReaderPolicyInterface> the_reader_policy();71 virtual droidinput::sp<droidinput::InputReaderPolicyInterface> the_reader_policy();
72
73 virtual bool is_key_repeat_enabled();
7274
73protected:75protected:
74 DefaultInputConfiguration(DefaultInputConfiguration const&) = delete;76 DefaultInputConfiguration(DefaultInputConfiguration const&) = delete;
7577
=== modified file 'src/server/input/android/event_filter_dispatcher_policy.cpp'
--- src/server/input/android/event_filter_dispatcher_policy.cpp 2013-04-17 02:49:53 +0000
+++ src/server/input/android/event_filter_dispatcher_policy.cpp 2013-04-23 12:15:34 +0000
@@ -21,8 +21,9 @@
21namespace mi = mir::input;21namespace mi = mir::input;
22namespace mia = mi::android;22namespace mia = mi::android;
2323
24mia::EventFilterDispatcherPolicy::EventFilterDispatcherPolicy(std::shared_ptr<mi::EventFilter> const& event_filter) :24mia::EventFilterDispatcherPolicy::EventFilterDispatcherPolicy(std::shared_ptr<mi::EventFilter> const& event_filter, bool key_repeat_enabled) :
25 event_filter(event_filter)25 event_filter(event_filter),
26 key_repeat_enabled(key_repeat_enabled)
26{27{
27}28}
2829
@@ -46,7 +47,7 @@
4647
47bool mia::EventFilterDispatcherPolicy::isKeyRepeatEnabled()48bool mia::EventFilterDispatcherPolicy::isKeyRepeatEnabled()
48{49{
49 return true;50 return key_repeat_enabled;
50}51}
5152
52bool mia::EventFilterDispatcherPolicy::filterInputEvent(const droidinput::InputEvent* input_event, uint32_t /*policy_flags*/)53bool mia::EventFilterDispatcherPolicy::filterInputEvent(const droidinput::InputEvent* input_event, uint32_t /*policy_flags*/)
5354
=== modified file 'src/server/input/android/event_filter_dispatcher_policy.h'
--- src/server/input/android/event_filter_dispatcher_policy.h 2013-04-16 09:16:38 +0000
+++ src/server/input/android/event_filter_dispatcher_policy.h 2013-04-23 12:15:34 +0000
@@ -40,7 +40,7 @@
40class EventFilterDispatcherPolicy : public droidinput::InputDispatcherPolicyInterface40class EventFilterDispatcherPolicy : public droidinput::InputDispatcherPolicyInterface
41{41{
42public:42public:
43 EventFilterDispatcherPolicy(std::shared_ptr<EventFilter> const& event_filter);43 EventFilterDispatcherPolicy(std::shared_ptr<EventFilter> const& event_filter, bool key_repeat_enabled);
44 virtual ~EventFilterDispatcherPolicy() {}44 virtual ~EventFilterDispatcherPolicy() {}
4545
46 void notifyConfigurationChanged(nsecs_t when);46 void notifyConfigurationChanged(nsecs_t when);
@@ -71,6 +71,7 @@
71 EventFilterDispatcherPolicy& operator=(const EventFilterDispatcherPolicy&) = delete;71 EventFilterDispatcherPolicy& operator=(const EventFilterDispatcherPolicy&) = delete;
72private:72private:
73 std::shared_ptr<EventFilter> event_filter;73 std::shared_ptr<EventFilter> event_filter;
74 bool key_repeat_enabled;
74};75};
7576
76}77}
7778
=== modified file 'src/server/shell/application_session.cpp'
--- src/server/shell/application_session.cpp 2013-04-19 08:03:57 +0000
+++ src/server/shell/application_session.cpp 2013-04-23 12:15:34 +0000
@@ -18,8 +18,8 @@
1818
19#include "mir/shell/application_session.h"19#include "mir/shell/application_session.h"
20#include "mir/shell/surface.h"20#include "mir/shell/surface.h"
21
22#include "mir/shell/surface_factory.h"21#include "mir/shell/surface_factory.h"
22#include "mir/shell/input_target_listener.h"
2323
24#include <boost/throw_exception.hpp>24#include <boost/throw_exception.hpp>
2525
@@ -28,14 +28,19 @@
28#include <cassert>28#include <cassert>
29#include <algorithm>29#include <algorithm>
3030
31namespace me = mir::events;
31namespace mf = mir::frontend;32namespace mf = mir::frontend;
32namespace msh = mir::shell;33namespace msh = mir::shell;
3334
34msh::ApplicationSession::ApplicationSession(35msh::ApplicationSession::ApplicationSession(
35 std::shared_ptr<SurfaceFactory> const& surface_factory,36 std::shared_ptr<SurfaceFactory> const& surface_factory,
36 std::string const& session_name) :37 std::shared_ptr<msh::InputTargetListener> const& input_target_listener,
38 std::string const& session_name,
39 std::shared_ptr<me::EventSink> const& sink) :
37 surface_factory(surface_factory),40 surface_factory(surface_factory),
41 input_target_listener(input_target_listener),
38 session_name(session_name),42 session_name(session_name),
43 event_sink(sink),
39 next_surface_id(0)44 next_surface_id(0)
40{45{
41 assert(surface_factory);46 assert(surface_factory);
@@ -46,6 +51,7 @@
46 std::unique_lock<std::mutex> lock(surfaces_mutex);51 std::unique_lock<std::mutex> lock(surfaces_mutex);
47 for (auto const& pair_id_surface : surfaces)52 for (auto const& pair_id_surface : surfaces)
48 {53 {
54 input_target_listener->input_surface_closed(pair_id_surface.second);
49 pair_id_surface.second->destroy();55 pair_id_surface.second->destroy();
50 }56 }
51}57}
@@ -63,8 +69,8 @@
6369
64mf::SurfaceId msh::ApplicationSession::create_surface(const mf::SurfaceCreationParameters& params)70mf::SurfaceId msh::ApplicationSession::create_surface(const mf::SurfaceCreationParameters& params)
65{71{
66 auto surf = surface_factory->create_surface(params);
67 auto const id = next_id();72 auto const id = next_id();
73 auto surf = surface_factory->create_surface(params, id, event_sink);
6874
69 surf->set_id(id);75 surf->set_id(id);
70 surf->set_event_target(event_sink);76 surf->set_event_target(event_sink);
@@ -104,6 +110,7 @@
104 std::unique_lock<std::mutex> lock(surfaces_mutex);110 std::unique_lock<std::mutex> lock(surfaces_mutex);
105 auto p = checked_find(id);111 auto p = checked_find(id);
106112
113 input_target_listener->input_surface_closed(p->second);
107 p->second->destroy();114 p->second->destroy();
108 surfaces.erase(p);115 surfaces.erase(p);
109}116}
110117
=== modified file 'src/server/shell/organising_surface_factory.cpp'
--- src/server/shell/organising_surface_factory.cpp 2013-04-16 09:16:38 +0000
+++ src/server/shell/organising_surface_factory.cpp 2013-04-23 12:15:34 +0000
@@ -34,10 +34,13 @@
34{34{
35}35}
3636
37std::shared_ptr<msh::Surface> msh::OrganisingSurfaceFactory::create_surface(const mf::SurfaceCreationParameters& params)37std::shared_ptr<msh::Surface> msh::OrganisingSurfaceFactory::create_surface(
38 frontend::SurfaceCreationParameters const& params,
39 frontend::SurfaceId id,
40 std::shared_ptr<events::EventSink> const& sink)
38{41{
39 auto placed_params = placement_strategy->place(params);42 auto placed_params = placement_strategy->place(params);
4043
41 return underlying_factory->create_surface(placed_params);44 return underlying_factory->create_surface(placed_params, id, sink);
42}45}
4346
4447
=== modified file 'src/server/shell/session_manager.cpp'
--- src/server/shell/session_manager.cpp 2013-04-22 03:24:56 +0000
+++ src/server/shell/session_manager.cpp 2013-04-23 12:15:34 +0000
@@ -23,6 +23,8 @@
23#include "mir/shell/focus_sequence.h"23#include "mir/shell/focus_sequence.h"
24#include "mir/shell/focus_setter.h"24#include "mir/shell/focus_setter.h"
25#include "mir/shell/session.h"25#include "mir/shell/session.h"
26#include "mir/shell/surface.h"
27#include "mir/shell/input_target_listener.h"
2628
27#include <memory>29#include <memory>
28#include <cassert>30#include <cassert>
@@ -31,47 +33,62 @@
31namespace mf = mir::frontend;33namespace mf = mir::frontend;
32namespace msh = mir::shell;34namespace msh = mir::shell;
3335
34msh::SessionManager::SessionManager(36msh::SessionManager::SessionManager(std::shared_ptr<msh::SurfaceFactory> const& surface_factory,
35 std::shared_ptr<msh::SurfaceFactory> const& surface_factory,
36 std::shared_ptr<msh::SessionContainer> const& container,37 std::shared_ptr<msh::SessionContainer> const& container,
37 std::shared_ptr<msh::FocusSequence> const& sequence,38 std::shared_ptr<msh::FocusSequence> const& sequence,
38 std::shared_ptr<msh::FocusSetter> const& focus_setter) :39 std::shared_ptr<msh::FocusSetter> const& focus_setter,
40 std::shared_ptr<msh::InputTargetListener> const& input_target_listener) :
39 surface_factory(surface_factory),41 surface_factory(surface_factory),
40 app_container(container),42 app_container(container),
41 focus_sequence(sequence),43 focus_sequence(sequence),
42 focus_setter(focus_setter)44 focus_setter(focus_setter),
45 input_target_listener(input_target_listener)
43{46{
44 assert(surface_factory);47 assert(surface_factory);
45 assert(sequence);48 assert(sequence);
46 assert(container);49 assert(container);
47 assert(focus_setter);50 assert(focus_setter);
51 assert(input_target_listener);
48}52}
4953
50msh::SessionManager::~SessionManager()54msh::SessionManager::~SessionManager()
51{55{
52}56}
5357
54std::shared_ptr<mf::Session> msh::SessionManager::open_session(std::string const& name)58std::shared_ptr<mf::Session> msh::SessionManager::open_session(
59 std::string const& name,
60 std::shared_ptr<events::EventSink> const& sink)
55{61{
56 auto new_session = std::make_shared<msh::ApplicationSession>(surface_factory, name);62 auto new_session = std::make_shared<msh::ApplicationSession>(surface_factory, input_target_listener, name, sink);
5763
58 app_container->insert_session(new_session);64 app_container->insert_session(new_session);
65
66 input_target_listener->input_application_opened(new_session);
5967
60 set_focus_to_locked(std::unique_lock<std::mutex>(mutex), new_session);68 set_focus_to_locked(std::unique_lock<std::mutex>(mutex), new_session);
6169
62 return new_session;70 return new_session;
63}71}
6472
65inline void msh::SessionManager::set_focus_to_locked(std::unique_lock<std::mutex> const&, std::shared_ptr<Session> const& next_focus)73inline void msh::SessionManager::set_focus_to_locked(std::unique_lock<std::mutex> const&, std::shared_ptr<Session> const& shell_session)
66{74{
67 focus_application = next_focus;75 auto old_focus = focus_application.lock();
68 focus_setter->set_focus_to(next_focus);76
77 focus_application = shell_session;
78 focus_setter->set_focus_to(shell_session);
79
80 if (shell_session && shell_session->default_surface())
81 input_target_listener->focus_changed(shell_session->default_surface());
82 else if (shell_session == old_focus || !shell_session)
83 input_target_listener->focus_cleared();
69}84}
7085
71void msh::SessionManager::close_session(std::shared_ptr<mf::Session> const& session)86void msh::SessionManager::close_session(std::shared_ptr<mf::Session> const& session)
72{87{
73 auto shell_session = std::dynamic_pointer_cast<Session>(session);88 auto shell_session = std::dynamic_pointer_cast<Session>(session);
7489
90 input_target_listener->input_application_closed(shell_session);
91
75 app_container->remove_session(shell_session);92 app_container->remove_session(shell_session);
7693
77 std::unique_lock<std::mutex> lock(mutex);94 std::unique_lock<std::mutex> lock(mutex);
@@ -133,9 +150,11 @@
133 mf::SurfaceCreationParameters const& params)150 mf::SurfaceCreationParameters const& params)
134{151{
135 auto shell_session = std::dynamic_pointer_cast<Session>(session);152 auto shell_session = std::dynamic_pointer_cast<Session>(session);
136 auto id = session->create_surface(params);153 auto id = shell_session->create_surface(params);
154
155 input_target_listener->input_surface_opened(shell_session,
156 std::dynamic_pointer_cast<msh::Surface>(shell_session->get_surface(id)));
137 set_focus_to_locked(std::unique_lock<std::mutex>(mutex), shell_session);157 set_focus_to_locked(std::unique_lock<std::mutex>(mutex), shell_session);
138158
139 return id;159 return id;
140}160}
141
142161
=== modified file 'src/server/shell/single_visibility_focus_mechanism.cpp'
--- src/server/shell/single_visibility_focus_mechanism.cpp 2013-04-19 03:20:05 +0000
+++ src/server/shell/single_visibility_focus_mechanism.cpp 2013-04-23 12:15:34 +0000
@@ -19,7 +19,6 @@
19#include "mir/shell/session_container.h"19#include "mir/shell/session_container.h"
20#include "mir/frontend/session.h"20#include "mir/frontend/session.h"
21#include "mir/shell/single_visibility_focus_mechanism.h"21#include "mir/shell/single_visibility_focus_mechanism.h"
22#include "mir/shell/input_focus_selector.h"
2322
24#include "mir/shell/session.h"23#include "mir/shell/session.h"
25#include "mir/shell/surface.h"24#include "mir/shell/surface.h"
@@ -27,10 +26,8 @@
27namespace mf = mir::frontend;26namespace mf = mir::frontend;
28namespace msh = mir::shell;27namespace msh = mir::shell;
2928
30msh::SingleVisibilityFocusMechanism::SingleVisibilityFocusMechanism(std::shared_ptr<msh::SessionContainer> const& app_container,29msh::SingleVisibilityFocusMechanism::SingleVisibilityFocusMechanism(std::shared_ptr<msh::SessionContainer> const& app_container)
31 std::shared_ptr<msh::InputFocusSelector> const& input_selector)30 : app_container(app_container)
32 : app_container(app_container),
33 input_selector(input_selector)
34{31{
35}32}
3633
@@ -41,8 +38,6 @@
41 if (session == focus_session)38 if (session == focus_session)
42 {39 {
43 session->show();40 session->show();
44
45 input_selector->set_input_focus_to(focus_session, focus_session->default_surface());
46 }41 }
47 else42 else
48 {43 {
4944
=== modified file 'src/server/shell/surface.cpp'
--- src/server/shell/surface.cpp 2013-04-19 03:20:05 +0000
+++ src/server/shell/surface.cpp 2013-04-23 12:15:34 +0000
@@ -19,8 +19,13 @@
19#include "mir/shell/surface.h"19#include "mir/shell/surface.h"
20#include "mir/shell/surface_builder.h"20#include "mir/shell/surface_builder.h"
21#include "mir/input/input_channel.h"21#include "mir/input/input_channel.h"
22<<<<<<< TREE
22#include "mir_toolkit/event.h"23#include "mir_toolkit/event.h"
23#include "mir/event_sink.h"24#include "mir/event_sink.h"
25=======
26#include "mir_toolkit/event.h"
27#include "mir/events/event_sink.h"
28>>>>>>> MERGE-SOURCE
2429
25#include <boost/throw_exception.hpp>30#include <boost/throw_exception.hpp>
2631
@@ -34,13 +39,22 @@
34msh::Surface::Surface(39msh::Surface::Surface(
35 std::shared_ptr<SurfaceBuilder> const& builder,40 std::shared_ptr<SurfaceBuilder> const& builder,
36 frontend::SurfaceCreationParameters const& params,41 frontend::SurfaceCreationParameters const& params,
37 std::shared_ptr<input::InputChannel> const& input_channel)42 std::shared_ptr<input::InputChannel> const& input_channel,
43 frontend::SurfaceId id,
44 std::shared_ptr<events::EventSink> const& sink)
38 : builder(builder),45 : builder(builder),
39 input_channel(input_channel),46 input_channel(input_channel),
40 surface(builder->create_surface(params)),47 surface(builder->create_surface(params)),
48<<<<<<< TREE
41 id(0),49 id(0),
42 type_value(mir_surface_type_normal),50 type_value(mir_surface_type_normal),
43 state_value(mir_surface_state_restored)51 state_value(mir_surface_state_restored)
52=======
53 id(id),
54 event_sink(sink),
55 type_value(mir_surface_type_normal),
56 state_value(mir_surface_state_restored)
57>>>>>>> MERGE-SOURCE
44{58{
45}59}
4660
4761
=== modified file 'src/server/shell/surface_source.cpp'
--- src/server/shell/surface_source.cpp 2013-04-16 09:16:38 +0000
+++ src/server/shell/surface_source.cpp 2013-04-23 12:15:34 +0000
@@ -39,11 +39,16 @@
39 assert(surface_builder);39 assert(surface_builder);
40}40}
4141
42std::shared_ptr<msh::Surface> msh::SurfaceSource::create_surface(const mf::SurfaceCreationParameters& params)42std::shared_ptr<msh::Surface> msh::SurfaceSource::create_surface(
43 frontend::SurfaceCreationParameters const& params,
44 frontend::SurfaceId id,
45 std::shared_ptr<events::EventSink> const& sink)
43{46{
44 return std::make_shared<Surface>(47 return std::make_shared<Surface>(
45 surface_builder,48 surface_builder,
46 params,49 params,
47 input_factory->make_input_channel());50 input_factory->make_input_channel(),
51 id,
52 sink);
48}53}
4954
5055
=== modified file 'tests/acceptance-tests/test_client_input.cpp'
--- tests/acceptance-tests/test_client_input.cpp 2013-04-18 04:23:56 +0000
+++ tests/acceptance-tests/test_client_input.cpp 2013-04-23 12:15:34 +0000
@@ -65,10 +65,9 @@
6565
66 }66 }
67 67
68 void set_input_focus_to(68 void focus_changed(std::shared_ptr<mi::SurfaceTarget> const& surface) override
69 std::shared_ptr<mi::SessionTarget> const& session, std::shared_ptr<mi::SurfaceTarget> const& surface) override
70 {69 {
71 DispatcherController::set_input_focus_to(session, surface);70 DispatcherController::focus_changed(surface);
72 71
73 // We need a synchronization primitive inorder to halt test event injection72 // We need a synchronization primitive inorder to halt test event injection
74 // until after a surface has taken focus (lest the events be discarded).73 // until after a surface has taken focus (lest the events be discarded).
@@ -122,10 +121,10 @@
122 });121 });
123 }122 }
124123
125 std::shared_ptr<msh::InputFocusSelector>124 std::shared_ptr<msh::InputTargetListener>
126 the_input_focus_selector() override125 the_input_target_listener() override
127 {126 {
128 return input_focus_selector(127 return input_target_listener(
129 [this]()128 [this]()
130 {129 {
131 return std::make_shared<FocusNotifyingDispatcherController>(mt::fake_shared(input_config), on_focus_set);130 return std::make_shared<FocusNotifyingDispatcherController>(mt::fake_shared(input_config), on_focus_set);
132131
=== modified file 'tests/acceptance-tests/test_focus_management_api.cpp'
--- tests/acceptance-tests/test_focus_management_api.cpp 2013-04-22 03:24:56 +0000
+++ tests/acceptance-tests/test_focus_management_api.cpp 2013-04-23 12:15:34 +0000
@@ -126,7 +126,7 @@
126 {126 {
127 using namespace ::testing;127 using namespace ::testing;
128 using frontend::Shell;128 using frontend::Shell;
129 ON_CALL(*this, open_session(_)).WillByDefault(Invoke(impl.get(), &Shell::open_session));129 ON_CALL(*this, open_session(_, _)).WillByDefault(Invoke(impl.get(), &Shell::open_session));
130 ON_CALL(*this, close_session(_)).WillByDefault(Invoke(impl.get(), &Shell::close_session));130 ON_CALL(*this, close_session(_)).WillByDefault(Invoke(impl.get(), &Shell::close_session));
131131
132 ON_CALL(*this, tag_session_with_lightdm_id(_, _)).WillByDefault(Invoke(impl.get(), &Shell::tag_session_with_lightdm_id));132 ON_CALL(*this, tag_session_with_lightdm_id(_, _)).WillByDefault(Invoke(impl.get(), &Shell::tag_session_with_lightdm_id));
@@ -135,7 +135,7 @@
135 ON_CALL(*this, create_surface_for(_, _)).WillByDefault(Invoke(impl.get(), &Shell::create_surface_for));135 ON_CALL(*this, create_surface_for(_, _)).WillByDefault(Invoke(impl.get(), &Shell::create_surface_for));
136 }136 }
137137
138 MOCK_METHOD1(open_session, std::shared_ptr<mf::Session> (std::string const& name));138 MOCK_METHOD2(open_session, std::shared_ptr<mf::Session> (std::string const& name, std::shared_ptr<mir::events::EventSink> const&));
139 MOCK_METHOD1(close_session, void (std::shared_ptr<mf::Session> const& session));139 MOCK_METHOD1(close_session, void (std::shared_ptr<mf::Session> const& session));
140140
141 MOCK_METHOD2(tag_session_with_lightdm_id, void (std::shared_ptr<mf::Session> const& session, int id));141 MOCK_METHOD2(tag_session_with_lightdm_id, void (std::shared_ptr<mf::Session> const& session, int id));
@@ -165,13 +165,13 @@
165165
166 Sequence s1, s2;166 Sequence s1, s2;
167167
168 EXPECT_CALL(*mock_shell, open_session(_))168 EXPECT_CALL(*mock_shell, open_session(_, _))
169 .InSequence(s1, s2);169 .InSequence(s1, s2);
170170
171 EXPECT_CALL(*mock_shell, create_surface_for(_,_))171 EXPECT_CALL(*mock_shell, create_surface_for(_,_))
172 .InSequence(s1);172 .InSequence(s1);
173173
174 EXPECT_CALL(*mock_shell, open_session(_))174 EXPECT_CALL(*mock_shell, open_session(_, _))
175 .InSequence(s2);175 .InSequence(s2);
176176
177 EXPECT_CALL(*mock_shell, close_session(_))177 EXPECT_CALL(*mock_shell, close_session(_))
178178
=== modified file 'tests/acceptance-tests/test_focus_selection.cpp'
--- tests/acceptance-tests/test_focus_selection.cpp 2013-04-18 04:23:56 +0000
+++ tests/acceptance-tests/test_focus_selection.cpp 2013-04-23 12:15:34 +0000
@@ -24,11 +24,11 @@
24#include "mir/shell/organising_surface_factory.h"24#include "mir/shell/organising_surface_factory.h"
25#include "mir/shell/session_manager.h"25#include "mir/shell/session_manager.h"
26#include "mir/graphics/display.h"26#include "mir/graphics/display.h"
27#include "mir/shell/input_focus_selector.h"27#include "mir/shell/input_target_listener.h"
2828
29#include "mir_test_framework/display_server_test_fixture.h"29#include "mir_test_framework/display_server_test_fixture.h"
30#include "mir_test_doubles/mock_focus_setter.h"30#include "mir_test_doubles/mock_focus_setter.h"
31#include "mir_test_doubles/mock_input_focus_selector.h"31#include "mir_test_doubles/mock_input_target_listener.h"
3232
33#include <gtest/gtest.h>33#include <gtest/gtest.h>
34#include <gmock/gmock.h>34#include <gmock/gmock.h>
@@ -36,7 +36,8 @@
36namespace mf = mir::frontend;36namespace mf = mir::frontend;
37namespace msh = mir::shell;37namespace msh = mir::shell;
38namespace mi = mir::input;38namespace mi = mir::input;
39namespace mtd = mir::test::doubles;39namespace mt = mir::test;
40namespace mtd = mt::doubles;
40namespace mtf = mir_test_framework;41namespace mtf = mir_test_framework;
4142
42namespace43namespace
@@ -46,6 +47,7 @@
4647
47namespace48namespace
48{49{
50
49struct ClientConfigCommon : TestingClientConfiguration51struct ClientConfigCommon : TestingClientConfiguration
50{52{
51 ClientConfigCommon() :53 ClientConfigCommon() :
@@ -121,18 +123,10 @@
121{123{
122 return arg != std::shared_ptr<msh::Session>();124 return arg != std::shared_ptr<msh::Session>();
123}125}
124MATCHER(NonNullSessionTarget, "")
125{
126 return arg != std::shared_ptr<mi::SessionTarget>();
127}
128MATCHER(NonNullSurfaceTarget, "")126MATCHER(NonNullSurfaceTarget, "")
129{127{
130 return arg != std::shared_ptr<mi::SurfaceTarget>();128 return arg != std::shared_ptr<mi::SurfaceTarget>();
131}129}
132MATCHER(NullSurfaceTarget, "")
133{
134 return arg == std::shared_ptr<mi::SurfaceTarget>();
135}
136}130}
137131
138TEST_F(BespokeDisplayServerTestFixture, sessions_creating_surface_receive_focus)132TEST_F(BespokeDisplayServerTestFixture, sessions_creating_surface_receive_focus)
@@ -148,7 +142,6 @@
148 using namespace ::testing;142 using namespace ::testing;
149143
150 auto focus_setter = std::make_shared<mtd::MockFocusSetter>();144 auto focus_setter = std::make_shared<mtd::MockFocusSetter>();
151
152 {145 {
153 InSequence seq;146 InSequence seq;
154 // Once on application registration and once on surface creation147 // Once on application registration and once on surface creation
@@ -174,30 +167,37 @@
174{167{
175 struct ServerConfig : TestingServerConfiguration168 struct ServerConfig : TestingServerConfiguration
176 {169 {
177 std::shared_ptr<mtd::MockInputFocusSelector> focus_selector;170 std::shared_ptr<mtd::MockInputTargetListener> target_listener;
178 bool expected;171 bool expected;
179172
180 ServerConfig()173 ServerConfig()
181 : focus_selector(std::make_shared<mtd::MockInputFocusSelector>()),174 : target_listener(std::make_shared<mtd::MockInputTargetListener>()),
182 expected(false)175 expected(false)
183 {176 {
184 }177 }
185178
186 std::shared_ptr<msh::InputFocusSelector>179 std::shared_ptr<msh::InputTargetListener>
187 the_input_focus_selector() override180 the_input_target_listener() override
188 {181 {
189 using namespace ::testing;182 using namespace ::testing;
190183
191 if (!expected)184 if (!expected)
192 {185 {
193 InSequence seq;186
187 EXPECT_CALL(*target_listener, input_application_opened(_)).Times(AtLeast(0));
188 EXPECT_CALL(*target_listener, input_application_closed(_)).Times(AtLeast(0));
189 EXPECT_CALL(*target_listener, input_surface_opened(_,_)).Times(AtLeast(0));
190 EXPECT_CALL(*target_listener, input_surface_closed(_)).Times(AtLeast(0));
191 EXPECT_CALL(*target_listener, focus_cleared()).Times(AtLeast(0));
194192
195 EXPECT_CALL(*focus_selector, set_input_focus_to(NonNullSessionTarget(), NullSurfaceTarget())).Times(1);193 {
196 EXPECT_CALL(*focus_selector, set_input_focus_to(NonNullSessionTarget(), NonNullSurfaceTarget())).Times(1);194 InSequence seq;
197 expected = true;195 EXPECT_CALL(*target_listener, focus_changed(NonNullSurfaceTarget())).Times(1);
196 expected = true;
197 }
198 }198 }
199199
200 return focus_selector;200 return target_listener;
201 }201 }
202 } server_config;202 } server_config;
203203
204204
=== modified file 'tests/behavior-tests/session_management_context.cpp'
--- tests/behavior-tests/session_management_context.cpp 2013-04-22 03:24:56 +0000
+++ tests/behavior-tests/session_management_context.cpp 2013-04-23 12:15:34 +0000
@@ -66,12 +66,16 @@
66 {66 {
67 }67 }
6868
69 std::shared_ptr<msh::Surface> create_surface(const mf::SurfaceCreationParameters& params)69 std::shared_ptr<msh::Surface> create_surface(const mf::SurfaceCreationParameters& params,
70 frontend::SurfaceId id,
71 std::shared_ptr<events::EventSink> const& sink) override
70 {72 {
71 return std::make_shared<msh::Surface>(73 return std::make_shared<msh::Surface>(
72 mt::fake_shared(surface_builder),74 mt::fake_shared(surface_builder),
73 params,75 params,
74 std::shared_ptr<mir::input::InputChannel>());76 std::shared_ptr<mir::input::InputChannel>(),
77 id,
78 sink);
75 }79 }
7680
77 mtd::StubSurfaceBuilder surface_builder;81 mtd::StubSurfaceBuilder surface_builder;
@@ -152,7 +156,7 @@
152bool mtc::SessionManagementContext::open_window_consuming(std::string const& window_name)156bool mtc::SessionManagementContext::open_window_consuming(std::string const& window_name)
153{157{
154 auto const params = mf::a_surface().of_name(window_name);158 auto const params = mf::a_surface().of_name(window_name);
155 auto session = shell->open_session(window_name);159 auto session = shell->open_session(window_name, std::shared_ptr<mir::events::EventSink>());
156 auto const surface_id = session->create_surface(params);160 auto const surface_id = session->create_surface(params);
157161
158 open_windows[window_name] = std::make_tuple(session, surface_id);162 open_windows[window_name] = std::make_tuple(session, surface_id);
@@ -164,7 +168,7 @@
164 geom::Size const& size)168 geom::Size const& size)
165{169{
166 auto const params = mf::a_surface().of_name(window_name).of_size(size);170 auto const params = mf::a_surface().of_name(window_name).of_size(size);
167 auto session = shell->open_session(window_name);171 auto session = shell->open_session(window_name, std::shared_ptr<mir::events::EventSink>());
168 auto const surface_id = session->create_surface(params);172 auto const surface_id = session->create_surface(params);
169173
170 open_windows[window_name] = std::make_tuple(session, surface_id);174 open_windows[window_name] = std::make_tuple(session, surface_id);
171175
=== modified file 'tests/death-tests/test_application_manager_death.cpp'
--- tests/death-tests/test_application_manager_death.cpp 2013-03-21 03:32:59 +0000
+++ tests/death-tests/test_application_manager_death.cpp 2013-04-23 12:15:34 +0000
@@ -30,11 +30,12 @@
30// ::testing::FLAGS_gtest_death_test_style = "threadsafe";30// ::testing::FLAGS_gtest_death_test_style = "threadsafe";
31// leads to the test failing under valgrind31// leads to the test failing under valgrind
32 EXPECT_EXIT(32 EXPECT_EXIT(
33 std::shared_ptr<msh::SurfaceFactory> factory;33 std::shared_ptr<msh::SurfaceFactory> surface_factory;
34 mir::shell::SessionManager app(factory,34 mir::shell::SessionManager app(surface_factory,
35 std::shared_ptr<msh::SessionContainer>(),35 std::shared_ptr<msh::SessionContainer>(),
36 std::shared_ptr<msh::FocusSequence>(),36 std::shared_ptr<msh::FocusSequence>(),
37 std::shared_ptr<msh::FocusSetter>()),37 std::shared_ptr<msh::FocusSetter>(),
38 std::shared_ptr<msh::InputTargetListener>()),
38 ::testing::KilledBySignal(SIGABRT),39 ::testing::KilledBySignal(SIGABRT),
39 ".*");40 ".*");
40}41}
4142
=== modified file 'tests/integration-tests/cucumber/test_session_management_context.cpp'
--- tests/integration-tests/cucumber/test_session_management_context.cpp 2013-04-22 03:24:56 +0000
+++ tests/integration-tests/cucumber/test_session_management_context.cpp 2013-04-23 12:15:34 +0000
@@ -106,7 +106,7 @@
106106
107 mtd::MockSession session;107 mtd::MockSession session;
108108
109 EXPECT_CALL(shell, open_session(test_window_name)).Times(1)109 EXPECT_CALL(shell, open_session(test_window_name, _)).Times(1)
110 .WillOnce(Return(mt::fake_shared<mf::Session>(session)));110 .WillOnce(Return(mt::fake_shared<mf::Session>(session)));
111111
112 // As consuming mode is the default, omiting geometry is sufficient to request it.112 // As consuming mode is the default, omiting geometry is sufficient to request it.
@@ -122,7 +122,7 @@
122122
123 mtd::MockSession session;123 mtd::MockSession session;
124124
125 EXPECT_CALL(shell, open_session(test_window_name)).Times(1)125 EXPECT_CALL(shell, open_session(test_window_name, _)).Times(1)
126 .WillOnce(Return(mt::fake_shared<mf::Session>(session)));126 .WillOnce(Return(mt::fake_shared<mf::Session>(session)));
127127
128 EXPECT_CALL(session, create_surface(NamedWindowWithGeometry(test_window_name, test_window_size))).Times(1)128 EXPECT_CALL(session, create_surface(NamedWindowWithGeometry(test_window_name, test_window_size))).Times(1)
@@ -138,7 +138,7 @@
138 mtd::MockSession session;138 mtd::MockSession session;
139 mtd::MockSurface surface(std::make_shared<mtd::StubSurfaceBuilder>());139 mtd::MockSurface surface(std::make_shared<mtd::StubSurfaceBuilder>());
140140
141 EXPECT_CALL(shell, open_session(test_window_name)).Times(1)141 EXPECT_CALL(shell, open_session(test_window_name, _)).Times(1)
142 .WillOnce(Return(mt::fake_shared<mf::Session>(session)));142 .WillOnce(Return(mt::fake_shared<mf::Session>(session)));
143143
144 EXPECT_CALL(session, create_surface(NamedWindowWithGeometry(test_window_name, test_window_size))).Times(1)144 EXPECT_CALL(session, create_surface(NamedWindowWithGeometry(test_window_name, test_window_size))).Times(1)
145145
=== modified file 'tests/integration-tests/input/android/test_android_input_manager.cpp'
--- tests/integration-tests/input/android/test_android_input_manager.cpp 2013-04-16 04:56:53 +0000
+++ tests/integration-tests/input/android/test_android_input_manager.cpp 2013-04-23 12:15:34 +0000
@@ -171,7 +171,7 @@
171struct MockDispatcherPolicy : public mia::EventFilterDispatcherPolicy171struct MockDispatcherPolicy : public mia::EventFilterDispatcherPolicy
172{172{
173 MockDispatcherPolicy(std::shared_ptr<mi::EventFilter> const& filter)173 MockDispatcherPolicy(std::shared_ptr<mi::EventFilter> const& filter)
174 : EventFilterDispatcherPolicy(filter)174 : EventFilterDispatcherPolicy(filter, false)
175 {175 {
176 }176 }
177 MOCK_METHOD3(interceptKeyBeforeDispatching, nsecs_t(droidinput::sp<droidinput::InputWindowHandle> const&,177 MOCK_METHOD3(interceptKeyBeforeDispatching, nsecs_t(droidinput::sp<droidinput::InputWindowHandle> const&,
@@ -211,24 +211,31 @@
211 ON_CALL(viewable_area, view_area())211 ON_CALL(viewable_area, view_area())
212 .WillByDefault(Return(default_view_area));212 .WillByDefault(Return(default_view_area));
213 input_manager = std::make_shared<mia::InputManager>(configuration);213 input_manager = std::make_shared<mia::InputManager>(configuration);
214 input_focus_selector = std::make_shared<mia::DispatcherController>(configuration);214 input_target_listener = std::make_shared<mia::DispatcherController>(configuration);
215215
216 dispatcher_policy = configuration->the_mock_dispatcher_policy();216 dispatcher_policy = configuration->the_mock_dispatcher_policy();
217217
218 }218 }
219219
220 ~AndroidInputManagerDispatcherInterceptSetup()
221 {
222 input_manager->stop();
223 }
224
220 // TODO: It would be nice if it were possible to mock the interface between225 // TODO: It would be nice if it were possible to mock the interface between
221 // droidinput::InputChannel and droidinput::InputDispatcher rather than use226 // droidinput::InputChannel and droidinput::InputDispatcher rather than use
222 // valid fds to allow non-throwing construction of a real input channel.227 // valid fds to allow non-throwing construction of a real input channel.
223 void SetUp()228 void SetUp()
224 {229 {
225 test_input_fd = socket(AF_UNIX, SOCK_SEQPACKET, 0);
226 input_manager->start();230 input_manager->start();
227 }231 }
228 void TearDown()232
233 int test_fd()
229 {234 {
230 input_manager->stop();235 int fds[2];
231 close(test_input_fd);236 // Closed by droidinput InputChannel on shutdown
237 socketpair(AF_UNIX, SOCK_SEQPACKET, 0, fds);
238 return fds[0];
232 }239 }
233240
234 MockEventFilter event_filter;241 MockEventFilter event_filter;
@@ -238,9 +245,7 @@
238 droidinput::sp<MockDispatcherPolicy> dispatcher_policy;245 droidinput::sp<MockDispatcherPolicy> dispatcher_policy;
239246
240 std::shared_ptr<mia::InputManager> input_manager;247 std::shared_ptr<mia::InputManager> input_manager;
241 std::shared_ptr<msh::InputFocusSelector> input_focus_selector;248 std::shared_ptr<msh::InputTargetListener> input_target_listener;
242
243 int test_input_fd;
244};249};
245250
246MATCHER_P(WindowHandleWithInputFd, input_fd, "")251MATCHER_P(WindowHandleWithInputFd, input_fd, "")
@@ -259,14 +264,18 @@
259 mt::WaitCondition wait_condition;264 mt::WaitCondition wait_condition;
260265
261 mtd::StubSessionTarget session;266 mtd::StubSessionTarget session;
262 mtd::StubSurfaceTarget surface(test_input_fd);267
268 auto input_fd = test_fd();
269 mtd::StubSurfaceTarget surface(input_fd);
263270
264 EXPECT_CALL(event_filter, handles(_)).Times(1).WillOnce(Return(false));271 EXPECT_CALL(event_filter, handles(_)).Times(1).WillOnce(Return(false));
265 // We return -1 here to skip publishing of the event (to an unconnected test socket!).272 // We return -1 here to skip publishing of the event (to an unconnected test socket!).
266 EXPECT_CALL(*dispatcher_policy, interceptKeyBeforeDispatching(WindowHandleWithInputFd(test_input_fd), _, _))273 EXPECT_CALL(*dispatcher_policy, interceptKeyBeforeDispatching(WindowHandleWithInputFd(input_fd), _, _))
267 .Times(1).WillOnce(DoAll(mt::WakeUp(&wait_condition), Return(-1)));274 .Times(1).WillOnce(DoAll(mt::WakeUp(&wait_condition), Return(-1)));
268275
269 input_focus_selector->set_input_focus_to(mt::fake_shared(session), mt::fake_shared(surface));276 input_target_listener->input_application_opened(mt::fake_shared(session));
277 input_target_listener->input_surface_opened(mt::fake_shared(session), mt::fake_shared(surface));
278 input_target_listener->focus_changed(mt::fake_shared(surface));
270279
271 fake_event_hub->synthesize_builtin_keyboard_added();280 fake_event_hub->synthesize_builtin_keyboard_added();
272 fake_event_hub->synthesize_device_scan_complete();281 fake_event_hub->synthesize_device_scan_complete();
@@ -275,3 +284,52 @@
275284
276 wait_condition.wait_for_at_most_seconds(1);285 wait_condition.wait_for_at_most_seconds(1);
277}286}
287
288TEST_F(AndroidInputManagerDispatcherInterceptSetup, changing_focus_changes_event_recipient)
289{
290 using namespace ::testing;
291
292 mt::WaitCondition wait1, wait2, wait3;
293
294 mtd::StubSessionTarget session;
295
296 auto input_fd_1 = test_fd();
297 mtd::StubSurfaceTarget surface1(input_fd_1);
298 auto input_fd_2 = test_fd();
299 mtd::StubSurfaceTarget surface2(input_fd_2);
300
301 input_target_listener->input_application_opened(mt::fake_shared(session));
302 input_target_listener->input_surface_opened(mt::fake_shared(session), mt::fake_shared(surface1));
303 input_target_listener->input_surface_opened(mt::fake_shared(session), mt::fake_shared(surface2));
304
305 EXPECT_CALL(event_filter, handles(_)).Times(3).WillRepeatedly(Return(false));
306
307 {
308 InSequence seq;
309
310 EXPECT_CALL(*dispatcher_policy, interceptKeyBeforeDispatching(WindowHandleWithInputFd(input_fd_1), _, _))
311 .Times(1).WillOnce(DoAll(mt::WakeUp(&wait1), Return(-1)));
312 EXPECT_CALL(*dispatcher_policy, interceptKeyBeforeDispatching(WindowHandleWithInputFd(input_fd_2), _, _))
313 .Times(1).WillOnce(DoAll(mt::WakeUp(&wait2), Return(-1)));
314 EXPECT_CALL(*dispatcher_policy, interceptKeyBeforeDispatching(WindowHandleWithInputFd(input_fd_1), _, _))
315 .Times(1).WillOnce(DoAll(mt::WakeUp(&wait3), Return(-1)));
316 }
317
318 fake_event_hub->synthesize_builtin_keyboard_added();
319 fake_event_hub->synthesize_device_scan_complete();
320
321 input_target_listener->focus_changed(mt::fake_shared(surface1));
322 fake_event_hub->synthesize_event(mis::a_key_down_event()
323 .of_scancode(KEY_1));
324 wait1.wait_for_at_most_seconds(1);
325
326 input_target_listener->focus_changed(mt::fake_shared(surface2));
327 fake_event_hub->synthesize_event(mis::a_key_down_event()
328 .of_scancode(KEY_2));
329 wait2.wait_for_at_most_seconds(1);
330
331 input_target_listener->focus_changed(mt::fake_shared(surface1));
332 fake_event_hub->synthesize_event(mis::a_key_down_event()
333 .of_scancode(KEY_3));
334 wait3.wait_for_at_most_seconds(5);
335}
278336
=== modified file 'tests/integration-tests/input/android/test_fake_event_hub_to_event_filter.cpp'
--- tests/integration-tests/input/android/test_fake_event_hub_to_event_filter.cpp 2013-04-05 07:12:27 +0000
+++ tests/integration-tests/input/android/test_fake_event_hub_to_event_filter.cpp 2013-04-23 12:15:34 +0000
@@ -56,7 +56,7 @@
56 void SetUp()56 void SetUp()
57 {57 {
58 event_hub = new mia::FakeEventHub();58 event_hub = new mia::FakeEventHub();
59 dispatcher_policy = new mia::EventFilterDispatcherPolicy(mt::fake_shared(event_filter));59 dispatcher_policy = new mia::EventFilterDispatcherPolicy(mt::fake_shared(event_filter), false);
60 reader_policy = new mia::RudimentaryInputReaderPolicy();60 reader_policy = new mia::RudimentaryInputReaderPolicy();
61 dispatcher = new droidinput::InputDispatcher(dispatcher_policy);61 dispatcher = new droidinput::InputDispatcher(dispatcher_policy);
62 reader = new droidinput::InputReader(event_hub, reader_policy, dispatcher);62 reader = new droidinput::InputReader(event_hub, reader_policy, dispatcher);
6363
=== modified file 'tests/integration-tests/shell/test_session_manager.cpp'
--- tests/integration-tests/shell/test_session_manager.cpp 2013-04-19 03:20:05 +0000
+++ tests/integration-tests/shell/test_session_manager.cpp 2013-04-23 12:15:34 +0000
@@ -33,8 +33,10 @@
33#include "mir_test/fake_shared.h"33#include "mir_test/fake_shared.h"
34#include "mir_test_doubles/mock_surface_factory.h"34#include "mir_test_doubles/mock_surface_factory.h"
35#include "mir_test_doubles/mock_focus_setter.h"35#include "mir_test_doubles/mock_focus_setter.h"
36#include "mir_test_doubles/stub_input_target_listener.h"
3637
37namespace mc = mir::compositor;38namespace mc = mir::compositor;
39namespace me = mir::events;
38namespace mf = mir::frontend;40namespace mf = mir::frontend;
39namespace msh = mir::shell;41namespace msh = mir::shell;
40namespace ms = mir::surfaces;42namespace ms = mir::surfaces;
@@ -44,29 +46,32 @@
44TEST(TestSessionManagerAndFocusSelectionStrategy, cycle_focus)46TEST(TestSessionManagerAndFocusSelectionStrategy, cycle_focus)
45{47{
46 using namespace ::testing;48 using namespace ::testing;
49
47 mtd::MockSurfaceFactory surface_factory;50 mtd::MockSurfaceFactory surface_factory;
48 std::shared_ptr<msh::DefaultSessionContainer> container(new msh::DefaultSessionContainer());51 std::shared_ptr<msh::DefaultSessionContainer> container(new msh::DefaultSessionContainer());
49 msh::RegistrationOrderFocusSequence sequence(container);52 msh::RegistrationOrderFocusSequence sequence(container);
50 mtd::MockFocusSetter focus_changer;53 mtd::MockFocusSetter focus_setter;
51 std::shared_ptr<mf::Session> new_session;54 std::shared_ptr<mf::Session> new_session;
55 mtd::StubInputTargetListener input_target_listener;
5256
53 msh::SessionManager session_manager(57 msh::SessionManager session_manager(
54 mt::fake_shared(surface_factory),58 mt::fake_shared(surface_factory),
55 container,59 container,
56 mt::fake_shared(sequence),60 mt::fake_shared(sequence),
57 mt::fake_shared(focus_changer));61 mt::fake_shared(focus_setter),
5862 mt::fake_shared(input_target_listener));
59 EXPECT_CALL(focus_changer, set_focus_to(_)).Times(3);63
6064 EXPECT_CALL(focus_setter, set_focus_to(_)).Times(3);
61 auto session1 = session_manager.open_session("Visual Basic Studio");65
62 auto session2 = session_manager.open_session("Microsoft Access");66 auto session1 = session_manager.open_session("Visual Basic Studio", std::shared_ptr<me::EventSink>());
63 auto session3 = session_manager.open_session("WordPerfect");67 auto session2 = session_manager.open_session("Microsoft Access", std::shared_ptr<me::EventSink>());
68 auto session3 = session_manager.open_session("WordPerfect", std::shared_ptr<me::EventSink>());
6469
65 {70 {
66 InSequence seq;71 InSequence seq;
67 EXPECT_CALL(focus_changer, set_focus_to(Eq(session1))).Times(1);72 EXPECT_CALL(focus_setter, set_focus_to(Eq(session1))).Times(1);
68 EXPECT_CALL(focus_changer, set_focus_to(Eq(session2))).Times(1);73 EXPECT_CALL(focus_setter, set_focus_to(Eq(session2))).Times(1);
69 EXPECT_CALL(focus_changer, set_focus_to(Eq(session3))).Times(1);74 EXPECT_CALL(focus_setter, set_focus_to(Eq(session3))).Times(1);
70 }75 }
7176
72 session_manager.focus_next();77 session_manager.focus_next();
@@ -77,28 +82,31 @@
77TEST(TestSessionManagerAndFocusSelectionStrategy, closing_applications_transfers_focus)82TEST(TestSessionManagerAndFocusSelectionStrategy, closing_applications_transfers_focus)
78{83{
79 using namespace ::testing;84 using namespace ::testing;
85
80 mtd::MockSurfaceFactory surface_factory;86 mtd::MockSurfaceFactory surface_factory;
81 std::shared_ptr<msh::DefaultSessionContainer> model(new msh::DefaultSessionContainer());87 std::shared_ptr<msh::DefaultSessionContainer> container(new msh::DefaultSessionContainer());
82 msh::RegistrationOrderFocusSequence sequence(model);88 msh::RegistrationOrderFocusSequence sequence(container);
83 mtd::MockFocusSetter focus_changer;89 mtd::MockFocusSetter focus_setter;
84 std::shared_ptr<mf::Session> new_session;90 std::shared_ptr<mf::Session> new_session;
91 mtd::StubInputTargetListener input_target_listener;
8592
86 msh::SessionManager session_manager(93 msh::SessionManager session_manager(
87 mt::fake_shared(surface_factory),94 mt::fake_shared(surface_factory),
88 model,95 container,
89 mt::fake_shared(sequence),96 mt::fake_shared(sequence),
90 mt::fake_shared(focus_changer));97 mt::fake_shared(focus_setter),
9198 mt::fake_shared(input_target_listener));
92 EXPECT_CALL(focus_changer, set_focus_to(_)).Times(3);99
93100 EXPECT_CALL(focus_setter, set_focus_to(_)).Times(3);
94 auto session1 = session_manager.open_session("Visual Basic Studio");101
95 auto session2 = session_manager.open_session("Microsoft Access");102 auto session1 = session_manager.open_session("Visual Basic Studio", std::shared_ptr<me::EventSink>());
96 auto session3 = session_manager.open_session("WordPerfect");103 auto session2 = session_manager.open_session("Microsoft Access", std::shared_ptr<me::EventSink>());
104 auto session3 = session_manager.open_session("WordPerfect", std::shared_ptr<me::EventSink>());
97105
98 {106 {
99 InSequence seq;107 InSequence seq;
100 EXPECT_CALL(focus_changer, set_focus_to(Eq(session2))).Times(1);108 EXPECT_CALL(focus_setter, set_focus_to(Eq(session2))).Times(1);
101 EXPECT_CALL(focus_changer, set_focus_to(Eq(session1))).Times(1);109 EXPECT_CALL(focus_setter, set_focus_to(Eq(session1))).Times(1);
102 }110 }
103111
104 session_manager.close_session(session3);112 session_manager.close_session(session3);
105113
=== modified file 'tests/mir_test_framework/testing_server_options.cpp'
--- tests/mir_test_framework/testing_server_options.cpp 2013-04-22 03:24:56 +0000
+++ tests/mir_test_framework/testing_server_options.cpp 2013-04-23 12:15:34 +0000
@@ -29,7 +29,7 @@
29#include "mir/compositor/graphic_buffer_allocator.h"29#include "mir/compositor/graphic_buffer_allocator.h"
30#include "mir/input/input_channel.h"30#include "mir/input/input_channel.h"
31#include "mir/input/input_manager.h"31#include "mir/input/input_manager.h"
32#include "mir/shell/input_focus_selector.h"32#include "mir/input/null_input_target_listener.h"
33#include "src/server/input/android/android_input_manager.h"33#include "src/server/input/android/android_input_manager.h"
34#include "src/server/input/android/android_dispatcher_controller.h"34#include "src/server/input/android/android_dispatcher_controller.h"
3535
@@ -159,14 +159,6 @@
159 }159 }
160};160};
161161
162class StubInputFocusSelector : public msh::InputFocusSelector
163{
164public:
165 void set_input_focus_to(std::shared_ptr<mi::SessionTarget> const& /* session */, std::shared_ptr<mi::SurfaceTarget> const& /* surface */)
166 {
167 }
168};
169
170}162}
171163
172mtf::TestingServerConfiguration::TestingServerConfiguration() :164mtf::TestingServerConfiguration::TestingServerConfiguration() :
@@ -184,14 +176,14 @@
184 return std::make_shared<StubInputManager>();176 return std::make_shared<StubInputManager>();
185}177}
186178
187std::shared_ptr<msh::InputFocusSelector> mtf::TestingServerConfiguration::the_input_focus_selector()179std::shared_ptr<msh::InputTargetListener> mtf::TestingServerConfiguration::the_input_target_listener()
188{180{
189 auto options = the_options();181 auto options = the_options();
190 182
191 if (options->get("tests-use-real-input", false))183 if (options->get("tests-use-real-input", false))
192 return std::make_shared<mia::DispatcherController>(the_input_configuration());184 return std::make_shared<mia::DispatcherController>(the_input_configuration());
193 else185 else
194 return std::make_shared<StubInputFocusSelector>();186 return std::make_shared<mi::NullInputTargetListener>();
195}187}
196188
197std::shared_ptr<mg::Platform> mtf::TestingServerConfiguration::the_graphics_platform()189std::shared_ptr<mg::Platform> mtf::TestingServerConfiguration::the_graphics_platform()
198190
=== modified file 'tests/unit-tests/CMakeLists.txt'
--- tests/unit-tests/CMakeLists.txt 2013-04-10 02:48:51 +0000
+++ tests/unit-tests/CMakeLists.txt 2013-04-23 12:15:34 +0000
@@ -20,8 +20,12 @@
20add_subdirectory(android_input/)20add_subdirectory(android_input/)
21add_subdirectory(surfaces/)21add_subdirectory(surfaces/)
22add_subdirectory(draw/)22add_subdirectory(draw/)
23<<<<<<< TREE
23add_subdirectory(event/)24add_subdirectory(event/)
2425
26=======
27
28>>>>>>> MERGE-SOURCE
25add_executable(unit-tests ${UNIT_TEST_SOURCES})29add_executable(unit-tests ${UNIT_TEST_SOURCES})
26uses_android_input(unit-tests)30uses_android_input(unit-tests)
2731
2832
=== modified file 'tests/unit-tests/frontend/CMakeLists.txt'
--- tests/unit-tests/frontend/CMakeLists.txt 2013-04-11 03:54:01 +0000
+++ tests/unit-tests/frontend/CMakeLists.txt 2013-04-23 12:15:34 +0000
@@ -6,6 +6,7 @@
6 ${CMAKE_CURRENT_SOURCE_DIR}/test_protobuf_reports_errors.cpp6 ${CMAKE_CURRENT_SOURCE_DIR}/test_protobuf_reports_errors.cpp
7 ${CMAKE_CURRENT_SOURCE_DIR}/test_resource_cache.cpp7 ${CMAKE_CURRENT_SOURCE_DIR}/test_resource_cache.cpp
8 ${CMAKE_CURRENT_SOURCE_DIR}/test_session_mediator.cpp8 ${CMAKE_CURRENT_SOURCE_DIR}/test_session_mediator.cpp
9 ${CMAKE_CURRENT_SOURCE_DIR}/test_event_pipe.cpp
9)10)
1011
11# TODO this test is a mess - something better is needed.12# TODO this test is a mess - something better is needed.
1213
=== renamed file 'tests/unit-tests/event/test_event_queue.cpp' => 'tests/unit-tests/frontend/test_event_pipe.cpp'
--- tests/unit-tests/event/test_event_queue.cpp 2013-04-22 03:37:28 +0000
+++ tests/unit-tests/frontend/test_event_pipe.cpp 2013-04-23 12:15:34 +0000
@@ -1,3 +1,4 @@
1<<<<<<< TREE
1/*2/*
2 * Copyright © 2013 Canonical Ltd.3 * Copyright © 2013 Canonical Ltd.
3 *4 *
@@ -111,3 +112,121 @@
111 EXPECT_EQ(mir_event_type_key, b->last_event_handled().type);112 EXPECT_EQ(mir_event_type_key, b->last_event_handled().type);
112 EXPECT_EQ(mir_event_type_motion, a->last_event_handled().type);113 EXPECT_EQ(mir_event_type_motion, a->last_event_handled().type);
113}114}
115=======
116/*
117 * Copyright © 2013 Canonical Ltd.
118 *
119 * This program is free software: you can redistribute it and/or modify
120 * it under the terms of the GNU General Public License version 3 as
121 * published by the Free Software Foundation.
122 *
123 * This program is distributed in the hope that it will be useful,
124 * but WITHOUT ANY WARRANTY; without even the implied warranty of
125 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
126 * GNU General Public License for more details.
127 *
128 * You should have received a copy of the GNU General Public License
129 * along with this program. If not, see <http://www.gnu.org/licenses/>.
130 *
131 * Authored by: Daniel van Vugt <daniel.van.vugt@canonical.com>
132 */
133
134#include "src/server/frontend/event_pipe.h"
135#include <cstring>
136
137#include <gtest/gtest.h>
138
139using mir::frontend::EventPipe;
140
141
142TEST(EventPipe, no_sink)
143{
144 EventPipe q;
145 MirEvent e;
146
147 e.type = mir_event_type_key;
148 q.handle_event(e);
149
150 e.type = mir_event_type_motion;
151 q.handle_event(e);
152
153 e.type = mir_event_type_surface;
154 q.handle_event(e);
155}
156
157namespace
158{
159 class TestSink : public mir::events::EventSink
160 {
161 public:
162 TestSink()
163 {
164 memset(&last_event, 0, sizeof last_event);
165 }
166
167 void handle_event(MirEvent const& e)
168 {
169 last_event = e;
170 }
171
172 MirEvent const& last_event_handled() const
173 {
174 return last_event;
175 }
176
177 private:
178 MirEvent last_event;
179 };
180}
181
182TEST(EventPipe, events_get_handled)
183{
184 EventPipe q;
185 std::shared_ptr<TestSink> s(new TestSink);
186
187 q.set_target(s);
188
189 MirEvent e;
190 memset(&e, 0, sizeof e);
191
192 e.type = mir_event_type_key;
193 q.handle_event(e);
194 EXPECT_EQ(mir_event_type_key, s->last_event_handled().type);
195
196 e.type = mir_event_type_motion;
197 q.handle_event(e);
198 EXPECT_EQ(mir_event_type_motion, s->last_event_handled().type);
199
200 e.type = mir_event_type_surface;
201 q.handle_event(e);
202 EXPECT_EQ(mir_event_type_surface, s->last_event_handled().type);
203}
204
205TEST(EventPipe, sink_is_changeable)
206{
207 EventPipe q;
208 std::shared_ptr<TestSink> a(new TestSink);
209 std::shared_ptr<TestSink> b(new TestSink);
210
211 q.set_target(a);
212
213 MirEvent e;
214 memset(&e, 0, sizeof e);
215
216 e.type = mir_event_type_motion;
217 q.handle_event(e);
218 EXPECT_EQ(mir_event_type_motion, a->last_event_handled().type);
219
220 q.set_target(b);
221
222 e.type = mir_event_type_surface;
223 q.handle_event(e);
224 EXPECT_EQ(mir_event_type_surface, b->last_event_handled().type);
225 EXPECT_EQ(mir_event_type_motion, a->last_event_handled().type);
226
227 e.type = mir_event_type_key;
228 q.handle_event(e);
229 EXPECT_EQ(mir_event_type_key, b->last_event_handled().type);
230 EXPECT_EQ(mir_event_type_motion, a->last_event_handled().type);
231}
232>>>>>>> MERGE-SOURCE
114233
=== modified file 'tests/unit-tests/frontend/test_session_mediator.cpp'
--- tests/unit-tests/frontend/test_session_mediator.cpp 2013-04-19 08:03:57 +0000
+++ tests/unit-tests/frontend/test_session_mediator.cpp 2013-04-23 12:15:34 +0000
@@ -34,7 +34,11 @@
34#include "mir_test_doubles/stub_session.h"34#include "mir_test_doubles/stub_session.h"
35#include "mir_test_doubles/stub_surface_builder.h"35#include "mir_test_doubles/stub_surface_builder.h"
36#include "mir_test/fake_shared.h"36#include "mir_test/fake_shared.h"
37<<<<<<< TREE
37#include "mir/event_queue.h"38#include "mir/event_queue.h"
39=======
40#include "mir/events/event_sink.h"
41>>>>>>> MERGE-SOURCE
38#include "mir/shell/surface.h"42#include "mir/shell/surface.h"
3943
40#include <gtest/gtest.h>44#include <gtest/gtest.h>
@@ -129,7 +133,11 @@
129 }133 }
130};134};
131135
132}136class NullEventSink : public mir::events::EventSink
137{
138public:
139 void handle_event(MirEvent const& ) override {}
140};
133141
134struct SessionMediatorTest : public ::testing::Test142struct SessionMediatorTest : public ::testing::Test
135{143{
@@ -141,15 +149,21 @@
141 report{std::make_shared<mf::NullSessionMediatorReport>()},149 report{std::make_shared<mf::NullSessionMediatorReport>()},
142 resource_cache{std::make_shared<mf::ResourceCache>()},150 resource_cache{std::make_shared<mf::ResourceCache>()},
143 mediator{shell, graphics_platform, graphics_display,151 mediator{shell, graphics_platform, graphics_display,
152<<<<<<< TREE
144 buffer_allocator, report, 153 buffer_allocator, report,
145 std::make_shared<mir::EventQueue>(),154 std::make_shared<mir::EventQueue>(),
146 resource_cache},155 resource_cache},
156=======
157 buffer_allocator, report,
158 std::make_shared<NullEventSink>(),
159 resource_cache},
160>>>>>>> MERGE-SOURCE
147 stubbed_session{std::make_shared<StubbedSession>()},161 stubbed_session{std::make_shared<StubbedSession>()},
148 null_callback{google::protobuf::NewPermanentCallback(google::protobuf::DoNothing)}162 null_callback{google::protobuf::NewPermanentCallback(google::protobuf::DoNothing)}
149 {163 {
150 using namespace ::testing;164 using namespace ::testing;
151165
152 ON_CALL(*shell, open_session(_)).WillByDefault(Return(stubbed_session));166 ON_CALL(*shell, open_session(_, _)).WillByDefault(Return(stubbed_session));
153 ON_CALL(*shell, create_surface_for(_, _)).WillByDefault(Return(mf::SurfaceId{1}));167 ON_CALL(*shell, create_surface_for(_, _)).WillByDefault(Return(mf::SurfaceId{1}));
154 }168 }
155169
@@ -164,7 +178,7 @@
164178
165 std::unique_ptr<google::protobuf::Closure> null_callback;179 std::unique_ptr<google::protobuf::Closure> null_callback;
166};180};
167181}
168182
169TEST_F(SessionMediatorTest, disconnect_releases_session)183TEST_F(SessionMediatorTest, disconnect_releases_session)
170{184{
171185
=== modified file 'tests/unit-tests/frontend/test_session_mediator_android.cpp'
--- tests/unit-tests/frontend/test_session_mediator_android.cpp 2013-04-22 03:35:08 +0000
+++ tests/unit-tests/frontend/test_session_mediator_android.cpp 2013-04-23 12:15:34 +0000
@@ -31,8 +31,13 @@
31#include "mir_test_doubles/mock_session.h"31#include "mir_test_doubles/mock_session.h"
32#include "mir_test_doubles/stub_shell.h"32#include "mir_test_doubles/stub_shell.h"
3333
34<<<<<<< TREE
34#include "mir/event_queue.h"35#include "mir/event_queue.h"
3536
37=======
38#include "mir/event_sink.h"
39
40>>>>>>> MERGE-SOURCE
36#include <gtest/gtest.h>41#include <gtest/gtest.h>
3742
38#include <stdexcept>43#include <stdexcept>
@@ -87,7 +92,11 @@
87 }92 }
88};93};
8994
90}95class NullEventSink : public mir::EventSink
96{
97public:
98 void handle_event(MirEvent const& ) override {}
99};
91100
92struct SessionMediatorAndroidTest : public ::testing::Test101struct SessionMediatorAndroidTest : public ::testing::Test
93{102{
@@ -99,9 +108,15 @@
99 report{std::make_shared<mf::NullSessionMediatorReport>()},108 report{std::make_shared<mf::NullSessionMediatorReport>()},
100 resource_cache{std::make_shared<mf::ResourceCache>()},109 resource_cache{std::make_shared<mf::ResourceCache>()},
101 mediator{shell, graphics_platform, graphics_display,110 mediator{shell, graphics_platform, graphics_display,
111<<<<<<< TREE
102 buffer_allocator, report,112 buffer_allocator, report,
103 std::make_shared<mir::EventQueue>(),113 std::make_shared<mir::EventQueue>(),
104 resource_cache},114 resource_cache},
115=======
116 buffer_allocator, report,
117 std::make_shared<NullEventSink>(),
118 resource_cache},
119>>>>>>> MERGE-SOURCE
105 null_callback{google::protobuf::NewPermanentCallback(google::protobuf::DoNothing)}120 null_callback{google::protobuf::NewPermanentCallback(google::protobuf::DoNothing)}
106 {121 {
107 }122 }
@@ -117,6 +132,8 @@
117 std::unique_ptr<google::protobuf::Closure> null_callback;132 std::unique_ptr<google::protobuf::Closure> null_callback;
118};133};
119134
135}
136
120TEST_F(SessionMediatorAndroidTest, drm_auth_magic_throws)137TEST_F(SessionMediatorAndroidTest, drm_auth_magic_throws)
121{138{
122 mp::ConnectParameters connect_parameters;139 mp::ConnectParameters connect_parameters;
123140
=== modified file 'tests/unit-tests/frontend/test_session_mediator_gbm.cpp'
--- tests/unit-tests/frontend/test_session_mediator_gbm.cpp 2013-04-19 08:03:57 +0000
+++ tests/unit-tests/frontend/test_session_mediator_gbm.cpp 2013-04-23 12:15:34 +0000
@@ -27,7 +27,11 @@
27#include "mir/graphics/drm_authenticator.h"27#include "mir/graphics/drm_authenticator.h"
28#include "mir/graphics/platform.h"28#include "mir/graphics/platform.h"
29#include "mir/graphics/platform_ipc_package.h"29#include "mir/graphics/platform_ipc_package.h"
30<<<<<<< TREE
30#include "mir/event_queue.h"31#include "mir/event_queue.h"
32=======
33#include "mir/events/event_sink.h"
34>>>>>>> MERGE-SOURCE
3135
32#include <boost/exception/errinfo_errno.hpp>36#include <boost/exception/errinfo_errno.hpp>
33#include <boost/throw_exception.hpp>37#include <boost/throw_exception.hpp>
@@ -91,7 +95,11 @@
91 MOCK_METHOD1(drm_auth_magic, void(drm_magic_t));95 MOCK_METHOD1(drm_auth_magic, void(drm_magic_t));
92};96};
9397
94}98class NullEventSink : public mir::events::EventSink
99{
100public:
101 void handle_event(MirEvent const& ) override {}
102};
95103
96struct SessionMediatorGBMTest : public ::testing::Test104struct SessionMediatorGBMTest : public ::testing::Test
97{105{
@@ -103,9 +111,15 @@
103 report{std::make_shared<mf::NullSessionMediatorReport>()},111 report{std::make_shared<mf::NullSessionMediatorReport>()},
104 resource_cache{std::make_shared<mf::ResourceCache>()},112 resource_cache{std::make_shared<mf::ResourceCache>()},
105 mediator{shell, mock_platform, graphics_display,113 mediator{shell, mock_platform, graphics_display,
114<<<<<<< TREE
106 buffer_allocator, report,115 buffer_allocator, report,
107 std::make_shared<mir::EventQueue>(),116 std::make_shared<mir::EventQueue>(),
108 resource_cache},117 resource_cache},
118=======
119 buffer_allocator, report,
120 std::make_shared<NullEventSink>(),
121 resource_cache},
122>>>>>>> MERGE-SOURCE
109 null_callback{google::protobuf::NewPermanentCallback(google::protobuf::DoNothing)}123 null_callback{google::protobuf::NewPermanentCallback(google::protobuf::DoNothing)}
110 {124 {
111 }125 }
@@ -121,6 +135,8 @@
121 std::unique_ptr<google::protobuf::Closure> null_callback;135 std::unique_ptr<google::protobuf::Closure> null_callback;
122};136};
123137
138}
139
124TEST_F(SessionMediatorGBMTest, drm_auth_magic_uses_drm_authenticator)140TEST_F(SessionMediatorGBMTest, drm_auth_magic_uses_drm_authenticator)
125{141{
126 mp::ConnectParameters connect_parameters;142 mp::ConnectParameters connect_parameters;
127143
=== modified file 'tests/unit-tests/input/android/test_android_dispatcher_controller.cpp'
--- tests/unit-tests/input/android/test_android_dispatcher_controller.cpp 2013-04-15 14:39:18 +0000
+++ tests/unit-tests/input/android/test_android_dispatcher_controller.cpp 2013-04-23 12:15:34 +0000
@@ -2,15 +2,15 @@
2 * Copyright © 2013 Canonical Ltd.2 * Copyright © 2013 Canonical Ltd.
3 *3 *
4 * This program is free software: you can redistribute it and/or modify it4 * This program is free software: you can redistribute it and/or modify it
5 * under the terms of the GNU Lesser General Public License version 3,5 * under the terms of the GNU General Public License version 3,
6 * as published by the Free Software Foundation.6 * as published by the Free Software Foundation.
7 *7 *
8 * This program is distributed in the hope that it will be useful,8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU Lesser General Public License for more details.11 * GNU General Public License for more details.
12 *12 *
13 * You should have received a copy of the GNU Lesser General Public License13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 *15 *
16 * Authored by: Robert Carr <robert.carr@canonical.com>16 * Authored by: Robert Carr <robert.carr@canonical.com>
@@ -31,6 +31,8 @@
31#include <sys/types.h>31#include <sys/types.h>
32#include <sys/socket.h>32#include <sys/socket.h>
3333
34#include <stdexcept>
35
34namespace mi = mir::input;36namespace mi = mir::input;
35namespace mia = mi::android;37namespace mia = mi::android;
36namespace mt = mir::test;38namespace mt = mir::test;
@@ -47,12 +49,16 @@
47 void SetUp() override49 void SetUp() override
48 {50 {
49 test_input_fd = socket(AF_UNIX, SOCK_SEQPACKET, 0);51 test_input_fd = socket(AF_UNIX, SOCK_SEQPACKET, 0);
52
53 dispatcher = new mtd::MockInputDispatcher();
50 }54 }
51 void TearDown() override55 void TearDown() override
52 {56 {
53 close(test_input_fd);57 close(test_input_fd);
54 }58 }
55 int test_input_fd;59 int test_input_fd;
60 droidinput::sp<mtd::MockInputDispatcher> dispatcher;
61 mtd::MockInputConfiguration config;
56};62};
5763
58static bool64static bool
@@ -104,30 +110,151 @@
104110
105}111}
106112
107TEST_F(AndroidDispatcherControllerFdSetup, set_input_focus)113TEST_F(AndroidDispatcherControllerFdSetup, input_application_opened_behavior)
108{114{
109 using namespace ::testing;115 using namespace ::testing;
110116
111 auto dispatcher = new mtd::MockInputDispatcher(); // We need droidinput::sp117 EXPECT_CALL(config, the_dispatcher()).Times(1)
112 mtd::MockInputConfiguration config;118 .WillOnce(Return(dispatcher));
113 EXPECT_CALL(config, the_dispatcher()).Times(1)119 mia::DispatcherController controller(mt::fake_shared(config));
114 .WillOnce(Return(dispatcher));120
115121 auto session = std::make_shared<mtd::StubSessionTarget>();
116 auto session = std::make_shared<mtd::StubSessionTarget>();122 controller.input_application_opened(session);
117 auto surface = std::make_shared<mtd::StubSurfaceTarget>(test_input_fd);123 EXPECT_THROW({
124 // An application can not be opened twice!
125 controller.input_application_opened(session);
126 }, std::logic_error);
127}
128
129TEST_F(AndroidDispatcherControllerFdSetup, input_application_closed_behavior)
130{
131 using namespace ::testing;
132
133 EXPECT_CALL(config, the_dispatcher()).Times(1)
134 .WillOnce(Return(dispatcher));
135 mia::DispatcherController controller(mt::fake_shared(config));
136
137 auto session = std::make_shared<mtd::StubSessionTarget>();
138 EXPECT_THROW({
139 // We can't close an application which is not open
140 controller.input_application_closed(session);
141 }, std::logic_error);
142 controller.input_application_opened(session);
143 controller.input_application_closed(session);
144 EXPECT_THROW({
145 // Nor can we close an application twice
146 controller.input_application_closed(session);
147 }, std::logic_error);
148}
149
150TEST_F(AndroidDispatcherControllerFdSetup, input_surface_opened_behavior)
151{
152 using namespace ::testing;
153
154 auto session = std::make_shared<mtd::StubSessionTarget>();
155 auto surface = std::make_shared<mtd::StubSurfaceTarget>(test_input_fd);
156
157 EXPECT_CALL(config, the_dispatcher()).Times(1)
158 .WillOnce(Return(dispatcher));
159 EXPECT_CALL(*dispatcher, registerInputChannel(_, WindowHandleFor(session, surface), false)).Times(1)
160 .WillOnce(Return(droidinput::OK));
161
162 mia::DispatcherController controller(mt::fake_shared(config));
163
164 EXPECT_THROW({
165 // We can't open a surface with an unopened session!
166 controller.input_surface_opened(session, surface);
167 }, std::logic_error);
168 controller.input_application_opened(session);
169 controller.input_surface_opened(session, surface);
170 EXPECT_THROW({
171 // We can't open a surface twice
172 controller.input_surface_opened(session, surface);
173 }, std::logic_error);
174}
175
176TEST_F(AndroidDispatcherControllerFdSetup, input_surface_closed_behavior)
177{
178 using namespace ::testing;
179
180 auto session = std::make_shared<mtd::StubSessionTarget>();
181 auto surface = std::make_shared<mtd::StubSurfaceTarget>(test_input_fd);
182
183 EXPECT_CALL(config, the_dispatcher()).Times(1)
184 .WillOnce(Return(dispatcher));
185 EXPECT_CALL(*dispatcher, registerInputChannel(_, WindowHandleFor(session, surface), false)).Times(1)
186 .WillOnce(Return(droidinput::OK));
187 EXPECT_CALL(*dispatcher, unregisterInputChannel(_)).Times(1);
188 mia::DispatcherController controller(mt::fake_shared(config));
189
190 controller.input_application_opened(session);
191
192 EXPECT_THROW({
193 // We can't close a surface which hasn't been opened
194 controller.input_surface_closed(surface);
195 }, std::logic_error);
196 controller.input_surface_opened(session, surface);
197 controller.input_surface_closed(surface);
198 EXPECT_THROW({
199 // Nor can we close a surface twice
200 controller.input_surface_closed(surface);
201 }, std::logic_error);
202}
203
204TEST_F(AndroidDispatcherControllerFdSetup, on_focus_cleared)
205{
206 using namespace ::testing;
207
208 EXPECT_CALL(config, the_dispatcher()).Times(1)
209 .WillOnce(Return(dispatcher));
210
211 EXPECT_CALL(*dispatcher, setFocusedApplication(droidinput::sp<droidinput::InputApplicationHandle>(0))).Times(1);
212 EXPECT_CALL(*dispatcher, setInputWindows(EmptyVector())).Times(1);
213
214 mia::DispatcherController controller(mt::fake_shared(config));
215
216 controller.focus_cleared();
217}
218
219TEST_F(AndroidDispatcherControllerFdSetup, on_focus_changed)
220{
221 using namespace ::testing;
222
223 auto session = std::make_shared<mtd::StubSessionTarget>();
224 auto surface = std::make_shared<mtd::StubSurfaceTarget>(test_input_fd);
225
226 EXPECT_CALL(config, the_dispatcher()).Times(1)
227 .WillOnce(Return(dispatcher));
228 EXPECT_CALL(*dispatcher, registerInputChannel(_, WindowHandleFor(session, surface), false)).Times(1)
229 .WillOnce(Return(droidinput::OK));
118230
119 {231 {
120 InSequence seq;232 InSequence seq;
121 EXPECT_CALL(*dispatcher, setFocusedApplication(ApplicationHandleFor(session))).Times(1);233 EXPECT_CALL(*dispatcher, setFocusedApplication(ApplicationHandleFor(session))).Times(1);
122 EXPECT_CALL(*dispatcher, registerInputChannel(_, WindowHandleFor(session, surface), false)).Times(1)
123 .WillOnce(Return(droidinput::OK));
124 EXPECT_CALL(*dispatcher, setInputWindows(VectorContainingWindowHandleFor(session, surface))).Times(1);234 EXPECT_CALL(*dispatcher, setInputWindows(VectorContainingWindowHandleFor(session, surface))).Times(1);
125 EXPECT_CALL(*dispatcher, unregisterInputChannel(_)).Times(1);
126 EXPECT_CALL(*dispatcher, setInputWindows(EmptyVector())).Times(1);
127 }235 }
128236
129 mia::DispatcherController controller(mt::fake_shared(config));237 mia::DispatcherController controller(mt::fake_shared(config));
130238
131 controller.set_input_focus_to(session, surface);239 controller.input_application_opened(session);
132 controller.set_input_focus_to(session, std::shared_ptr<mi::SurfaceTarget>());240 controller.input_surface_opened(session, surface);
241
242 controller.focus_changed(surface);
243}
244
245TEST_F(AndroidDispatcherControllerFdSetup, on_focus_changed_throw_behavior)
246{
247 using namespace ::testing;
248
249 EXPECT_CALL(config, the_dispatcher()).Times(1)
250 .WillOnce(Return(dispatcher));
251
252 auto surface = std::make_shared<mtd::StubSurfaceTarget>(test_input_fd);
253
254 mia::DispatcherController controller(mt::fake_shared(config));
255
256 EXPECT_THROW({
257 // We can't focus surfaces which never opened
258 controller.focus_changed(surface);
259 }, std::logic_error);
133}260}
134261
=== modified file 'tests/unit-tests/input/android/test_event_filter_input_dispatcher_policy.cpp'
--- tests/unit-tests/input/android/test_event_filter_input_dispatcher_policy.cpp 2013-03-26 05:28:14 +0000
+++ tests/unit-tests/input/android/test_event_filter_input_dispatcher_policy.cpp 2013-04-23 12:15:34 +0000
@@ -37,7 +37,7 @@
37 using namespace ::testing;37 using namespace ::testing;
38 droidinput::KeyEvent ev;38 droidinput::KeyEvent ev;
39 mtd::MockEventFilter filter;39 mtd::MockEventFilter filter;
40 mia::EventFilterDispatcherPolicy policy(mt::fake_shared(filter));40 mia::EventFilterDispatcherPolicy policy(mt::fake_shared(filter), true);
41 uint32_t policy_flags;41 uint32_t policy_flags;
4242
43 EXPECT_CALL(filter, handles(_)).Times(1).WillOnce(Return(false));43 EXPECT_CALL(filter, handles(_)).Times(1).WillOnce(Return(false));
4444
=== modified file 'tests/unit-tests/shell/test_application_session.cpp'
--- tests/unit-tests/shell/test_application_session.cpp 2013-04-22 03:24:56 +0000
+++ tests/unit-tests/shell/test_application_session.cpp 2013-04-23 12:15:34 +0000
@@ -22,6 +22,7 @@
22#include "mir_test/fake_shared.h"22#include "mir_test/fake_shared.h"
23#include "mir_test_doubles/mock_surface_factory.h"23#include "mir_test_doubles/mock_surface_factory.h"
24#include "mir_test_doubles/mock_surface.h"24#include "mir_test_doubles/mock_surface.h"
25#include "mir_test_doubles/stub_input_target_listener.h"
25#include "mir_test_doubles/stub_surface_builder.h"26#include "mir_test_doubles/stub_surface_builder.h"
26#include "mir_test_doubles/stub_surface.h"27#include "mir_test_doubles/stub_surface.h"
2728
@@ -31,6 +32,7 @@
31#include <gtest/gtest.h>32#include <gtest/gtest.h>
3233
33namespace mc = mir::compositor;34namespace mc = mir::compositor;
35namespace me = mir::events;
34namespace mf = mir::frontend;36namespace mf = mir::frontend;
35namespace msh = mir::shell;37namespace msh = mir::shell;
36namespace ms = mir::surfaces;38namespace ms = mir::surfaces;
@@ -46,12 +48,13 @@
46 auto const mock_surface = std::make_shared<mtd::MockSurface>(mt::fake_shared(surface_builder));48 auto const mock_surface = std::make_shared<mtd::MockSurface>(mt::fake_shared(surface_builder));
4749
48 mtd::MockSurfaceFactory surface_factory;50 mtd::MockSurfaceFactory surface_factory;
49 ON_CALL(surface_factory, create_surface(_)).WillByDefault(Return(mock_surface));51 ON_CALL(surface_factory, create_surface(_, _, _)).WillByDefault(Return(mock_surface));
5052
51 EXPECT_CALL(surface_factory, create_surface(_));53 EXPECT_CALL(surface_factory, create_surface(_, _, _));
52 EXPECT_CALL(*mock_surface, destroy());54 EXPECT_CALL(*mock_surface, destroy());
5355
54 msh::ApplicationSession session(mt::fake_shared(surface_factory), "Foo");56 mtd::StubInputTargetListener input_listener;
57 msh::ApplicationSession session(mt::fake_shared(surface_factory), mt::fake_shared(input_listener), "Foo", std::shared_ptr<me::EventSink>());
5558
56 mf::SurfaceCreationParameters params;59 mf::SurfaceCreationParameters params;
57 auto surf = session.create_surface(params);60 auto surf = session.create_surface(params);
@@ -67,15 +70,16 @@
67 mtd::StubSurfaceBuilder surface_builder;70 mtd::StubSurfaceBuilder surface_builder;
68 {71 {
69 InSequence seq;72 InSequence seq;
70 EXPECT_CALL(surface_factory, create_surface(_)).Times(1)73 EXPECT_CALL(surface_factory, create_surface(_, _, _)).Times(1)
71 .WillOnce(Return(std::make_shared<NiceMock<mtd::MockSurface>>(mt::fake_shared(surface_builder))));74 .WillOnce(Return(std::make_shared<NiceMock<mtd::MockSurface>>(mt::fake_shared(surface_builder))));
72 EXPECT_CALL(surface_factory, create_surface(_)).Times(1)75 EXPECT_CALL(surface_factory, create_surface(_, _, _)).Times(1)
73 .WillOnce(Return(std::make_shared<NiceMock<mtd::MockSurface>>(mt::fake_shared(surface_builder))));76 .WillOnce(Return(std::make_shared<NiceMock<mtd::MockSurface>>(mt::fake_shared(surface_builder))));
74 EXPECT_CALL(surface_factory, create_surface(_)).Times(1)77 EXPECT_CALL(surface_factory, create_surface(_, _, _)).Times(1)
75 .WillOnce(Return(std::make_shared<NiceMock<mtd::MockSurface>>(mt::fake_shared(surface_builder))));78 .WillOnce(Return(std::make_shared<NiceMock<mtd::MockSurface>>(mt::fake_shared(surface_builder))));
76 }79 }
7780
78 msh::ApplicationSession app_session(mt::fake_shared(surface_factory), "Foo");81 mtd::StubInputTargetListener input_listener;
82 msh::ApplicationSession app_session(mt::fake_shared(surface_factory), mt::fake_shared(input_listener), "Foo", std::shared_ptr<me::EventSink>());
7983
80 mf::SurfaceCreationParameters params;84 mf::SurfaceCreationParameters params;
81 auto id1 = app_session.create_surface(params);85 auto id1 = app_session.create_surface(params);
@@ -103,11 +107,12 @@
103 auto const mock_surface = std::make_shared<mtd::MockSurface>(mt::fake_shared(surface_builder));107 auto const mock_surface = std::make_shared<mtd::MockSurface>(mt::fake_shared(surface_builder));
104108
105 mtd::MockSurfaceFactory surface_factory;109 mtd::MockSurfaceFactory surface_factory;
106 ON_CALL(surface_factory, create_surface(_)).WillByDefault(Return(mock_surface));110 ON_CALL(surface_factory, create_surface(_, _, _)).WillByDefault(Return(mock_surface));
107111
108 msh::ApplicationSession app_session(mt::fake_shared(surface_factory), "Foo");112 mtd::StubInputTargetListener input_listener;
109113 msh::ApplicationSession app_session(mt::fake_shared(surface_factory), mt::fake_shared(input_listener), "Foo", std::shared_ptr<me::EventSink>());
110 EXPECT_CALL(surface_factory, create_surface(_));114
115 EXPECT_CALL(surface_factory, create_surface(_, _, _));
111116
112 {117 {
113 InSequence seq;118 InSequence seq;
@@ -130,7 +135,8 @@
130 using namespace ::testing;135 using namespace ::testing;
131136
132 mtd::MockSurfaceFactory surface_factory;137 mtd::MockSurfaceFactory surface_factory;
133 msh::ApplicationSession app_session(mt::fake_shared(surface_factory), "Foo");138 mtd::StubInputTargetListener input_listener;
139 msh::ApplicationSession app_session(mt::fake_shared(surface_factory), mt::fake_shared(input_listener), "Foo", std::shared_ptr<me::EventSink>());
134 mf::SurfaceId invalid_surface_id(1);140 mf::SurfaceId invalid_surface_id(1);
135141
136 EXPECT_THROW({142 EXPECT_THROW({
@@ -143,7 +149,8 @@
143 using namespace ::testing;149 using namespace ::testing;
144150
145 mtd::MockSurfaceFactory surface_factory;151 mtd::MockSurfaceFactory surface_factory;
146 msh::ApplicationSession app_session(mt::fake_shared(surface_factory), "Foo");152 mtd::StubInputTargetListener input_listener;
153 msh::ApplicationSession app_session(mt::fake_shared(surface_factory), mt::fake_shared(input_listener), "Foo", std::shared_ptr<me::EventSink>());
147 mf::SurfaceId invalid_surface_id(1);154 mf::SurfaceId invalid_surface_id(1);
148155
149 EXPECT_THROW({156 EXPECT_THROW({
150157
=== modified file 'tests/unit-tests/shell/test_organising_surface_factory.cpp'
--- tests/unit-tests/shell/test_organising_surface_factory.cpp 2013-04-02 05:58:55 +0000
+++ tests/unit-tests/shell/test_organising_surface_factory.cpp 2013-04-23 12:15:34 +0000
@@ -25,6 +25,7 @@
25#include <gtest/gtest.h>25#include <gtest/gtest.h>
26#include <gmock/gmock.h>26#include <gmock/gmock.h>
2727
28namespace me = mir::events;
28namespace mf = mir::frontend;29namespace mf = mir::frontend;
29namespace msh = mir::shell;30namespace msh = mir::shell;
30namespace geom = mir::geometry;31namespace geom = mir::geometry;
@@ -45,7 +46,7 @@
45 using namespace ::testing;46 using namespace ::testing;
4647
47 underlying_surface_factory = std::make_shared<mtd::MockSurfaceFactory>();48 underlying_surface_factory = std::make_shared<mtd::MockSurfaceFactory>();
48 ON_CALL(*underlying_surface_factory, create_surface(_)).WillByDefault(Return(null_surface));49 ON_CALL(*underlying_surface_factory, create_surface(_, _, _)).WillByDefault(Return(null_surface));
4950
50 placement_strategy = std::make_shared<MockPlacementStrategy>();51 placement_strategy = std::make_shared<MockPlacementStrategy>();
51 }52 }
@@ -62,13 +63,13 @@
6263
63 msh::OrganisingSurfaceFactory factory(underlying_surface_factory, placement_strategy);64 msh::OrganisingSurfaceFactory factory(underlying_surface_factory, placement_strategy);
6465
65 EXPECT_CALL(*underlying_surface_factory, create_surface(_)).Times(1);66 EXPECT_CALL(*underlying_surface_factory, create_surface(_, _, _)).Times(1);
6667
67 auto params = mf::a_surface();68 auto params = mf::a_surface();
68 EXPECT_CALL(*placement_strategy, place(Ref(params))).Times(1)69 EXPECT_CALL(*placement_strategy, place(Ref(params))).Times(1)
69 .WillOnce(Return(mf::a_surface()));70 .WillOnce(Return(mf::a_surface()));
7071
71 factory.create_surface(params);72 factory.create_surface(params, mf::SurfaceId(), std::shared_ptr<me::EventSink>());
72}73}
7374
74TEST_F(OrganisingSurfaceFactorySetup, forwards_create_surface_parameters_from_placement_strategy_to_underlying_factory)75TEST_F(OrganisingSurfaceFactorySetup, forwards_create_surface_parameters_from_placement_strategy_to_underlying_factory)
@@ -83,8 +84,8 @@
8384
84 EXPECT_CALL(*placement_strategy, place(Ref(params))).Times(1)85 EXPECT_CALL(*placement_strategy, place(Ref(params))).Times(1)
85 .WillOnce(Return(placed_params));86 .WillOnce(Return(placed_params));
86 EXPECT_CALL(*underlying_surface_factory, create_surface(placed_params));87 EXPECT_CALL(*underlying_surface_factory, create_surface(placed_params, mf::SurfaceId(), std::shared_ptr<me::EventSink>()));
8788
88 factory.create_surface(params);89 factory.create_surface(params, mf::SurfaceId(), std::shared_ptr<me::EventSink>());
89}90}
9091
9192
=== modified file 'tests/unit-tests/shell/test_registration_order_focus_sequence.cpp'
--- tests/unit-tests/shell/test_registration_order_focus_sequence.cpp 2013-04-19 03:20:05 +0000
+++ tests/unit-tests/shell/test_registration_order_focus_sequence.cpp 2013-04-23 12:15:34 +0000
@@ -22,17 +22,22 @@
22#include "mir/shell/registration_order_focus_sequence.h"22#include "mir/shell/registration_order_focus_sequence.h"
23#include "mir/frontend/surface_creation_parameters.h"23#include "mir/frontend/surface_creation_parameters.h"
24#include "mir/surfaces/surface.h"24#include "mir/surfaces/surface.h"
25
25#include "mir_test_doubles/mock_buffer_bundle.h"26#include "mir_test_doubles/mock_buffer_bundle.h"
26#include "mir_test_doubles/mock_surface_factory.h"27#include "mir_test_doubles/mock_surface_factory.h"
28#include "mir_test_doubles/stub_input_target_listener.h"
29#include "mir_test/fake_shared.h"
2730
28#include <gmock/gmock.h>31#include <gmock/gmock.h>
29#include <gtest/gtest.h>32#include <gtest/gtest.h>
30#include <string>33#include <string>
3134
32namespace mc = mir::compositor;35namespace mc = mir::compositor;
36namespace me = mir::events;
33namespace msh = mir::shell;37namespace msh = mir::shell;
34namespace ms = mir::surfaces;38namespace ms = mir::surfaces;
35namespace mtd = mir::test::doubles;39namespace mt = mir::test;
40namespace mtd = mt::doubles;
3641
37namespace42namespace
38{43{
@@ -45,6 +50,7 @@
45 }50 }
46 std::shared_ptr<mtd::MockSurfaceFactory> factory;51 std::shared_ptr<mtd::MockSurfaceFactory> factory;
47 std::shared_ptr<msh::DefaultSessionContainer> container;52 std::shared_ptr<msh::DefaultSessionContainer> container;
53 mtd::StubInputTargetListener input_listener;
4854
49 static std::string const testing_app_name1;55 static std::string const testing_app_name1;
50 static std::string const testing_app_name2;56 static std::string const testing_app_name2;
@@ -60,9 +66,9 @@
60{66{
61 using namespace ::testing;67 using namespace ::testing;
6268
63 auto app1 = std::make_shared<msh::ApplicationSession>(factory, testing_app_name1);69 auto app1 = std::make_shared<msh::ApplicationSession>(factory, mt::fake_shared(input_listener), testing_app_name1, std::shared_ptr<me::EventSink>());
64 auto app2 = std::make_shared<msh::ApplicationSession>(factory, testing_app_name2);70 auto app2 = std::make_shared<msh::ApplicationSession>(factory, mt::fake_shared(input_listener), testing_app_name2, std::shared_ptr<me::EventSink>());
65 auto app3 = std::make_shared<msh::ApplicationSession>(factory, testing_app_name3);71 auto app3 = std::make_shared<msh::ApplicationSession>(factory, mt::fake_shared(input_listener), testing_app_name3, std::shared_ptr<me::EventSink>());
6672
67 container->insert_session(app1);73 container->insert_session(app1);
68 container->insert_session(app2);74 container->insert_session(app2);
@@ -78,9 +84,9 @@
78{84{
79 using namespace ::testing;85 using namespace ::testing;
8086
81 auto app1 = std::make_shared<msh::ApplicationSession>(factory, testing_app_name1);87 auto app1 = std::make_shared<msh::ApplicationSession>(factory, mt::fake_shared(input_listener), testing_app_name1, std::shared_ptr<me::EventSink>());
82 auto app2 = std::make_shared<msh::ApplicationSession>(factory, testing_app_name2);88 auto app2 = std::make_shared<msh::ApplicationSession>(factory, mt::fake_shared(input_listener), testing_app_name2, std::shared_ptr<me::EventSink>());
83 auto app3 = std::make_shared<msh::ApplicationSession>(factory, testing_app_name3);89 auto app3 = std::make_shared<msh::ApplicationSession>(factory, mt::fake_shared(input_listener), testing_app_name3, std::shared_ptr<me::EventSink>());
84 container->insert_session(app1);90 container->insert_session(app1);
85 container->insert_session(app2);91 container->insert_session(app2);
86 container->insert_session(app3);92 container->insert_session(app3);
@@ -95,7 +101,7 @@
95{101{
96 using namespace ::testing;102 using namespace ::testing;
97103
98 auto app1 = std::make_shared<msh::ApplicationSession>(factory, testing_app_name1);104 auto app1 = std::make_shared<msh::ApplicationSession>(factory, mt::fake_shared(input_listener), testing_app_name1, std::shared_ptr<me::EventSink>());
99 container->insert_session(app1);105 container->insert_session(app1);
100106
101 msh::RegistrationOrderFocusSequence focus_sequence(container);107 msh::RegistrationOrderFocusSequence focus_sequence(container);
@@ -107,8 +113,8 @@
107{113{
108 using namespace ::testing;114 using namespace ::testing;
109115
110 auto app1 = std::make_shared<msh::ApplicationSession>(factory, testing_app_name1);116 auto app1 = std::make_shared<msh::ApplicationSession>(factory, mt::fake_shared(input_listener), testing_app_name1, std::shared_ptr<me::EventSink>());
111 auto app2 = std::make_shared<msh::ApplicationSession>(factory, testing_app_name2);117 auto app2 = std::make_shared<msh::ApplicationSession>(factory, mt::fake_shared(input_listener), testing_app_name2, std::shared_ptr<me::EventSink>());
112 auto null_session = std::shared_ptr<msh::ApplicationSession>();118 auto null_session = std::shared_ptr<msh::ApplicationSession>();
113119
114 msh::RegistrationOrderFocusSequence focus_sequence(container);120 msh::RegistrationOrderFocusSequence focus_sequence(container);
@@ -124,7 +130,7 @@
124{130{
125 using namespace ::testing;131 using namespace ::testing;
126132
127 auto invalid_session = std::make_shared<msh::ApplicationSession>(factory, testing_app_name1);133 auto invalid_session = std::make_shared<msh::ApplicationSession>(factory, mt::fake_shared(input_listener), testing_app_name1, std::shared_ptr<me::EventSink>());
128 auto null_session = std::shared_ptr<msh::ApplicationSession>();134 auto null_session = std::shared_ptr<msh::ApplicationSession>();
129135
130 msh::RegistrationOrderFocusSequence focus_sequence(container);136 msh::RegistrationOrderFocusSequence focus_sequence(container);
131137
=== modified file 'tests/unit-tests/shell/test_session_manager.cpp'
--- tests/unit-tests/shell/test_session_manager.cpp 2013-04-19 03:20:05 +0000
+++ tests/unit-tests/shell/test_session_manager.cpp 2013-04-23 12:15:34 +0000
@@ -21,15 +21,19 @@
21#include "mir/shell/session_manager.h"21#include "mir/shell/session_manager.h"
22#include "mir/shell/default_session_container.h"22#include "mir/shell/default_session_container.h"
23#include "mir/shell/session.h"23#include "mir/shell/session.h"
24#include "mir/shell/input_target_listener.h"
24#include "mir/frontend/surface_creation_parameters.h"25#include "mir/frontend/surface_creation_parameters.h"
25#include "mir/surfaces/surface.h"26#include "mir/surfaces/surface.h"
26#include "mir/input/input_channel.h"27#include "mir/input/input_channel.h"
28
29#include "mir_test/fake_shared.h"
27#include "mir_test_doubles/mock_buffer_bundle.h"30#include "mir_test_doubles/mock_buffer_bundle.h"
28#include "mir_test/fake_shared.h"
29#include "mir_test_doubles/mock_surface_factory.h"31#include "mir_test_doubles/mock_surface_factory.h"
30#include "mir_test_doubles/mock_focus_setter.h"32#include "mir_test_doubles/mock_focus_setter.h"
31#include "mir_test_doubles/null_buffer_bundle.h"33#include "mir_test_doubles/null_buffer_bundle.h"
32#include "mir_test_doubles/stub_surface_builder.h"34#include "mir_test_doubles/stub_surface_builder.h"
35#include "mir_test_doubles/stub_input_target_listener.h"
36#include "mir_test_doubles/mock_input_target_listener.h"
3337
34#include "mir/shell/surface.h"38#include "mir/shell/surface.h"
3539
@@ -37,6 +41,7 @@
37#include <gtest/gtest.h>41#include <gtest/gtest.h>
3842
39namespace mc = mir::compositor;43namespace mc = mir::compositor;
44namespace me = mir::events;
40namespace mf = mir::frontend;45namespace mf = mir::frontend;
41namespace msh = mir::shell;46namespace msh = mir::shell;
42namespace ms = mir::surfaces;47namespace ms = mir::surfaces;
@@ -56,7 +61,7 @@
56 ~MockSessionContainer() noexcept {}61 ~MockSessionContainer() noexcept {}
57};62};
5863
59struct MockFocusSequence: public msh::FocusSequence64struct MockFocusSequence : public msh::FocusSequence
60{65{
61 MOCK_CONST_METHOD1(successor_of, std::shared_ptr<msh::Session>(std::shared_ptr<msh::Session> const&));66 MOCK_CONST_METHOD1(successor_of, std::shared_ptr<msh::Session>(std::shared_ptr<msh::Session> const&));
62 MOCK_CONST_METHOD1(predecessor_of, std::shared_ptr<msh::Session>(std::shared_ptr<msh::Session> const&));67 MOCK_CONST_METHOD1(predecessor_of, std::shared_ptr<msh::Session>(std::shared_ptr<msh::Session> const&));
@@ -68,16 +73,18 @@
68 SessionManagerSetup()73 SessionManagerSetup()
69 : session_manager(mt::fake_shared(surface_factory),74 : session_manager(mt::fake_shared(surface_factory),
70 mt::fake_shared(container),75 mt::fake_shared(container),
71 mt::fake_shared(sequence),76 mt::fake_shared(focus_sequence),
72 mt::fake_shared(focus_setter))77 mt::fake_shared(focus_setter),
78 mt::fake_shared(input_target_listener))
73 {79 {
74 }80 }
7581
76 mtd::StubSurfaceBuilder surface_builder;82 mtd::StubSurfaceBuilder surface_builder;
77 mtd::MockSurfaceFactory surface_factory;83 mtd::MockSurfaceFactory surface_factory;
78 testing::NiceMock<MockSessionContainer> container; // Inelegant but some tests need a stub84 testing::NiceMock<MockSessionContainer> container; // Inelegant but some tests need a stub
79 MockFocusSequence sequence;85 MockFocusSequence focus_sequence;
80 testing::NiceMock<mtd::MockFocusSetter> focus_setter; // Inelegant but some tests need a stub86 testing::NiceMock<mtd::MockFocusSetter> focus_setter; // Inelegant but some tests need a stub
87 mtd::StubInputTargetListener input_target_listener;
8188
82 msh::SessionManager session_manager;89 msh::SessionManager session_manager;
83};90};
@@ -93,9 +100,9 @@
93 EXPECT_CALL(focus_setter, set_focus_to(_));100 EXPECT_CALL(focus_setter, set_focus_to(_));
94 EXPECT_CALL(focus_setter, set_focus_to(std::shared_ptr<msh::Session>())).Times(1);101 EXPECT_CALL(focus_setter, set_focus_to(std::shared_ptr<msh::Session>())).Times(1);
95102
96 EXPECT_CALL(sequence, default_focus()).WillOnce(Return((std::shared_ptr<msh::Session>())));103 EXPECT_CALL(focus_sequence, default_focus()).WillOnce(Return((std::shared_ptr<msh::Session>())));
97104
98 auto session = session_manager.open_session("Visual Basic Studio");105 auto session = session_manager.open_session("Visual Basic Studio", std::shared_ptr<me::EventSink>());
99 session_manager.close_session(session);106 session_manager.close_session(session);
100}107}
101108
@@ -103,14 +110,16 @@
103{110{
104 using namespace ::testing;111 using namespace ::testing;
105112
106 EXPECT_CALL(surface_factory, create_surface(_)).Times(1);113 EXPECT_CALL(surface_factory, create_surface(_, _, _)).Times(1);
107114
108 std::shared_ptr<mi::InputChannel> null_input_channel;115 std::shared_ptr<mi::InputChannel> null_input_channel;
109 ON_CALL(surface_factory, create_surface(_)).WillByDefault(116 ON_CALL(surface_factory, create_surface(_, _, _)).WillByDefault(
110 Return(std::make_shared<msh::Surface>(117 Return(std::make_shared<msh::Surface>(
111 mt::fake_shared(surface_builder),118 mt::fake_shared(surface_builder),
112 mf::a_surface(),119 mf::a_surface(),
113 null_input_channel)));120 null_input_channel,
121 mf::SurfaceId(),
122 std::shared_ptr<me::EventSink>())));
114123
115 EXPECT_CALL(container, insert_session(_)).Times(1);124 EXPECT_CALL(container, insert_session(_)).Times(1);
116 EXPECT_CALL(container, remove_session(_)).Times(1);125 EXPECT_CALL(container, remove_session(_)).Times(1);
@@ -118,9 +127,9 @@
118 EXPECT_CALL(focus_setter, set_focus_to(_)).Times(1);127 EXPECT_CALL(focus_setter, set_focus_to(_)).Times(1);
119 EXPECT_CALL(focus_setter, set_focus_to(std::shared_ptr<msh::Session>())).Times(1);128 EXPECT_CALL(focus_setter, set_focus_to(std::shared_ptr<msh::Session>())).Times(1);
120129
121 EXPECT_CALL(sequence, default_focus()).WillOnce(Return((std::shared_ptr<msh::Session>())));130 EXPECT_CALL(focus_sequence, default_focus()).WillOnce(Return((std::shared_ptr<msh::Session>())));
122131
123 auto session = session_manager.open_session("Visual Basic Studio");132 auto session = session_manager.open_session("Visual Basic Studio", std::shared_ptr<me::EventSink>());
124 session->create_surface(mf::a_surface().of_size(geom::Size{geom::Width{1024}, geom::Height{768}}));133 session->create_surface(mf::a_surface().of_size(geom::Size{geom::Width{1024}, geom::Height{768}}));
125134
126 session_manager.close_session(session);135 session_manager.close_session(session);
@@ -134,7 +143,7 @@
134 EXPECT_CALL(container, insert_session(_)).Times(1);143 EXPECT_CALL(container, insert_session(_)).Times(1);
135 EXPECT_CALL(focus_setter, set_focus_to(_)).WillOnce(SaveArg<0>(&new_session));144 EXPECT_CALL(focus_setter, set_focus_to(_)).WillOnce(SaveArg<0>(&new_session));
136145
137 auto session = session_manager.open_session("Visual Basic Studio");146 auto session = session_manager.open_session("Visual Basic Studio", std::shared_ptr<me::EventSink>());
138 EXPECT_EQ(session, new_session);147 EXPECT_EQ(session, new_session);
139}148}
140149
@@ -142,8 +151,8 @@
142{151{
143 using namespace ::testing;152 using namespace ::testing;
144153
145 auto session1 = session_manager.open_session("Visual Basic Studio");154 auto session1 = session_manager.open_session("Visual Basic Studio", std::shared_ptr<me::EventSink>());
146 auto session2 = session_manager.open_session("IntelliJ IDEA");155 auto session2 = session_manager.open_session("IntelliJ IDEA", std::shared_ptr<me::EventSink>());
147156
148 session_manager.tag_session_with_lightdm_id(session1, 1);157 session_manager.tag_session_with_lightdm_id(session1, 1);
149158
@@ -155,8 +164,8 @@
155{164{
156 using namespace ::testing;165 using namespace ::testing;
157166
158 auto session1 = session_manager.open_session("Visual Basic Studio");167 auto session1 = session_manager.open_session("Visual Basic Studio", std::shared_ptr<me::EventSink>());
159 auto session2 = session_manager.open_session("IntelliJ IDEA");168 auto session2 = session_manager.open_session("IntelliJ IDEA", std::shared_ptr<me::EventSink>());
160169
161 auto shell_session1 = std::dynamic_pointer_cast<msh::Session>(session1);170 auto shell_session1 = std::dynamic_pointer_cast<msh::Session>(session1);
162 auto shell_session2 = std::dynamic_pointer_cast<msh::Session>(session2);171 auto shell_session2 = std::dynamic_pointer_cast<msh::Session>(session2);
@@ -164,7 +173,7 @@
164 session_manager.tag_session_with_lightdm_id(session1, 1);173 session_manager.tag_session_with_lightdm_id(session1, 1);
165 session_manager.focus_session_with_lightdm_id(1);174 session_manager.focus_session_with_lightdm_id(1);
166175
167 EXPECT_CALL(sequence, default_focus()).WillOnce(Return(shell_session2));176 EXPECT_CALL(focus_sequence, default_focus()).WillOnce(Return(shell_session2));
168 EXPECT_CALL(focus_setter, set_focus_to(Eq(shell_session2)));177 EXPECT_CALL(focus_setter, set_focus_to(Eq(shell_session2)));
169178
170 session_manager.close_session(session1);179 session_manager.close_session(session1);
@@ -174,22 +183,85 @@
174{183{
175 using namespace ::testing;184 using namespace ::testing;
176 std::shared_ptr<mi::InputChannel> null_input_channel;185 std::shared_ptr<mi::InputChannel> null_input_channel;
177 ON_CALL(surface_factory, create_surface(_)).WillByDefault(186 ON_CALL(surface_factory, create_surface(_, _, _)).WillByDefault(
178 Return(std::make_shared<msh::Surface>(187 Return(std::make_shared<msh::Surface>(
179 mt::fake_shared(surface_builder),188 mt::fake_shared(surface_builder),
180 mf::a_surface(),189 mf::a_surface(),
181 null_input_channel)));190 null_input_channel,
191 mf::SurfaceId(),
192 std::shared_ptr<me::EventSink>())));
182193
183 // Once for session creation and once for surface creation194 // Once for session creation and once for surface creation
184 {195 {
185 InSequence seq;196 InSequence seq;
186197
187 EXPECT_CALL(focus_setter, set_focus_to(_)).Times(1); // Session creation198 EXPECT_CALL(focus_setter, set_focus_to(_)).Times(1); // Session creation
188 EXPECT_CALL(surface_factory, create_surface(_)).Times(1);199 EXPECT_CALL(surface_factory, create_surface(_, _, _)).Times(1);
189 EXPECT_CALL(focus_setter, set_focus_to(_)).Times(1); // Post Surface creation200 EXPECT_CALL(focus_setter, set_focus_to(_)).Times(1); // Post Surface creation
190 }201 }
191202
192 auto session1 = session_manager.open_session("Weather Report");203 auto session1 = session_manager.open_session("Weather Report", std::shared_ptr<me::EventSink>());
193 session_manager.create_surface_for(session1, mf::a_surface());204 session_manager.create_surface_for(session1, mf::a_surface());
194}205}
195206
207namespace
208{
209
210struct SessionManagerInputTargetListenerSetup : public testing::Test
211{
212 SessionManagerInputTargetListenerSetup()
213 : session_manager(mt::fake_shared(surface_factory),
214 mt::fake_shared(container),
215 mt::fake_shared(focus_sequence),
216 mt::fake_shared(focus_setter),
217 mt::fake_shared(input_target_listener))
218 {
219 }
220
221 mtd::StubSurfaceBuilder surface_builder;
222 mtd::MockSurfaceFactory surface_factory;
223 testing::NiceMock<MockSessionContainer> container; // Inelegant but some tests need a stub
224 testing::NiceMock<MockFocusSequence> focus_sequence;
225 testing::NiceMock<mtd::MockFocusSetter> focus_setter; // Inelegant but some tests need a stub
226 mtd::MockInputTargetListener input_target_listener;
227
228 msh::SessionManager session_manager;
229};
230
231}
232
233TEST_F(SessionManagerInputTargetListenerSetup, listener_is_notified_of_session_and_surfacelifecycle)
234{
235 using namespace ::testing;
236
237 std::shared_ptr<mi::InputChannel> null_input_channel;
238 ON_CALL(surface_factory, create_surface(_,_,_)).WillByDefault(
239 Return(std::make_shared<msh::Surface>(
240 mt::fake_shared(surface_builder),
241 mf::a_surface(),
242 null_input_channel,
243 mf::SurfaceId(),
244 std::shared_ptr<me::EventSink>())));
245 EXPECT_CALL(surface_factory, create_surface(_,_,_)).Times(1);
246
247 EXPECT_CALL(focus_sequence, default_focus()).WillOnce(Return((std::shared_ptr<msh::Session>())));
248 {
249 InSequence seq;
250
251 EXPECT_CALL(input_target_listener, input_application_opened(_))
252 .Times(1);
253 EXPECT_CALL(input_target_listener, input_surface_opened(_, _)).Times(1);
254 EXPECT_CALL(input_target_listener, focus_changed(_)).Times(1);
255 EXPECT_CALL(input_target_listener, input_surface_closed(_)).Times(1);
256 EXPECT_CALL(input_target_listener, input_application_closed(_))
257 .Times(1);
258 EXPECT_CALL(input_target_listener, focus_cleared()).Times(1);
259 }
260
261 {
262 auto session = session_manager.open_session("test", std::shared_ptr<me::EventSink>());
263 auto surf = session_manager.create_surface_for(session, mf::a_surface());
264 session->destroy_surface(surf);
265 session_manager.close_session(session);
266 }
267}
196268
=== modified file 'tests/unit-tests/shell/test_single_visibility_focus_mechanism.cpp'
--- tests/unit-tests/shell/test_single_visibility_focus_mechanism.cpp 2013-04-22 03:24:56 +0000
+++ tests/unit-tests/shell/test_single_visibility_focus_mechanism.cpp 2013-04-23 12:15:34 +0000
@@ -27,7 +27,6 @@
27#include "mir_test_doubles/mock_buffer_bundle.h"27#include "mir_test_doubles/mock_buffer_bundle.h"
28#include "mir_test/fake_shared.h"28#include "mir_test/fake_shared.h"
29#include "mir_test_doubles/mock_surface_factory.h"29#include "mir_test_doubles/mock_surface_factory.h"
30#include "mir_test_doubles/mock_input_focus_selector.h"
31#include "mir_test_doubles/stub_surface.h"30#include "mir_test_doubles/stub_surface.h"
32#include "mir_test_doubles/mock_surface.h"31#include "mir_test_doubles/mock_surface.h"
33#include "mir_test_doubles/stub_surface_builder.h"32#include "mir_test_doubles/stub_surface_builder.h"
@@ -65,8 +64,6 @@
65{64{
66 using namespace ::testing;65 using namespace ::testing;
6766
68 NiceMock<mtd::MockInputFocusSelector> input_focus_selector;
69
70 NiceMock<MockShellSession> app1, app2, app3;67 NiceMock<MockShellSession> app1, app2, app3;
71 msh::DefaultSessionContainer model;68 msh::DefaultSessionContainer model;
7269
@@ -74,7 +71,7 @@
74 ON_CALL(app2, default_surface()).WillByDefault(Return(std::shared_ptr<msh::Surface>()));71 ON_CALL(app2, default_surface()).WillByDefault(Return(std::shared_ptr<msh::Surface>()));
75 ON_CALL(app3, default_surface()).WillByDefault(Return(std::shared_ptr<msh::Surface>()));72 ON_CALL(app3, default_surface()).WillByDefault(Return(std::shared_ptr<msh::Surface>()));
7673
77 msh::SingleVisibilityFocusMechanism focus_mechanism(mt::fake_shared(model), mt::fake_shared(input_focus_selector));74 msh::SingleVisibilityFocusMechanism focus_mechanism(mt::fake_shared(model));
7875
79 EXPECT_CALL(app1, show()).Times(1);76 EXPECT_CALL(app1, show()).Times(1);
80 EXPECT_CALL(app2, hide()).Times(1);77 EXPECT_CALL(app2, hide()).Times(1);
@@ -90,23 +87,3 @@
9087
91 focus_mechanism.set_focus_to(mt::fake_shared(app1));88 focus_mechanism.set_focus_to(mt::fake_shared(app1));
92}89}
93
94TEST(SingleVisibilityFocusMechanism, mechanism_sets_input_focus_from_default_surface)
95{
96 using namespace ::testing;
97
98 mtd::MockInputFocusSelector input_focus_selector;
99 msh::DefaultSessionContainer model;
100 auto session = std::make_shared<NiceMock<MockShellSession>>();
101 auto surface = std::make_shared<mtd::MockSurface>(std::make_shared<mtd::StubSurfaceBuilder>());
102
103 msh::SingleVisibilityFocusMechanism focus_mechanism(mt::fake_shared(model), mt::fake_shared(input_focus_selector));
104
105 EXPECT_CALL(*session, default_surface()).Times(1).WillOnce(Return(surface));
106
107 EXPECT_CALL(input_focus_selector, set_input_focus_to(Eq(session), Eq(surface))).Times(1);
108
109 model.insert_session(session);
110 focus_mechanism.set_focus_to(session);
111}
112
11390
=== modified file 'tests/unit-tests/shell/test_surface.cpp'
--- tests/unit-tests/shell/test_surface.cpp 2013-04-19 03:20:05 +0000
+++ tests/unit-tests/shell/test_surface.cpp 2013-04-23 12:15:34 +0000
@@ -33,6 +33,7 @@
33#include <gmock/gmock.h>33#include <gmock/gmock.h>
34#include <gtest/gtest.h>34#include <gtest/gtest.h>
3535
36namespace me = mir::events;
36namespace ms = mir::surfaces;37namespace ms = mir::surfaces;
37namespace msh = mir::shell;38namespace msh = mir::shell;
38namespace mf = mir::frontend;39namespace mf = mir::frontend;
@@ -137,7 +138,9 @@
137 msh::Surface test(138 msh::Surface test(
138 mt::fake_shared(surface_builder),139 mt::fake_shared(surface_builder),
139 params,140 params,
140 null_input_channel);141 null_input_channel,
142 mf::SurfaceId(),
143 std::shared_ptr<me::EventSink>());
141}144}
142145
143TEST_F(ShellSurface, creation_throws_means_no_destroy)146TEST_F(ShellSurface, creation_throws_means_no_destroy)
@@ -156,7 +159,9 @@
156 msh::Surface test(159 msh::Surface test(
157 mt::fake_shared(surface_builder),160 mt::fake_shared(surface_builder),
158 params,161 params,
159 null_input_channel);162 null_input_channel,
163 mf::SurfaceId(),
164 std::shared_ptr<me::EventSink>());
160 }, std::runtime_error);165 }, std::runtime_error);
161}166}
162167
@@ -172,7 +177,9 @@
172 msh::Surface test(177 msh::Surface test(
173 mt::fake_shared(surface_builder),178 mt::fake_shared(surface_builder),
174 mf::a_surface(),179 mf::a_surface(),
175 null_input_channel);180 null_input_channel,
181 mf::SurfaceId(),
182 std::shared_ptr<me::EventSink>());
176183
177 Mock::VerifyAndClearExpectations(&test);184 Mock::VerifyAndClearExpectations(&test);
178 EXPECT_CALL(surface_builder, destroy_surface(_)).Times(1);185 EXPECT_CALL(surface_builder, destroy_surface(_)).Times(1);
@@ -189,7 +196,9 @@
189 msh::Surface test(196 msh::Surface test(
190 mt::fake_shared(surface_builder),197 mt::fake_shared(surface_builder),
191 mf::a_surface(),198 mf::a_surface(),
192 null_input_channel);199 null_input_channel,
200 mf::SurfaceId(),
201 std::shared_ptr<me::EventSink>());
193202
194 EXPECT_NO_THROW({203 EXPECT_NO_THROW({
195 test.client_buffer();204 test.client_buffer();
@@ -207,7 +216,9 @@
207 msh::Surface test(216 msh::Surface test(
208 mt::fake_shared(surface_builder),217 mt::fake_shared(surface_builder),
209 mf::a_surface(),218 mf::a_surface(),
210 null_input_channel);219 null_input_channel,
220 mf::SurfaceId(),
221 std::shared_ptr<me::EventSink>());
211222
212 EXPECT_NO_THROW({223 EXPECT_NO_THROW({
213 test.size();224 test.size();
@@ -225,7 +236,9 @@
225 msh::Surface test(236 msh::Surface test(
226 mt::fake_shared(surface_builder),237 mt::fake_shared(surface_builder),
227 mf::a_surface(),238 mf::a_surface(),
228 null_input_channel);239 null_input_channel,
240 mf::SurfaceId(),
241 std::shared_ptr<me::EventSink>());
229242
230 EXPECT_NO_THROW({243 EXPECT_NO_THROW({
231 test.name();244 test.name();
@@ -243,7 +256,9 @@
243 msh::Surface test(256 msh::Surface test(
244 mt::fake_shared(surface_builder),257 mt::fake_shared(surface_builder),
245 mf::a_surface(),258 mf::a_surface(),
246 null_input_channel);259 null_input_channel,
260 mf::SurfaceId(),
261 std::shared_ptr<me::EventSink>());
247262
248 EXPECT_NO_THROW({263 EXPECT_NO_THROW({
249 test.pixel_format();264 test.pixel_format();
@@ -261,7 +276,9 @@
261 msh::Surface test(276 msh::Surface test(
262 mt::fake_shared(surface_builder),277 mt::fake_shared(surface_builder),
263 mf::a_surface(),278 mf::a_surface(),
264 null_input_channel);279 null_input_channel,
280 mf::SurfaceId(),
281 std::shared_ptr<me::EventSink>());
265282
266 EXPECT_NO_THROW({283 EXPECT_NO_THROW({
267 test.hide();284 test.hide();
@@ -279,7 +296,9 @@
279 msh::Surface test(296 msh::Surface test(
280 mt::fake_shared(surface_builder),297 mt::fake_shared(surface_builder),
281 mf::a_surface(),298 mf::a_surface(),
282 null_input_channel);299 null_input_channel,
300 mf::SurfaceId(),
301 std::shared_ptr<me::EventSink>());
283302
284 EXPECT_NO_THROW({303 EXPECT_NO_THROW({
285 test.show();304 test.show();
@@ -297,7 +316,9 @@
297 msh::Surface test(316 msh::Surface test(
298 mt::fake_shared(surface_builder),317 mt::fake_shared(surface_builder),
299 mf::a_surface(),318 mf::a_surface(),
300 null_input_channel);319 null_input_channel,
320 mf::SurfaceId(),
321 std::shared_ptr<me::EventSink>());
301322
302 EXPECT_NO_THROW({323 EXPECT_NO_THROW({
303 test.destroy();324 test.destroy();
@@ -315,7 +336,9 @@
315 msh::Surface test(336 msh::Surface test(
316 mt::fake_shared(surface_builder),337 mt::fake_shared(surface_builder),
317 mf::a_surface(),338 mf::a_surface(),
318 null_input_channel);339 null_input_channel,
340 mf::SurfaceId(),
341 std::shared_ptr<me::EventSink>());
319342
320 EXPECT_NO_THROW({343 EXPECT_NO_THROW({
321 test.force_requests_to_complete();344 test.force_requests_to_complete();
@@ -333,7 +356,9 @@
333 msh::Surface test(356 msh::Surface test(
334 mt::fake_shared(surface_builder),357 mt::fake_shared(surface_builder),
335 mf::a_surface(),358 mf::a_surface(),
336 null_input_channel);359 null_input_channel,
360 mf::SurfaceId(),
361 std::shared_ptr<me::EventSink>());
337362
338 EXPECT_NO_THROW({363 EXPECT_NO_THROW({
339 test.advance_client_buffer();364 test.advance_client_buffer();
@@ -352,8 +377,19 @@
352 const int testing_client_fd = 17;377 const int testing_client_fd = 17;
353378
354 MockInputChannel mock_package;379 MockInputChannel mock_package;
355 msh::Surface proxy_surface(mt::fake_shared(surface_builder), mf::a_surface(), null_input_channel);380 msh::Surface proxy_surface(
356 msh::Surface input_proxy_surface(mt::fake_shared(surface_builder), mf::a_surface(), mt::fake_shared(mock_package));381 mt::fake_shared(surface_builder),
382 mf::a_surface(),
383 null_input_channel,
384 mf::SurfaceId(),
385 std::shared_ptr<me::EventSink>());
386
387 msh::Surface input_proxy_surface(
388 mt::fake_shared(surface_builder),
389 mf::a_surface(),
390 mt::fake_shared(mock_package),
391 mf::SurfaceId(),
392 std::shared_ptr<me::EventSink>());
357393
358 EXPECT_CALL(mock_package, client_fd()).Times(1).WillOnce(Return(testing_client_fd));394 EXPECT_CALL(mock_package, client_fd()).Times(1).WillOnce(Return(testing_client_fd));
359395
@@ -374,7 +410,9 @@
374 msh::Surface surf(410 msh::Surface surf(
375 mt::fake_shared(surface_builder),411 mt::fake_shared(surface_builder),
376 mf::a_surface(),412 mf::a_surface(),
377 null_input_channel);413 null_input_channel,
414 mf::SurfaceId(),
415 std::shared_ptr<me::EventSink>());
378416
379 EXPECT_THROW({417 EXPECT_THROW({
380 surf.configure(static_cast<MirSurfaceAttrib>(111), 222);418 surf.configure(static_cast<MirSurfaceAttrib>(111), 222);
@@ -388,7 +426,9 @@
388 msh::Surface surf(426 msh::Surface surf(
389 mt::fake_shared(surface_builder),427 mt::fake_shared(surface_builder),
390 mf::a_surface(),428 mf::a_surface(),
391 null_input_channel);429 null_input_channel,
430 mf::SurfaceId(),
431 std::shared_ptr<me::EventSink>());
392432
393 EXPECT_EQ(mir_surface_type_normal, surf.type());433 EXPECT_EQ(mir_surface_type_normal, surf.type());
394434
@@ -415,6 +455,7 @@
415 mir_surface_type_freestyle));455 mir_surface_type_freestyle));
416 EXPECT_EQ(mir_surface_type_freestyle, surf.type());456 EXPECT_EQ(mir_surface_type_freestyle, surf.type());
417}457}
458<<<<<<< TREE
418459
419TEST_F(ShellSurface, states)460TEST_F(ShellSurface, states)
420{461{
@@ -450,3 +491,43 @@
450 mir_surface_state_fullscreen));491 mir_surface_state_fullscreen));
451 EXPECT_EQ(mir_surface_state_fullscreen, surf.state());492 EXPECT_EQ(mir_surface_state_fullscreen, surf.state());
452}493}
494=======
495
496TEST_F(ShellSurface, states)
497{
498 using namespace testing;
499
500 msh::Surface surf(
501 mt::fake_shared(surface_builder),
502 mf::a_surface(),
503 null_input_channel,
504 mf::SurfaceId(),
505 std::shared_ptr<me::EventSink>());
506
507 EXPECT_EQ(mir_surface_state_restored, surf.state());
508
509 EXPECT_EQ(mir_surface_state_vertmaximized,
510 surf.configure(mir_surface_attrib_state,
511 mir_surface_state_vertmaximized));
512 EXPECT_EQ(mir_surface_state_vertmaximized, surf.state());
513
514 EXPECT_THROW({
515 surf.configure(mir_surface_attrib_state, 999);
516 }, std::logic_error);
517 EXPECT_THROW({
518 surf.configure(mir_surface_attrib_state, -1);
519 }, std::logic_error);
520 EXPECT_EQ(mir_surface_state_vertmaximized, surf.state());
521
522 EXPECT_EQ(mir_surface_state_minimized,
523 surf.configure(mir_surface_attrib_state,
524 mir_surface_state_minimized));
525 EXPECT_EQ(mir_surface_state_minimized, surf.state());
526
527 EXPECT_EQ(mir_surface_state_fullscreen,
528 surf.configure(mir_surface_attrib_state,
529 mir_surface_state_fullscreen));
530 EXPECT_EQ(mir_surface_state_fullscreen, surf.state());
531}
532
533>>>>>>> MERGE-SOURCE
453534
=== modified file 'tests/unit-tests/shell/test_the_session_container_implementation.cpp'
--- tests/unit-tests/shell/test_the_session_container_implementation.cpp 2013-04-19 03:20:05 +0000
+++ tests/unit-tests/shell/test_the_session_container_implementation.cpp 2013-04-23 12:15:34 +0000
@@ -22,12 +22,14 @@
22#include "mir/frontend/surface_creation_parameters.h"22#include "mir/frontend/surface_creation_parameters.h"
23#include "mir/surfaces/surface.h"23#include "mir/surfaces/surface.h"
24#include "mir_test_doubles/mock_buffer_bundle.h"24#include "mir_test_doubles/mock_buffer_bundle.h"
25#include "mir_test_doubles/stub_input_target_listener.h"
25#include "mir_test_doubles/mock_surface_factory.h"26#include "mir_test_doubles/mock_surface_factory.h"
2627
27#include <gmock/gmock.h>28#include <gmock/gmock.h>
28#include <gtest/gtest.h>29#include <gtest/gtest.h>
29#include <string>30#include <string>
3031
32namespace me = mir::events;
31namespace mf = mir::frontend;33namespace mf = mir::frontend;
32namespace msh = mir::shell;34namespace msh = mir::shell;
33namespace mtd = mir::test::doubles;35namespace mtd = mir::test::doubles;
@@ -38,8 +40,8 @@
38 auto factory = std::make_shared<mtd::MockSurfaceFactory>();40 auto factory = std::make_shared<mtd::MockSurfaceFactory>();
39 msh::DefaultSessionContainer container;41 msh::DefaultSessionContainer container;
4042
41 container.insert_session(std::make_shared<msh::ApplicationSession>(factory, "Visual Studio 7"));43 container.insert_session(std::make_shared<msh::ApplicationSession>(factory, std::make_shared<mtd::StubInputTargetListener>(), "Visual Studio 7", std::shared_ptr<me::EventSink>()));
42 container.insert_session(std::make_shared<msh::ApplicationSession>(factory, "Visual Studio 8"));44 container.insert_session(std::make_shared<msh::ApplicationSession>(factory, std::make_shared<mtd::StubInputTargetListener>(), "Visual Studio 8", std::shared_ptr<me::EventSink>()));
4345
44 struct local46 struct local
45 {47 {
@@ -64,8 +66,11 @@
64 auto factory = std::make_shared<mtd::MockSurfaceFactory>();66 auto factory = std::make_shared<mtd::MockSurfaceFactory>();
65 msh::DefaultSessionContainer container;67 msh::DefaultSessionContainer container;
6668
67 auto session = std::make_shared<msh::ApplicationSession>(factory,69 auto session = std::make_shared<msh::ApplicationSession>(
68 "Visual Studio 7");70 factory,
71 std::make_shared<mtd::StubInputTargetListener>(),
72 "Visual Studio 7",
73 std::shared_ptr<me::EventSink>());
69 EXPECT_THROW({74 EXPECT_THROW({
70 container.remove_session(session);75 container.remove_session(session);
71 }, std::logic_error);76 }, std::logic_error);
7277
=== modified file 'tools/setup-partial-armhf-chroot.sh'
--- tools/setup-partial-armhf-chroot.sh 2013-04-17 02:49:53 +0000
+++ tools/setup-partial-armhf-chroot.sh 2013-04-23 12:15:34 +0000
@@ -7,7 +7,7 @@
7 exit7 exit
8fi8fi
99
10echo "creating phablet-compatible quantal armhf partial chroot for mir compiles in directory ${1}"10echo "creating phablet-compatible raring armhf partial chroot for mir compiles in directory ${1}"
1111
12if [ ! -d ${1} ]; then12if [ ! -d ${1} ]; then
13 mkdir -p ${1} 13 mkdir -p ${1}
@@ -37,6 +37,10 @@
37 libboost-program-options1.49.037 libboost-program-options1.49.0
38 libhybris38 libhybris
39 libhybris-dev39 libhybris-dev
40 libgflags2
41 libgflags-dev
42 libgoogle-glog-dev
43 libgoogle-glog0
40 libicu4844 libicu48
41 libprotobuf745 libprotobuf7
42 libprotobuf-dev46 libprotobuf-dev
@@ -75,29 +79,6 @@
75 dpkg -x ${PACKAGE_FILENAME} . 79 dpkg -x ${PACKAGE_FILENAME} .
76 done80 done
7781
78 #glog is only available in raring for armhf. we download the raring sources and
79 #install them manually for this quantal script
80 if [ ! -f libgoogle-glog0_0.3.2-4ubuntu1_armhf.deb ]; then
81 wget "https://launchpad.net/ubuntu/+archive/primary/+files/libgoogle-glog0_0.3.2-4ubuntu1_armhf.deb"
82 fi
83
84 if [ ! -f libgflags2_2.0-1_armhf.deb ]; then
85 wget "https://launchpad.net/ubuntu/+archive/primary/+files/libgflags2_2.0-1_armhf.deb"
86 fi
87
88 if [ ! -f libgoogle-glog-dev_0.3.2-4ubuntu1_armhf.deb ]; then
89 wget "http://launchpadlibrarian.net/134086853/libgoogle-glog-dev_0.3.2-4ubuntu1_armhf.deb"
90 fi
91
92 if [ ! -f libgflags-dev_2.0-1_armhf.deb ]; then
93 wget "http://launchpadlibrarian.net/106868249/libgflags-dev_2.0-1_armhf.deb"
94 fi
95
96 dpkg -x libgflags-dev_2.0-1_armhf.deb .
97 dpkg -x libgflags2_2.0-1_armhf.deb .
98 dpkg -x libgoogle-glog0_0.3.2-4ubuntu1_armhf.deb .
99 dpkg -x libgoogle-glog-dev_0.3.2-4ubuntu1_armhf.deb .
100
101 #todo: we get egl/gles headers from the mesa packages, but should be pointing at the hybris libraries82 #todo: we get egl/gles headers from the mesa packages, but should be pointing at the hybris libraries
102 #just rewrite the symlinks for now83 #just rewrite the symlinks for now
103 rm ./usr/lib/arm-linux-gnueabihf/libEGL.so 84 rm ./usr/lib/arm-linux-gnueabihf/libEGL.so

Subscribers

People subscribed via source and target branches