Mir

Merge lp:~robertcarr/mir/enable-and-demonstrate-inprocess-input into lp:~mir-team/mir/trunk

Proposed by Robert Carr
Status: Merged
Approved by: Robert Carr
Approved revision: no longer in the source branch.
Merged at revision: 682
Proposed branch: lp:~robertcarr/mir/enable-and-demonstrate-inprocess-input
Merge into: lp:~mir-team/mir/trunk
Diff against target: 1066 lines (+215/-143)
28 files modified
examples/CMakeLists.txt (+1/-1)
examples/demo-inprocess-surface-client/CMakeLists.txt (+1/-1)
examples/demo-inprocess-surface-client/demo_inprocess_surface_client.cpp (+1/-1)
examples/demo-inprocess-surface-client/inprocess_egl_client.cpp (+35/-4)
examples/demo-inprocess-surface-client/inprocess_egl_client.h (+19/-4)
include/server/mir/default_server_configuration.h (+2/-1)
include/shared/mir/input/input_platform.h (+5/-5)
include/shared/mir/input/input_receiver_thread.h (+5/-5)
include/shared/mir/input/xkb_mapper.h (+5/-5)
src/client/CMakeLists.txt (+0/-1)
src/client/input/CMakeLists.txt (+0/-13)
src/client/mir_connection.cpp (+3/-3)
src/client/mir_connection.h (+4/-1)
src/client/mir_surface.cpp (+4/-4)
src/client/mir_surface.h (+9/-6)
src/shared/input/CMakeLists.txt (+4/-1)
src/shared/input/android/CMakeLists.txt (+29/-0)
src/shared/input/android/android_input_platform.cpp (+16/-16)
src/shared/input/android/android_input_platform.h (+3/-3)
src/shared/input/android/android_input_receiver.cpp (+18/-18)
src/shared/input/android/android_input_receiver.h (+5/-5)
src/shared/input/android/android_input_receiver_thread.cpp (+8/-8)
src/shared/input/android/android_input_receiver_thread.h (+7/-7)
src/shared/input/xkb_mapper.cpp (+5/-5)
tests/unit-tests/client/input/test_android_input_receiver.cpp (+6/-6)
tests/unit-tests/client/input/test_android_input_receiver_thread.cpp (+7/-7)
tests/unit-tests/client/input/test_xkb_mapper.cpp (+3/-3)
tests/unit-tests/client/test_client_mir_surface.cpp (+10/-9)
To merge this branch: bzr merge lp:~robertcarr/mir/enable-and-demonstrate-inprocess-input
Reviewer Review Type Date Requested Status
PS Jenkins bot (community) continuous-integration Approve
Kevin DuBois (community) Approve
Review via email: mp+163615@code.launchpad.net

Commit message

Enable usage of in-process input (i.e. reorganize headers), and demonstrate usage in examples/.

Description of the change

Enable usage of in-process input (i.e. reorganize headers), and demonstrate usage in examples/.

To post a comment you must log in.
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
Kevin DuBois (kdub) wrote :

overall, looks ok... a few needs fixings though

should we have mir::client::input in shared/ ? I'd rather just have mir::input in shared, usable on both the server side and client side

106/107: reinterpret_cast not needed here

review: Needs Fixing
Revision history for this message
Kevin DuBois (kdub) wrote :

I think we're quickly converging on an interface for our internal clients that makes sense. I also think we're suffering from name overloading, specifically on what we want to call the interfaces that provide internal renderloops to the shell. put another way, me::InprocessEGLClient::InprocessEGLClient is quickly converging on something elegant, but I think if I had not wrestled with that code last week, it would be a strange abstraction.
maybe i'll send out a mail or something to discuss

Revision history for this message
Kevin DuBois (kdub) wrote :

> I think we're quickly converging on an interface for our internal clients that
> makes sense. I also think we're suffering from name overloading, specifically
> on what we want to call the interfaces that provide internal renderloops to
> the shell. put another way, me::InprocessEGLClient::InprocessEGLClient is
> quickly converging on something elegant, but I think if I had not wrestled
> with that code last week, it would be a strange abstraction.
> maybe i'll send out a mail or something to discuss

oh, and this branch can land without having that interface, just want to make sure we get to that clean naming and interface for this part of mir :)

Revision history for this message
Robert Carr (robertcarr) wrote :

After discussion on IRC moved the machinery to mir::input::receiver.

Removed reinterpret cast.

r652 and 653

Revision history for this message
Kevin DuBois (kdub) wrote :

seems ok, pending the decision on the rename for 'not over ipc clients'

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

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'examples/CMakeLists.txt'
--- examples/CMakeLists.txt 2013-05-07 20:24:11 +0000
+++ examples/CMakeLists.txt 2013-05-14 00:10:31 +0000
@@ -120,7 +120,7 @@
120 mir_eglplasma120 mir_eglplasma
121)121)
122122
123add_subdirectory(demo-inprocess-egl)123add_subdirectory(demo-inprocess-surface-client)
124add_subdirectory(demo-shell)124add_subdirectory(demo-shell)
125125
126install(TARGETS ${DEMO_CLIENTS} RUNTIME DESTINATION bin)126install(TARGETS ${DEMO_CLIENTS} RUNTIME DESTINATION bin)
127127
=== renamed directory 'examples/demo-inprocess-egl' => 'examples/demo-inprocess-surface-client'
=== modified file 'examples/demo-inprocess-surface-client/CMakeLists.txt'
--- examples/demo-inprocess-egl/CMakeLists.txt 2013-04-24 05:22:20 +0000
+++ examples/demo-inprocess-surface-client/CMakeLists.txt 2013-05-14 00:10:31 +0000
@@ -1,7 +1,7 @@
1include_directories(..)1include_directories(..)
22
3add_executable(mir_demo_inprocess_egl3add_executable(mir_demo_inprocess_egl
4 demo_inprocess_egl.cpp4 demo_inprocess_surface_client.cpp
5 inprocess_egl_client.cpp5 inprocess_egl_client.cpp
6 example_egl_helper.cpp6 example_egl_helper.cpp
7)7)
88
=== renamed file 'examples/demo-inprocess-egl/demo_inprocess_egl.cpp' => 'examples/demo-inprocess-surface-client/demo_inprocess_surface_client.cpp'
--- examples/demo-inprocess-egl/demo_inprocess_egl.cpp 2013-05-09 01:17:23 +0000
+++ examples/demo-inprocess-surface-client/demo_inprocess_surface_client.cpp 2013-05-14 00:10:31 +0000
@@ -48,7 +48,7 @@
48 client = std::make_shared<me::InprocessEGLClient>(48 client = std::make_shared<me::InprocessEGLClient>(
49 config.the_main_loop(),49 config.the_main_loop(),
50 config.the_graphics_platform(),50 config.the_graphics_platform(),
51 config.the_shell_surface_factory());51 config.the_session_manager());
52 });52 });
53 ///\internal [main_tag]53 ///\internal [main_tag]
5454
5555
=== modified file 'examples/demo-inprocess-surface-client/inprocess_egl_client.cpp'
--- examples/demo-inprocess-egl/inprocess_egl_client.cpp 2013-05-09 01:17:23 +0000
+++ examples/demo-inprocess-surface-client/inprocess_egl_client.cpp 2013-05-14 00:10:31 +0000
@@ -20,18 +20,23 @@
20#include "example_egl_helper.h"20#include "example_egl_helper.h"
2121
22#include "mir/main_loop.h"22#include "mir/main_loop.h"
23#include "mir/shell/surface_factory.h"23#include "mir/shell/session_manager.h"
24#include "mir/shell/surface.h"24#include "mir/shell/surface.h"
25#include "mir/frontend/surface_creation_parameters.h"25#include "mir/frontend/surface_creation_parameters.h"
26#include "mir/frontend/session.h"
26#include "mir/geometry/size.h"27#include "mir/geometry/size.h"
27#include "mir/compositor/buffer_properties.h"28#include "mir/compositor/buffer_properties.h"
28#include "mir/graphics/platform.h"29#include "mir/graphics/platform.h"
30#include "mir/input/input_receiver_thread.h"
31#include "mir/input/input_platform.h"
29#include "mir/graphics/internal_client.h"32#include "mir/graphics/internal_client.h"
3033
31#include "graphics.h"34#include "graphics.h"
3235
33#include <EGL/egl.h>36#include <EGL/egl.h>
3437
38#include <xkbcommon/xkbcommon-keysyms.h>
39
35#include <functional>40#include <functional>
3641
37#include <assert.h>42#include <assert.h>
@@ -43,13 +48,16 @@
43namespace msh = mir::shell;48namespace msh = mir::shell;
44namespace mg = mir::graphics;49namespace mg = mir::graphics;
45namespace me = mir::examples;50namespace me = mir::examples;
51namespace mircv = mir::input::receiver;
46namespace geom = mir::geometry;52namespace geom = mir::geometry;
4753
54
48me::InprocessEGLClient::InprocessEGLClient(std::shared_ptr<mir::MainLoop> const& main_loop,55me::InprocessEGLClient::InprocessEGLClient(std::shared_ptr<mir::MainLoop> const& main_loop,
49 std::shared_ptr<mg::Platform> const& graphics_platform,56 std::shared_ptr<mg::Platform> const& graphics_platform,
50 std::shared_ptr<msh::SurfaceFactory> const& surface_factory)57 std::shared_ptr<msh::SessionManager> const& session_manager)
51 : graphics_platform(graphics_platform),58 : graphics_platform(graphics_platform),
52 surface_factory(surface_factory),59
60 session_manager(session_manager),
53 client_thread(std::mem_fn(&InprocessEGLClient::thread_loop), this),61 client_thread(std::mem_fn(&InprocessEGLClient::thread_loop), this),
54 terminate(false)62 terminate(false)
55{63{
@@ -72,7 +80,17 @@
72 .of_size(surface_size)80 .of_size(surface_size)
73 .of_buffer_usage(mc::BufferUsage::hardware)81 .of_buffer_usage(mc::BufferUsage::hardware)
74 .of_pixel_format(geom::PixelFormat::argb_8888);82 .of_pixel_format(geom::PixelFormat::argb_8888);
75 auto surface = surface_factory->create_surface(params, mf::SurfaceId(), std::shared_ptr<events::EventSink>());83 auto session = session_manager->open_session("Inprocess client",
84 std::shared_ptr<mir::events::EventSink>());
85 // TODO: Why do we get an ID? ~racarr
86 auto surface = session->get_surface(session_manager->create_surface_for(session, params));
87
88 auto input_platform = mircv::InputPlatform::create();
89 input_thread = input_platform->create_input_thread(
90 surface->client_input_fd(),
91 std::bind(std::mem_fn(&me::InprocessEGLClient::handle_event), this, std::placeholders::_1));
92 input_thread->start();
93
76 auto internal_client = graphics_platform->create_internal_client(surface);94 auto internal_client = graphics_platform->create_internal_client(surface);
77 me::EGLHelper helper(internal_client->egl_native_display(), internal_client->egl_native_window());95 me::EGLHelper helper(internal_client->egl_native_display(), internal_client->egl_native_window());
7896
@@ -92,5 +110,18 @@
92110
93 gl_animation.step();111 gl_animation.step();
94 }112 }
113
114 input_thread->stop();
95 ///\internal [loop_tag]115 ///\internal [loop_tag]
96}116}
117
118void me::InprocessEGLClient::handle_event(MirEvent *event)
119{
120 if (event->type != mir_event_type_key)
121 return;
122 if (event->key.action != mir_key_action_down)
123 return;
124 if (event->key.key_code != XKB_KEY_Escape)
125 return;
126 terminate = true;
127}
97128
=== modified file 'examples/demo-inprocess-surface-client/inprocess_egl_client.h'
--- examples/demo-inprocess-egl/inprocess_egl_client.h 2013-05-09 01:17:23 +0000
+++ examples/demo-inprocess-surface-client/inprocess_egl_client.h 2013-05-14 00:10:31 +0000
@@ -19,19 +19,29 @@
19#ifndef MIR_EXAMPLES_INPROCESS_EGL_CLIENT_H_19#ifndef MIR_EXAMPLES_INPROCESS_EGL_CLIENT_H_
20#define MIR_EXAMPLES_INPROCESS_EGL_CLIENT_H_20#define MIR_EXAMPLES_INPROCESS_EGL_CLIENT_H_
2121
22#include "mir_toolkit/event.h"
23
22#include <thread>24#include <thread>
23#include <memory>25#include <memory>
26#include <atomic>
2427
25namespace mir28namespace mir
26{29{
27class MainLoop;30class MainLoop;
31namespace input
32{
33namespace receiver
34{
35class InputReceiverThread;
36}
37}
28namespace graphics38namespace graphics
29{39{
30class Platform;40class Platform;
31}41}
32namespace shell42namespace shell
33{43{
34class SurfaceFactory;44class SessionManager;
35}45}
3646
37namespace examples47namespace examples
@@ -43,7 +53,7 @@
43public:53public:
44 InprocessEGLClient(std::shared_ptr<mir::MainLoop> const& main_loop,54 InprocessEGLClient(std::shared_ptr<mir::MainLoop> const& main_loop,
45 std::shared_ptr<graphics::Platform> const& graphics_platform,55 std::shared_ptr<graphics::Platform> const& graphics_platform,
46 std::shared_ptr<shell::SurfaceFactory> const& surface_factory);56 std::shared_ptr<shell::SessionManager> const& session_manager);
4757
48protected:58protected:
49 InprocessEGLClient(InprocessEGLClient const&) = delete;59 InprocessEGLClient(InprocessEGLClient const&) = delete;
@@ -51,11 +61,16 @@
5161
52private:62private:
53 std::shared_ptr<graphics::Platform> const graphics_platform;63 std::shared_ptr<graphics::Platform> const graphics_platform;
54 std::shared_ptr<shell::SurfaceFactory> const surface_factory;64 std::shared_ptr<shell::SessionManager> const session_manager;
5565
56 std::thread client_thread;66 std::thread client_thread;
67
68 std::shared_ptr<input::receiver::InputReceiverThread> input_thread;
69
57 void thread_loop();70 void thread_loop();
58 bool terminate;71 void handle_event(MirEvent *event);
72
73 std::atomic<bool> terminate;
59};74};
6075
61}76}
6277
=== modified file 'include/server/mir/default_server_configuration.h'
--- include/server/mir/default_server_configuration.h 2013-05-09 14:54:22 +0000
+++ include/server/mir/default_server_configuration.h 2013-05-14 00:10:31 +0000
@@ -197,6 +197,8 @@
197 virtual std::shared_ptr<graphics::Platform> the_graphics_platform();197 virtual std::shared_ptr<graphics::Platform> the_graphics_platform();
198 virtual std::shared_ptr<time::TimeSource> the_time_source();198 virtual std::shared_ptr<time::TimeSource> the_time_source();
199199
200 virtual std::shared_ptr<shell::SessionManager> the_session_manager();
201
200protected:202protected:
201 // add_options() allows configuration specializations to add their203 // add_options() allows configuration specializations to add their
202 // own options. This MUST be called before the first invocation of204 // own options. This MUST be called before the first invocation of
@@ -205,7 +207,6 @@
205 virtual std::shared_ptr<options::Option> the_options() const;207 virtual std::shared_ptr<options::Option> the_options() const;
206208
207 virtual std::shared_ptr<input::InputChannelFactory> the_input_channel_factory();209 virtual std::shared_ptr<input::InputChannelFactory> the_input_channel_factory();
208 virtual std::shared_ptr<shell::SessionManager> the_session_manager();
209210
210 CachedPtr<frontend::Communicator> communicator;211 CachedPtr<frontend::Communicator> communicator;
211 CachedPtr<shell::SessionManager> session_manager;212 CachedPtr<shell::SessionManager> session_manager;
212213
=== renamed file 'src/client/input/input_platform.h' => 'include/shared/mir/input/input_platform.h'
--- src/client/input/input_platform.h 2013-04-24 05:22:20 +0000
+++ include/shared/mir/input/input_platform.h 2013-05-14 00:10:31 +0000
@@ -16,8 +16,8 @@
16 * Authored by: Robert Carr <robert.carr@canonical.com>16 * Authored by: Robert Carr <robert.carr@canonical.com>
17 */17 */
1818
19#ifndef MIR_CLIENT_INPUT_PLATFORM_H_19#ifndef MIR_INPUT_RECEIVER_PLATFORM_H_
20#define MIR_CLIENT_INPUT_PLATFORM_H_20#define MIR_INPUT_RECEIVER_PLATFORM_H_
2121
22#include "mir_toolkit/event.h"22#include "mir_toolkit/event.h"
2323
@@ -26,10 +26,10 @@
2626
27namespace mir27namespace mir
28{28{
29namespace client
30{
31namespace input29namespace input
32{30{
31namespace receiver
32{
33class InputReceiverThread;33class InputReceiverThread;
3434
35// Interface for MirSurface to construct input dispatcher threads.35// Interface for MirSurface to construct input dispatcher threads.
@@ -52,4 +52,4 @@
52}52}
53} // namespace mir53} // namespace mir
5454
55#endif // MIR_CLIENT_INPUT_PLATFORM_H_55#endif // MIR_INPUT_RECEIVER_PLATFORM_H_
5656
=== renamed file 'src/client/input/input_receiver_thread.h' => 'include/shared/mir/input/input_receiver_thread.h'
--- src/client/input/input_receiver_thread.h 2013-04-24 05:22:20 +0000
+++ include/shared/mir/input/input_receiver_thread.h 2013-05-14 00:10:31 +0000
@@ -16,15 +16,15 @@
16 * Authored by: Robert Carr <robert.carr@canonical.com>16 * Authored by: Robert Carr <robert.carr@canonical.com>
17 */17 */
1818
19#ifndef MIR_CLIENT_INPUT_RECEIVER_THREAD_H_19#ifndef MIR_INPUT_RECEIVER_RECEIVER_THREAD_H_
20#define MIR_CLIENT_INPUT_RECEIVER_THREAD_H_20#define MIR_INPUT_RECEIVER_RECEIVER_THREAD_H_
2121
22namespace mir22namespace mir
23{23{
24namespace client
25{
26namespace input24namespace input
27{25{
26namespace receiver
27{
2828
29class InputReceiverThread29class InputReceiverThread
30{30{
@@ -45,4 +45,4 @@
45}45}
46} // namespace mir46} // namespace mir
4747
48#endif // MIR_CLIENT_INPUT_RECEIVER_THREAD_H_48#endif // MIR_INPUT_RECEIVER_RECEIVER_THREAD_H_
4949
=== renamed file 'src/client/input/xkb_mapper.h' => 'include/shared/mir/input/xkb_mapper.h'
--- src/client/input/xkb_mapper.h 2013-04-12 17:33:05 +0000
+++ include/shared/mir/input/xkb_mapper.h 2013-05-14 00:10:31 +0000
@@ -16,8 +16,8 @@
16 * Authored by: Robert Carr <robert.carr@canonical.com>16 * Authored by: Robert Carr <robert.carr@canonical.com>
17 */17 */
1818
19#ifndef MIR_CLIENT_INPUT_XKB_MAPPER_H_19#ifndef MIR_INPUT_RECEIVER_XKB_MAPPER_H_
20#define MIR_CLIENT_INPUT_XKB_MAPPER_H_20#define MIR_INPUT_RECEIVER_XKB_MAPPER_H_
2121
22#include <xkbcommon/xkbcommon.h>22#include <xkbcommon/xkbcommon.h>
2323
@@ -25,10 +25,10 @@
2525
26namespace mir26namespace mir
27{27{
28namespace client
29{
30namespace input28namespace input
31{29{
30namespace receiver
31{
3232
33class XKBMapper33class XKBMapper
34{34{
@@ -53,4 +53,4 @@
53}53}
54}54}
5555
56#endif // MIR_CLIENT_INPUT_XKB_MAPPER_H_56#endif // MIR_INPUT_RECEIVER_XKB_MAPPER_H_
5757
=== modified file 'src/client/CMakeLists.txt'
--- src/client/CMakeLists.txt 2013-04-24 05:22:20 +0000
+++ src/client/CMakeLists.txt 2013-05-14 00:10:31 +0000
@@ -35,7 +35,6 @@
35 mir_basic_rpc_channel.cpp35 mir_basic_rpc_channel.cpp
36 ${PROTO_SRCS}36 ${PROTO_SRCS}
37)37)
38add_subdirectory(input)
3938
40list(APPEND CLIENT_SOURCES39list(APPEND CLIENT_SOURCES
41 mir_socket_rpc_channel.cpp40 mir_socket_rpc_channel.cpp
4241
=== removed directory 'src/client/input'
=== removed file 'src/client/input/CMakeLists.txt'
--- src/client/input/CMakeLists.txt 2013-04-24 05:22:20 +0000
+++ src/client/input/CMakeLists.txt 1970-01-01 00:00:00 +0000
@@ -1,13 +0,0 @@
1list(
2 APPEND CLIENT_SOURCES
3 ${CMAKE_CURRENT_SOURCE_DIR}/android_input_receiver.cpp
4 ${CMAKE_CURRENT_SOURCE_DIR}/android_input_receiver_thread.cpp
5 ${CMAKE_CURRENT_SOURCE_DIR}/android_input_platform.cpp
6 ${CMAKE_CURRENT_SOURCE_DIR}/xkb_mapper.cpp
7)
8
9set(
10 CLIENT_SOURCES
11 ${CLIENT_SOURCES}
12 PARENT_SCOPE
13)
140
=== modified file 'src/client/mir_connection.cpp'
--- src/client/mir_connection.cpp 2013-04-29 23:21:58 +0000
+++ src/client/mir_connection.cpp 2013-05-14 00:10:31 +0000
@@ -25,13 +25,13 @@
25#include "client_buffer_depository.h"25#include "client_buffer_depository.h"
26#include "make_rpc_channel.h"26#include "make_rpc_channel.h"
2727
28#include "input/input_platform.h"28#include "mir/input/input_platform.h"
2929
30#include <thread>30#include <thread>
31#include <cstddef>31#include <cstddef>
3232
33namespace mcl = mir::client;33namespace mcl = mir::client;
34namespace mcli = mcl::input;34namespace mircv = mir::input::receiver;
35namespace mp = mir::protobuf;35namespace mp = mir::protobuf;
36namespace gp = google::protobuf;36namespace gp = google::protobuf;
3737
@@ -50,7 +50,7 @@
50 server(channel.get(), ::google::protobuf::Service::STUB_DOESNT_OWN_CHANNEL),50 server(channel.get(), ::google::protobuf::Service::STUB_DOESNT_OWN_CHANNEL),
51 log(log),51 log(log),
52 client_platform_factory(client_platform_factory),52 client_platform_factory(client_platform_factory),
53 input_platform(mcli::InputPlatform::create())53 input_platform(mircv::InputPlatform::create())
54{54{
55 channel->set_event_handler(this);55 channel->set_event_handler(this);
56 {56 {
5757
=== modified file 'src/client/mir_connection.h'
--- src/client/mir_connection.h 2013-04-29 23:21:58 +0000
+++ src/client/mir_connection.h 2013-05-14 00:10:31 +0000
@@ -45,9 +45,12 @@
45class ClientBufferDepository;45class ClientBufferDepository;
46class ClientPlatformFactory;46class ClientPlatformFactory;
47class MirBasicRpcChannel;47class MirBasicRpcChannel;
48}
4849
49namespace input50namespace input
50{51{
52namespace receiver
53{
51class InputPlatform;54class InputPlatform;
52}55}
53}56}
@@ -117,7 +120,7 @@
117 std::shared_ptr<mir::client::ClientPlatform> platform;120 std::shared_ptr<mir::client::ClientPlatform> platform;
118 std::shared_ptr<EGLNativeDisplayType> native_display;121 std::shared_ptr<EGLNativeDisplayType> native_display;
119122
120 std::shared_ptr<mir::client::input::InputPlatform> const input_platform;123 std::shared_ptr<mir::input::receiver::InputPlatform> const input_platform;
121124
122 std::string error_message;125 std::string error_message;
123126
124127
=== modified file 'src/client/mir_surface.cpp'
--- src/client/mir_surface.cpp 2013-05-03 18:39:57 +0000
+++ src/client/mir_surface.cpp 2013-05-14 00:10:31 +0000
@@ -22,14 +22,14 @@
22#include "client_buffer.h"22#include "client_buffer.h"
23#include "mir_surface.h"23#include "mir_surface.h"
24#include "mir_connection.h"24#include "mir_connection.h"
25#include "input/input_receiver_thread.h"25#include "mir/input/input_receiver_thread.h"
26#include "input/input_platform.h"26#include "mir/input/input_platform.h"
2727
28#include <cassert>28#include <cassert>
2929
30namespace geom = mir::geometry;30namespace geom = mir::geometry;
31namespace mcl = mir::client;31namespace mcl = mir::client;
32namespace mcli = mir::client::input;32namespace mircv = mir::input::receiver;
33namespace mp = mir::protobuf;33namespace mp = mir::protobuf;
34namespace gp = google::protobuf;34namespace gp = google::protobuf;
3535
@@ -38,7 +38,7 @@
38 mp::DisplayServer::Stub & server,38 mp::DisplayServer::Stub & server,
39 std::shared_ptr<mir::client::Logger> const& logger,39 std::shared_ptr<mir::client::Logger> const& logger,
40 std::shared_ptr<mcl::ClientBufferFactory> const& factory,40 std::shared_ptr<mcl::ClientBufferFactory> const& factory,
41 std::shared_ptr<mcli::InputPlatform> const& input_platform,41 std::shared_ptr<mircv::InputPlatform> const& input_platform,
42 MirSurfaceParameters const & params,42 MirSurfaceParameters const & params,
43 mir_surface_lifecycle_callback callback, void * context)43 mir_surface_lifecycle_callback callback, void * context)
44 : server(server),44 : server(server),
4545
=== modified file 'src/client/mir_surface.h'
--- src/client/mir_surface.h 2013-05-03 22:53:42 +0000
+++ src/client/mir_surface.h 2013-05-14 00:10:31 +0000
@@ -35,14 +35,17 @@
3535
36namespace mir36namespace mir
37{37{
38namespace client
39{
40class ClientBuffer;
41namespace input38namespace input
42{39{
40namespace receiver
41{
43class InputPlatform;42class InputPlatform;
44class InputReceiverThread;43class InputReceiverThread;
45}44}
45}
46namespace client
47{
48class ClientBuffer;
4649
47struct MemoryRegion;50struct MemoryRegion;
48}51}
@@ -59,7 +62,7 @@
59 mir::protobuf::DisplayServer::Stub & server,62 mir::protobuf::DisplayServer::Stub & server,
60 std::shared_ptr<mir::client::Logger> const& logger,63 std::shared_ptr<mir::client::Logger> const& logger,
61 std::shared_ptr<mir::client::ClientBufferFactory> const& buffer_factory,64 std::shared_ptr<mir::client::ClientBufferFactory> const& buffer_factory,
62 std::shared_ptr<mir::client::input::InputPlatform> const& input_platform,65 std::shared_ptr<mir::input::receiver::InputPlatform> const& input_platform,
63 MirSurfaceParameters const& params,66 MirSurfaceParameters const& params,
64 mir_surface_lifecycle_callback callback, void * context);67 mir_surface_lifecycle_callback callback, void * context);
6568
@@ -110,7 +113,7 @@
110113
111 std::shared_ptr<mir::client::MemoryRegion> secured_region;114 std::shared_ptr<mir::client::MemoryRegion> secured_region;
112 std::shared_ptr<mir::client::ClientBufferDepository> buffer_depository;115 std::shared_ptr<mir::client::ClientBufferDepository> buffer_depository;
113 std::shared_ptr<mir::client::input::InputPlatform> const input_platform;116 std::shared_ptr<mir::input::receiver::InputPlatform> const input_platform;
114117
115 std::shared_ptr<mir::client::Logger> logger;118 std::shared_ptr<mir::client::Logger> logger;
116 std::shared_ptr<EGLNativeWindowType> accelerated_window;119 std::shared_ptr<EGLNativeWindowType> accelerated_window;
@@ -121,7 +124,7 @@
121 int attrib_cache[mir_surface_attrib_arraysize_];124 int attrib_cache[mir_surface_attrib_arraysize_];
122125
123 std::function<void(MirEvent const*)> handle_event_callback;126 std::function<void(MirEvent const*)> handle_event_callback;
124 std::shared_ptr<mir::client::input::InputReceiverThread> input_thread;127 std::shared_ptr<mir::input::receiver::InputReceiverThread> input_thread;
125};128};
126129
127#endif /* MIR_CLIENT_PRIVATE_MIR_WAIT_HANDLE_H_ */130#endif /* MIR_CLIENT_PRIVATE_MIR_WAIT_HANDLE_H_ */
128131
=== modified file 'src/shared/input/CMakeLists.txt'
--- src/shared/input/CMakeLists.txt 2013-04-24 05:22:20 +0000
+++ src/shared/input/CMakeLists.txt 2013-05-14 00:10:31 +0000
@@ -16,9 +16,11 @@
1616
17set(17set(
18 ANDROID_SHARED_INPUT_SOURCES18 ANDROID_SHARED_INPUT_SOURCES
19 ${CMAKE_CURRENT_SOURCE_DIR}/android_input_lexicon.cpp19 ${CMAKE_CURRENT_SOURCE_DIR}/xkb_mapper.cpp
20)20)
2121
22add_subdirectory(android)
23
22add_library(24add_library(
23 mirsharedinput STATIC25 mirsharedinput STATIC
24 ${ANDROID_SHARED_INPUT_SOURCES}26 ${ANDROID_SHARED_INPUT_SOURCES}
@@ -28,4 +30,5 @@
28 mirsharedinput30 mirsharedinput
29 31
30 android-input32 android-input
33 ${XKBCOMMON_LIBRARIES}
31)34)
3235
=== added directory 'src/shared/input/android'
=== added file 'src/shared/input/android/CMakeLists.txt'
--- src/shared/input/android/CMakeLists.txt 1970-01-01 00:00:00 +0000
+++ src/shared/input/android/CMakeLists.txt 2013-05-14 00:10:31 +0000
@@ -0,0 +1,29 @@
1# Copyright © 2012 Canonical Ltd.
2#
3# This program is free software: you can redistribute it and/or modify
4# it under the terms of the GNU Lesser General Public License version 3 as
5# published by the Free Software Foundation.
6#
7# This program is distributed in the hope that it will be useful,
8# but WITHOUT ANY WARRANTY; without even the implied warranty of
9# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10# GNU Lesser General Public License for more details.
11#
12# You should have received a copy of the GNU Lesser General Public License
13# along with this program. If not, see <http://www.gnu.org/licenses/>.
14#
15# Authored by: Robert Carr <robert.carr@canonical.com>
16
17list(
18 APPEND ANDROID_SHARED_INPUT_SOURCES
19 ${CMAKE_CURRENT_SOURCE_DIR}/android_input_lexicon.cpp
20 ${CMAKE_CURRENT_SOURCE_DIR}/android_input_receiver.cpp
21 ${CMAKE_CURRENT_SOURCE_DIR}/android_input_receiver_thread.cpp
22 ${CMAKE_CURRENT_SOURCE_DIR}/android_input_platform.cpp
23)
24
25set(
26 ANDROID_SHARED_INPUT_SOURCES
27 ${ANDROID_SHARED_INPUT_SOURCES}
28 PARENT_SCOPE
29)
030
=== renamed file 'src/shared/input/android_input_lexicon.cpp' => 'src/shared/input/android/android_input_lexicon.cpp'
=== renamed file 'src/client/input/android_input_platform.cpp' => 'src/shared/input/android/android_input_platform.cpp'
--- src/client/input/android_input_platform.cpp 2013-04-24 05:22:20 +0000
+++ src/shared/input/android/android_input_platform.cpp 2013-05-14 00:10:31 +0000
@@ -20,25 +20,25 @@
20#include "android_input_receiver.h"20#include "android_input_receiver.h"
21#include "android_input_receiver_thread.h"21#include "android_input_receiver_thread.h"
2222
23namespace mcli = mir::client::input;23namespace mircv = mir::input::receiver;
24namespace mclia = mcli::android;24namespace mircva = mircv::android;
2525
26mclia::AndroidInputPlatform::AndroidInputPlatform()26mircva::AndroidInputPlatform::AndroidInputPlatform()
27{27{
28}28}
2929
30mclia::AndroidInputPlatform::~AndroidInputPlatform()30mircva::AndroidInputPlatform::~AndroidInputPlatform()
31{31{
32}32}
3333
34std::shared_ptr<mcli::InputReceiverThread> mclia::AndroidInputPlatform::create_input_thread(34std::shared_ptr<mircv::InputReceiverThread> mircva::AndroidInputPlatform::create_input_thread(
35 int fd, std::function<void(MirEvent*)> const& callback)35 int fd, std::function<void(MirEvent*)> const& callback)
36{36{
37 auto receiver = std::make_shared<mclia::InputReceiver>(fd);37 auto receiver = std::make_shared<mircva::InputReceiver>(fd);
38 return std::make_shared<mclia::InputReceiverThread>(receiver, callback);38 return std::make_shared<mircva::InputReceiverThread>(receiver, callback);
39}39}
4040
41std::shared_ptr<mcli::InputPlatform> mcli::InputPlatform::create()41std::shared_ptr<mircv::InputPlatform> mircv::InputPlatform::create()
42{42{
43 return std::make_shared<mclia::AndroidInputPlatform>();43 return std::make_shared<mircva::AndroidInputPlatform>();
44}44}
4545
=== renamed file 'src/client/input/android_input_platform.h' => 'src/shared/input/android/android_input_platform.h'
--- src/client/input/android_input_platform.h 2013-04-24 05:22:20 +0000
+++ src/shared/input/android/android_input_platform.h 2013-05-14 00:10:31 +0000
@@ -19,14 +19,14 @@
19#ifndef MIR_CLIENT_ANDROID_INPUT_PLATFORM_H_19#ifndef MIR_CLIENT_ANDROID_INPUT_PLATFORM_H_
20#define MIR_CLIENT_ANDROID_INPUT_PLATFORM_H_20#define MIR_CLIENT_ANDROID_INPUT_PLATFORM_H_
2121
22#include "input_platform.h"22#include "mir/input/input_platform.h"
2323
24namespace mir24namespace mir
25{25{
26namespace client
27{
28namespace input26namespace input
29{27{
28namespace receiver
29{
30namespace android30namespace android
31{31{
3232
3333
=== renamed file 'src/client/input/android_input_receiver.cpp' => 'src/shared/input/android/android_input_receiver.cpp'
--- src/client/input/android_input_receiver.cpp 2013-04-24 05:22:20 +0000
+++ src/shared/input/android/android_input_receiver.cpp 2013-05-14 00:10:31 +0000
@@ -17,41 +17,41 @@
17 */17 */
1818
19#include "android_input_receiver.h"19#include "android_input_receiver.h"
20#include "xkb_mapper.h"
2120
21#include "mir/input/xkb_mapper.h"
22#include "mir/input/android/android_input_lexicon.h"22#include "mir/input/android/android_input_lexicon.h"
2323
24#include <androidfw/InputTransport.h>24#include <androidfw/InputTransport.h>
25#include <utils/Looper.h>25#include <utils/Looper.h>
2626
27namespace mcli = mir::client::input;27namespace mircv = mir::input::receiver;
28namespace mclia = mcli::android;28namespace mircva = mircv::android;
2929
30namespace mia = mir::input::android;30namespace mia = mir::input::android;
3131
32mclia::InputReceiver::InputReceiver(droidinput::sp<droidinput::InputChannel> const& input_channel)32mircva::InputReceiver::InputReceiver(droidinput::sp<droidinput::InputChannel> const& input_channel)
33 : input_channel(input_channel),33 : input_channel(input_channel),
34 input_consumer(std::make_shared<droidinput::InputConsumer>(input_channel)),34 input_consumer(std::make_shared<droidinput::InputConsumer>(input_channel)),
35 looper(new droidinput::Looper(true)),35 looper(new droidinput::Looper(true)),
36 fd_added(false),36 fd_added(false),
37 xkb_mapper(std::make_shared<mcli::XKBMapper>())37 xkb_mapper(std::make_shared<mircv::XKBMapper>())
38{38{
39}39}
4040
41mclia::InputReceiver::InputReceiver(int fd)41mircva::InputReceiver::InputReceiver(int fd)
42 : input_channel(new droidinput::InputChannel(droidinput::String8(""), fd)), 42 : input_channel(new droidinput::InputChannel(droidinput::String8(""), fd)),
43 input_consumer(std::make_shared<droidinput::InputConsumer>(input_channel)),43 input_consumer(std::make_shared<droidinput::InputConsumer>(input_channel)),
44 looper(new droidinput::Looper(true)),44 looper(new droidinput::Looper(true)),
45 fd_added(false),45 fd_added(false),
46 xkb_mapper(std::make_shared<mcli::XKBMapper>())46 xkb_mapper(std::make_shared<mircv::XKBMapper>())
47{47{
48}48}
4949
50mclia::InputReceiver::~InputReceiver()50mircva::InputReceiver::~InputReceiver()
51{51{
52}52}
5353
54int mclia::InputReceiver::fd() const54int mircva::InputReceiver::fd() const
55{55{
56 return input_channel->getFd();56 return input_channel->getFd();
57}57}
@@ -59,7 +59,7 @@
59namespace59namespace
60{60{
6161
62static void map_key_event(std::shared_ptr<mcli::XKBMapper> const& xkb_mapper, MirEvent &ev)62static void map_key_event(std::shared_ptr<mircv::XKBMapper> const& xkb_mapper, MirEvent &ev)
63{63{
64 // TODO: As XKBMapper is used to track modifier state we need to use a seperate instance64 // TODO: As XKBMapper is used to track modifier state we need to use a seperate instance
65 // of XKBMapper per device id (or modify XKBMapper semantics)65 // of XKBMapper per device id (or modify XKBMapper semantics)
@@ -77,7 +77,7 @@
7777
78// TODO: We use a droidinput::Looper here for polling functionality but it might be nice to integrate78// TODO: We use a droidinput::Looper here for polling functionality but it might be nice to integrate
79// with the existing client io_service ~racarr ~tvoss79// with the existing client io_service ~racarr ~tvoss
80bool mclia::InputReceiver::next_event(std::chrono::milliseconds const& timeout, MirEvent &ev)80bool mircva::InputReceiver::next_event(std::chrono::milliseconds const& timeout, MirEvent &ev)
81{81{
82 droidinput::InputEvent *android_event;82 droidinput::InputEvent *android_event;
83 uint32_t event_sequence_id;83 uint32_t event_sequence_id;
@@ -113,7 +113,7 @@
113 return handled_event;113 return handled_event;
114}114}
115115
116void mclia::InputReceiver::wake()116void mircva::InputReceiver::wake()
117{117{
118 looper->wake();118 looper->wake();
119}119}
120120
=== renamed file 'src/client/input/android_input_receiver.h' => 'src/shared/input/android/android_input_receiver.h'
--- src/client/input/android_input_receiver.h 2013-04-24 05:22:20 +0000
+++ src/shared/input/android/android_input_receiver.h 2013-05-14 00:10:31 +0000
@@ -16,8 +16,8 @@
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_ANDROID_INPUT_RECEIVER_H_19#ifndef MIR_INPUT_RECEIVER_ANDROID_INPUT_RECEIVER_H_
20#define MIR_INPUT_ANDROID_INPUT_RECEIVER_H_20#define MIR_INPUT_RECEIVER_ANDROID_INPUT_RECEIVER_H_
2121
22#include "mir_toolkit/event.h"22#include "mir_toolkit/event.h"
2323
@@ -38,10 +38,10 @@
3838
39namespace mir39namespace mir
40{40{
41namespace client
42{
43namespace input41namespace input
44{42{
43namespace receiver
44{
45class XKBMapper;45class XKBMapper;
4646
47namespace android47namespace android
@@ -85,4 +85,4 @@
85}85}
86} // namespace mir86} // namespace mir
8787
88#endif // MIR_INPUT_ANDROID_INPUT_RECEIVER_H_88#endif // MIR_INPUT_RECEIVER_ANDROID_INPUT_RECEIVER_H_
8989
=== renamed file 'src/client/input/android_input_receiver_thread.cpp' => 'src/shared/input/android/android_input_receiver_thread.cpp'
--- src/client/input/android_input_receiver_thread.cpp 2013-04-24 05:22:20 +0000
+++ src/shared/input/android/android_input_receiver_thread.cpp 2013-05-14 00:10:31 +0000
@@ -21,9 +21,9 @@
2121
22#include <thread>22#include <thread>
2323
24namespace mclia = mir::client::input::android;24namespace mircva = mir::input::receiver::android;
2525
26mclia::InputReceiverThread::InputReceiverThread(std::shared_ptr<mclia::InputReceiver> const& receiver,26mircva::InputReceiverThread::InputReceiverThread(std::shared_ptr<mircva::InputReceiver> const& receiver,
27 std::function<void(MirEvent*)> const& event_handling_callback)27 std::function<void(MirEvent*)> const& event_handling_callback)
28 : receiver(receiver),28 : receiver(receiver),
29 handler(event_handling_callback),29 handler(event_handling_callback),
@@ -31,7 +31,7 @@
31{31{
32}32}
3333
34mclia::InputReceiverThread::~InputReceiverThread()34mircva::InputReceiverThread::~InputReceiverThread()
35{35{
36 if (running)36 if (running)
37 stop();37 stop();
@@ -39,24 +39,24 @@
39 join();39 join();
40}40}
4141
42void mclia::InputReceiverThread::start()42void mircva::InputReceiverThread::start()
43{43{
44 running = true;44 running = true;
45 thread = std::thread(std::mem_fn(&mclia::InputReceiverThread::thread_loop), this);45 thread = std::thread(std::mem_fn(&mircva::InputReceiverThread::thread_loop), this);
46}46}
4747
48void mclia::InputReceiverThread::stop()48void mircva::InputReceiverThread::stop()
49{49{
50 running = false;50 running = false;
51 receiver->wake();51 receiver->wake();
52}52}
5353
54void mclia::InputReceiverThread::join()54void mircva::InputReceiverThread::join()
55{55{
56 thread.join();56 thread.join();
57}57}
5858
59void mclia::InputReceiverThread::thread_loop()59void mircva::InputReceiverThread::thread_loop()
60{60{
61 while (running)61 while (running)
62 {62 {
6363
=== renamed file 'src/client/input/android_input_receiver_thread.h' => 'src/shared/input/android/android_input_receiver_thread.h'
--- src/client/input/android_input_receiver_thread.h 2013-04-24 05:22:20 +0000
+++ src/shared/input/android/android_input_receiver_thread.h 2013-05-14 00:10:31 +0000
@@ -16,10 +16,10 @@
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_ANDROID_INPUT_RECEIVER_THREAD_H_19#ifndef MIR_INPUT_RECEIVER_ANDROID_INPUT_RECEIVER_THREAD_H_
20#define MIR_INPUT_ANDROID_INPUT_RECEIVER_THREAD_H_20#define MIR_INPUT_RECEIVER_ANDROID_INPUT_RECEIVER_THREAD_H_
2121
22#include "input_receiver_thread.h"22#include "mir/input/input_receiver_thread.h"
2323
24#include "mir_toolkit/event.h"24#include "mir_toolkit/event.h"
2525
@@ -30,16 +30,16 @@
3030
31namespace mir31namespace mir
32{32{
33namespace client
34{
35namespace input33namespace input
36{34{
35namespace receiver
36{
37namespace android37namespace android
38{38{
39class InputReceiver;39class InputReceiver;
4040
41/// Responsible for polling an InputReceiver to read and dispatch events when appropriate.41/// Responsible for polling an InputReceiver to read and dispatch events when appropriate.
42class InputReceiverThread : public input::InputReceiverThread42class InputReceiverThread : public receiver::InputReceiverThread
43{43{
44public:44public:
45 InputReceiverThread(std::shared_ptr<InputReceiver> const& receiver, 45 InputReceiverThread(std::shared_ptr<InputReceiver> const& receiver,
@@ -68,4 +68,4 @@
68}68}
69} // namespace mir69} // namespace mir
7070
71#endif // MIR_INPUT_ANDROID_INPUT_RECEIVER_THREAD_H_71#endif // MIR_INPUT_RECEIVER_ANDROID_INPUT_RECEIVER_THREAD_H_
7272
=== renamed file 'src/client/input/xkb_mapper.cpp' => 'src/shared/input/xkb_mapper.cpp'
--- src/client/input/xkb_mapper.cpp 2013-04-15 14:47:44 +0000
+++ src/shared/input/xkb_mapper.cpp 2013-05-14 00:10:31 +0000
@@ -16,11 +16,11 @@
16 * Authored by: Robert Carr <robert.carr@canonical.com>16 * Authored by: Robert Carr <robert.carr@canonical.com>
17 */17 */
1818
19#include "xkb_mapper.h"19#include "mir/input/xkb_mapper.h"
2020
21#include <string.h>21#include <string.h>
2222
23namespace mcli = mir::client::input;23namespace mircv = mir::input::receiver;
2424
25namespace25namespace
26{26{
@@ -47,7 +47,7 @@
47};47};
48}48}
4949
50mcli::XKBMapper::XKBMapper()50mircv::XKBMapper::XKBMapper()
51{51{
52 xkb_rule_names names;52 xkb_rule_names names;
53 names.rules = "evdev";53 names.rules = "evdev";
@@ -85,7 +85,7 @@
8585
86}86}
8787
88xkb_keysym_t mcli::XKBMapper::press_and_map_key(int scan_code)88xkb_keysym_t mircv::XKBMapper::press_and_map_key(int scan_code)
89{89{
90 uint32_t xkb_scan_code = to_xkb_scan_code(scan_code);90 uint32_t xkb_scan_code = to_xkb_scan_code(scan_code);
91 xkb_state_update_key(state.get(), xkb_scan_code, XKB_KEY_DOWN);91 xkb_state_update_key(state.get(), xkb_scan_code, XKB_KEY_DOWN);
@@ -93,7 +93,7 @@
93 return keysym_for_scan_code(state.get(), xkb_scan_code);93 return keysym_for_scan_code(state.get(), xkb_scan_code);
94}94}
9595
96xkb_keysym_t mcli::XKBMapper::release_and_map_key(int scan_code)96xkb_keysym_t mircv::XKBMapper::release_and_map_key(int scan_code)
97{97{
98 uint32_t xkb_scan_code = to_xkb_scan_code(scan_code);98 uint32_t xkb_scan_code = to_xkb_scan_code(scan_code);
99 xkb_state_update_key(state.get(), xkb_scan_code, XKB_KEY_UP);99 xkb_state_update_key(state.get(), xkb_scan_code, XKB_KEY_UP);
100100
=== modified file 'tests/unit-tests/client/input/test_android_input_receiver.cpp'
--- tests/unit-tests/client/input/test_android_input_receiver.cpp 2013-04-24 05:22:20 +0000
+++ tests/unit-tests/client/input/test_android_input_receiver.cpp 2013-05-14 00:10:31 +0000
@@ -16,7 +16,7 @@
16 * Authored by: Robert Carr <robert.carr@canonical.com>16 * Authored by: Robert Carr <robert.carr@canonical.com>
17 */17 */
1818
19#include "src/client/input/android_input_receiver.h"19#include "src/shared/input/android/android_input_receiver.h"
20#include "mir_toolkit/event.h"20#include "mir_toolkit/event.h"
2121
22#include <androidfw/InputTransport.h>22#include <androidfw/InputTransport.h>
@@ -27,7 +27,7 @@
27#include <unistd.h>27#include <unistd.h>
28#include <memory>28#include <memory>
2929
30namespace mclia = mir::client::input::android;30namespace mircva = mir::input::receiver::android;
3131
32namespace droidinput = android;32namespace droidinput = android;
3333
@@ -141,14 +141,14 @@
141141
142TEST_F(AndroidInputReceiverSetup, receiever_takes_channel_fd)142TEST_F(AndroidInputReceiverSetup, receiever_takes_channel_fd)
143{143{
144 mclia::InputReceiver receiver(android_client_channel);144 mircva::InputReceiver receiver(android_client_channel);
145 145
146 EXPECT_EQ(android_client_channel->getFd(), receiver.fd());146 EXPECT_EQ(android_client_channel->getFd(), receiver.fd());
147}147}
148148
149TEST_F(AndroidInputReceiverSetup, receiver_receives_key_events)149TEST_F(AndroidInputReceiverSetup, receiver_receives_key_events)
150{150{
151 mclia::InputReceiver receiver(android_client_channel);151 mircva::InputReceiver receiver(android_client_channel);
152 TestingInputProducer producer(android_server_channel);152 TestingInputProducer producer(android_server_channel);
153 153
154 producer.produce_a_key_event();154 producer.produce_a_key_event();
@@ -164,7 +164,7 @@
164164
165TEST_F(AndroidInputReceiverSetup, receiver_handles_events)165TEST_F(AndroidInputReceiverSetup, receiver_handles_events)
166{166{
167 mclia::InputReceiver receiver(android_client_channel);167 mircva::InputReceiver receiver(android_client_channel);
168 TestingInputProducer producer(android_server_channel);168 TestingInputProducer producer(android_server_channel);
169 169
170 producer.produce_a_key_event();170 producer.produce_a_key_event();
@@ -180,7 +180,7 @@
180180
181TEST_F(AndroidInputReceiverSetup, receiver_consumes_batched_motion_events)181TEST_F(AndroidInputReceiverSetup, receiver_consumes_batched_motion_events)
182{182{
183 mclia::InputReceiver receiver(android_client_channel);183 mircva::InputReceiver receiver(android_client_channel);
184 TestingInputProducer producer(android_server_channel);184 TestingInputProducer producer(android_server_channel);
185 185
186 // Produce 3 motion events before client handles any.186 // Produce 3 motion events before client handles any.
187187
=== modified file 'tests/unit-tests/client/input/test_android_input_receiver_thread.cpp'
--- tests/unit-tests/client/input/test_android_input_receiver_thread.cpp 2013-04-24 05:22:20 +0000
+++ tests/unit-tests/client/input/test_android_input_receiver_thread.cpp 2013-05-14 00:10:31 +0000
@@ -16,8 +16,8 @@
16 * Authored by: Robert Carr <robert.carr@canonical.com>16 * Authored by: Robert Carr <robert.carr@canonical.com>
17 */17 */
1818
19#include "src/client/input/android_input_receiver_thread.h"19#include "src/shared/input/android/android_input_receiver_thread.h"
20#include "src/client/input/android_input_receiver.h"20#include "src/shared/input/android/android_input_receiver.h"
2121
22#include "mir_toolkit/mir_client_library.h"22#include "mir_toolkit/mir_client_library.h"
2323
@@ -30,7 +30,7 @@
3030
31#include <fcntl.h>31#include <fcntl.h>
3232
33namespace mclia = mir::client::input::android;33namespace mircva = mir::input::receiver::android;
3434
35namespace35namespace
36{36{
@@ -40,7 +40,7 @@
40 MOCK_METHOD1(handle_event, void(MirEvent*));40 MOCK_METHOD1(handle_event, void(MirEvent*));
41};41};
4242
43struct MockInputReceiver : public mclia::InputReceiver43struct MockInputReceiver : public mircva::InputReceiver
44{44{
45 MockInputReceiver(int fd)45 MockInputReceiver(int fd)
46 : InputReceiver(fd)46 : InputReceiver(fd)
@@ -77,7 +77,7 @@
77{77{
78 using namespace ::testing;78 using namespace ::testing;
7979
80 mclia::InputReceiverThread input_thread(input_receiver, 80 mircva::InputReceiverThread input_thread(input_receiver,
81 std::function<void(MirEvent*)>()); 81 std::function<void(MirEvent*)>());
82 {82 {
83 InSequence seq;83 InSequence seq;
@@ -105,7 +105,7 @@
105 MockEventHandler &handler;105 MockEventHandler &handler;
106 } input_delegate(mock_handler);106 } input_delegate(mock_handler);
107107
108 mclia::InputReceiverThread input_thread(input_receiver, input_delegate);108 mircva::InputReceiverThread input_thread(input_receiver, input_delegate);
109 {109 {
110 InSequence seq;110 InSequence seq;
111111
@@ -138,7 +138,7 @@
138 std::atomic<bool> &handled;138 std::atomic<bool> &handled;
139 } input_delegate(handled);139 } input_delegate(handled);
140140
141 mclia::InputReceiverThread input_thread(input_receiver, input_delegate);141 mircva::InputReceiverThread input_thread(input_receiver, input_delegate);
142 {142 {
143 InSequence seq;143 InSequence seq;
144144
145145
=== modified file 'tests/unit-tests/client/input/test_xkb_mapper.cpp'
--- tests/unit-tests/client/input/test_xkb_mapper.cpp 2013-04-08 22:50:00 +0000
+++ tests/unit-tests/client/input/test_xkb_mapper.cpp 2013-05-14 00:10:31 +0000
@@ -16,7 +16,7 @@
16 * Authored by: Robert Carr <robert.carr@canonical.com>16 * Authored by: Robert Carr <robert.carr@canonical.com>
17 */17 */
1818
19#include "src/client/input/xkb_mapper.h"19#include "mir/input/xkb_mapper.h"
2020
21#include <xkbcommon/xkbcommon-keysyms.h>21#include <xkbcommon/xkbcommon-keysyms.h>
22#include <xkbcommon/xkbcommon.h>22#include <xkbcommon/xkbcommon.h>
@@ -25,11 +25,11 @@
2525
26#include <gtest/gtest.h>26#include <gtest/gtest.h>
2727
28namespace mcli = mir::client::input;28namespace mircv = mir::input::receiver;
2929
30TEST(XKBMapper, maps_generic_us_english_keys)30TEST(XKBMapper, maps_generic_us_english_keys)
31{31{
32 mcli::XKBMapper mapper;32 mircv::XKBMapper mapper;
3333
34 EXPECT_EQ(static_cast<xkb_keysym_t>(XKB_KEY_4), mapper.press_and_map_key(KEY_4));34 EXPECT_EQ(static_cast<xkb_keysym_t>(XKB_KEY_4), mapper.press_and_map_key(KEY_4));
35 EXPECT_EQ(static_cast<xkb_keysym_t>(XKB_KEY_Shift_L), mapper.press_and_map_key(KEY_LEFTSHIFT));35 EXPECT_EQ(static_cast<xkb_keysym_t>(XKB_KEY_Shift_L), mapper.press_and_map_key(KEY_LEFTSHIFT));
3636
=== modified file 'tests/unit-tests/client/test_client_mir_surface.cpp'
--- tests/unit-tests/client/test_client_mir_surface.cpp 2013-05-09 15:23:09 +0000
+++ tests/unit-tests/client/test_client_mir_surface.cpp 2013-05-14 00:10:31 +0000
@@ -25,9 +25,10 @@
25#include "src/client/client_platform_factory.h"25#include "src/client/client_platform_factory.h"
26#include "src/client/mir_surface.h"26#include "src/client/mir_surface.h"
27#include "src/client/mir_connection.h"27#include "src/client/mir_connection.h"
28#include "src/client/input/input_platform.h"28
29#include "src/client/input/input_receiver_thread.h"
30#include "mir/frontend/resource_cache.h"29#include "mir/frontend/resource_cache.h"
30#include "mir/input/input_platform.h"
31#include "mir/input/input_receiver_thread.h"
3132
32#include "mir_test/test_protobuf_server.h"33#include "mir_test/test_protobuf_server.h"
33#include "mir_test/stub_server_tool.h"34#include "mir_test/stub_server_tool.h"
@@ -43,7 +44,7 @@
43#include <fcntl.h>44#include <fcntl.h>
4445
45namespace mcl = mir::client;46namespace mcl = mir::client;
46namespace mcli = mcl::input;47namespace mircv = mir::input::receiver;
47namespace mp = mir::protobuf;48namespace mp = mir::protobuf;
48namespace geom = mir::geometry;49namespace geom = mir::geometry;
4950
@@ -230,20 +231,20 @@
230 }231 }
231};232};
232233
233struct StubClientInputPlatform : public mcli::InputPlatform234struct StubClientInputPlatform : public mircv::InputPlatform
234{235{
235 std::shared_ptr<mcli::InputReceiverThread> create_input_thread(int /* fd */, std::function<void(MirEvent*)> const& /* callback */)236 std::shared_ptr<mircv::InputReceiverThread> create_input_thread(int /* fd */, std::function<void(MirEvent*)> const& /* callback */)
236 {237 {
237 return std::shared_ptr<mcli::InputReceiverThread>();238 return std::shared_ptr<mircv::InputReceiverThread>();
238 }239 }
239};240};
240241
241struct MockClientInputPlatform : public mcli::InputPlatform242struct MockClientInputPlatform : public mircv::InputPlatform
242{243{
243 MOCK_METHOD2(create_input_thread, std::shared_ptr<mcli::InputReceiverThread>(int, std::function<void(MirEvent*)> const&));244 MOCK_METHOD2(create_input_thread, std::shared_ptr<mircv::InputReceiverThread>(int, std::function<void(MirEvent*)> const&));
244};245};
245246
246struct MockInputReceiverThread : public mcli::InputReceiverThread247struct MockInputReceiverThread : public mircv::InputReceiverThread
247{248{
248 MOCK_METHOD0(start, void());249 MOCK_METHOD0(start, void());
249 MOCK_METHOD0(stop, void());250 MOCK_METHOD0(stop, void());

Subscribers

People subscribed via source and target branches