Merge lp:~mir-team/mir/unify-keyboard-actions into lp:mir
- unify-keyboard-actions
- Merge into development-branch
Status: | Merged |
---|---|
Approved by: | Robert Carr |
Approved revision: | no longer in the source branch. |
Merged at revision: | 2568 |
Proposed branch: | lp:~mir-team/mir/unify-keyboard-actions |
Merge into: | lp:mir |
Prerequisite: | lp:~mir-team/mir/unify-event-modifiers |
Diff against target: |
589 lines (+93/-148) 20 files modified
src/client/events/event_builders.cpp (+1/-20) src/client/input/android/android_input_lexicon.cpp (+1/-2) src/client/input/android/event_conversion_helpers.cpp (+32/-0) src/client/input/input_event.cpp (+2/-16) src/client/input/xkb_mapper.cpp (+4/-7) src/client/symbols.map (+2/-0) src/include/common/mir/events/event_private.h (+1/-8) src/include/common/mir/input/android/event_conversion_helpers.h (+9/-0) src/server/input/android/android_input_dispatcher.cpp (+2/-1) src/server/input/android/input_sender.cpp (+4/-2) src/server/input/android/input_translator.cpp (+1/-9) src/server/input/vt_filter.cpp (+1/-1) tests/acceptance-tests/throwback/test_client_input.cpp (+1/-1) tests/unit-tests/client/input/test_xkb_mapper.cpp (+17/-38) tests/unit-tests/input/android/test_android_input_dispatcher.cpp (+2/-3) tests/unit-tests/input/android/test_android_input_lexicon.cpp (+3/-4) tests/unit-tests/input/android/test_android_input_sender.cpp (+1/-1) tests/unit-tests/input/android/test_event_filter_input_dispatcher_policy.cpp (+2/-0) tests/unit-tests/input/android/test_input_translator.cpp (+5/-21) tests/unit-tests/input/test_input_event.cpp (+2/-14) |
To merge this branch: | bzr merge lp:~mir-team/mir/unify-keyboard-actions |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
PS Jenkins bot (community) | continuous-integration | Approve | |
Andreas Pokorny (community) | Approve | ||
Alan Griffiths | Approve | ||
Alexandros Frantzis (community) | Approve | ||
Kevin DuBois (community) | Approve | ||
Review via email: mp+258288@code.launchpad.net |
Commit message
Unify keyboard action enums.
The removed mir_key_
repeat_count is unified in to mir_keyboard_
Description of the change
Unify keyboard action enums.
The removed mir_key_
repeat_count is unified in to mir_keyboard_
This branch is part of the event cleaning pipeline:
Pluck-low-
Unify-event-
Unify-keyboard-
Remaining-
unify-pointer-
https:/
PS Jenkins bot (ps-jenkins) wrote : | # |
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:2546
http://
Executed test runs:
SUCCESS: http://
SUCCESS: http://
FAILURE: http://
FAILURE: http://
FAILURE: http://
Click here to trigger a rebuild:
http://
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:2547
http://
Executed test runs:
SUCCESS: http://
SUCCESS: http://
FAILURE: http://
FAILURE: http://
FAILURE: http://
Click here to trigger a rebuild:
http://
PS Jenkins bot (ps-jenkins) wrote : | # |
PASSED: Continuous integration, rev:2549
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://
Alexandros Frantzis (afrantzis) wrote : | # |
Looks good.
+ event.key.action == mir_keyboard_
It would be nice to change (in a future MP) event.key to event.keyboard to better match the new names.
Robert Carr (robertcarr) wrote : | # |
Fixed some conflicts and re taed
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Autolanding.
Unapproved changes made after approval.
http://
Executed test runs:
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
SUCCESS: http://
PS Jenkins bot (ps-jenkins) wrote : | # |
PASSED: Continuous integration, rev:2550
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://
Alan Griffiths (alan-griffiths) wrote : | # |
114 MirKeyboardAction mir_keyboard_
115 {
116 auto const& old_kev = old_kev_
117-
118- switch (old_kev.action)
119- {
120- case mir_key_
121- if (old_kev.
122- return mir_keyboard_
123- else
124- return mir_keyboard_
125- case mir_key_action_up:
126- return mir_keyboard_
127- default:
128- // TODO:? This means we got key_action_multiple which I dont think is
129- // actually emitted yet (and never will be as in the future it would fall under text
130- // event in the new model).
131- return mir_keyboard_
132- }
133+
134+ return old_kev.action;
135 }
Could be a one liner:
return old_kev_
Alan Griffiths (alan-griffiths) wrote : | # |
218+int32_t android_
The name doesn't make it obvious that we have a return value and an out parameter - which, BTW is in the wrong location:
Robert Carr (robertcarr) wrote : | # |
>> }
>> Could be a one liner:
>> return old_kev_
Not quite. mir_key_
Robert Carr (robertcarr) wrote : | # |
>. The name doesn't make it obvious that we have a return value and an out parameter - which, BTW >> is in the wrong location:
Fixed parameter location.
I don't see how I could make it more obvious that there is an out parameter without repeating myself 3 times in the same line (non const reference, _out postfix...) I've added a comment explaining why MirKeyboardAction needs to be converted to 2 android values though.
PS Jenkins bot (ps-jenkins) wrote : | # |
PASSED: Continuous integration, rev:2552
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://
Alan Griffiths (alan-griffiths) wrote : | # |
497+ ev.initialize(0, 0, 0, 0, 0, 0, 0, 0, std::chrono:
Yuck!
Alan Griffiths (alan-griffiths) wrote : | # |
> >. The name doesn't make it obvious that we have a return value and an out
> parameter - which, BTW >> is in the wrong location:
>
> Fixed parameter location.
>
> I don't see how I could make it more obvious that there is an out parameter
> without repeating myself 3 times in the same line (non const reference, _out
> postfix...) I've added a comment explaining why MirKeyboardAction needs to be
> converted to 2 android values though.
Well you could return a struct { action, repeat_count }; or a tuple<>
PS Jenkins bot (ps-jenkins) wrote : | # |
PASSED: Continuous integration, rev:2553
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://
Andreas Pokorny (andreas-pokorny) wrote : | # |
+ 489 might not be necessary?
+1 for tuple
lgtm
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Autolanding.
Unapproved changes made after approval.
http://
Executed test runs:
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
SUCCESS: http://
PS Jenkins bot (ps-jenkins) wrote : | # |
PASSED: Continuous integration, rev:2554
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://
Preview Diff
1 | === modified file 'src/client/events/event_builders.cpp' | |||
2 | --- src/client/events/event_builders.cpp 2015-05-07 15:00:30 +0000 | |||
3 | +++ src/client/events/event_builders.cpp 2015-05-12 14:00:09 +0000 | |||
4 | @@ -92,23 +92,6 @@ | |||
5 | 92 | return make_event_uptr(e); | 92 | return make_event_uptr(e); |
6 | 93 | } | 93 | } |
7 | 94 | 94 | ||
8 | 95 | namespace | ||
9 | 96 | { | ||
10 | 97 | MirKeyAction old_action_from_new(MirKeyboardAction action) | ||
11 | 98 | { | ||
12 | 99 | switch (action) | ||
13 | 100 | { | ||
14 | 101 | case mir_keyboard_action_repeat: | ||
15 | 102 | case mir_keyboard_action_up: | ||
16 | 103 | return mir_key_action_up; | ||
17 | 104 | case mir_keyboard_action_down: | ||
18 | 105 | return mir_key_action_down; | ||
19 | 106 | default: | ||
20 | 107 | BOOST_THROW_EXCEPTION(std::logic_error("Invalid key action")); | ||
21 | 108 | } | ||
22 | 109 | } | ||
23 | 110 | } | ||
24 | 111 | |||
25 | 112 | mir::EventUPtr mev::make_event(MirInputDeviceId device_id, int64_t timestamp, | 95 | mir::EventUPtr mev::make_event(MirInputDeviceId device_id, int64_t timestamp, |
26 | 113 | MirKeyboardAction action, xkb_keysym_t key_code, | 96 | MirKeyboardAction action, xkb_keysym_t key_code, |
27 | 114 | int scan_code, MirInputEventModifiers modifiers) | 97 | int scan_code, MirInputEventModifiers modifiers) |
28 | @@ -120,9 +103,7 @@ | |||
29 | 120 | auto& kev = e->key; | 103 | auto& kev = e->key; |
30 | 121 | kev.device_id = device_id; | 104 | kev.device_id = device_id; |
31 | 122 | kev.event_time = timestamp; | 105 | kev.event_time = timestamp; |
35 | 123 | kev.action = old_action_from_new(action); | 106 | kev.action = action; |
33 | 124 | if (action == mir_keyboard_action_repeat) | ||
34 | 125 | kev.repeat_count = 1; | ||
36 | 126 | kev.key_code = key_code; | 107 | kev.key_code = key_code; |
37 | 127 | kev.scan_code = scan_code; | 108 | kev.scan_code = scan_code; |
38 | 128 | kev.modifiers = modifiers; | 109 | kev.modifiers = modifiers; |
39 | 129 | 110 | ||
40 | === modified file 'src/client/input/android/android_input_lexicon.cpp' | |||
41 | --- src/client/input/android/android_input_lexicon.cpp 2015-05-05 00:15:05 +0000 | |||
42 | +++ src/client/input/android/android_input_lexicon.cpp 2015-05-12 14:00:09 +0000 | |||
43 | @@ -35,11 +35,10 @@ | |||
44 | 35 | mir_event.type = mir_event_type_key; | 35 | mir_event.type = mir_event_type_key; |
45 | 36 | mir_event.key.device_id = android_event->getDeviceId(); | 36 | mir_event.key.device_id = android_event->getDeviceId(); |
46 | 37 | mir_event.key.source_id = android_event->getSource(); | 37 | mir_event.key.source_id = android_event->getSource(); |
48 | 38 | mir_event.key.action = static_cast<MirKeyAction>(kev->getAction()); | 38 | mir_event.key.action = mia::mir_keyboard_action_from_android(kev->getAction(), kev->getRepeatCount()); |
49 | 39 | mir_event.key.modifiers = mia::mir_modifiers_from_android(kev->getMetaState()); | 39 | mir_event.key.modifiers = mia::mir_modifiers_from_android(kev->getMetaState()); |
50 | 40 | mir_event.key.key_code = kev->getKeyCode(); | 40 | mir_event.key.key_code = kev->getKeyCode(); |
51 | 41 | mir_event.key.scan_code = kev->getScanCode(); | 41 | mir_event.key.scan_code = kev->getScanCode(); |
52 | 42 | mir_event.key.repeat_count = kev->getRepeatCount(); | ||
53 | 43 | mir_event.key.event_time = kev->getEventTime().count(); | 42 | mir_event.key.event_time = kev->getEventTime().count(); |
54 | 44 | break; | 43 | break; |
55 | 45 | } | 44 | } |
56 | 46 | 45 | ||
57 | === modified file 'src/client/input/android/event_conversion_helpers.cpp' | |||
58 | --- src/client/input/android/event_conversion_helpers.cpp 2015-05-05 00:15:05 +0000 | |||
59 | +++ src/client/input/android/event_conversion_helpers.cpp 2015-05-12 14:00:09 +0000 | |||
60 | @@ -68,3 +68,35 @@ | |||
61 | 68 | if (mir_modifiers & mir_input_event_modifier_scroll_lock) ret |= AMETA_SCROLL_LOCK_ON; | 68 | if (mir_modifiers & mir_input_event_modifier_scroll_lock) ret |= AMETA_SCROLL_LOCK_ON; |
62 | 69 | return ret; | 69 | return ret; |
63 | 70 | } | 70 | } |
64 | 71 | |||
65 | 72 | MirKeyboardAction mia::mir_keyboard_action_from_android(int32_t android_action, int32_t repeat_count) | ||
66 | 73 | { | ||
67 | 74 | if (repeat_count > 0) | ||
68 | 75 | return mir_keyboard_action_repeat; | ||
69 | 76 | |||
70 | 77 | switch (android_action) | ||
71 | 78 | { | ||
72 | 79 | case AKEY_EVENT_ACTION_DOWN: | ||
73 | 80 | case AKEY_EVENT_ACTION_MULTIPLE: | ||
74 | 81 | return mir_keyboard_action_down; | ||
75 | 82 | case AKEY_EVENT_ACTION_UP: | ||
76 | 83 | return mir_keyboard_action_up; | ||
77 | 84 | default: | ||
78 | 85 | return mir_keyboard_action_down; | ||
79 | 86 | } | ||
80 | 87 | } | ||
81 | 88 | |||
82 | 89 | int32_t mia::android_keyboard_action_from_mir(int32_t& repeat_count_out, MirKeyboardAction action) | ||
83 | 90 | { | ||
84 | 91 | repeat_count_out = 0; | ||
85 | 92 | switch (action) | ||
86 | 93 | { | ||
87 | 94 | case mir_keyboard_action_repeat: | ||
88 | 95 | repeat_count_out = 1; | ||
89 | 96 | case mir_keyboard_action_down: | ||
90 | 97 | return AKEY_EVENT_ACTION_DOWN; | ||
91 | 98 | case mir_keyboard_action_up: | ||
92 | 99 | default: | ||
93 | 100 | return AKEY_EVENT_ACTION_UP; | ||
94 | 101 | } | ||
95 | 102 | } | ||
96 | 71 | 103 | ||
97 | === modified file 'src/client/input/input_event.cpp' | |||
98 | --- src/client/input/input_event.cpp 2015-05-05 00:15:05 +0000 | |||
99 | +++ src/client/input/input_event.cpp 2015-05-12 14:00:09 +0000 | |||
100 | @@ -209,22 +209,8 @@ | |||
101 | 209 | MirKeyboardAction mir_keyboard_event_action(MirKeyboardEvent const* kev) | 209 | MirKeyboardAction mir_keyboard_event_action(MirKeyboardEvent const* kev) |
102 | 210 | { | 210 | { |
103 | 211 | auto const& old_kev = old_kev_from_new(kev); | 211 | auto const& old_kev = old_kev_from_new(kev); |
120 | 212 | 212 | ||
121 | 213 | switch (old_kev.action) | 213 | return old_kev.action; |
106 | 214 | { | ||
107 | 215 | case mir_key_action_down: | ||
108 | 216 | if (old_kev.repeat_count != 0) | ||
109 | 217 | return mir_keyboard_action_repeat; | ||
110 | 218 | else | ||
111 | 219 | return mir_keyboard_action_down; | ||
112 | 220 | case mir_key_action_up: | ||
113 | 221 | return mir_keyboard_action_up; | ||
114 | 222 | default: | ||
115 | 223 | // TODO:? This means we got key_action_multiple which I dont think is | ||
116 | 224 | // actually emitted yet (and never will be as in the future it would fall under text | ||
117 | 225 | // event in the new model). | ||
118 | 226 | return mir_keyboard_action_down; | ||
119 | 227 | } | ||
122 | 228 | } | 214 | } |
123 | 229 | 215 | ||
124 | 230 | xkb_keysym_t mir_keyboard_event_key_code(MirKeyboardEvent const* kev) | 216 | xkb_keysym_t mir_keyboard_event_key_code(MirKeyboardEvent const* kev) |
125 | 231 | 217 | ||
126 | === modified file 'src/client/input/xkb_mapper.cpp' | |||
127 | --- src/client/input/xkb_mapper.cpp 2015-04-01 19:39:19 +0000 | |||
128 | +++ src/client/input/xkb_mapper.cpp 2015-05-12 14:00:09 +0000 | |||
129 | @@ -90,17 +90,14 @@ | |||
130 | 90 | 90 | ||
131 | 91 | auto &key_ev = ev.key; | 91 | auto &key_ev = ev.key; |
132 | 92 | 92 | ||
134 | 93 | xkb_key_direction direction; | 93 | xkb_key_direction direction = XKB_KEY_DOWN; |
135 | 94 | 94 | ||
136 | 95 | bool update_state = true; | 95 | bool update_state = true; |
138 | 96 | if (key_ev.action == mir_key_action_up) | 96 | if (key_ev.action == mir_keyboard_action_up) |
139 | 97 | direction = XKB_KEY_UP; | 97 | direction = XKB_KEY_UP; |
141 | 98 | else if (key_ev.action == mir_key_action_down) | 98 | else if (key_ev.action == mir_keyboard_action_down) |
142 | 99 | direction = XKB_KEY_DOWN; | 99 | direction = XKB_KEY_DOWN; |
147 | 100 | else // mir_key_action_multiple does not correspond to a physical keypress | 100 | else if (key_ev.action == mir_keyboard_action_repeat) |
144 | 101 | update_state = false; | ||
145 | 102 | |||
146 | 103 | if (key_ev.repeat_count > 0) | ||
148 | 104 | update_state = false; | 101 | update_state = false; |
149 | 105 | 102 | ||
150 | 106 | uint32_t xkb_scan_code = to_xkb_scan_code(key_ev.scan_code); | 103 | uint32_t xkb_scan_code = to_xkb_scan_code(key_ev.scan_code); |
151 | 107 | 104 | ||
152 | === modified file 'src/client/symbols.map' | |||
153 | --- src/client/symbols.map 2015-05-07 07:20:05 +0000 | |||
154 | +++ src/client/symbols.map 2015-05-12 14:00:09 +0000 | |||
155 | @@ -206,6 +206,8 @@ | |||
156 | 206 | mir::input::android::Lexicon::translate*; | 206 | mir::input::android::Lexicon::translate*; |
157 | 207 | mir::input::android::android_modifiers_from_mir*; | 207 | mir::input::android::android_modifiers_from_mir*; |
158 | 208 | mir::input::android::mir_modifiers_from_android*; | 208 | mir::input::android::mir_modifiers_from_android*; |
159 | 209 | mir::input::android::mir_keyboard_action_from_android*; | ||
160 | 210 | mir::input::android::android_keyboard_action_from_mir*; | ||
161 | 209 | mir::client::DefaultConnectionConfiguration::DefaultConnectionConfiguration*; | 211 | mir::client::DefaultConnectionConfiguration::DefaultConnectionConfiguration*; |
162 | 210 | mir::client::DefaultConnectionConfiguration::the_surface_map*; | 212 | mir::client::DefaultConnectionConfiguration::the_surface_map*; |
163 | 211 | mir::client::DefaultConnectionConfiguration::the_rpc_channel*; | 213 | mir::client::DefaultConnectionConfiguration::the_rpc_channel*; |
164 | 212 | 214 | ||
165 | === modified file 'src/include/common/mir/events/event_private.h' | |||
166 | --- src/include/common/mir/events/event_private.h 2015-05-07 07:20:05 +0000 | |||
167 | +++ src/include/common/mir/events/event_private.h 2015-05-12 14:00:09 +0000 | |||
168 | @@ -47,12 +47,6 @@ | |||
169 | 47 | typedef int64_t nsecs_t; | 47 | typedef int64_t nsecs_t; |
170 | 48 | 48 | ||
171 | 49 | typedef enum { | 49 | typedef enum { |
172 | 50 | mir_key_action_down = 0, | ||
173 | 51 | mir_key_action_up = 1, | ||
174 | 52 | mir_key_action_multiple = 2 | ||
175 | 53 | } MirKeyAction; | ||
176 | 54 | |||
177 | 55 | typedef enum { | ||
178 | 56 | mir_motion_action_down = 0, | 50 | mir_motion_action_down = 0, |
179 | 57 | mir_motion_action_up = 1, | 51 | mir_motion_action_up = 1, |
180 | 58 | mir_motion_action_move = 2, | 52 | mir_motion_action_move = 2, |
181 | @@ -91,12 +85,11 @@ | |||
182 | 91 | 85 | ||
183 | 92 | int32_t device_id; | 86 | int32_t device_id; |
184 | 93 | int32_t source_id; | 87 | int32_t source_id; |
186 | 94 | MirKeyAction action; | 88 | MirKeyboardAction action; |
187 | 95 | MirInputEventModifiers modifiers; | 89 | MirInputEventModifiers modifiers; |
188 | 96 | 90 | ||
189 | 97 | int32_t key_code; | 91 | int32_t key_code; |
190 | 98 | int32_t scan_code; | 92 | int32_t scan_code; |
191 | 99 | int32_t repeat_count; | ||
192 | 100 | 93 | ||
193 | 101 | nsecs_t event_time; | 94 | nsecs_t event_time; |
194 | 102 | } MirKeyEvent; | 95 | } MirKeyEvent; |
195 | 103 | 96 | ||
196 | === modified file 'src/include/common/mir/input/android/event_conversion_helpers.h' | |||
197 | --- src/include/common/mir/input/android/event_conversion_helpers.h 2015-05-05 00:15:05 +0000 | |||
198 | +++ src/include/common/mir/input/android/event_conversion_helpers.h 2015-05-12 14:00:09 +0000 | |||
199 | @@ -29,6 +29,15 @@ | |||
200 | 29 | { | 29 | { |
201 | 30 | MirInputEventModifiers mir_modifiers_from_android(int32_t android_modifiers); | 30 | MirInputEventModifiers mir_modifiers_from_android(int32_t android_modifiers); |
202 | 31 | int32_t android_modifiers_from_mir(MirInputEventModifiers modifiers); | 31 | int32_t android_modifiers_from_mir(MirInputEventModifiers modifiers); |
203 | 32 | |||
204 | 33 | MirKeyboardAction mir_keyboard_action_from_android(int32_t android_action, int32_t repeat_count); | ||
205 | 34 | |||
206 | 35 | // Mir differentiates between mir_keyboard_action_down | ||
207 | 36 | // and mir_keyboard_action_repeat whereas android encodes | ||
208 | 37 | // keyrepeats as AKEY_EVENT_ACTION_DOWN and a repeatCount of > 0 | ||
209 | 38 | // Thus when converting from MirKeyboardAction to an android | ||
210 | 39 | // action we must also fetch a repeat count for the android event. | ||
211 | 40 | int32_t android_keyboard_action_from_mir(int32_t& repeat_count_out, MirKeyboardAction action); | ||
212 | 32 | } | 41 | } |
213 | 33 | } | 42 | } |
214 | 34 | } | 43 | } |
215 | 35 | 44 | ||
216 | === modified file 'src/server/input/android/android_input_dispatcher.cpp' | |||
217 | --- src/server/input/android/android_input_dispatcher.cpp 2015-05-07 07:20:05 +0000 | |||
218 | +++ src/server/input/android/android_input_dispatcher.cpp 2015-05-12 14:00:09 +0000 | |||
219 | @@ -55,12 +55,13 @@ | |||
220 | 55 | { | 55 | { |
221 | 56 | case mir_event_type_key: | 56 | case mir_event_type_key: |
222 | 57 | { | 57 | { |
223 | 58 | int32_t ignored_repeat_count = 0; | ||
224 | 58 | droidinput::NotifyKeyArgs const notify_key_args( | 59 | droidinput::NotifyKeyArgs const notify_key_args( |
225 | 59 | std::chrono::nanoseconds(event.key.event_time), | 60 | std::chrono::nanoseconds(event.key.event_time), |
226 | 60 | event.key.device_id, | 61 | event.key.device_id, |
227 | 61 | event.key.source_id, | 62 | event.key.source_id, |
228 | 62 | policy_flags, | 63 | policy_flags, |
230 | 63 | event.key.action, | 64 | mia::android_keyboard_action_from_mir(ignored_repeat_count, event.key.action), |
231 | 64 | 0, /* flags */ | 65 | 0, /* flags */ |
232 | 65 | event.key.key_code, | 66 | event.key.key_code, |
233 | 66 | event.key.scan_code, | 67 | event.key.scan_code, |
234 | 67 | 68 | ||
235 | === modified file 'src/server/input/android/input_sender.cpp' | |||
236 | --- src/server/input/android/input_sender.cpp 2015-05-05 00:15:05 +0000 | |||
237 | +++ src/server/input/android/input_sender.cpp 2015-05-12 14:00:09 +0000 | |||
238 | @@ -237,16 +237,18 @@ | |||
239 | 237 | 237 | ||
240 | 238 | droidinput::status_t mia::InputSender::ActiveTransfer::send_key_event(uint32_t seq, MirKeyEvent const& event) | 238 | droidinput::status_t mia::InputSender::ActiveTransfer::send_key_event(uint32_t seq, MirKeyEvent const& event) |
241 | 239 | { | 239 | { |
242 | 240 | int32_t repeat_count = 0; | ||
243 | 241 | auto android_action = mia::android_keyboard_action_from_mir(repeat_count, event.action); | ||
244 | 240 | return publisher.publishKeyEvent( | 242 | return publisher.publishKeyEvent( |
245 | 241 | seq, | 243 | seq, |
246 | 242 | event.device_id, | 244 | event.device_id, |
247 | 243 | event.source_id, | 245 | event.source_id, |
249 | 244 | event.action, | 246 | android_action, |
250 | 245 | 0, /* Flags */ | 247 | 0, /* Flags */ |
251 | 246 | event.key_code, | 248 | event.key_code, |
252 | 247 | event.scan_code, | 249 | event.scan_code, |
253 | 248 | mia::android_modifiers_from_mir(event.modifiers), | 250 | mia::android_modifiers_from_mir(event.modifiers), |
255 | 249 | event.repeat_count, | 251 | repeat_count, |
256 | 250 | std::chrono::nanoseconds(event.event_time), | 252 | std::chrono::nanoseconds(event.event_time), |
257 | 251 | std::chrono::nanoseconds(event.event_time) | 253 | std::chrono::nanoseconds(event.event_time) |
258 | 252 | ); | 254 | ); |
259 | 253 | 255 | ||
260 | === modified file 'src/server/input/android/input_translator.cpp' | |||
261 | --- src/server/input/android/input_translator.cpp 2015-05-07 07:20:05 +0000 | |||
262 | +++ src/server/input/android/input_translator.cpp 2015-05-12 14:00:09 +0000 | |||
263 | @@ -29,10 +29,6 @@ | |||
264 | 29 | 29 | ||
265 | 30 | namespace | 30 | namespace |
266 | 31 | { | 31 | { |
267 | 32 | bool valid_key_event(MirKeyEvent const& key) | ||
268 | 33 | { | ||
269 | 34 | return key.action == mir_key_action_up || key.action == mir_key_action_down; | ||
270 | 35 | } | ||
271 | 36 | inline int32_t get_index_from_motion_action(int action) | 32 | inline int32_t get_index_from_motion_action(int action) |
272 | 37 | { | 33 | { |
273 | 38 | // FIXME: https://bugs.launchpad.net/mir/+bug/1311699 | 34 | // FIXME: https://bugs.launchpad.net/mir/+bug/1311699 |
274 | @@ -131,16 +127,12 @@ | |||
275 | 131 | mir_event.type = mir_event_type_key; | 127 | mir_event.type = mir_event_type_key; |
276 | 132 | mir_event.key.device_id = args->deviceId; | 128 | mir_event.key.device_id = args->deviceId; |
277 | 133 | mir_event.key.source_id = args->source; | 129 | mir_event.key.source_id = args->source; |
279 | 134 | mir_event.key.action = static_cast<MirKeyAction>(args->action); | 130 | mir_event.key.action = mia::mir_keyboard_action_from_android(args->action, 0 /* repeat_count */); |
280 | 135 | mir_event.key.modifiers = mir_modifiers; | 131 | mir_event.key.modifiers = mir_modifiers; |
281 | 136 | mir_event.key.key_code = args->keyCode; | 132 | mir_event.key.key_code = args->keyCode; |
282 | 137 | mir_event.key.scan_code = args->scanCode; | 133 | mir_event.key.scan_code = args->scanCode; |
283 | 138 | mir_event.key.repeat_count = 0; | ||
284 | 139 | mir_event.key.event_time = args->eventTime.count(); | 134 | mir_event.key.event_time = args->eventTime.count(); |
285 | 140 | 135 | ||
286 | 141 | if (!valid_key_event(mir_event.key)) | ||
287 | 142 | return; | ||
288 | 143 | |||
289 | 144 | dispatcher->dispatch(mir_event); | 136 | dispatcher->dispatch(mir_event); |
290 | 145 | } | 137 | } |
291 | 146 | 138 | ||
292 | 147 | 139 | ||
293 | === modified file 'src/server/input/vt_filter.cpp' | |||
294 | --- src/server/input/vt_filter.cpp 2015-05-05 00:15:05 +0000 | |||
295 | +++ src/server/input/vt_filter.cpp 2015-05-12 14:00:09 +0000 | |||
296 | @@ -38,7 +38,7 @@ | |||
297 | 38 | bool mir::input::VTFilter::handle(MirEvent const& event) | 38 | bool mir::input::VTFilter::handle(MirEvent const& event) |
298 | 39 | { | 39 | { |
299 | 40 | if (event.type == mir_event_type_key && | 40 | if (event.type == mir_event_type_key && |
301 | 41 | event.key.action == mir_key_action_down && | 41 | event.key.action == mir_keyboard_action_down && |
302 | 42 | (event.key.modifiers & mir_input_event_modifier_alt) && | 42 | (event.key.modifiers & mir_input_event_modifier_alt) && |
303 | 43 | (event.key.modifiers & mir_input_event_modifier_ctrl)) | 43 | (event.key.modifiers & mir_input_event_modifier_ctrl)) |
304 | 44 | { | 44 | { |
305 | 45 | 45 | ||
306 | === modified file 'tests/acceptance-tests/throwback/test_client_input.cpp' | |||
307 | --- tests/acceptance-tests/throwback/test_client_input.cpp 2015-04-30 11:36:36 +0000 | |||
308 | +++ tests/acceptance-tests/throwback/test_client_input.cpp 2015-05-12 14:00:09 +0000 | |||
309 | @@ -617,7 +617,7 @@ | |||
310 | 617 | MirEvent key_event; | 617 | MirEvent key_event; |
311 | 618 | std::memset(&key_event, 0, sizeof key_event); | 618 | std::memset(&key_event, 0, sizeof key_event); |
312 | 619 | key_event.type = mir_event_type_key; | 619 | key_event.type = mir_event_type_key; |
314 | 620 | key_event.key.action = mir_key_action_down; | 620 | key_event.key.action = mir_keyboard_action_down; |
315 | 621 | 621 | ||
316 | 622 | session->default_surface()->consume(key_event); | 622 | session->default_surface()->consume(key_event); |
317 | 623 | }); | 623 | }); |
318 | 624 | 624 | ||
319 | === modified file 'tests/unit-tests/client/input/test_xkb_mapper.cpp' | |||
320 | --- tests/unit-tests/client/input/test_xkb_mapper.cpp 2015-04-01 19:39:19 +0000 | |||
321 | +++ tests/unit-tests/client/input/test_xkb_mapper.cpp 2015-05-12 14:00:09 +0000 | |||
322 | @@ -31,25 +31,12 @@ | |||
323 | 31 | namespace | 31 | namespace |
324 | 32 | { | 32 | { |
325 | 33 | 33 | ||
345 | 34 | static int map_key(mircv::XKBMapper &mapper, MirKeyAction action, int scan_code) | 34 | static int map_key(mircv::XKBMapper &mapper, MirKeyboardAction action, int scan_code) |
346 | 35 | { | 35 | { |
347 | 36 | MirEvent ev; | 36 | MirEvent ev; |
348 | 37 | ev.type = mir_event_type_key; | 37 | ev.type = mir_event_type_key; |
349 | 38 | ev.key.action = action; | 38 | ev.key.action = action; |
350 | 39 | ev.key.scan_code = scan_code; | 39 | ev.key.scan_code = scan_code; |
332 | 40 | ev.key.repeat_count = 0; | ||
333 | 41 | |||
334 | 42 | mapper.update_state_and_map_event(ev); | ||
335 | 43 | return ev.key.key_code; | ||
336 | 44 | } | ||
337 | 45 | |||
338 | 46 | static int map_repeated_key(mircv::XKBMapper &mapper, MirKeyAction action, int scan_code) | ||
339 | 47 | { | ||
340 | 48 | MirEvent ev; | ||
341 | 49 | ev.type = mir_event_type_key; | ||
342 | 50 | ev.key.action = action; | ||
343 | 51 | ev.key.scan_code = scan_code; | ||
344 | 52 | ev.key.repeat_count = 1; | ||
351 | 53 | 40 | ||
352 | 54 | mapper.update_state_and_map_event(ev); | 41 | mapper.update_state_and_map_event(ev); |
353 | 55 | return ev.key.key_code; | 42 | return ev.key.key_code; |
354 | @@ -61,29 +48,21 @@ | |||
355 | 61 | { | 48 | { |
356 | 62 | mircv::XKBMapper mapper; | 49 | mircv::XKBMapper mapper; |
357 | 63 | 50 | ||
372 | 64 | EXPECT_EQ(XKB_KEY_4, map_key(mapper, mir_key_action_down, KEY_4)); | 51 | EXPECT_EQ(XKB_KEY_4, map_key(mapper, mir_keyboard_action_down, KEY_4)); |
373 | 65 | EXPECT_EQ(XKB_KEY_Shift_L, map_key(mapper, mir_key_action_down, KEY_LEFTSHIFT)); | 52 | EXPECT_EQ(XKB_KEY_Shift_L, map_key(mapper, mir_keyboard_action_down, KEY_LEFTSHIFT)); |
374 | 66 | EXPECT_EQ(XKB_KEY_dollar, map_key(mapper, mir_key_action_down, KEY_4)); | 53 | EXPECT_EQ(XKB_KEY_dollar, map_key(mapper, mir_keyboard_action_down, KEY_4)); |
375 | 67 | EXPECT_EQ(XKB_KEY_dollar, map_key(mapper, mir_key_action_up, KEY_4)); | 54 | EXPECT_EQ(XKB_KEY_dollar, map_key(mapper, mir_keyboard_action_up, KEY_4)); |
376 | 68 | EXPECT_EQ(XKB_KEY_Shift_L, map_key(mapper, mir_key_action_up, KEY_LEFTSHIFT)); | 55 | EXPECT_EQ(XKB_KEY_Shift_L, map_key(mapper, mir_keyboard_action_up, KEY_LEFTSHIFT)); |
377 | 69 | EXPECT_EQ(XKB_KEY_4, map_key(mapper, mir_key_action_down, KEY_4)); | 56 | EXPECT_EQ(XKB_KEY_4, map_key(mapper, mir_keyboard_action_down, KEY_4)); |
364 | 70 | } | ||
365 | 71 | |||
366 | 72 | TEST(XKBMapper, key_action_multiple_does_not_update_modifier_state) | ||
367 | 73 | { | ||
368 | 74 | mircv::XKBMapper mapper; | ||
369 | 75 | |||
370 | 76 | EXPECT_EQ(XKB_KEY_Shift_R, map_key(mapper, mir_key_action_multiple, KEY_RIGHTSHIFT)); | ||
371 | 77 | EXPECT_EQ(XKB_KEY_7, map_key(mapper, mir_key_action_down, KEY_7)); | ||
378 | 78 | } | 57 | } |
379 | 79 | 58 | ||
380 | 80 | TEST(XKBMapper, key_repeats_do_not_recurse_modifier_state) | 59 | TEST(XKBMapper, key_repeats_do_not_recurse_modifier_state) |
381 | 81 | { | 60 | { |
382 | 82 | mircv::XKBMapper mapper; | 61 | mircv::XKBMapper mapper; |
383 | 83 | 62 | ||
389 | 84 | EXPECT_EQ(XKB_KEY_Shift_R, map_key(mapper, mir_key_action_down, KEY_RIGHTSHIFT)); | 63 | EXPECT_EQ(XKB_KEY_Shift_R, map_key(mapper, mir_keyboard_action_down, KEY_RIGHTSHIFT)); |
390 | 85 | EXPECT_EQ(XKB_KEY_Shift_R, map_repeated_key(mapper, mir_key_action_down, KEY_RIGHTSHIFT)); | 64 | EXPECT_EQ(XKB_KEY_Shift_R, map_key(mapper, mir_keyboard_action_repeat, KEY_RIGHTSHIFT)); |
391 | 86 | EXPECT_EQ(XKB_KEY_ampersand, map_key(mapper, mir_key_action_down, KEY_7)); | 65 | EXPECT_EQ(XKB_KEY_ampersand, map_key(mapper, mir_keyboard_action_down, KEY_7)); |
392 | 87 | EXPECT_EQ(XKB_KEY_Shift_R, map_key(mapper, mir_key_action_up, KEY_RIGHTSHIFT)); | 66 | EXPECT_EQ(XKB_KEY_Shift_R, map_key(mapper, mir_keyboard_action_up, KEY_RIGHTSHIFT)); |
393 | 88 | EXPECT_EQ(XKB_KEY_7, map_key(mapper, mir_key_action_down, KEY_7)); | 67 | EXPECT_EQ(XKB_KEY_7, map_key(mapper, mir_keyboard_action_down, KEY_7)); |
394 | 89 | } | 68 | } |
395 | 90 | 69 | ||
396 | === modified file 'tests/unit-tests/input/android/test_android_input_dispatcher.cpp' | |||
397 | --- tests/unit-tests/input/android/test_android_input_dispatcher.cpp 2015-05-05 00:15:05 +0000 | |||
398 | +++ tests/unit-tests/input/android/test_android_input_dispatcher.cpp 2015-05-12 14:00:09 +0000 | |||
399 | @@ -236,17 +236,16 @@ | |||
400 | 236 | event.key.event_time = 1; | 236 | event.key.event_time = 1; |
401 | 237 | event.key.device_id = 2; | 237 | event.key.device_id = 2; |
402 | 238 | event.key.source_id = 3; | 238 | event.key.source_id = 3; |
404 | 239 | event.key.action = mir_key_action_down; | 239 | event.key.action = mir_keyboard_action_down; |
405 | 240 | event.key.scan_code = 4; | 240 | event.key.scan_code = 4; |
406 | 241 | event.key.key_code = 5; | 241 | event.key.key_code = 5; |
407 | 242 | event.key.repeat_count = 0; | ||
408 | 243 | event.key.modifiers = mir_input_event_modifier_shift; | 242 | event.key.modifiers = mir_input_event_modifier_shift; |
409 | 244 | 243 | ||
410 | 245 | droidinput::NotifyKeyArgs expected(std::chrono::nanoseconds(event.key.event_time), | 244 | droidinput::NotifyKeyArgs expected(std::chrono::nanoseconds(event.key.event_time), |
411 | 246 | event.key.device_id, | 245 | event.key.device_id, |
412 | 247 | event.key.source_id, | 246 | event.key.source_id, |
413 | 248 | default_policy_flags, | 247 | default_policy_flags, |
415 | 249 | event.key.action, | 248 | AKEY_EVENT_ACTION_DOWN, |
416 | 250 | 0, /* flags */ | 249 | 0, /* flags */ |
417 | 251 | event.key.key_code, | 250 | event.key.key_code, |
418 | 252 | event.key.scan_code, | 251 | event.key.scan_code, |
419 | 253 | 252 | ||
420 | === modified file 'tests/unit-tests/input/android/test_android_input_lexicon.cpp' | |||
421 | --- tests/unit-tests/input/android/test_android_input_lexicon.cpp 2015-05-05 00:15:05 +0000 | |||
422 | +++ tests/unit-tests/input/android/test_android_input_lexicon.cpp 2015-05-12 14:00:09 +0000 | |||
423 | @@ -34,12 +34,12 @@ | |||
424 | 34 | 34 | ||
425 | 35 | const int32_t device_id = 1; | 35 | const int32_t device_id = 1; |
426 | 36 | const int32_t source_id = 2; | 36 | const int32_t source_id = 2; |
428 | 37 | const int32_t action = 3; | 37 | const int32_t action = AKEY_EVENT_ACTION_DOWN; |
429 | 38 | const int32_t flags = 4; | 38 | const int32_t flags = 4; |
430 | 39 | const int32_t key_code = 5; | 39 | const int32_t key_code = 5; |
431 | 40 | const int32_t scan_code = 6; | 40 | const int32_t scan_code = 6; |
432 | 41 | const int32_t meta_state = AMETA_ALT_ON; | 41 | const int32_t meta_state = AMETA_ALT_ON; |
434 | 42 | const int32_t repeat_count = 8; | 42 | const int32_t repeat_count = 0; |
435 | 43 | auto const down_time = std::chrono::nanoseconds(9); | 43 | auto const down_time = std::chrono::nanoseconds(9); |
436 | 44 | auto const event_time = std::chrono::nanoseconds(10); | 44 | auto const event_time = std::chrono::nanoseconds(10); |
437 | 45 | 45 | ||
438 | @@ -53,7 +53,7 @@ | |||
439 | 53 | // Common event properties | 53 | // Common event properties |
440 | 54 | EXPECT_EQ(device_id, mir_ev.key.device_id); | 54 | EXPECT_EQ(device_id, mir_ev.key.device_id); |
441 | 55 | EXPECT_EQ(source_id, mir_ev.key.source_id); | 55 | EXPECT_EQ(source_id, mir_ev.key.source_id); |
443 | 56 | EXPECT_EQ(action, mir_ev.key.action); | 56 | EXPECT_EQ(mir_keyboard_action_down, mir_ev.key.action); |
444 | 57 | EXPECT_EQ(mir_input_event_modifier_alt, mir_ev.key.modifiers); | 57 | EXPECT_EQ(mir_input_event_modifier_alt, mir_ev.key.modifiers); |
445 | 58 | 58 | ||
446 | 59 | auto mir_key_ev = &mir_ev.key; | 59 | auto mir_key_ev = &mir_ev.key; |
447 | @@ -61,7 +61,6 @@ | |||
448 | 61 | EXPECT_EQ(mir_ev.type, mir_event_type_key); | 61 | EXPECT_EQ(mir_ev.type, mir_event_type_key); |
449 | 62 | EXPECT_EQ(mir_key_ev->key_code, key_code); | 62 | EXPECT_EQ(mir_key_ev->key_code, key_code); |
450 | 63 | EXPECT_EQ(mir_key_ev->scan_code, scan_code); | 63 | EXPECT_EQ(mir_key_ev->scan_code, scan_code); |
451 | 64 | EXPECT_EQ(mir_key_ev->repeat_count, repeat_count); | ||
452 | 65 | EXPECT_EQ(mir_key_ev->event_time, event_time.count()); | 64 | EXPECT_EQ(mir_key_ev->event_time, event_time.count()); |
453 | 66 | 65 | ||
454 | 67 | delete android_key_ev; | 66 | delete android_key_ev; |
455 | 68 | 67 | ||
456 | === modified file 'tests/unit-tests/input/android/test_android_input_sender.cpp' | |||
457 | --- tests/unit-tests/input/android/test_android_input_sender.cpp 2015-04-01 19:39:19 +0000 | |||
458 | +++ tests/unit-tests/input/android/test_android_input_sender.cpp 2015-05-12 14:00:09 +0000 | |||
459 | @@ -89,7 +89,7 @@ | |||
460 | 89 | 89 | ||
461 | 90 | key_event.type = mir_event_type_key; | 90 | key_event.type = mir_event_type_key; |
462 | 91 | key_event.key.scan_code = 32; | 91 | key_event.key.scan_code = 32; |
464 | 92 | key_event.key.action = mir_key_action_down; | 92 | key_event.key.action = mir_keyboard_action_down; |
465 | 93 | 93 | ||
466 | 94 | motion_event.type = mir_event_type_motion; | 94 | motion_event.type = mir_event_type_motion; |
467 | 95 | motion_event.motion.pointer_count = 2; | 95 | motion_event.motion.pointer_count = 2; |
468 | 96 | 96 | ||
469 | === modified file 'tests/unit-tests/input/android/test_event_filter_input_dispatcher_policy.cpp' | |||
470 | --- tests/unit-tests/input/android/test_event_filter_input_dispatcher_policy.cpp 2015-04-01 19:39:19 +0000 | |||
471 | +++ tests/unit-tests/input/android/test_event_filter_input_dispatcher_policy.cpp 2015-05-12 14:00:09 +0000 | |||
472 | @@ -24,6 +24,7 @@ | |||
473 | 24 | #include "mir_test_doubles/mock_event_filter.h" | 24 | #include "mir_test_doubles/mock_event_filter.h" |
474 | 25 | 25 | ||
475 | 26 | #include <androidfw/Input.h> | 26 | #include <androidfw/Input.h> |
476 | 27 | #include <string.h> | ||
477 | 27 | 28 | ||
478 | 28 | #include <gtest/gtest.h> | 29 | #include <gtest/gtest.h> |
479 | 29 | #include <gmock/gmock.h> | 30 | #include <gmock/gmock.h> |
480 | @@ -37,6 +38,7 @@ | |||
481 | 37 | { | 38 | { |
482 | 38 | using namespace ::testing; | 39 | using namespace ::testing; |
483 | 39 | droidinput::KeyEvent ev; | 40 | droidinput::KeyEvent ev; |
484 | 41 | ev.initialize(0, 0, 0, 0, 0, 0, 0, 0, std::chrono::nanoseconds(0), std::chrono::nanoseconds(0)); | ||
485 | 40 | mtd::MockEventFilter filter; | 42 | mtd::MockEventFilter filter; |
486 | 41 | mia::EventFilterDispatcherPolicy policy(mt::fake_shared(filter), true); | 43 | mia::EventFilterDispatcherPolicy policy(mt::fake_shared(filter), true); |
487 | 42 | uint32_t policy_flags; | 44 | uint32_t policy_flags; |
488 | 43 | 45 | ||
489 | === modified file 'tests/unit-tests/input/android/test_input_translator.cpp' | |||
490 | --- tests/unit-tests/input/android/test_input_translator.cpp 2015-05-07 07:20:05 +0000 | |||
491 | +++ tests/unit-tests/input/android/test_input_translator.cpp 2015-05-12 14:00:09 +0000 | |||
492 | @@ -102,21 +102,6 @@ | |||
493 | 102 | translator.notifyDeviceReset(&reset); | 102 | translator.notifyDeviceReset(&reset); |
494 | 103 | } | 103 | } |
495 | 104 | 104 | ||
496 | 105 | TEST_F(InputTranslator, ignores_invalid_key_events) | ||
497 | 106 | { | ||
498 | 107 | using namespace ::testing; | ||
499 | 108 | |||
500 | 109 | EXPECT_CALL(dispatcher, dispatch(_)).Times(0); | ||
501 | 110 | |||
502 | 111 | translator.notifyKey(nullptr); | ||
503 | 112 | |||
504 | 113 | const int32_t invalid_action = 5; | ||
505 | 114 | droidinput::NotifyKeyArgs key(some_time, device_id, source_id, 0, invalid_action, no_flags, | ||
506 | 115 | arbitrary_key_code, arbitrary_scan_code, no_modifiers, later_time); | ||
507 | 116 | |||
508 | 117 | translator.notifyKey(&key); | ||
509 | 118 | } | ||
510 | 119 | |||
511 | 120 | TEST_F(InputTranslator, ignores_invalid_motion_action) | 105 | TEST_F(InputTranslator, ignores_invalid_motion_action) |
512 | 121 | { | 106 | { |
513 | 122 | using namespace ::testing; | 107 | using namespace ::testing; |
514 | @@ -231,9 +216,9 @@ | |||
515 | 231 | EXPECT_CALL(dispatcher, dispatch(mt::KeyDownEvent())).Times(1); | 216 | EXPECT_CALL(dispatcher, dispatch(mt::KeyDownEvent())).Times(1); |
516 | 232 | EXPECT_CALL(dispatcher, dispatch(mt::KeyUpEvent())).Times(1); | 217 | EXPECT_CALL(dispatcher, dispatch(mt::KeyUpEvent())).Times(1); |
517 | 233 | 218 | ||
519 | 234 | droidinput::NotifyKeyArgs down(some_time, device_id, source_id, 0, mir_key_action_down, | 219 | droidinput::NotifyKeyArgs down(some_time, device_id, source_id, 0, AKEY_EVENT_ACTION_DOWN, |
520 | 235 | no_flags, arbitrary_key_code, arbitrary_scan_code, no_modifiers, later_time); | 220 | no_flags, arbitrary_key_code, arbitrary_scan_code, no_modifiers, later_time); |
522 | 236 | droidinput::NotifyKeyArgs up(some_time, device_id, source_id, 0, mir_key_action_up, | 221 | droidinput::NotifyKeyArgs up(some_time, device_id, source_id, 0, AKEY_EVENT_ACTION_UP, |
523 | 237 | no_flags, arbitrary_key_code, arbitrary_scan_code, no_modifiers, later_time); | 222 | no_flags, arbitrary_key_code, arbitrary_scan_code, no_modifiers, later_time); |
524 | 238 | 223 | ||
525 | 239 | translator.notifyKey(&down); | 224 | translator.notifyKey(&down); |
526 | @@ -248,10 +233,9 @@ | |||
527 | 248 | expected.key.event_time = 1; | 233 | expected.key.event_time = 1; |
528 | 249 | expected.key.device_id = 2; | 234 | expected.key.device_id = 2; |
529 | 250 | expected.key.source_id = 3; | 235 | expected.key.source_id = 3; |
531 | 251 | expected.key.action = mir_key_action_down; | 236 | expected.key.action = mir_keyboard_action_down; |
532 | 252 | expected.key.scan_code = 4; | 237 | expected.key.scan_code = 4; |
533 | 253 | expected.key.key_code = 5; | 238 | expected.key.key_code = 5; |
534 | 254 | expected.key.repeat_count = 0; | ||
535 | 255 | expected.key.modifiers = mir_input_event_modifier_shift; | 239 | expected.key.modifiers = mir_input_event_modifier_shift; |
536 | 256 | 240 | ||
537 | 257 | InSequence seq; | 241 | InSequence seq; |
538 | @@ -261,7 +245,7 @@ | |||
539 | 261 | expected.key.device_id, | 245 | expected.key.device_id, |
540 | 262 | expected.key.source_id, | 246 | expected.key.source_id, |
541 | 263 | default_policy_flags, | 247 | default_policy_flags, |
543 | 264 | expected.key.action, | 248 | AKEY_EVENT_ACTION_DOWN, |
544 | 265 | 0, /* flags */ | 249 | 0, /* flags */ |
545 | 266 | expected.key.key_code, | 250 | expected.key.key_code, |
546 | 267 | expected.key.scan_code, | 251 | expected.key.scan_code, |
547 | @@ -341,7 +325,7 @@ | |||
548 | 341 | ).Times(1); | 325 | ).Times(1); |
549 | 342 | 326 | ||
550 | 343 | droidinput::NotifyKeyArgs tester(some_time, device_id, source_id, | 327 | droidinput::NotifyKeyArgs tester(some_time, device_id, source_id, |
552 | 344 | GetParam().policy_flag, mir_key_action_down, | 328 | GetParam().policy_flag, AKEY_EVENT_ACTION_DOWN, |
553 | 345 | no_flags, arbitrary_key_code, arbitrary_scan_code, no_modifiers, later_time); | 329 | no_flags, arbitrary_key_code, arbitrary_scan_code, no_modifiers, later_time); |
554 | 346 | 330 | ||
555 | 347 | translator.notifyKey(&tester); | 331 | translator.notifyKey(&tester); |
556 | 348 | 332 | ||
557 | === modified file 'tests/unit-tests/input/test_input_event.cpp' | |||
558 | --- tests/unit-tests/input/test_input_event.cpp 2015-05-05 00:15:05 +0000 | |||
559 | +++ tests/unit-tests/input/test_input_event.cpp 2015-05-12 14:00:09 +0000 | |||
560 | @@ -125,27 +125,15 @@ | |||
561 | 125 | { | 125 | { |
562 | 126 | auto old_ev = a_key_ev(); | 126 | auto old_ev = a_key_ev(); |
563 | 127 | 127 | ||
566 | 128 | old_ev.key.action = mir_key_action_down; | 128 | old_ev.key.action = mir_keyboard_action_down; |
565 | 129 | old_ev.key.repeat_count = 0; | ||
567 | 130 | 129 | ||
568 | 131 | auto new_kev = mir_input_event_get_keyboard_event(mir_event_get_input_event(&old_ev)); | 130 | auto new_kev = mir_input_event_get_keyboard_event(mir_event_get_input_event(&old_ev)); |
569 | 132 | EXPECT_EQ(mir_keyboard_action_down, mir_keyboard_event_action(new_kev)); | 131 | EXPECT_EQ(mir_keyboard_action_down, mir_keyboard_event_action(new_kev)); |
570 | 133 | 132 | ||
572 | 134 | old_ev.key.action = mir_key_action_up; | 133 | old_ev.key.action = mir_keyboard_action_up; |
573 | 135 | EXPECT_EQ(mir_keyboard_action_up, mir_keyboard_event_action(new_kev)); | 134 | EXPECT_EQ(mir_keyboard_action_up, mir_keyboard_event_action(new_kev)); |
574 | 136 | } | 135 | } |
575 | 137 | 136 | ||
576 | 138 | TEST(KeyInputEventProperties, repeat_action_produced_from_non_zero_repeat_count_in_old_style_event) | ||
577 | 139 | { | ||
578 | 140 | auto old_ev = a_key_ev(); | ||
579 | 141 | |||
580 | 142 | old_ev.key.action = mir_key_action_down; | ||
581 | 143 | old_ev.key.repeat_count = 1; | ||
582 | 144 | |||
583 | 145 | auto new_kev = mir_input_event_get_keyboard_event(mir_event_get_input_event(&old_ev)); | ||
584 | 146 | EXPECT_EQ(mir_keyboard_action_repeat, mir_keyboard_event_action(new_kev)); | ||
585 | 147 | } | ||
586 | 148 | |||
587 | 149 | TEST(KeyInputEventProperties, keycode_scancode_and_modifiers_taken_from_old_style_event) | 137 | TEST(KeyInputEventProperties, keycode_scancode_and_modifiers_taken_from_old_style_event) |
588 | 150 | { | 138 | { |
589 | 151 | xkb_keysym_t key_code = 171; | 139 | xkb_keysym_t key_code = 171; |
FAILED: Continuous integration, rev:2545 jenkins. qa.ubuntu. com/job/ mir-ci/ 3722/ jenkins. qa.ubuntu. com/job/ mir-android- vivid-i386- build/2320 jenkins. qa.ubuntu. com/job/ mir-clang- vivid-amd64- build/2319 jenkins. qa.ubuntu. com/job/ mir-mediumtests -vivid- touch/2268/ console jenkins. qa.ubuntu. com/job/ mir-vivid- amd64-ci/ 1719/console jenkins. qa.ubuntu. com/job/ mir-mediumtests -builder- vivid-armhf/ 2268/console
http://
Executed test runs:
SUCCESS: http://
SUCCESS: http://
FAILURE: http://
FAILURE: http://
FAILURE: http://
Click here to trigger a rebuild: s-jenkins. ubuntu- ci:8080/ job/mir- ci/3722/ rebuild
http://