Merge lp:~mir-team/mir/rename-everything into lp:mir
- rename-everything
- Merge into development-branch
Status: | Rejected |
---|---|
Rejected by: | Robert Carr |
Proposed branch: | lp:~mir-team/mir/rename-everything |
Merge into: | lp:mir |
Diff against target: |
1762 lines (+362/-362) 17 files modified
examples/demo_client_display_config.c (+4/-4) examples/eglapp.c (+3/-3) examples/fingerpaint.c (+16/-16) examples/server_example_input_event_filter.cpp (+4/-4) examples/server_example_input_filter.cpp (+8/-8) include/common/mir/events/event_builders.h (+7/-7) include/common/mir_toolkit/events/input/input_event.h (+10/-10) include/common/mir_toolkit/events/input/key_input_event.h (+12/-12) include/common/mir_toolkit/events/input/pointer_input_event.h (+18/-18) include/common/mir_toolkit/events/input/touch_input_event.h (+18/-18) src/client/logging/input_receiver_report.cpp (+21/-21) src/client/lttng/input_receiver_report.cpp (+15/-15) src/common/events/event_builders.cpp (+23/-23) src/common/input/input_event.cpp (+57/-57) tests/include/mir_test/event_matchers.h (+56/-56) tests/unit-tests/input/test_event_builders.cpp (+36/-36) tests/unit-tests/input/test_input_event.cpp (+54/-54) |
To merge this branch: | bzr merge lp:~mir-team/mir/rename-everything |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
PS Jenkins bot (community) | continuous-integration | Approve | |
Robert Carr (community) | Disapprove | ||
Daniel van Vugt | Disapprove | ||
Chris Halse Rogers | Approve | ||
Review via email: mp+248543@code.launchpad.net |
Commit message
Rename Mir(*)InputEvent to Mir(*)Input.
Description of the change
Rename Mir(*)InputEvent to Mir(*)Input.
I prefer the semantics of this naming style e.g. MirTouchInput to MirTouchEvent (the idea being that MirTouchInput is a sample of touch input which was delivered in an event).
Conveniently it also solves the naming conflict with the "MirTouchEvent" scheme where "MirKeyEvent" would conflict with the old MirKeyEvent.
Alan Griffiths (alan-griffiths) wrote : | # |
Chris Halse Rogers (raof) wrote : | # |
LGTM. I don't mind whether or not we rename the function in the examples.
- 2290. By Robert Carr
-
Update example
Daniel van Vugt (vanvugt) wrote : | # |
I think calling Input an object is confusing. Input is a general concept that happens. It doesn't have a start or an end. Which is confusing. An "event" however does, so it's clearer what an event is.
I don't want this to become another case of A is disapproved so we land B which is worse. What's in lp:mir right now is better than this, and also needs fixing.
Robert Carr (robertcarr) : | # |
PS Jenkins bot (ps-jenkins) wrote : | # |
PASSED: Continuous integration, rev:2290
http://
Executed test runs:
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
Unmerged revisions
- 2290. By Robert Carr
-
Update example
- 2289. By Robert Carr
-
Rename input event types
Preview Diff
1 | === modified file 'examples/demo_client_display_config.c' |
2 | --- examples/demo_client_display_config.c 2015-01-21 07:34:50 +0000 |
3 | +++ examples/demo_client_display_config.c 2015-02-04 13:19:24 +0000 |
4 | @@ -295,11 +295,11 @@ |
5 | ctx->reconfigure = 1; |
6 | } |
7 | |
8 | -static void handle_key_input_event(struct ClientContext *ctx, MirKeyInputEvent const* event) |
9 | +static void handle_key_input(struct ClientContext *ctx, MirKeyInput const* event) |
10 | { |
11 | - if (mir_key_input_event_get_action(event) != mir_key_input_event_action_up) |
12 | + if (mir_key_input_get_action(event) != mir_key_input_action_up) |
13 | return; |
14 | - xkb_keysym_t key_code = mir_key_input_event_get_key_code(event); |
15 | + xkb_keysym_t key_code = mir_key_input_get_key_code(event); |
16 | |
17 | if (key_code >= XKB_KEY_1 && |
18 | key_code <= XKB_KEY_9) |
19 | @@ -340,7 +340,7 @@ |
20 | if (mir_input_event_get_type(input_event) != mir_input_event_type_key) |
21 | return; |
22 | |
23 | - handle_key_input_event(ctx, mir_input_event_get_key_input_event(input_event)); |
24 | + handle_key_input(ctx, mir_input_event_get_key_input(input_event)); |
25 | } |
26 | |
27 | int main(int argc, char *argv[]) |
28 | |
29 | === modified file 'examples/eglapp.c' |
30 | --- examples/eglapp.c 2015-01-27 03:02:22 +0000 |
31 | +++ examples/eglapp.c 2015-02-04 13:19:24 +0000 |
32 | @@ -96,10 +96,10 @@ |
33 | { |
34 | if (mir_input_event_get_type(event) != mir_input_event_type_key) |
35 | return; |
36 | - MirKeyInputEvent const* kev = mir_input_event_get_key_input_event(event); |
37 | - if (mir_key_input_event_get_action(kev) != mir_key_input_event_action_up) |
38 | + MirKeyInput const* kev = mir_input_event_get_key_input(event); |
39 | + if (mir_key_input_get_action(kev) != mir_key_input_action_up) |
40 | return; |
41 | - if (mir_key_input_event_get_key_code(kev) != XKB_KEY_q) |
42 | + if (mir_key_input_get_key_code(kev) != XKB_KEY_q) |
43 | return; |
44 | |
45 | running = 0; |
46 | |
47 | === modified file 'examples/fingerpaint.c' |
48 | --- examples/fingerpaint.c 2015-01-22 09:00:14 +0000 |
49 | +++ examples/fingerpaint.c 2015-02-04 13:19:24 +0000 |
50 | @@ -212,8 +212,8 @@ |
51 | static float max_pressure = 1.0f; |
52 | |
53 | MirInputEvent const* input_event = mir_event_get_input_event(event); |
54 | - MirTouchInputEvent const* tev = NULL; |
55 | - MirPointerInputEvent const* pev = NULL; |
56 | + MirTouchInput const* tev = NULL; |
57 | + MirPointerInput const* pev = NULL; |
58 | unsigned touch_count = 0; |
59 | bool ended = false; |
60 | MirInputEventType type = mir_input_event_get_type(input_event); |
61 | @@ -221,17 +221,17 @@ |
62 | switch (type) |
63 | { |
64 | case mir_input_event_type_touch: |
65 | - tev = mir_input_event_get_touch_input_event(input_event); |
66 | - touch_count = mir_touch_input_event_get_touch_count(tev); |
67 | + tev = mir_input_event_get_touch_input(input_event); |
68 | + touch_count = mir_touch_input_get_touch_count(tev); |
69 | ended = touch_count == 1 && |
70 | - (mir_touch_input_event_get_touch_action(tev, 0) == |
71 | - mir_touch_input_event_action_up); |
72 | + (mir_touch_input_get_touch_action(tev, 0) == |
73 | + mir_touch_input_action_up); |
74 | break; |
75 | case mir_input_event_type_pointer: |
76 | - pev = mir_input_event_get_pointer_input_event(input_event); |
77 | - ended = mir_pointer_input_event_get_action(pev) == |
78 | - mir_pointer_input_event_action_button_up; |
79 | - touch_count = mir_pointer_input_event_get_button_state(pev, |
80 | + pev = mir_input_event_get_pointer_input(input_event); |
81 | + ended = mir_pointer_input_get_action(pev) == |
82 | + mir_pointer_input_action_button_up; |
83 | + touch_count = mir_pointer_input_get_button_state(pev, |
84 | mir_pointer_input_button_primary) ? 1 : 0; |
85 | default: |
86 | break; |
87 | @@ -259,21 +259,21 @@ |
88 | |
89 | if (tev != NULL) |
90 | { |
91 | - x = mir_touch_input_event_get_touch_axis_value(tev, p, |
92 | + x = mir_touch_input_get_touch_axis_value(tev, p, |
93 | mir_touch_input_axis_x); |
94 | - y = mir_touch_input_event_get_touch_axis_value(tev, p, |
95 | + y = mir_touch_input_get_touch_axis_value(tev, p, |
96 | mir_touch_input_axis_y); |
97 | - float size = mir_touch_input_event_get_touch_axis_value( |
98 | + float size = mir_touch_input_get_touch_axis_value( |
99 | tev, p, mir_touch_input_axis_size); |
100 | - pressure = mir_touch_input_event_get_touch_axis_value(tev, |
101 | + pressure = mir_touch_input_get_touch_axis_value(tev, |
102 | p, mir_touch_input_axis_pressure); |
103 | radius = size * 50.0f + 1.0f; |
104 | } |
105 | else if (pev != NULL) |
106 | { |
107 | - x = mir_pointer_input_event_get_axis_value(pev, |
108 | + x = mir_pointer_input_get_axis_value(pev, |
109 | mir_pointer_input_axis_x); |
110 | - y = mir_pointer_input_event_get_axis_value(pev, |
111 | + y = mir_pointer_input_get_axis_value(pev, |
112 | mir_pointer_input_axis_y); |
113 | pressure = 0.5f; |
114 | radius = 5; |
115 | |
116 | === modified file 'examples/server_example_input_event_filter.cpp' |
117 | --- examples/server_example_input_event_filter.cpp 2015-01-21 07:34:50 +0000 |
118 | +++ examples/server_example_input_event_filter.cpp 2015-02-04 13:19:24 +0000 |
119 | @@ -40,13 +40,13 @@ |
120 | MirInputEvent const* input_event = mir_event_get_input_event(&event); |
121 | if (mir_input_event_get_type(input_event) != mir_input_event_type_key) |
122 | return false; |
123 | - MirKeyInputEvent const* kev = mir_input_event_get_key_input_event(input_event); |
124 | - if (mir_key_input_event_get_action(kev) != mir_key_input_event_action_down) |
125 | + MirKeyInput const* kev = mir_input_event_get_key_input(input_event); |
126 | + if (mir_key_input_get_action(kev) != mir_key_input_action_down) |
127 | return false; |
128 | - MirInputEventModifiers mods = mir_key_input_event_get_modifiers(kev); |
129 | + MirInputModifiers mods = mir_key_input_get_modifiers(kev); |
130 | if (!(mods & mir_input_event_modifier_alt) || !(mods & mir_input_event_modifier_ctrl)) |
131 | return false; |
132 | - if (mir_key_input_event_get_scan_code(kev) == KEY_BACKSPACE) |
133 | + if (mir_key_input_get_scan_code(kev) == KEY_BACKSPACE) |
134 | { |
135 | quit_action(); |
136 | return true; |
137 | |
138 | === modified file 'examples/server_example_input_filter.cpp' |
139 | --- examples/server_example_input_filter.cpp 2015-01-21 07:34:50 +0000 |
140 | +++ examples/server_example_input_filter.cpp 2015-02-04 13:19:24 +0000 |
141 | @@ -35,9 +35,9 @@ |
142 | void print_key_event(MirInputEvent const* ev) |
143 | { |
144 | auto event_time = mir_input_event_get_event_time(ev); |
145 | - auto kev = mir_input_event_get_key_input_event(ev); |
146 | - auto scan_code = mir_key_input_event_get_scan_code(kev); |
147 | - auto key_code = mir_key_input_event_get_key_code(kev); |
148 | + auto kev = mir_input_event_get_key_input(ev); |
149 | + auto scan_code = mir_key_input_get_scan_code(kev); |
150 | + auto key_code = mir_key_input_get_key_code(kev); |
151 | |
152 | std::cout << "Handling key event (time, scancode, keycode): " << event_time << " " << |
153 | scan_code << " " << key_code << std::endl; |
154 | @@ -46,17 +46,17 @@ |
155 | void print_touch_event(MirInputEvent const* ev) |
156 | { |
157 | auto event_time = mir_input_event_get_event_time(ev); |
158 | - auto tev = mir_input_event_get_touch_input_event(ev); |
159 | - auto tc = mir_touch_input_event_get_touch_count(tev); |
160 | + auto tev = mir_input_event_get_touch_input(ev); |
161 | + auto tc = mir_touch_input_get_touch_count(tev); |
162 | |
163 | std::cout << "Handline touch event time=" << event_time |
164 | << " touch_count=" << tc << std::endl; |
165 | for (unsigned i = 0; i < tc; i++) |
166 | { |
167 | - auto id = mir_touch_input_event_get_touch_id(tev, i); |
168 | - auto px = mir_touch_input_event_get_touch_axis_value(tev, i, |
169 | + auto id = mir_touch_input_get_touch_id(tev, i); |
170 | + auto px = mir_touch_input_get_touch_axis_value(tev, i, |
171 | mir_touch_input_axis_x); |
172 | - auto py = mir_touch_input_event_get_touch_axis_value(tev, i, |
173 | + auto py = mir_touch_input_get_touch_axis_value(tev, i, |
174 | mir_touch_input_axis_y); |
175 | |
176 | std::cout << " " |
177 | |
178 | === modified file 'include/common/mir/events/event_builders.h' |
179 | --- include/common/mir/events/event_builders.h 2015-01-29 04:34:12 +0000 |
180 | +++ include/common/mir/events/event_builders.h 2015-02-04 13:19:24 +0000 |
181 | @@ -49,20 +49,20 @@ |
182 | |
183 | // Key event |
184 | EventUPtr make_event(MirInputDeviceId device_id, int64_t timestamp, |
185 | - MirKeyInputEventAction action, xkb_keysym_t key_code, |
186 | - int scan_code, MirInputEventModifiers modifiers); |
187 | + MirKeyInputAction action, xkb_keysym_t key_code, |
188 | + int scan_code, MirInputModifiers modifiers); |
189 | |
190 | // Touch event |
191 | EventUPtr make_event(MirInputDeviceId device_id, int64_t timestamp, |
192 | - MirInputEventModifiers modifiers); |
193 | -void add_touch(MirEvent &event, MirTouchInputEventTouchId touch_id, MirTouchInputEventTouchAction action, |
194 | - MirTouchInputEventTouchTooltype tooltype, float x_axis_value, float y_axis_value, |
195 | + MirInputModifiers modifiers); |
196 | +void add_touch(MirEvent &event, MirTouchInputTouchId touch_id, MirTouchInputTouchAction action, |
197 | + MirTouchInputTouchTooltype tooltype, float x_axis_value, float y_axis_value, |
198 | float pressure_value, float touch_major_value, float touch_minor_value, float size_value); |
199 | |
200 | // Pointer event |
201 | EventUPtr make_event(MirInputDeviceId device_id, int64_t timestamp, |
202 | - MirInputEventModifiers modifiers, MirPointerInputEventAction action, |
203 | - std::vector<MirPointerInputEventButton> const& buttons_pressed, |
204 | + MirInputModifiers modifiers, MirPointerInputAction action, |
205 | + std::vector<MirPointerInputButton> const& buttons_pressed, |
206 | float x_axis_value, float y_axis_value, |
207 | float hscroll_value, float vscroll_value); |
208 | } |
209 | |
210 | === modified file 'include/common/mir_toolkit/events/input/input_event.h' |
211 | --- include/common/mir_toolkit/events/input/input_event.h 2015-01-27 03:02:22 +0000 |
212 | +++ include/common/mir_toolkit/events/input/input_event.h 2015-02-04 13:19:24 +0000 |
213 | @@ -62,7 +62,7 @@ |
214 | mir_input_event_modifier_num_lock = 1 << 16, |
215 | mir_input_event_modifier_scroll_lock = 1 << 17 |
216 | } MirInputEventModifier; |
217 | -typedef unsigned int MirInputEventModifiers; |
218 | +typedef unsigned int MirInputModifiers; |
219 | |
220 | #ifdef __cplusplus |
221 | } |
222 | @@ -106,31 +106,31 @@ |
223 | MirInputEventType mir_input_event_get_type(MirInputEvent const* ev); |
224 | |
225 | /* |
226 | - * Retrieve the MirKeyInputEvent associated with a given input event. |
227 | + * Retrieve the MirKeyInput associated with a given input event. |
228 | * |
229 | * \param[in] event The input event |
230 | - * \return The MirKeyInputEvent or NULL if event type is not |
231 | + * \return The MirKeyInput or NULL if event type is not |
232 | * mir_input_event_type_key |
233 | */ |
234 | -MirKeyInputEvent const* mir_input_event_get_key_input_event(MirInputEvent const* ev); |
235 | +MirKeyInput const* mir_input_event_get_key_input(MirInputEvent const* ev); |
236 | |
237 | /* |
238 | - * Retrieve the MirTouchInputEvent associated with a given input event. |
239 | + * Retrieve the MirTouchInput associated with a given input event. |
240 | * |
241 | * \param[in] event The input event |
242 | - * \return The MirTouchInputEvent or NULL if event type is not |
243 | + * \return The MirTouchInput or NULL if event type is not |
244 | * mir_input_event_type_touch |
245 | */ |
246 | -MirTouchInputEvent const* mir_input_event_get_touch_input_event(MirInputEvent const* ev); |
247 | +MirTouchInput const* mir_input_event_get_touch_input(MirInputEvent const* ev); |
248 | |
249 | /* |
250 | - * Retrieve the MirPointerInputEvent associated with a given input event. |
251 | + * Retrieve the MirPointerInput associated with a given input event. |
252 | * |
253 | * \param[in] event The input event |
254 | - * \return The MirPointerInputEvent or NULL if event type is not |
255 | + * \return The MirPointerInput or NULL if event type is not |
256 | * mir_input_event_type_pointer |
257 | */ |
258 | -MirPointerInputEvent const* mir_input_event_get_pointer_input_event(MirInputEvent const* ev); |
259 | +MirPointerInput const* mir_input_event_get_pointer_input(MirInputEvent const* ev); |
260 | |
261 | #ifdef __cplusplus |
262 | } |
263 | |
264 | === modified file 'include/common/mir_toolkit/events/input/key_input_event.h' |
265 | --- include/common/mir_toolkit/events/input/key_input_event.h 2014-12-29 03:44:41 +0000 |
266 | +++ include/common/mir_toolkit/events/input/key_input_event.h 2015-02-04 13:19:24 +0000 |
267 | @@ -16,8 +16,8 @@ |
268 | * Authored by: Robert Carr <robert.carr@canonical.com> |
269 | */ |
270 | |
271 | -#ifndef MIR_TOOLKIT_KEY_INPUT_EVENT_H_ |
272 | -#define MIR_TOOLKIT_KEY_INPUT_EVENT_H_ |
273 | +#ifndef MIR_TOOLKIT_KEY_INPUT_H_ |
274 | +#define MIR_TOOLKIT_KEY_INPUT_H_ |
275 | |
276 | #include <xkbcommon/xkbcommon.h> |
277 | |
278 | @@ -32,20 +32,20 @@ |
279 | /** |
280 | * An event type describing a change in keyboard state |
281 | */ |
282 | -typedef struct MirKeyInputEvent MirKeyInputEvent; |
283 | +typedef struct MirKeyInput MirKeyInput; |
284 | |
285 | /** |
286 | * Possible actions for changing key state |
287 | */ |
288 | typedef enum { |
289 | /* A key has gone down */ |
290 | - mir_key_input_event_action_up, |
291 | + mir_key_input_action_up, |
292 | /* A key has come up */ |
293 | - mir_key_input_event_action_down, |
294 | + mir_key_input_action_down, |
295 | /* System policy has triggered a key repeat on a key |
296 | which was already down */ |
297 | - mir_key_input_event_action_repeat |
298 | -} MirKeyInputEventAction; |
299 | + mir_key_input_action_repeat |
300 | +} MirKeyInputAction; |
301 | |
302 | /** |
303 | * Retrieve the action which triggered a given key event. |
304 | @@ -53,7 +53,7 @@ |
305 | * \param [in] event The key event |
306 | * \return The associated action |
307 | */ |
308 | -MirKeyInputEventAction mir_key_input_event_get_action(MirKeyInputEvent const* event); |
309 | +MirKeyInputAction mir_key_input_get_action(MirKeyInput const* event); |
310 | |
311 | /** |
312 | * Retrieve the xkb mapped keycode associated with the key acted on.. May |
313 | @@ -62,7 +62,7 @@ |
314 | * \param [in] event The key event |
315 | * \return The xkb_keysym |
316 | */ |
317 | -xkb_keysym_t mir_key_input_event_get_key_code(MirKeyInputEvent const* event); |
318 | +xkb_keysym_t mir_key_input_get_key_code(MirKeyInput const* event); |
319 | |
320 | /** |
321 | * Retrieve the raw hardware scan code associated with the key acted on. May |
322 | @@ -71,7 +71,7 @@ |
323 | * \param [in] event The key event |
324 | * \return The scancode |
325 | */ |
326 | -int mir_key_input_event_get_scan_code(MirKeyInputEvent const* event); |
327 | +int mir_key_input_get_scan_code(MirKeyInput const* event); |
328 | |
329 | /** |
330 | * Retrieve the modifier keys pressed when the key action occured. |
331 | @@ -79,11 +79,11 @@ |
332 | * \param [in] event The key event |
333 | * \return The modifier mask |
334 | */ |
335 | -MirInputEventModifiers mir_key_input_event_get_modifiers(MirKeyInputEvent const* event); |
336 | +MirInputModifiers mir_key_input_get_modifiers(MirKeyInput const* event); |
337 | |
338 | #ifdef __cplusplus |
339 | } |
340 | /**@}*/ |
341 | #endif |
342 | |
343 | -#endif /* MIR_TOOLKIT_KEY_INPUT_EVENT_H_ */ |
344 | +#endif /* MIR_TOOLKIT_KEY_INPUT_H_ */ |
345 | |
346 | === modified file 'include/common/mir_toolkit/events/input/pointer_input_event.h' |
347 | --- include/common/mir_toolkit/events/input/pointer_input_event.h 2015-01-23 03:50:26 +0000 |
348 | +++ include/common/mir_toolkit/events/input/pointer_input_event.h 2015-02-04 13:19:24 +0000 |
349 | @@ -16,8 +16,8 @@ |
350 | * Authored by: Robert Carr <robert.carr@canonical.com> |
351 | */ |
352 | |
353 | -#ifndef MIR_TOOLKIT_POINTER_INPUT_EVENT_H_ |
354 | -#define MIR_TOOLKIT_POINTER_INPUT_EVENT_H_ |
355 | +#ifndef MIR_TOOLKIT_POINTER_INPUT_H_ |
356 | +#define MIR_TOOLKIT_POINTER_INPUT_H_ |
357 | |
358 | #include <stdbool.h> |
359 | |
360 | @@ -32,23 +32,23 @@ |
361 | /** |
362 | * An event type describing a change in pointer device state. |
363 | */ |
364 | -typedef struct MirPointerInputEvent MirPointerInputEvent; |
365 | +typedef struct MirPointerInput MirPointerInput; |
366 | |
367 | /** |
368 | * Possible pointer actions |
369 | */ |
370 | typedef enum { |
371 | /* A pointer button has come up */ |
372 | - mir_pointer_input_event_action_button_up = 0, |
373 | + mir_pointer_input_action_button_up = 0, |
374 | /* A pointer button has gone down */ |
375 | - mir_pointer_input_event_action_button_down = 1, |
376 | + mir_pointer_input_action_button_down = 1, |
377 | /* The pointer has entered the surface to which this event was delivered */ |
378 | - mir_pointer_input_event_action_enter = 2, |
379 | + mir_pointer_input_action_enter = 2, |
380 | /* The pointer has left the surface to which this event was delivered */ |
381 | - mir_pointer_input_event_action_leave = 3, |
382 | + mir_pointer_input_action_leave = 3, |
383 | /* Axis values have changed for the pointer */ |
384 | - mir_pointer_input_event_action_motion = 4 |
385 | -} MirPointerInputEventAction; |
386 | + mir_pointer_input_action_motion = 4 |
387 | +} MirPointerInputAction; |
388 | |
389 | /** |
390 | * Identifiers for pointer axis |
391 | @@ -62,7 +62,7 @@ |
392 | mir_pointer_input_axis_vscroll = 2, |
393 | /* Relative axis containing ticks reported by the horizontal scroll wheel */ |
394 | mir_pointer_input_axis_hscroll = 3 |
395 | -} MirPointerInputEventAxis; |
396 | +} MirPointerInputAxis; |
397 | |
398 | /* |
399 | * Identifiers for pointer buttons |
400 | @@ -73,7 +73,7 @@ |
401 | mir_pointer_input_button_tertiary = 3, |
402 | mir_pointer_input_button_back = 4, |
403 | mir_pointer_input_button_forward = 5 |
404 | -} MirPointerInputEventButton; |
405 | +} MirPointerInputButton; |
406 | |
407 | /** |
408 | * Retrieve the modifier keys pressed when the pointer action occured. |
409 | @@ -81,7 +81,7 @@ |
410 | * \param [in] event The pointer event |
411 | * \return The modifier mask |
412 | */ |
413 | -MirInputEventModifiers mir_pointer_input_event_get_modifiers(MirPointerInputEvent const* event); |
414 | +MirInputModifiers mir_pointer_input_get_modifiers(MirPointerInput const* event); |
415 | |
416 | /** |
417 | * Retrieve the action which occured to generate a given pointer event. |
418 | @@ -89,7 +89,7 @@ |
419 | * \param [in] event The pointer event |
420 | * \return Action performed by the pointer |
421 | */ |
422 | -MirPointerInputEventAction mir_pointer_input_event_get_action(MirPointerInputEvent const* event); |
423 | +MirPointerInputAction mir_pointer_input_get_action(MirPointerInput const* event); |
424 | |
425 | /** |
426 | * Retrieve the state of a given pointer button when the action occurred. |
427 | @@ -99,8 +99,8 @@ |
428 | * |
429 | * \return Whether the given button is depressed |
430 | */ |
431 | -bool mir_pointer_input_event_get_button_state(MirPointerInputEvent const* event, |
432 | - MirPointerInputEventButton button); |
433 | +bool mir_pointer_input_get_button_state(MirPointerInput const* event, |
434 | + MirPointerInputButton button); |
435 | |
436 | /** |
437 | * Retrieve the axis value reported by a given pointer event. |
438 | @@ -109,12 +109,12 @@ |
439 | * \param [in] axis The axis to retreive a value from |
440 | * \return The value of the given axis |
441 | */ |
442 | -float mir_pointer_input_event_get_axis_value(MirPointerInputEvent const* event, |
443 | - MirPointerInputEventAxis axis); |
444 | +float mir_pointer_input_get_axis_value(MirPointerInput const* event, |
445 | + MirPointerInputAxis axis); |
446 | |
447 | #ifdef __cplusplus |
448 | } |
449 | /**@}*/ |
450 | #endif |
451 | |
452 | -#endif /* MIR_TOOLKIT_POINTER_INPUT_EVENT_H_ */ |
453 | +#endif /* MIR_TOOLKIT_POINTER_INPUT_H_ */ |
454 | |
455 | === modified file 'include/common/mir_toolkit/events/input/touch_input_event.h' |
456 | --- include/common/mir_toolkit/events/input/touch_input_event.h 2014-12-29 03:44:41 +0000 |
457 | +++ include/common/mir_toolkit/events/input/touch_input_event.h 2015-02-04 13:19:24 +0000 |
458 | @@ -16,8 +16,8 @@ |
459 | * Authored by: Robert Carr <robert.carr@canonical.com> |
460 | */ |
461 | |
462 | -#ifndef MIR_TOOLKIT_TOUCH_INPUT_EVENT_H_ |
463 | -#define MIR_TOOLKIT_TOUCH_INPUT_EVENT_H_ |
464 | +#ifndef MIR_TOOLKIT_TOUCH_INPUT_H_ |
465 | +#define MIR_TOOLKIT_TOUCH_INPUT_H_ |
466 | |
467 | #ifdef __cplusplus |
468 | /** |
469 | @@ -30,26 +30,26 @@ |
470 | /** |
471 | * An event type describing a change in touch device state. |
472 | */ |
473 | -typedef struct MirTouchInputEvent MirTouchInputEvent; |
474 | +typedef struct MirTouchInput MirTouchInput; |
475 | |
476 | /** |
477 | * An identifier for a touch-point. TouchId's are unique per-gesture. |
478 | * That is to say, once a touch has gone down at time T, no other touch will |
479 | * use that touch's ID until all touches at time T have come up. |
480 | */ |
481 | -typedef int32_t MirTouchInputEventTouchId; |
482 | +typedef int32_t MirTouchInputTouchId; |
483 | |
484 | /** |
485 | * Possible per touch actions for state changing |
486 | */ |
487 | typedef enum { |
488 | /* This touch point is going up */ |
489 | - mir_touch_input_event_action_up = 0, |
490 | + mir_touch_input_action_up = 0, |
491 | /* This touch point is going down */ |
492 | - mir_touch_input_event_action_down = 1, |
493 | + mir_touch_input_action_down = 1, |
494 | /* Axis values have changed on this touch point */ |
495 | - mir_touch_input_event_action_change = 2 |
496 | -} MirTouchInputEventTouchAction; |
497 | + mir_touch_input_action_change = 2 |
498 | +} MirTouchInputTouchAction; |
499 | |
500 | /** |
501 | * Identifiers for touch axis |
502 | @@ -70,7 +70,7 @@ |
503 | /* Axis representing the diameter of a circle centered on the touch |
504 | point */ |
505 | mir_touch_input_axis_size = 5 |
506 | -} MirTouchInputEventTouchAxis; |
507 | +} MirTouchInputTouchAxis; |
508 | |
509 | /** |
510 | * Identifiers for per-touch tool types |
511 | @@ -82,7 +82,7 @@ |
512 | mir_touch_input_tool_type_finger = 1, |
513 | // Touch is made with a stylus |
514 | mir_touch_input_tool_type_stylus = 2 |
515 | -} MirTouchInputEventTouchTooltype; |
516 | +} MirTouchInputTouchTooltype; |
517 | |
518 | /** |
519 | * Retrieve the modifier keys pressed when the touch action occured. |
520 | @@ -90,7 +90,7 @@ |
521 | * \param [in] event The key event |
522 | * \return The modifier mask |
523 | */ |
524 | -MirInputEventModifiers mir_touch_input_event_get_modifiers(MirTouchInputEvent const* event); |
525 | +MirInputModifiers mir_touch_input_get_modifiers(MirTouchInput const* event); |
526 | |
527 | /** |
528 | * Retrieve the number of touches reported for a given touch event. Each touch |
529 | @@ -99,7 +99,7 @@ |
530 | * \param [in] event The touch event |
531 | * \return The number of touches |
532 | */ |
533 | -unsigned int mir_touch_input_event_get_touch_count(MirTouchInputEvent const* event); |
534 | +unsigned int mir_touch_input_get_touch_count(MirTouchInput const* event); |
535 | |
536 | /** |
537 | * Retrieve the TouchID for a touch at given index. |
538 | @@ -108,7 +108,7 @@ |
539 | * \param [in] touch_index The touch index. Must be less than (touch_count - 1). |
540 | * \return ID of the touch at index |
541 | */ |
542 | -MirTouchInputEventTouchId mir_touch_input_event_get_touch_id(MirTouchInputEvent const* event, size_t touch_index); |
543 | +MirTouchInputTouchId mir_touch_input_get_touch_id(MirTouchInput const* event, size_t touch_index); |
544 | |
545 | /** |
546 | * Retrieve the action which occured for a touch at given index. |
547 | @@ -117,7 +117,7 @@ |
548 | * \param [in] touch_index The touch index. Must be less than (touch_count - 1). |
549 | * \return Action performed for the touch at index. |
550 | */ |
551 | -MirTouchInputEventTouchAction mir_touch_input_event_get_touch_action(MirTouchInputEvent const* event, size_t touch_index); |
552 | +MirTouchInputTouchAction mir_touch_input_get_touch_action(MirTouchInput const* event, size_t touch_index); |
553 | |
554 | /** |
555 | * Retrieve the tooltype for touch at given index. |
556 | @@ -126,7 +126,7 @@ |
557 | * \param [in] touch_index The touch index. Must be less than (touch_count - 1). |
558 | * \return Tooltype used for the touch at index |
559 | */ |
560 | -MirTouchInputEventTouchTooltype mir_touch_input_event_get_touch_tooltype(MirTouchInputEvent const* event, |
561 | +MirTouchInputTouchTooltype mir_touch_input_get_touch_tooltype(MirTouchInput const* event, |
562 | size_t touch_index); |
563 | |
564 | |
565 | @@ -138,12 +138,12 @@ |
566 | * \param [in] axis The axis to retreive a value from |
567 | * \return The value of the given axis |
568 | */ |
569 | -float mir_touch_input_event_get_touch_axis_value(MirTouchInputEvent const* event, |
570 | - size_t touch_index, MirTouchInputEventTouchAxis axis); |
571 | +float mir_touch_input_get_touch_axis_value(MirTouchInput const* event, |
572 | + size_t touch_index, MirTouchInputTouchAxis axis); |
573 | |
574 | #ifdef __cplusplus |
575 | } |
576 | /**@}*/ |
577 | #endif |
578 | |
579 | -#endif /* MIR_TOOLKIT_TOUCH_INPUT_EVENT_H_ */ |
580 | +#endif /* MIR_TOOLKIT_TOUCH_INPUT_H_ */ |
581 | |
582 | === modified file 'src/client/logging/input_receiver_report.cpp' |
583 | --- src/client/logging/input_receiver_report.cpp 2015-02-02 12:18:18 +0000 |
584 | +++ src/client/logging/input_receiver_report.cpp 2015-02-04 13:19:24 +0000 |
585 | @@ -44,40 +44,40 @@ |
586 | |
587 | static void format_key_event(std::stringstream &ss, MirInputEvent const* ev) |
588 | { |
589 | - auto kev = mir_input_event_get_key_input_event(ev); |
590 | + auto kev = mir_input_event_get_key_input(ev); |
591 | |
592 | - ss << "MirKeyInputEvent {" << std::endl; |
593 | + ss << "MirKeyInput {" << std::endl; |
594 | ss << " device_id: " << mir_input_event_get_device_id(ev) << std::endl; |
595 | - ss << " action: " << mir_key_input_event_get_action(kev) << std::endl; |
596 | - ss << " modifiers: " << mir_key_input_event_get_modifiers(kev) << std::endl; |
597 | - ss << " key_code: " << mir_key_input_event_get_key_code(kev) << std::endl; |
598 | - ss << " scan_code: " << mir_key_input_event_get_scan_code(kev) << std::endl; |
599 | + ss << " action: " << mir_key_input_get_action(kev) << std::endl; |
600 | + ss << " modifiers: " << mir_key_input_get_modifiers(kev) << std::endl; |
601 | + ss << " key_code: " << mir_key_input_get_key_code(kev) << std::endl; |
602 | + ss << " scan_code: " << mir_key_input_get_scan_code(kev) << std::endl; |
603 | ss << " event_time: " << ml::input_timestamp(std::chrono::nanoseconds(mir_input_event_get_event_time(ev))) << std::endl; |
604 | ss << "}"; |
605 | } |
606 | |
607 | static void format_touch_event(std::stringstream &ss, MirInputEvent const* ev) |
608 | { |
609 | - auto tev = mir_input_event_get_touch_input_event(ev); |
610 | + auto tev = mir_input_event_get_touch_input(ev); |
611 | |
612 | - ss << "MirTouchInputEvent{" << std::endl; |
613 | + ss << "MirTouchInput{" << std::endl; |
614 | ss << " type: touch" << std::endl; |
615 | ss << " device_id: " << mir_input_event_get_device_id(ev) << std::endl; |
616 | - ss << " modifiers: " << mir_touch_input_event_get_modifiers(tev) << std::endl; |
617 | + ss << " modifiers: " << mir_touch_input_get_modifiers(tev) << std::endl; |
618 | ss << " event_time: " << ml::input_timestamp(std::chrono::nanoseconds(mir_input_event_get_event_time(ev))) << std::endl; |
619 | - auto touch_count = mir_touch_input_event_get_touch_count(tev); |
620 | + auto touch_count = mir_touch_input_get_touch_count(tev); |
621 | ss << " touch_count: " << touch_count << std::endl; |
622 | for (unsigned int i = 0; i < touch_count; i++) |
623 | { |
624 | ss << " touch[" << i << "]{" << std::endl; |
625 | - ss << " id: " << mir_touch_input_event_get_touch_id(tev, i) << std::endl; |
626 | - ss << " x: " << mir_touch_input_event_get_touch_axis_value(tev, i, mir_touch_input_axis_x) << std::endl; |
627 | - ss << " y: " << mir_touch_input_event_get_touch_axis_value(tev, i, mir_touch_input_axis_y) << std::endl; |
628 | - ss << " touch_major: " << mir_touch_input_event_get_touch_axis_value(tev, i, mir_touch_input_axis_touch_major) << std::endl; |
629 | - ss << " touch_minor: " << mir_touch_input_event_get_touch_axis_value(tev, i, mir_touch_input_axis_touch_minor) << std::endl; |
630 | - ss << " size: " << mir_touch_input_event_get_touch_axis_value(tev, i, mir_touch_input_axis_size) << std::endl; |
631 | - ss << " pressure: " << mir_touch_input_event_get_touch_axis_value(tev, i, mir_touch_input_axis_pressure) << std::endl; |
632 | - ss << " tool_type: " << mir_touch_input_event_get_touch_tooltype(tev, i) << std::endl; |
633 | + ss << " id: " << mir_touch_input_get_touch_id(tev, i) << std::endl; |
634 | + ss << " x: " << mir_touch_input_get_touch_axis_value(tev, i, mir_touch_input_axis_x) << std::endl; |
635 | + ss << " y: " << mir_touch_input_get_touch_axis_value(tev, i, mir_touch_input_axis_y) << std::endl; |
636 | + ss << " touch_major: " << mir_touch_input_get_touch_axis_value(tev, i, mir_touch_input_axis_touch_major) << std::endl; |
637 | + ss << " touch_minor: " << mir_touch_input_get_touch_axis_value(tev, i, mir_touch_input_axis_touch_minor) << std::endl; |
638 | + ss << " size: " << mir_touch_input_get_touch_axis_value(tev, i, mir_touch_input_axis_size) << std::endl; |
639 | + ss << " pressure: " << mir_touch_input_get_touch_axis_value(tev, i, mir_touch_input_axis_pressure) << std::endl; |
640 | + ss << " tool_type: " << mir_touch_input_get_touch_tooltype(tev, i) << std::endl; |
641 | ss << " }" << std::endl; |
642 | } |
643 | ss << "}"; |
644 | @@ -85,12 +85,12 @@ |
645 | |
646 | static void format_pointer_event(std::stringstream &ss, MirInputEvent const* ev) |
647 | { |
648 | - auto pev = mir_input_event_get_pointer_input_event(ev); |
649 | + auto pev = mir_input_event_get_pointer_input(ev); |
650 | |
651 | // TODO: Could be expanded |
652 | - ss << "MirPointerInputEvent {" << std::endl; |
653 | + ss << "MirPointerInput {" << std::endl; |
654 | ss << " device_id: " << mir_input_event_get_device_id(ev) << std::endl; |
655 | - ss << " action: " << mir_pointer_input_event_get_action(pev) << std::endl; |
656 | + ss << " action: " << mir_pointer_input_get_action(pev) << std::endl; |
657 | ss << " event_time: " << ml::input_timestamp(std::chrono::nanoseconds(mir_input_event_get_event_time(ev))) << std::endl; |
658 | ss << "}"; |
659 | } |
660 | |
661 | === modified file 'src/client/lttng/input_receiver_report.cpp' |
662 | --- src/client/lttng/input_receiver_report.cpp 2015-01-29 04:34:12 +0000 |
663 | +++ src/client/lttng/input_receiver_report.cpp 2015-02-04 13:19:24 +0000 |
664 | @@ -49,33 +49,33 @@ |
665 | |
666 | void mir::client::lttng::InputReceiverReport::report_key(MirInputEvent const* event) const |
667 | { |
668 | - auto kev = mir_input_event_get_key_input_event(event); |
669 | + auto kev = mir_input_event_get_key_input(event); |
670 | |
671 | mir_tracepoint(mir_client_input_receiver, key_event, mir_input_event_get_device_id(event), |
672 | - mir_key_input_event_get_action(kev), |
673 | - mir_key_input_event_get_modifiers(kev), |
674 | - mir_key_input_event_get_key_code(kev), |
675 | - mir_key_input_event_get_scan_code(kev), |
676 | + mir_key_input_get_action(kev), |
677 | + mir_key_input_get_modifiers(kev), |
678 | + mir_key_input_get_key_code(kev), |
679 | + mir_key_input_get_scan_code(kev), |
680 | mir_input_event_get_event_time(event)); |
681 | } |
682 | |
683 | void mir::client::lttng::InputReceiverReport::report_touch(MirInputEvent const* event) const |
684 | { |
685 | - auto tev = mir_input_event_get_touch_input_event(event); |
686 | + auto tev = mir_input_event_get_touch_input(event); |
687 | |
688 | mir_tracepoint(mir_client_input_receiver, touch_event, mir_input_event_get_device_id(event), |
689 | - mir_touch_input_event_get_modifiers(tev), mir_input_event_get_event_time(event)); |
690 | + mir_touch_input_get_modifiers(tev), mir_input_event_get_event_time(event)); |
691 | |
692 | - for (unsigned int i = 0; i < mir_touch_input_event_get_touch_count(tev); i++) |
693 | + for (unsigned int i = 0; i < mir_touch_input_get_touch_count(tev); i++) |
694 | { |
695 | mir_tracepoint(mir_client_input_receiver, touch_event_coordinate, |
696 | - mir_touch_input_event_get_touch_id(tev, i), |
697 | - mir_touch_input_event_get_touch_axis_value(tev, i, mir_touch_input_axis_x), |
698 | - mir_touch_input_event_get_touch_axis_value(tev, i, mir_touch_input_axis_y), |
699 | - mir_touch_input_event_get_touch_axis_value(tev, i, mir_touch_input_axis_touch_major), |
700 | - mir_touch_input_event_get_touch_axis_value(tev, i, mir_touch_input_axis_touch_minor), |
701 | - mir_touch_input_event_get_touch_axis_value(tev, i, mir_touch_input_axis_size), |
702 | - mir_touch_input_event_get_touch_axis_value(tev, i, mir_touch_input_axis_pressure)); |
703 | + mir_touch_input_get_touch_id(tev, i), |
704 | + mir_touch_input_get_touch_axis_value(tev, i, mir_touch_input_axis_x), |
705 | + mir_touch_input_get_touch_axis_value(tev, i, mir_touch_input_axis_y), |
706 | + mir_touch_input_get_touch_axis_value(tev, i, mir_touch_input_axis_touch_major), |
707 | + mir_touch_input_get_touch_axis_value(tev, i, mir_touch_input_axis_touch_minor), |
708 | + mir_touch_input_get_touch_axis_value(tev, i, mir_touch_input_axis_size), |
709 | + mir_touch_input_get_touch_axis_value(tev, i, mir_touch_input_axis_pressure)); |
710 | } |
711 | } |
712 | |
713 | |
714 | === modified file 'src/common/events/event_builders.cpp' |
715 | --- src/common/events/event_builders.cpp 2015-01-29 04:34:12 +0000 |
716 | +++ src/common/events/event_builders.cpp 2015-02-04 13:19:24 +0000 |
717 | @@ -95,20 +95,20 @@ |
718 | |
719 | namespace |
720 | { |
721 | -MirKeyAction old_action_from_new(MirKeyInputEventAction action) |
722 | +MirKeyAction old_action_from_new(MirKeyInputAction action) |
723 | { |
724 | switch (action) |
725 | { |
726 | - case mir_key_input_event_action_repeat: |
727 | - case mir_key_input_event_action_up: |
728 | + case mir_key_input_action_repeat: |
729 | + case mir_key_input_action_up: |
730 | return mir_key_action_up; |
731 | - case mir_key_input_event_action_down: |
732 | + case mir_key_input_action_down: |
733 | return mir_key_action_down; |
734 | default: |
735 | BOOST_THROW_EXCEPTION(std::logic_error("Invalid key action")); |
736 | } |
737 | } |
738 | -MirKeyModifier old_modifiers_from_new(MirInputEventModifiers modifiers) |
739 | +MirKeyModifier old_modifiers_from_new(MirInputModifiers modifiers) |
740 | { |
741 | int old_modifiers = mir_key_modifier_none; |
742 | |
743 | @@ -154,8 +154,8 @@ |
744 | } |
745 | |
746 | mir::EventUPtr mev::make_event(MirInputDeviceId device_id, int64_t timestamp, |
747 | - MirKeyInputEventAction action, xkb_keysym_t key_code, |
748 | - int scan_code, MirInputEventModifiers modifiers) |
749 | + MirKeyInputAction action, xkb_keysym_t key_code, |
750 | + int scan_code, MirInputModifiers modifiers) |
751 | { |
752 | MirEvent *e = new MirEvent; |
753 | memset(e, 0, sizeof (MirEvent)); |
754 | @@ -165,7 +165,7 @@ |
755 | kev.device_id = device_id; |
756 | kev.event_time = timestamp; |
757 | kev.action = old_action_from_new(action); |
758 | - if (action == mir_key_input_event_action_repeat) |
759 | + if (action == mir_key_input_action_repeat) |
760 | kev.repeat_count = 1; |
761 | kev.key_code = key_code; |
762 | kev.scan_code = scan_code; |
763 | @@ -206,7 +206,7 @@ |
764 | } |
765 | |
766 | mir::EventUPtr mev::make_event(MirInputDeviceId device_id, int64_t timestamp, |
767 | - MirInputEventModifiers modifiers) |
768 | + MirInputModifiers modifiers) |
769 | { |
770 | MirEvent *e = new MirEvent; |
771 | memset(e, 0, sizeof (MirEvent)); |
772 | @@ -227,12 +227,12 @@ |
773 | int const MIR_EVENT_ACTION_POINTER_INDEX_MASK = 0xff00; |
774 | int const MIR_EVENT_ACTION_POINTER_INDEX_SHIFT = 8; |
775 | |
776 | -void update_action_mask(MirMotionEvent &mev, MirTouchInputEventTouchAction action) |
777 | +void update_action_mask(MirMotionEvent &mev, MirTouchInputTouchAction action) |
778 | { |
779 | int new_mask = (mev.pointer_count - 1) << MIR_EVENT_ACTION_POINTER_INDEX_SHIFT; |
780 | - if (action == mir_touch_input_event_action_up) |
781 | + if (action == mir_touch_input_action_up) |
782 | new_mask = (new_mask & MIR_EVENT_ACTION_POINTER_INDEX_MASK) | mir_motion_action_pointer_up; |
783 | - else if (action == mir_touch_input_event_action_down) |
784 | + else if (action == mir_touch_input_action_down) |
785 | new_mask = (new_mask & MIR_EVENT_ACTION_POINTER_INDEX_MASK) | mir_motion_action_pointer_down; |
786 | else |
787 | new_mask = mir_motion_action_move; |
788 | @@ -246,7 +246,7 @@ |
789 | mev.action = new_mask; |
790 | } |
791 | |
792 | -MirMotionToolType old_tooltype_from_new(MirTouchInputEventTouchTooltype tooltype) |
793 | +MirMotionToolType old_tooltype_from_new(MirTouchInputTouchTooltype tooltype) |
794 | { |
795 | switch (tooltype) |
796 | { |
797 | @@ -262,8 +262,8 @@ |
798 | } |
799 | } |
800 | |
801 | -void mev::add_touch(MirEvent &event, MirTouchInputEventTouchId touch_id, MirTouchInputEventTouchAction action, |
802 | - MirTouchInputEventTouchTooltype tooltype, float x_axis_value, float y_axis_value, |
803 | +void mev::add_touch(MirEvent &event, MirTouchInputTouchId touch_id, MirTouchInputTouchAction action, |
804 | + MirTouchInputTouchTooltype tooltype, float x_axis_value, float y_axis_value, |
805 | float pressure_value, float touch_major_value, float touch_minor_value, float size_value) |
806 | { |
807 | auto& mev = event.motion; |
808 | @@ -282,19 +282,19 @@ |
809 | |
810 | namespace |
811 | { |
812 | -MirMotionAction old_action_from_pointer_action(MirPointerInputEventAction action) |
813 | +MirMotionAction old_action_from_pointer_action(MirPointerInputAction action) |
814 | { |
815 | switch (action) |
816 | { |
817 | - case mir_pointer_input_event_action_button_up: |
818 | + case mir_pointer_input_action_button_up: |
819 | return mir_motion_action_up; |
820 | - case mir_pointer_input_event_action_button_down: |
821 | + case mir_pointer_input_action_button_down: |
822 | return mir_motion_action_down; |
823 | - case mir_pointer_input_event_action_enter: |
824 | + case mir_pointer_input_action_enter: |
825 | return mir_motion_action_hover_enter; |
826 | - case mir_pointer_input_event_action_leave: |
827 | + case mir_pointer_input_action_leave: |
828 | return mir_motion_action_hover_exit; |
829 | - case mir_pointer_input_event_action_motion: |
830 | + case mir_pointer_input_action_motion: |
831 | return mir_motion_action_move; |
832 | default: |
833 | BOOST_THROW_EXCEPTION(std::logic_error("Invalid pointer action")); |
834 | @@ -303,8 +303,8 @@ |
835 | } |
836 | |
837 | mir::EventUPtr mev::make_event(MirInputDeviceId device_id, int64_t timestamp, |
838 | - MirInputEventModifiers modifiers, MirPointerInputEventAction action, |
839 | - std::vector<MirPointerInputEventButton> const& buttons_pressed, |
840 | + MirInputModifiers modifiers, MirPointerInputAction action, |
841 | + std::vector<MirPointerInputButton> const& buttons_pressed, |
842 | float x_axis_value, float y_axis_value, |
843 | float hscroll_value, float vscroll_value) |
844 | { |
845 | |
846 | === modified file 'src/common/input/input_event.cpp' |
847 | --- src/common/input/input_event.cpp 2015-01-27 03:02:22 +0000 |
848 | +++ src/common/input/input_event.cpp 2015-02-04 13:19:24 +0000 |
849 | @@ -93,28 +93,28 @@ |
850 | return reinterpret_cast<MirEvent const*>(ev); |
851 | } |
852 | |
853 | -MirKeyEvent const& old_kev_from_new(MirKeyInputEvent const* ev) |
854 | +MirKeyEvent const& old_kev_from_new(MirKeyInput const* ev) |
855 | { |
856 | auto old_ev = reinterpret_cast<MirEvent const*>(ev); |
857 | expect_old_event_type(old_ev, mir_event_type_key); |
858 | return old_ev->key; |
859 | } |
860 | |
861 | -MirMotionEvent const& old_mev_from_new(MirTouchInputEvent const* ev) |
862 | -{ |
863 | - auto old_ev = reinterpret_cast<MirEvent const*>(ev); |
864 | - expect_old_event_type(old_ev, mir_event_type_motion); |
865 | - return old_ev->motion; |
866 | -} |
867 | - |
868 | -MirMotionEvent const& old_mev_from_new(MirPointerInputEvent const* ev) |
869 | -{ |
870 | - auto old_ev = reinterpret_cast<MirEvent const*>(ev); |
871 | - expect_old_event_type(old_ev, mir_event_type_motion); |
872 | - return old_ev->motion; |
873 | -} |
874 | - |
875 | -// Differentiate between MirTouchInputEvents and MirPointerInputEvents based on old device class |
876 | +MirMotionEvent const& old_mev_from_new(MirTouchInput const* ev) |
877 | +{ |
878 | + auto old_ev = reinterpret_cast<MirEvent const*>(ev); |
879 | + expect_old_event_type(old_ev, mir_event_type_motion); |
880 | + return old_ev->motion; |
881 | +} |
882 | + |
883 | +MirMotionEvent const& old_mev_from_new(MirPointerInput const* ev) |
884 | +{ |
885 | + auto old_ev = reinterpret_cast<MirEvent const*>(ev); |
886 | + expect_old_event_type(old_ev, mir_event_type_motion); |
887 | + return old_ev->motion; |
888 | +} |
889 | + |
890 | +// Differentiate between MirTouchInputs and MirPointerInputs based on old device class |
891 | MirInputEventType type_from_device_class(int32_t source_class) |
892 | { |
893 | switch (source_class) |
894 | @@ -195,7 +195,7 @@ |
895 | |
896 | /* Key event accessors */ |
897 | |
898 | -MirKeyInputEvent const* mir_input_event_get_key_input_event(MirInputEvent const* ev) |
899 | +MirKeyInput const* mir_input_event_get_key_input(MirInputEvent const* ev) |
900 | { |
901 | if (mir_input_event_get_type(ev) != mir_input_event_type_key) |
902 | { |
903 | @@ -204,10 +204,10 @@ |
904 | abort(); |
905 | } |
906 | |
907 | - return reinterpret_cast<MirKeyInputEvent const*>(ev); |
908 | + return reinterpret_cast<MirKeyInput const*>(ev); |
909 | } |
910 | |
911 | -MirKeyInputEventAction mir_key_input_event_get_action(MirKeyInputEvent const* kev) |
912 | +MirKeyInputAction mir_key_input_get_action(MirKeyInput const* kev) |
913 | { |
914 | auto const& old_kev = old_kev_from_new(kev); |
915 | |
916 | @@ -215,26 +215,26 @@ |
917 | { |
918 | case mir_key_action_down: |
919 | if (old_kev.repeat_count != 0) |
920 | - return mir_key_input_event_action_repeat; |
921 | + return mir_key_input_action_repeat; |
922 | else |
923 | - return mir_key_input_event_action_down; |
924 | + return mir_key_input_action_down; |
925 | case mir_key_action_up: |
926 | - return mir_key_input_event_action_up; |
927 | + return mir_key_input_action_up; |
928 | default: |
929 | // TODO:? This means we got key_action_multiple which I dont think is |
930 | // actually emitted yet (and never will be as in the future it would fall under text |
931 | // event in the new model). |
932 | - return mir_key_input_event_action_down; |
933 | + return mir_key_input_action_down; |
934 | } |
935 | } |
936 | |
937 | -xkb_keysym_t mir_key_input_event_get_key_code(MirKeyInputEvent const* kev) |
938 | +xkb_keysym_t mir_key_input_get_key_code(MirKeyInput const* kev) |
939 | { |
940 | auto const& old_kev = old_kev_from_new(kev); |
941 | return old_kev.key_code; |
942 | } |
943 | |
944 | -int mir_key_input_event_get_scan_code(MirKeyInputEvent const* kev) |
945 | +int mir_key_input_get_scan_code(MirKeyInput const* kev) |
946 | { |
947 | auto const& old_kev = old_kev_from_new(kev); |
948 | return old_kev.scan_code; |
949 | @@ -242,9 +242,9 @@ |
950 | |
951 | namespace |
952 | { |
953 | -MirInputEventModifiers old_modifiers_to_new(unsigned int old_modifier) |
954 | +MirInputModifiers old_modifiers_to_new(unsigned int old_modifier) |
955 | { |
956 | - MirInputEventModifiers modifier = 0; |
957 | + MirInputModifiers modifier = 0; |
958 | |
959 | if (old_modifier & mir_key_modifier_none) |
960 | modifier |= mir_input_event_modifier_none; |
961 | @@ -288,20 +288,20 @@ |
962 | return mir_input_event_modifier_none; |
963 | } |
964 | } |
965 | -MirInputEventModifiers mir_key_input_event_get_modifiers(MirKeyInputEvent const* kev) |
966 | +MirInputModifiers mir_key_input_get_modifiers(MirKeyInput const* kev) |
967 | { |
968 | auto const& old_kev = old_kev_from_new(kev); |
969 | return old_modifiers_to_new(old_kev.modifiers); |
970 | } |
971 | /* Touch event accessors */ |
972 | |
973 | -MirInputEventModifiers mir_touch_input_event_get_modifiers(MirTouchInputEvent const* tev) |
974 | +MirInputModifiers mir_touch_input_get_modifiers(MirTouchInput const* tev) |
975 | { |
976 | auto const& old_mev = old_mev_from_new(tev); |
977 | return old_modifiers_to_new(old_mev.modifiers); |
978 | } |
979 | |
980 | -MirTouchInputEvent const* mir_input_event_get_touch_input_event(MirInputEvent const* ev) |
981 | +MirTouchInput const* mir_input_event_get_touch_input(MirInputEvent const* ev) |
982 | { |
983 | if(mir_input_event_get_type(ev) != mir_input_event_type_touch) |
984 | { |
985 | @@ -310,16 +310,16 @@ |
986 | abort(); |
987 | } |
988 | |
989 | - return reinterpret_cast<MirTouchInputEvent const*>(ev); |
990 | + return reinterpret_cast<MirTouchInput const*>(ev); |
991 | } |
992 | |
993 | -unsigned int mir_touch_input_event_get_touch_count(MirTouchInputEvent const* event) |
994 | +unsigned int mir_touch_input_get_touch_count(MirTouchInput const* event) |
995 | { |
996 | auto const& old_mev = reinterpret_cast<MirEvent const*>(event)->motion; |
997 | return old_mev.pointer_count; |
998 | } |
999 | |
1000 | -MirTouchInputEventTouchId mir_touch_input_event_get_touch_id(MirTouchInputEvent const* event, size_t touch_index) |
1001 | +MirTouchInputTouchId mir_touch_input_get_touch_id(MirTouchInput const* event, size_t touch_index) |
1002 | { |
1003 | auto const& old_mev = old_mev_from_new(event); |
1004 | |
1005 | @@ -332,7 +332,7 @@ |
1006 | return old_mev.pointer_coordinates[touch_index].id; |
1007 | } |
1008 | |
1009 | -MirTouchInputEventTouchAction mir_touch_input_event_get_touch_action(MirTouchInputEvent const* event, size_t touch_index) |
1010 | +MirTouchInputTouchAction mir_touch_input_get_touch_action(MirTouchInput const* event, size_t touch_index) |
1011 | { |
1012 | auto const& old_mev = old_mev_from_new(event); |
1013 | |
1014 | @@ -350,25 +350,25 @@ |
1015 | // For the next two cases we could assert pc=1...because a gesture must |
1016 | // be starting or ending. |
1017 | case mir_motion_action_down: |
1018 | - return mir_touch_input_event_action_down; |
1019 | + return mir_touch_input_action_down; |
1020 | case mir_motion_action_up: |
1021 | - return mir_touch_input_event_action_up; |
1022 | + return mir_touch_input_action_up; |
1023 | // We can't tell which touches have actually moved without tracking state |
1024 | // so we report all touchpoints as changed. |
1025 | case mir_motion_action_move: |
1026 | case mir_motion_action_hover_move: |
1027 | - return mir_touch_input_event_action_change; |
1028 | + return mir_touch_input_action_change; |
1029 | // All touch points are handled at once so we don't know the index |
1030 | case mir_motion_action_pointer_down: |
1031 | if (touch_index == masked_index) |
1032 | - return mir_touch_input_event_action_down; |
1033 | + return mir_touch_input_action_down; |
1034 | else |
1035 | - return mir_touch_input_event_action_change; |
1036 | + return mir_touch_input_action_change; |
1037 | case mir_motion_action_pointer_up: |
1038 | if (touch_index == masked_index) |
1039 | - return mir_touch_input_event_action_up; |
1040 | + return mir_touch_input_action_up; |
1041 | else |
1042 | - return mir_touch_input_event_action_change; |
1043 | + return mir_touch_input_action_change; |
1044 | // TODO: How to deal with these? |
1045 | case mir_motion_action_cancel: |
1046 | case mir_motion_action_outside: |
1047 | @@ -376,11 +376,11 @@ |
1048 | case mir_motion_action_hover_enter: |
1049 | case mir_motion_action_hover_exit: |
1050 | default: |
1051 | - return mir_touch_input_event_action_change; |
1052 | + return mir_touch_input_action_change; |
1053 | } |
1054 | } |
1055 | |
1056 | -MirTouchInputEventTouchTooltype mir_touch_input_event_get_touch_tooltype(MirTouchInputEvent const* event, |
1057 | +MirTouchInputTouchTooltype mir_touch_input_get_touch_tooltype(MirTouchInput const* event, |
1058 | size_t touch_index) |
1059 | { |
1060 | auto const& old_mev = old_mev_from_new(event); |
1061 | @@ -405,8 +405,8 @@ |
1062 | } |
1063 | } |
1064 | |
1065 | -float mir_touch_input_event_get_touch_axis_value(MirTouchInputEvent const* event, |
1066 | - size_t touch_index, MirTouchInputEventTouchAxis axis) |
1067 | +float mir_touch_input_get_touch_axis_value(MirTouchInput const* event, |
1068 | + size_t touch_index, MirTouchInputTouchAxis axis) |
1069 | { |
1070 | auto const& old_mev = old_mev_from_new(event); |
1071 | |
1072 | @@ -437,7 +437,7 @@ |
1073 | } |
1074 | |
1075 | /* Pointer event accessors */ |
1076 | -MirPointerInputEvent const* mir_input_event_get_pointer_input_event(MirInputEvent const* ev) |
1077 | +MirPointerInput const* mir_input_event_get_pointer_input(MirInputEvent const* ev) |
1078 | { |
1079 | if(mir_input_event_get_type(ev) != mir_input_event_type_pointer) |
1080 | { |
1081 | @@ -446,16 +446,16 @@ |
1082 | abort(); |
1083 | } |
1084 | |
1085 | - return reinterpret_cast<MirPointerInputEvent const*>(ev); |
1086 | + return reinterpret_cast<MirPointerInput const*>(ev); |
1087 | } |
1088 | |
1089 | -MirInputEventModifiers mir_pointer_input_event_get_modifiers(MirPointerInputEvent const* pev) |
1090 | +MirInputModifiers mir_pointer_input_get_modifiers(MirPointerInput const* pev) |
1091 | { |
1092 | auto const& old_mev = old_mev_from_new(pev); |
1093 | return old_modifiers_to_new(old_mev.modifiers); |
1094 | } |
1095 | |
1096 | -MirPointerInputEventAction mir_pointer_input_event_get_action(MirPointerInputEvent const* pev) |
1097 | +MirPointerInputAction mir_pointer_input_get_action(MirPointerInput const* pev) |
1098 | { |
1099 | auto const& old_mev = old_mev_from_new(pev); |
1100 | auto masked_action = old_mev.action & MIR_EVENT_ACTION_MASK; |
1101 | @@ -463,24 +463,24 @@ |
1102 | { |
1103 | case mir_motion_action_up: |
1104 | case mir_motion_action_pointer_up: |
1105 | - return mir_pointer_input_event_action_button_up; |
1106 | + return mir_pointer_input_action_button_up; |
1107 | case mir_motion_action_down: |
1108 | case mir_motion_action_pointer_down: |
1109 | - return mir_pointer_input_event_action_button_down; |
1110 | + return mir_pointer_input_action_button_down; |
1111 | case mir_motion_action_hover_enter: |
1112 | - return mir_pointer_input_event_action_enter; |
1113 | + return mir_pointer_input_action_enter; |
1114 | case mir_motion_action_hover_exit: |
1115 | - return mir_pointer_input_event_action_leave; |
1116 | + return mir_pointer_input_action_leave; |
1117 | case mir_motion_action_move: |
1118 | case mir_motion_action_hover_move: |
1119 | case mir_motion_action_outside: |
1120 | default: |
1121 | - return mir_pointer_input_event_action_motion; |
1122 | + return mir_pointer_input_action_motion; |
1123 | } |
1124 | } |
1125 | |
1126 | -bool mir_pointer_input_event_get_button_state(MirPointerInputEvent const* pev, |
1127 | - MirPointerInputEventButton button) |
1128 | +bool mir_pointer_input_get_button_state(MirPointerInput const* pev, |
1129 | + MirPointerInputButton button) |
1130 | { |
1131 | auto const& old_mev = old_mev_from_new(pev); |
1132 | switch (button) |
1133 | @@ -500,7 +500,7 @@ |
1134 | } |
1135 | } |
1136 | |
1137 | -float mir_pointer_input_event_get_axis_value(MirPointerInputEvent const* pev, MirPointerInputEventAxis axis) |
1138 | +float mir_pointer_input_get_axis_value(MirPointerInput const* pev, MirPointerInputAxis axis) |
1139 | { |
1140 | auto const& old_mev = old_mev_from_new(pev); |
1141 | switch (axis) |
1142 | |
1143 | === modified file 'tests/include/mir_test/event_matchers.h' |
1144 | --- tests/include/mir_test/event_matchers.h 2015-01-27 03:02:22 +0000 |
1145 | +++ tests/include/mir_test/event_matchers.h 2015-02-04 13:19:24 +0000 |
1146 | @@ -58,34 +58,34 @@ |
1147 | return event; |
1148 | } |
1149 | |
1150 | -inline MirKeyInputEvent const* maybe_key_event(MirEvent const* event) |
1151 | +inline MirKeyInput const* maybe_key_event(MirEvent const* event) |
1152 | { |
1153 | if (mir_event_get_type(event) != mir_event_type_input) |
1154 | return nullptr; |
1155 | auto input_event = mir_event_get_input_event(event); |
1156 | if (mir_input_event_get_type(input_event) != mir_input_event_type_key) |
1157 | return nullptr; |
1158 | - return mir_input_event_get_key_input_event(input_event); |
1159 | + return mir_input_event_get_key_input(input_event); |
1160 | } |
1161 | |
1162 | -inline MirTouchInputEvent const* maybe_touch_event(MirEvent const* event) |
1163 | +inline MirTouchInput const* maybe_touch_event(MirEvent const* event) |
1164 | { |
1165 | if (mir_event_get_type(event) != mir_event_type_input) |
1166 | return nullptr; |
1167 | auto input_event = mir_event_get_input_event(event); |
1168 | if (mir_input_event_get_type(input_event) != mir_input_event_type_touch) |
1169 | return nullptr; |
1170 | - return mir_input_event_get_touch_input_event(input_event); |
1171 | + return mir_input_event_get_touch_input(input_event); |
1172 | } |
1173 | |
1174 | -inline MirPointerInputEvent const* maybe_pointer_event(MirEvent const* event) |
1175 | +inline MirPointerInput const* maybe_pointer_event(MirEvent const* event) |
1176 | { |
1177 | if (mir_event_get_type(event) != mir_event_type_input) |
1178 | return nullptr; |
1179 | auto input_event = mir_event_get_input_event(event); |
1180 | if (mir_input_event_get_type(input_event) != mir_input_event_type_pointer) |
1181 | return nullptr; |
1182 | - return mir_input_event_get_pointer_input_event(input_event); |
1183 | + return mir_input_event_get_pointer_input(input_event); |
1184 | } |
1185 | /** |
1186 | * \} |
1187 | @@ -97,7 +97,7 @@ |
1188 | if (kev == nullptr) |
1189 | return false; |
1190 | |
1191 | - if (mir_key_input_event_get_action(kev) != mir_key_input_event_action_down) |
1192 | + if (mir_key_input_get_action(kev) != mir_key_input_action_down) |
1193 | return false; |
1194 | |
1195 | return true; |
1196 | @@ -109,7 +109,7 @@ |
1197 | if (kev == nullptr) |
1198 | return false; |
1199 | |
1200 | - if (mir_key_input_event_get_action(kev) != mir_key_input_event_action_repeat) |
1201 | + if (mir_key_input_get_action(kev) != mir_key_input_action_repeat) |
1202 | return false; |
1203 | |
1204 | return true; |
1205 | @@ -121,7 +121,7 @@ |
1206 | if (kev == nullptr) |
1207 | return false; |
1208 | |
1209 | - if (mir_key_input_event_get_action(kev) != mir_key_input_event_action_up) |
1210 | + if (mir_key_input_get_action(kev) != mir_key_input_action_up) |
1211 | return false; |
1212 | |
1213 | return true; |
1214 | @@ -133,9 +133,9 @@ |
1215 | if (kev == nullptr) |
1216 | return false; |
1217 | |
1218 | - if(mir_key_input_event_get_modifiers(kev) != modifiers) |
1219 | + if(mir_key_input_get_modifiers(kev) != modifiers) |
1220 | { |
1221 | - printf("modifiers: %d vs expected %d \n", mir_key_input_event_get_modifiers(kev), modifiers); |
1222 | + printf("modifiers: %d vs expected %d \n", mir_key_input_get_modifiers(kev), modifiers); |
1223 | return false; |
1224 | } |
1225 | |
1226 | @@ -148,7 +148,7 @@ |
1227 | if (kev == nullptr) |
1228 | return false; |
1229 | |
1230 | - if(mir_key_input_event_get_key_code(kev) != static_cast<xkb_keysym_t>(keysym)) |
1231 | + if(mir_key_input_get_key_code(kev) != static_cast<xkb_keysym_t>(keysym)) |
1232 | return false; |
1233 | |
1234 | return true; |
1235 | @@ -162,10 +162,10 @@ |
1236 | if (expected == nullptr || actual == nullptr) |
1237 | return false; |
1238 | |
1239 | - return mir_key_input_event_get_action(expected) == mir_key_input_event_get_action(actual) && |
1240 | - mir_key_input_event_get_key_code(expected) == mir_key_input_event_get_key_code(actual) && |
1241 | - mir_key_input_event_get_scan_code(expected) == mir_key_input_event_get_scan_code(actual) && |
1242 | - mir_key_input_event_get_modifiers(expected) == mir_key_input_event_get_modifiers(actual); |
1243 | + return mir_key_input_get_action(expected) == mir_key_input_get_action(actual) && |
1244 | + mir_key_input_get_key_code(expected) == mir_key_input_get_key_code(actual) && |
1245 | + mir_key_input_get_scan_code(expected) == mir_key_input_get_scan_code(actual) && |
1246 | + mir_key_input_get_modifiers(expected) == mir_key_input_get_modifiers(actual); |
1247 | } |
1248 | |
1249 | MATCHER_P(MirTouchEventMatches, event, "") |
1250 | @@ -176,19 +176,19 @@ |
1251 | if (expected == nullptr || actual == nullptr) |
1252 | return false; |
1253 | |
1254 | - auto tc = mir_touch_input_event_get_touch_count(actual); |
1255 | - if (mir_touch_input_event_get_touch_count(expected) != tc) |
1256 | + auto tc = mir_touch_input_get_touch_count(actual); |
1257 | + if (mir_touch_input_get_touch_count(expected) != tc) |
1258 | return false; |
1259 | |
1260 | for (unsigned i = 0; i != tc; i++) |
1261 | { |
1262 | - if (mir_touch_input_event_get_touch_id(actual, i) != mir_touch_input_event_get_touch_id(expected, i) || |
1263 | - mir_touch_input_event_get_touch_action(actual, i) != mir_touch_input_event_get_touch_action(expected, i) || |
1264 | - mir_touch_input_event_get_touch_tooltype(actual, i) != mir_touch_input_event_get_touch_tooltype(expected, i) || |
1265 | - mir_touch_input_event_get_touch_axis_value(actual, i, mir_touch_input_axis_x) != |
1266 | - mir_touch_input_event_get_touch_axis_value(expected, i, mir_touch_input_axis_x) || |
1267 | - mir_touch_input_event_get_touch_axis_value(actual, i, mir_touch_input_axis_y) != |
1268 | - mir_touch_input_event_get_touch_axis_value(expected, i, mir_touch_input_axis_y)) |
1269 | + if (mir_touch_input_get_touch_id(actual, i) != mir_touch_input_get_touch_id(expected, i) || |
1270 | + mir_touch_input_get_touch_action(actual, i) != mir_touch_input_get_touch_action(expected, i) || |
1271 | + mir_touch_input_get_touch_tooltype(actual, i) != mir_touch_input_get_touch_tooltype(expected, i) || |
1272 | + mir_touch_input_get_touch_axis_value(actual, i, mir_touch_input_axis_x) != |
1273 | + mir_touch_input_get_touch_axis_value(expected, i, mir_touch_input_axis_x) || |
1274 | + mir_touch_input_get_touch_axis_value(actual, i, mir_touch_input_axis_y) != |
1275 | + mir_touch_input_get_touch_axis_value(expected, i, mir_touch_input_axis_y)) |
1276 | { |
1277 | return false; |
1278 | } |
1279 | @@ -201,7 +201,7 @@ |
1280 | auto pev = maybe_pointer_event(to_address(arg)); |
1281 | if (pev == nullptr) |
1282 | return false; |
1283 | - if (mir_pointer_input_event_get_action(pev) == mir_pointer_input_event_action_enter) |
1284 | + if (mir_pointer_input_get_action(pev) == mir_pointer_input_action_enter) |
1285 | return true; |
1286 | return false; |
1287 | } |
1288 | @@ -211,7 +211,7 @@ |
1289 | auto pev = maybe_pointer_event(to_address(arg)); |
1290 | if (pev == nullptr) |
1291 | return false; |
1292 | - if (mir_pointer_input_event_get_action(pev) == mir_pointer_input_event_action_leave) |
1293 | + if (mir_pointer_input_get_action(pev) == mir_pointer_input_action_leave) |
1294 | return true; |
1295 | return false; |
1296 | } |
1297 | @@ -221,13 +221,13 @@ |
1298 | auto pev = maybe_pointer_event(to_address(arg)); |
1299 | if (pev == nullptr) |
1300 | return false; |
1301 | - if (mir_pointer_input_event_get_action(pev) != mir_pointer_input_event_action_button_down) |
1302 | - return false; |
1303 | - if (mir_pointer_input_event_get_button_state(pev, mir_pointer_input_button_primary) == false) |
1304 | - return false; |
1305 | - if (mir_pointer_input_event_get_axis_value(pev, mir_pointer_input_axis_x) != x) |
1306 | - return false; |
1307 | - if (mir_pointer_input_event_get_axis_value(pev, mir_pointer_input_axis_y) != y) |
1308 | + if (mir_pointer_input_get_action(pev) != mir_pointer_input_action_button_down) |
1309 | + return false; |
1310 | + if (mir_pointer_input_get_button_state(pev, mir_pointer_input_button_primary) == false) |
1311 | + return false; |
1312 | + if (mir_pointer_input_get_axis_value(pev, mir_pointer_input_axis_x) != x) |
1313 | + return false; |
1314 | + if (mir_pointer_input_get_axis_value(pev, mir_pointer_input_axis_y) != y) |
1315 | return false; |
1316 | return true; |
1317 | } |
1318 | @@ -237,13 +237,13 @@ |
1319 | auto pev = maybe_pointer_event(to_address(arg)); |
1320 | if (pev == nullptr) |
1321 | return false; |
1322 | - if (mir_pointer_input_event_get_action(pev) != mir_pointer_input_event_action_button_up) |
1323 | - return false; |
1324 | - if (mir_pointer_input_event_get_button_state(pev, mir_pointer_input_button_primary) == true) |
1325 | - return false; |
1326 | - if (mir_pointer_input_event_get_axis_value(pev, mir_pointer_input_axis_x) != x) |
1327 | - return false; |
1328 | - if (mir_pointer_input_event_get_axis_value(pev, mir_pointer_input_axis_y) != y) |
1329 | + if (mir_pointer_input_get_action(pev) != mir_pointer_input_action_button_up) |
1330 | + return false; |
1331 | + if (mir_pointer_input_get_button_state(pev, mir_pointer_input_button_primary) == true) |
1332 | + return false; |
1333 | + if (mir_pointer_input_get_axis_value(pev, mir_pointer_input_axis_x) != x) |
1334 | + return false; |
1335 | + if (mir_pointer_input_get_axis_value(pev, mir_pointer_input_axis_y) != y) |
1336 | return false; |
1337 | return true; |
1338 | } |
1339 | @@ -254,11 +254,11 @@ |
1340 | if (tev == nullptr) |
1341 | return false; |
1342 | |
1343 | - if (mir_touch_input_event_get_touch_action(tev, 0) != mir_touch_input_event_action_down) |
1344 | - return false; |
1345 | - if (mir_touch_input_event_get_touch_axis_value(tev, 0, mir_touch_input_axis_x) != x) |
1346 | - return false; |
1347 | - if (mir_touch_input_event_get_touch_axis_value(tev, 0, mir_touch_input_axis_y) != y) |
1348 | + if (mir_touch_input_get_touch_action(tev, 0) != mir_touch_input_action_down) |
1349 | + return false; |
1350 | + if (mir_touch_input_get_touch_axis_value(tev, 0, mir_touch_input_axis_x) != x) |
1351 | + return false; |
1352 | + if (mir_touch_input_get_touch_axis_value(tev, 0, mir_touch_input_axis_y) != y) |
1353 | return false; |
1354 | |
1355 | return true; |
1356 | @@ -269,11 +269,11 @@ |
1357 | auto pev = maybe_pointer_event(to_address(arg)); |
1358 | if (pev == nullptr) |
1359 | return false; |
1360 | - if (mir_pointer_input_event_get_action(pev) != mir_pointer_input_event_action_motion) |
1361 | - return false; |
1362 | - if (mir_pointer_input_event_get_axis_value(pev, mir_pointer_input_axis_x) != x) |
1363 | - return false; |
1364 | - if (mir_pointer_input_event_get_axis_value(pev, mir_pointer_input_axis_y) != y) |
1365 | + if (mir_pointer_input_get_action(pev) != mir_pointer_input_action_motion) |
1366 | + return false; |
1367 | + if (mir_pointer_input_get_axis_value(pev, mir_pointer_input_axis_x) != x) |
1368 | + return false; |
1369 | + if (mir_pointer_input_get_axis_value(pev, mir_pointer_input_axis_y) != y) |
1370 | return false; |
1371 | return true; |
1372 | } |
1373 | @@ -284,11 +284,11 @@ |
1374 | if (tev == nullptr) |
1375 | return false; |
1376 | |
1377 | - if (mir_touch_input_event_get_touch_action(tev, 0) != mir_touch_input_event_action_change) |
1378 | + if (mir_touch_input_get_touch_action(tev, 0) != mir_touch_input_action_change) |
1379 | return false; |
1380 | |
1381 | - auto x2 = mir_touch_input_event_get_touch_axis_value(tev, 0, mir_touch_input_axis_x); |
1382 | - auto y2 = mir_touch_input_event_get_touch_axis_value(tev, 0, mir_touch_input_axis_y); |
1383 | + auto x2 = mir_touch_input_get_touch_axis_value(tev, 0, mir_touch_input_axis_x); |
1384 | + auto y2 = mir_touch_input_get_touch_axis_value(tev, 0, mir_touch_input_axis_y); |
1385 | |
1386 | float dx1 = x1 - x0; |
1387 | float dy1 = y1 - y0; |
1388 | @@ -309,7 +309,7 @@ |
1389 | if (tev == nullptr) |
1390 | return false; |
1391 | |
1392 | - if (mir_touch_input_event_get_touch_action(tev, 0) != mir_touch_input_event_action_change) |
1393 | + if (mir_touch_input_get_touch_action(tev, 0) != mir_touch_input_action_change) |
1394 | return false; |
1395 | |
1396 | return true; |
1397 | @@ -321,7 +321,7 @@ |
1398 | if (pev == nullptr) |
1399 | return false; |
1400 | |
1401 | - if (mir_pointer_input_event_get_action(pev) != mir_pointer_input_event_action_motion) |
1402 | + if (mir_pointer_input_get_action(pev) != mir_pointer_input_action_motion) |
1403 | return false; |
1404 | |
1405 | return true; |
1406 | |
1407 | === modified file 'tests/unit-tests/input/test_event_builders.cpp' |
1408 | --- tests/unit-tests/input/test_event_builders.cpp 2015-01-22 23:04:22 +0000 |
1409 | +++ tests/unit-tests/input/test_event_builders.cpp 2015-02-04 13:19:24 +0000 |
1410 | @@ -30,13 +30,13 @@ |
1411 | { |
1412 | MirInputDeviceId const device_id = 7; |
1413 | int64_t const timestamp = 39; |
1414 | - MirInputEventModifiers const modifiers = mir_input_event_modifier_meta; |
1415 | + MirInputModifiers const modifiers = mir_input_event_modifier_meta; |
1416 | }; |
1417 | } |
1418 | |
1419 | TEST_F(InputEventBuilder, makes_valid_key_event) |
1420 | { |
1421 | - MirKeyInputEventAction const action = mir_key_input_event_action_down; |
1422 | + MirKeyInputAction const action = mir_key_input_action_down; |
1423 | xkb_keysym_t const key_code = 34; |
1424 | int const scan_code = 17; |
1425 | |
1426 | @@ -47,20 +47,20 @@ |
1427 | EXPECT_EQ(mir_event_type_input, mir_event_get_type(e)); |
1428 | auto ie = mir_event_get_input_event(e); |
1429 | EXPECT_EQ(mir_input_event_type_key, mir_input_event_get_type(ie)); |
1430 | - auto kev = mir_input_event_get_key_input_event(ie); |
1431 | - EXPECT_EQ(action, mir_key_input_event_get_action(kev)); |
1432 | - EXPECT_EQ(key_code, mir_key_input_event_get_key_code(kev)); |
1433 | - EXPECT_EQ(scan_code, mir_key_input_event_get_scan_code(kev)); |
1434 | - EXPECT_EQ(modifiers, mir_key_input_event_get_modifiers(kev)); |
1435 | + auto kev = mir_input_event_get_key_input(ie); |
1436 | + EXPECT_EQ(action, mir_key_input_get_action(kev)); |
1437 | + EXPECT_EQ(key_code, mir_key_input_get_key_code(kev)); |
1438 | + EXPECT_EQ(scan_code, mir_key_input_get_scan_code(kev)); |
1439 | + EXPECT_EQ(modifiers, mir_key_input_get_modifiers(kev)); |
1440 | } |
1441 | |
1442 | |
1443 | TEST_F(InputEventBuilder, makes_valid_touch_event) |
1444 | { |
1445 | unsigned touch_count = 3; |
1446 | - MirTouchInputEventTouchId touch_ids[] = {7, 9, 4}; |
1447 | - MirTouchInputEventTouchAction actions[] = { mir_touch_input_event_action_up, mir_touch_input_event_action_change, mir_touch_input_event_action_change}; |
1448 | - MirTouchInputEventTouchTooltype tooltypes[] = {mir_touch_input_tool_type_unknown, mir_touch_input_tool_type_finger, mir_touch_input_tool_type_stylus}; |
1449 | + MirTouchInputTouchId touch_ids[] = {7, 9, 4}; |
1450 | + MirTouchInputTouchAction actions[] = { mir_touch_input_action_up, mir_touch_input_action_change, mir_touch_input_action_change}; |
1451 | + MirTouchInputTouchTooltype tooltypes[] = {mir_touch_input_tool_type_unknown, mir_touch_input_tool_type_finger, mir_touch_input_tool_type_stylus}; |
1452 | float x_axis_values[] = { 7, 14.3, 19.6 }; |
1453 | float y_axis_values[] = { 3, 9, 11 }; |
1454 | float pressure_values[] = {3, 9, 14.6}; |
1455 | @@ -80,28 +80,28 @@ |
1456 | EXPECT_EQ(mir_event_type_input, mir_event_get_type(e)); |
1457 | auto ie = mir_event_get_input_event(e); |
1458 | EXPECT_EQ(mir_input_event_type_touch, mir_input_event_get_type(ie)); |
1459 | - auto tev = mir_input_event_get_touch_input_event(ie); |
1460 | - EXPECT_EQ(modifiers, mir_touch_input_event_get_modifiers(tev)); |
1461 | - EXPECT_EQ(touch_count, mir_touch_input_event_get_touch_count(tev)); |
1462 | + auto tev = mir_input_event_get_touch_input(ie); |
1463 | + EXPECT_EQ(modifiers, mir_touch_input_get_modifiers(tev)); |
1464 | + EXPECT_EQ(touch_count, mir_touch_input_get_touch_count(tev)); |
1465 | |
1466 | for (unsigned i = 0; i < touch_count; i++) |
1467 | { |
1468 | - EXPECT_EQ(touch_ids[i], mir_touch_input_event_get_touch_id(tev, i)); |
1469 | - EXPECT_EQ(actions[i], mir_touch_input_event_get_touch_action(tev, i)); |
1470 | - EXPECT_EQ(tooltypes[i], mir_touch_input_event_get_touch_tooltype(tev, i)); |
1471 | - EXPECT_EQ(x_axis_values[i], mir_touch_input_event_get_touch_axis_value(tev, i, mir_touch_input_axis_x)); |
1472 | - EXPECT_EQ(y_axis_values[i], mir_touch_input_event_get_touch_axis_value(tev, i, mir_touch_input_axis_y)); |
1473 | - EXPECT_EQ(pressure_values[i], mir_touch_input_event_get_touch_axis_value(tev, i, mir_touch_input_axis_pressure)); |
1474 | - EXPECT_EQ(touch_major_values[i], mir_touch_input_event_get_touch_axis_value(tev, i, mir_touch_input_axis_touch_major)); |
1475 | - EXPECT_EQ(touch_minor_values[i], mir_touch_input_event_get_touch_axis_value(tev, i, mir_touch_input_axis_touch_minor)); |
1476 | - EXPECT_EQ(size_values[i], mir_touch_input_event_get_touch_axis_value(tev, i, mir_touch_input_axis_size)); |
1477 | + EXPECT_EQ(touch_ids[i], mir_touch_input_get_touch_id(tev, i)); |
1478 | + EXPECT_EQ(actions[i], mir_touch_input_get_touch_action(tev, i)); |
1479 | + EXPECT_EQ(tooltypes[i], mir_touch_input_get_touch_tooltype(tev, i)); |
1480 | + EXPECT_EQ(x_axis_values[i], mir_touch_input_get_touch_axis_value(tev, i, mir_touch_input_axis_x)); |
1481 | + EXPECT_EQ(y_axis_values[i], mir_touch_input_get_touch_axis_value(tev, i, mir_touch_input_axis_y)); |
1482 | + EXPECT_EQ(pressure_values[i], mir_touch_input_get_touch_axis_value(tev, i, mir_touch_input_axis_pressure)); |
1483 | + EXPECT_EQ(touch_major_values[i], mir_touch_input_get_touch_axis_value(tev, i, mir_touch_input_axis_touch_major)); |
1484 | + EXPECT_EQ(touch_minor_values[i], mir_touch_input_get_touch_axis_value(tev, i, mir_touch_input_axis_touch_minor)); |
1485 | + EXPECT_EQ(size_values[i], mir_touch_input_get_touch_axis_value(tev, i, mir_touch_input_axis_size)); |
1486 | } |
1487 | } |
1488 | |
1489 | TEST_F(InputEventBuilder, makes_valid_pointer_event) |
1490 | { |
1491 | - MirPointerInputEventAction action = mir_pointer_input_event_action_enter; |
1492 | - std::vector<MirPointerInputEventButton> depressed_buttons = |
1493 | + MirPointerInputAction action = mir_pointer_input_action_enter; |
1494 | + std::vector<MirPointerInputButton> depressed_buttons = |
1495 | {mir_pointer_input_button_back, mir_pointer_input_button_tertiary}; |
1496 | float x_axis_value = 3.9, y_axis_value = 7.4, hscroll_value = .9, vscroll_value = .3; |
1497 | auto ev = mev::make_event(device_id, timestamp, modifiers, |
1498 | @@ -111,16 +111,16 @@ |
1499 | EXPECT_EQ(mir_event_type_input, mir_event_get_type(e)); |
1500 | auto ie = mir_event_get_input_event(e); |
1501 | EXPECT_EQ(mir_input_event_type_pointer, mir_input_event_get_type(ie)); |
1502 | - auto pev = mir_input_event_get_pointer_input_event(ie); |
1503 | - EXPECT_EQ(modifiers, mir_pointer_input_event_get_modifiers(pev)); |
1504 | - EXPECT_EQ(action, mir_pointer_input_event_get_action(pev)); |
1505 | - EXPECT_TRUE(mir_pointer_input_event_get_button_state(pev, mir_pointer_input_button_back)); |
1506 | - EXPECT_TRUE(mir_pointer_input_event_get_button_state(pev, mir_pointer_input_button_tertiary)); |
1507 | - EXPECT_FALSE(mir_pointer_input_event_get_button_state(pev, mir_pointer_input_button_primary)); |
1508 | - EXPECT_FALSE(mir_pointer_input_event_get_button_state(pev, mir_pointer_input_button_secondary)); |
1509 | - EXPECT_FALSE(mir_pointer_input_event_get_button_state(pev, mir_pointer_input_button_forward)); |
1510 | - EXPECT_EQ(x_axis_value, mir_pointer_input_event_get_axis_value(pev, mir_pointer_input_axis_x)); |
1511 | - EXPECT_EQ(y_axis_value, mir_pointer_input_event_get_axis_value(pev, mir_pointer_input_axis_y)); |
1512 | - EXPECT_EQ(hscroll_value, mir_pointer_input_event_get_axis_value(pev, mir_pointer_input_axis_hscroll)); |
1513 | - EXPECT_EQ(vscroll_value, mir_pointer_input_event_get_axis_value(pev, mir_pointer_input_axis_vscroll)); |
1514 | + auto pev = mir_input_event_get_pointer_input(ie); |
1515 | + EXPECT_EQ(modifiers, mir_pointer_input_get_modifiers(pev)); |
1516 | + EXPECT_EQ(action, mir_pointer_input_get_action(pev)); |
1517 | + EXPECT_TRUE(mir_pointer_input_get_button_state(pev, mir_pointer_input_button_back)); |
1518 | + EXPECT_TRUE(mir_pointer_input_get_button_state(pev, mir_pointer_input_button_tertiary)); |
1519 | + EXPECT_FALSE(mir_pointer_input_get_button_state(pev, mir_pointer_input_button_primary)); |
1520 | + EXPECT_FALSE(mir_pointer_input_get_button_state(pev, mir_pointer_input_button_secondary)); |
1521 | + EXPECT_FALSE(mir_pointer_input_get_button_state(pev, mir_pointer_input_button_forward)); |
1522 | + EXPECT_EQ(x_axis_value, mir_pointer_input_get_axis_value(pev, mir_pointer_input_axis_x)); |
1523 | + EXPECT_EQ(y_axis_value, mir_pointer_input_get_axis_value(pev, mir_pointer_input_axis_y)); |
1524 | + EXPECT_EQ(hscroll_value, mir_pointer_input_get_axis_value(pev, mir_pointer_input_axis_hscroll)); |
1525 | + EXPECT_EQ(vscroll_value, mir_pointer_input_get_axis_value(pev, mir_pointer_input_axis_vscroll)); |
1526 | } |
1527 | |
1528 | === modified file 'tests/unit-tests/input/test_input_event.cpp' |
1529 | --- tests/unit-tests/input/test_input_event.cpp 2015-01-27 03:02:22 +0000 |
1530 | +++ tests/unit-tests/input/test_input_event.cpp 2015-02-04 13:19:24 +0000 |
1531 | @@ -130,11 +130,11 @@ |
1532 | old_ev.key.action = mir_key_action_down; |
1533 | old_ev.key.repeat_count = 0; |
1534 | |
1535 | - auto new_kev = mir_input_event_get_key_input_event(mir_event_get_input_event(&old_ev)); |
1536 | - EXPECT_EQ(mir_key_input_event_action_down, mir_key_input_event_get_action(new_kev)); |
1537 | + auto new_kev = mir_input_event_get_key_input(mir_event_get_input_event(&old_ev)); |
1538 | + EXPECT_EQ(mir_key_input_action_down, mir_key_input_get_action(new_kev)); |
1539 | |
1540 | old_ev.key.action = mir_key_action_up; |
1541 | - EXPECT_EQ(mir_key_input_event_action_up, mir_key_input_event_get_action(new_kev)); |
1542 | + EXPECT_EQ(mir_key_input_action_up, mir_key_input_get_action(new_kev)); |
1543 | } |
1544 | |
1545 | TEST(KeyInputEventProperties, repeat_action_produced_from_non_zero_repeat_count_in_old_style_event) |
1546 | @@ -144,8 +144,8 @@ |
1547 | old_ev.key.action = mir_key_action_down; |
1548 | old_ev.key.repeat_count = 1; |
1549 | |
1550 | - auto new_kev = mir_input_event_get_key_input_event(mir_event_get_input_event(&old_ev)); |
1551 | - EXPECT_EQ(mir_key_input_event_action_repeat, mir_key_input_event_get_action(new_kev)); |
1552 | + auto new_kev = mir_input_event_get_key_input(mir_event_get_input_event(&old_ev)); |
1553 | + EXPECT_EQ(mir_key_input_action_repeat, mir_key_input_get_action(new_kev)); |
1554 | } |
1555 | |
1556 | TEST(KeyInputEventProperties, keycode_scancode_and_modifiers_taken_from_old_style_event) |
1557 | @@ -159,10 +159,10 @@ |
1558 | old_ev.key.scan_code = scan_code; |
1559 | old_ev.key.modifiers = old_modifiers; |
1560 | |
1561 | - auto new_kev = mir_input_event_get_key_input_event(mir_event_get_input_event(&old_ev)); |
1562 | - EXPECT_EQ(key_code, mir_key_input_event_get_key_code(new_kev)); |
1563 | - EXPECT_EQ(scan_code, mir_key_input_event_get_scan_code(new_kev)); |
1564 | - EXPECT_EQ(mir_input_event_modifier_shift, mir_key_input_event_get_modifiers(new_kev)); |
1565 | + auto new_kev = mir_input_event_get_key_input(mir_event_get_input_event(&old_ev)); |
1566 | + EXPECT_EQ(key_code, mir_key_input_get_key_code(new_kev)); |
1567 | + EXPECT_EQ(scan_code, mir_key_input_get_scan_code(new_kev)); |
1568 | + EXPECT_EQ(mir_input_event_modifier_shift, mir_key_input_get_modifiers(new_kev)); |
1569 | } |
1570 | |
1571 | TEST(TouchInputEventProperties, touch_count_taken_from_pointer_count) |
1572 | @@ -173,8 +173,8 @@ |
1573 | old_ev.motion.action = mir_motion_action_down; |
1574 | old_ev.motion.pointer_count = pointer_count; |
1575 | |
1576 | - auto tev = mir_input_event_get_touch_input_event(mir_event_get_input_event(&old_ev)); |
1577 | - EXPECT_EQ(pointer_count, mir_touch_input_event_get_touch_count(tev)); |
1578 | + auto tev = mir_input_event_get_touch_input(mir_event_get_input_event(&old_ev)); |
1579 | + EXPECT_EQ(pointer_count, mir_touch_input_get_touch_count(tev)); |
1580 | } |
1581 | |
1582 | TEST(TouchInputEventProperties, touch_id_comes_from_pointer_coordinates) |
1583 | @@ -186,8 +186,8 @@ |
1584 | old_ev.motion.pointer_count = 1; |
1585 | old_ev.motion.pointer_coordinates[0].id = touch_id; |
1586 | |
1587 | - auto tev = mir_input_event_get_touch_input_event(mir_event_get_input_event(&old_ev)); |
1588 | - EXPECT_EQ(touch_id, mir_touch_input_event_get_touch_id(tev, 0)); |
1589 | + auto tev = mir_input_event_get_touch_input(mir_event_get_input_event(&old_ev)); |
1590 | + EXPECT_EQ(touch_id, mir_touch_input_get_touch_id(tev, 0)); |
1591 | } |
1592 | |
1593 | // mir_motion_action_up/down represent the start of a gesture. pointers only go up/down one at a time |
1594 | @@ -197,8 +197,8 @@ |
1595 | old_ev.motion.action = mir_motion_action_down; |
1596 | old_ev.motion.pointer_count = 1; |
1597 | |
1598 | - auto tev = mir_input_event_get_touch_input_event(mir_event_get_input_event(&old_ev)); |
1599 | - EXPECT_EQ(mir_touch_input_event_action_down, mir_touch_input_event_get_touch_action(tev, 0)); |
1600 | + auto tev = mir_input_event_get_touch_input(mir_event_get_input_event(&old_ev)); |
1601 | + EXPECT_EQ(mir_touch_input_action_down, mir_touch_input_get_touch_action(tev, 0)); |
1602 | } |
1603 | |
1604 | TEST(TouchInputEventProperties, touch_up_down_applies_only_to_masked_action) |
1605 | @@ -210,10 +210,10 @@ |
1606 | old_ev.motion.action = (old_ev.motion.action & MIR_EVENT_ACTION_POINTER_INDEX_MASK) | mir_motion_action_pointer_up; |
1607 | old_ev.motion.pointer_count = 3; |
1608 | |
1609 | - auto tev = mir_input_event_get_touch_input_event(mir_event_get_input_event(&old_ev)); |
1610 | - EXPECT_EQ(mir_touch_input_event_action_change, mir_touch_input_event_get_touch_action(tev, 0)); |
1611 | - EXPECT_EQ(mir_touch_input_event_action_up, mir_touch_input_event_get_touch_action(tev, 1)); |
1612 | - EXPECT_EQ(mir_touch_input_event_action_change, mir_touch_input_event_get_touch_action(tev, 2)); |
1613 | + auto tev = mir_input_event_get_touch_input(mir_event_get_input_event(&old_ev)); |
1614 | + EXPECT_EQ(mir_touch_input_action_change, mir_touch_input_get_touch_action(tev, 0)); |
1615 | + EXPECT_EQ(mir_touch_input_action_up, mir_touch_input_get_touch_action(tev, 1)); |
1616 | + EXPECT_EQ(mir_touch_input_action_change, mir_touch_input_get_touch_action(tev, 2)); |
1617 | } |
1618 | |
1619 | TEST(TouchInputEventProperties, tool_type_copied_from_old_pc) |
1620 | @@ -227,10 +227,10 @@ |
1621 | old_mev.pointer_coordinates[2].tool_type = mir_motion_tool_type_stylus; |
1622 | old_mev.pointer_coordinates[3].tool_type = mir_motion_tool_type_mouse; |
1623 | |
1624 | - auto tev = mir_input_event_get_touch_input_event(mir_event_get_input_event(&old_ev)); |
1625 | - EXPECT_EQ(mir_touch_input_tool_type_unknown, mir_touch_input_event_get_touch_tooltype(tev, 0)); |
1626 | - EXPECT_EQ(mir_touch_input_tool_type_finger, mir_touch_input_event_get_touch_tooltype(tev, 1)); |
1627 | - EXPECT_EQ(mir_touch_input_tool_type_stylus, mir_touch_input_event_get_touch_tooltype(tev, 2)); |
1628 | + auto tev = mir_input_event_get_touch_input(mir_event_get_input_event(&old_ev)); |
1629 | + EXPECT_EQ(mir_touch_input_tool_type_unknown, mir_touch_input_get_touch_tooltype(tev, 0)); |
1630 | + EXPECT_EQ(mir_touch_input_tool_type_finger, mir_touch_input_get_touch_tooltype(tev, 1)); |
1631 | + EXPECT_EQ(mir_touch_input_tool_type_stylus, mir_touch_input_get_touch_tooltype(tev, 2)); |
1632 | } |
1633 | |
1634 | TEST(TouchInputEventProperties, axis_values_used_by_qtmir_copied) |
1635 | @@ -246,13 +246,13 @@ |
1636 | old_pc.pressure = pressure; |
1637 | old_pc.size = size; |
1638 | |
1639 | - auto tev = mir_input_event_get_touch_input_event(mir_event_get_input_event(&old_ev)); |
1640 | - EXPECT_EQ(x_value, mir_touch_input_event_get_touch_axis_value(tev, 0, mir_touch_input_axis_x)); |
1641 | - EXPECT_EQ(y_value, mir_touch_input_event_get_touch_axis_value(tev, 0, mir_touch_input_axis_y)); |
1642 | - EXPECT_EQ(touch_major, mir_touch_input_event_get_touch_axis_value(tev, 0, mir_touch_input_axis_touch_major)); |
1643 | - EXPECT_EQ(touch_minor, mir_touch_input_event_get_touch_axis_value(tev, 0, mir_touch_input_axis_touch_minor)); |
1644 | - EXPECT_EQ(pressure, mir_touch_input_event_get_touch_axis_value(tev, 0, mir_touch_input_axis_pressure)); |
1645 | - EXPECT_EQ(size, mir_touch_input_event_get_touch_axis_value(tev, 0, mir_touch_input_axis_size)); |
1646 | + auto tev = mir_input_event_get_touch_input(mir_event_get_input_event(&old_ev)); |
1647 | + EXPECT_EQ(x_value, mir_touch_input_get_touch_axis_value(tev, 0, mir_touch_input_axis_x)); |
1648 | + EXPECT_EQ(y_value, mir_touch_input_get_touch_axis_value(tev, 0, mir_touch_input_axis_y)); |
1649 | + EXPECT_EQ(touch_major, mir_touch_input_get_touch_axis_value(tev, 0, mir_touch_input_axis_touch_major)); |
1650 | + EXPECT_EQ(touch_minor, mir_touch_input_get_touch_axis_value(tev, 0, mir_touch_input_axis_touch_minor)); |
1651 | + EXPECT_EQ(pressure, mir_touch_input_get_touch_axis_value(tev, 0, mir_touch_input_axis_pressure)); |
1652 | + EXPECT_EQ(size, mir_touch_input_get_touch_axis_value(tev, 0, mir_touch_input_axis_size)); |
1653 | } |
1654 | |
1655 | /* Pointer and touch event differentiation */ |
1656 | @@ -302,8 +302,8 @@ |
1657 | old_ev.motion.modifiers = mir_key_modifier_shift; |
1658 | |
1659 | auto pointer_event = |
1660 | - mir_input_event_get_pointer_input_event(mir_event_get_input_event(&old_ev)); |
1661 | - EXPECT_EQ(mir_input_event_modifier_shift, mir_pointer_input_event_get_modifiers(pointer_event)); |
1662 | + mir_input_event_get_pointer_input(mir_event_get_input_event(&old_ev)); |
1663 | + EXPECT_EQ(mir_input_event_modifier_shift, mir_pointer_input_get_modifiers(pointer_event)); |
1664 | } |
1665 | |
1666 | namespace |
1667 | @@ -311,7 +311,7 @@ |
1668 | struct ActionTestParameters |
1669 | { |
1670 | MirMotionAction old_action; |
1671 | - MirPointerInputEventAction new_action; |
1672 | + MirPointerInputAction new_action; |
1673 | }; |
1674 | |
1675 | struct MotionToPointerActionTest : public testing::Test, testing::WithParamInterface<ActionTestParameters> |
1676 | @@ -328,55 +328,55 @@ |
1677 | auto shift = 0 << MIR_EVENT_ACTION_POINTER_INDEX_SHIFT; |
1678 | old_ev.motion.action = (shift & MIR_EVENT_ACTION_POINTER_INDEX_MASK) | params.old_action; |
1679 | EXPECT_EQ(params.new_action, |
1680 | - mir_pointer_input_event_get_action(mir_input_event_get_pointer_input_event(mir_event_get_input_event(&old_ev)))); |
1681 | + mir_pointer_input_get_action(mir_input_event_get_pointer_input(mir_event_get_input_event(&old_ev)))); |
1682 | } |
1683 | |
1684 | INSTANTIATE_TEST_CASE_P(MotionPointerUpTest, |
1685 | MotionToPointerActionTest, ::testing::Values( |
1686 | - ActionTestParameters{mir_motion_action_pointer_up, mir_pointer_input_event_action_button_up})); |
1687 | + ActionTestParameters{mir_motion_action_pointer_up, mir_pointer_input_action_button_up})); |
1688 | |
1689 | INSTANTIATE_TEST_CASE_P(MotionPointerDownTest, |
1690 | MotionToPointerActionTest, ::testing::Values( |
1691 | - ActionTestParameters{mir_motion_action_pointer_down, mir_pointer_input_event_action_button_down})); |
1692 | + ActionTestParameters{mir_motion_action_pointer_down, mir_pointer_input_action_button_down})); |
1693 | |
1694 | INSTANTIATE_TEST_CASE_P(MotionEnterTest, |
1695 | MotionToPointerActionTest, ::testing::Values( |
1696 | - ActionTestParameters{mir_motion_action_hover_enter, mir_pointer_input_event_action_enter})); |
1697 | + ActionTestParameters{mir_motion_action_hover_enter, mir_pointer_input_action_enter})); |
1698 | |
1699 | INSTANTIATE_TEST_CASE_P(MotionLeaveTest, |
1700 | MotionToPointerActionTest, ::testing::Values( |
1701 | - ActionTestParameters{mir_motion_action_hover_exit, mir_pointer_input_event_action_leave})); |
1702 | + ActionTestParameters{mir_motion_action_hover_exit, mir_pointer_input_action_leave})); |
1703 | |
1704 | INSTANTIATE_TEST_CASE_P(MotionPointerMoveTest, |
1705 | MotionToPointerActionTest, ::testing::Values( |
1706 | - ActionTestParameters{mir_motion_action_move, mir_pointer_input_event_action_motion})); |
1707 | + ActionTestParameters{mir_motion_action_move, mir_pointer_input_action_motion})); |
1708 | |
1709 | INSTANTIATE_TEST_CASE_P(MotionPointerHoverMoveTest, |
1710 | MotionToPointerActionTest, ::testing::Values( |
1711 | - ActionTestParameters{mir_motion_action_hover_move, mir_pointer_input_event_action_motion})); |
1712 | + ActionTestParameters{mir_motion_action_hover_move, mir_pointer_input_action_motion})); |
1713 | |
1714 | INSTANTIATE_TEST_CASE_P(MotionPointerOutsideMoveTest, |
1715 | MotionToPointerActionTest, ::testing::Values( |
1716 | - ActionTestParameters{mir_motion_action_outside, mir_pointer_input_event_action_motion})); |
1717 | + ActionTestParameters{mir_motion_action_outside, mir_pointer_input_action_motion})); |
1718 | |
1719 | TEST(PointerInputEventProperties, button_state_translated) |
1720 | { |
1721 | auto old_ev = a_motion_ev(AINPUT_SOURCE_MOUSE); |
1722 | |
1723 | old_ev.motion.button_state = mir_motion_button_primary; |
1724 | - auto pev = mir_input_event_get_pointer_input_event(mir_event_get_input_event(&old_ev)); |
1725 | + auto pev = mir_input_event_get_pointer_input(mir_event_get_input_event(&old_ev)); |
1726 | |
1727 | - EXPECT_TRUE(mir_pointer_input_event_get_button_state(pev, mir_pointer_input_button_primary)); |
1728 | - EXPECT_FALSE(mir_pointer_input_event_get_button_state(pev, mir_pointer_input_button_secondary)); |
1729 | + EXPECT_TRUE(mir_pointer_input_get_button_state(pev, mir_pointer_input_button_primary)); |
1730 | + EXPECT_FALSE(mir_pointer_input_get_button_state(pev, mir_pointer_input_button_secondary)); |
1731 | |
1732 | old_ev.motion.button_state = static_cast<MirMotionButton>(old_ev.motion.button_state | (mir_motion_button_secondary)); |
1733 | |
1734 | - EXPECT_TRUE(mir_pointer_input_event_get_button_state(pev, mir_pointer_input_button_primary)); |
1735 | - EXPECT_TRUE(mir_pointer_input_event_get_button_state(pev, mir_pointer_input_button_secondary)); |
1736 | + EXPECT_TRUE(mir_pointer_input_get_button_state(pev, mir_pointer_input_button_primary)); |
1737 | + EXPECT_TRUE(mir_pointer_input_get_button_state(pev, mir_pointer_input_button_secondary)); |
1738 | |
1739 | - EXPECT_FALSE(mir_pointer_input_event_get_button_state(pev, mir_pointer_input_button_tertiary)); |
1740 | - EXPECT_FALSE(mir_pointer_input_event_get_button_state(pev, mir_pointer_input_button_back)); |
1741 | - EXPECT_FALSE(mir_pointer_input_event_get_button_state(pev, mir_pointer_input_button_forward)); |
1742 | + EXPECT_FALSE(mir_pointer_input_get_button_state(pev, mir_pointer_input_button_tertiary)); |
1743 | + EXPECT_FALSE(mir_pointer_input_get_button_state(pev, mir_pointer_input_button_back)); |
1744 | + EXPECT_FALSE(mir_pointer_input_get_button_state(pev, mir_pointer_input_button_forward)); |
1745 | } |
1746 | |
1747 | TEST(PointerInputEventProperties, axis_values_copied) |
1748 | @@ -389,9 +389,9 @@ |
1749 | old_ev.motion.pointer_coordinates[0].vscroll = vscroll; |
1750 | old_ev.motion.pointer_coordinates[0].hscroll = hscroll; |
1751 | |
1752 | - auto pev = mir_input_event_get_pointer_input_event(mir_event_get_input_event(&old_ev)); |
1753 | - EXPECT_EQ(x, mir_pointer_input_event_get_axis_value(pev, mir_pointer_input_axis_x)); |
1754 | - EXPECT_EQ(y, mir_pointer_input_event_get_axis_value(pev, mir_pointer_input_axis_y)); |
1755 | - EXPECT_EQ(vscroll, mir_pointer_input_event_get_axis_value(pev, mir_pointer_input_axis_vscroll)); |
1756 | - EXPECT_EQ(hscroll, mir_pointer_input_event_get_axis_value(pev, mir_pointer_input_axis_hscroll)); |
1757 | + auto pev = mir_input_event_get_pointer_input(mir_event_get_input_event(&old_ev)); |
1758 | + EXPECT_EQ(x, mir_pointer_input_get_axis_value(pev, mir_pointer_input_axis_x)); |
1759 | + EXPECT_EQ(y, mir_pointer_input_get_axis_value(pev, mir_pointer_input_axis_y)); |
1760 | + EXPECT_EQ(vscroll, mir_pointer_input_get_axis_value(pev, mir_pointer_input_axis_vscroll)); |
1761 | + EXPECT_EQ(hscroll, mir_pointer_input_get_axis_value(pev, mir_pointer_input_axis_hscroll)); |
1762 | } |
t) key_input_ event(struct ClientContext *ctx, MirKeyInput const* event)
9 +static void handle_
For consistency shouldn't we s/handle_ key_input_ event/handle_ key_input/