Merge lp:~mir-team/mir/unify-event-modifiers into lp:mir
- unify-event-modifiers
- Merge into development-branch
Status: | Merged |
---|---|
Approved by: | Robert Carr |
Approved revision: | no longer in the source branch. |
Merged at revision: | 2546 |
Proposed branch: | lp:~mir-team/mir/unify-event-modifiers |
Merge into: | lp:mir |
Prerequisite: | lp:~mir-team/mir/pluck-low-hanging-event-fruit |
Diff against target: |
764 lines (+171/-166) 17 files modified
playground/demo-shell/window_manager.cpp (+14/-14) src/client/events/event_builders.cpp (+3/-46) src/client/input/android/CMakeLists.txt (+1/-0) src/client/input/android/android_input_lexicon.cpp (+3/-2) src/client/input/android/event_conversion_helpers.cpp (+70/-0) src/client/input/input_event.cpp (+3/-52) src/client/symbols.map (+2/-0) src/include/common/mir/events/event_private.h (+2/-23) src/include/common/mir/input/android/event_conversion_helpers.h (+36/-0) src/server/input/android/android_input_dispatcher.cpp (+3/-2) src/server/input/android/input_sender.cpp (+3/-2) src/server/input/android/input_translator.cpp (+15/-8) src/server/input/vt_filter.cpp (+2/-2) tests/unit-tests/input/android/test_android_input_dispatcher.cpp (+4/-4) tests/unit-tests/input/android/test_android_input_lexicon.cpp (+2/-4) tests/unit-tests/input/android/test_input_translator.cpp (+2/-2) tests/unit-tests/input/test_input_event.cpp (+6/-5) |
To merge this branch: | bzr merge lp:~mir-team/mir/unify-event-modifiers |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Alexandros Frantzis (community) | Approve | ||
Kevin DuBois (community) | Approve | ||
PS Jenkins bot (community) | continuous-integration | Approve | |
Review via email: mp+258218@code.launchpad.net |
Commit message
Remove the legacy event modifier enum.
Description of the change
Remove the legacy event modifier enum.
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 : | # |
PASSED: Continuous integration, rev:2543
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://
Kevin DuBois (kdub) wrote : | # |
side note: If playground/
lgtm
Alan Griffiths (alan-griffiths) wrote : | # |
585+ if (mir_modifiers != mir_input_
586+ mir_modifiers &= ~mir_input_
if (mir_modifiers != mir_input_
mir_modifiers &= ~mir_input_
or
if (mir_modifiers | ~mir_input_
mir_modifiers &= ~mir_input_
Alexandros Frantzis (afrantzis) wrote : | # |
Looks good.
I think that mir_input_
Robert Carr (robertcarr) wrote : | # |
>> I think that mir_input_
>> use unintuitive, but that's another discussion.
Yeah you may be right. It was originally an intentional decision with the idea that 0 was reserved for an out of band/invalid state. Practically though I made an error in the original assembly of the branch (fixed before submission don't worry ;))...I'm not sure if it was just because of confusion with the android flags or this interface really is hard to use though.
Preview Diff
1 | === modified file 'playground/demo-shell/window_manager.cpp' | |||
2 | --- playground/demo-shell/window_manager.cpp 2015-04-16 18:50:58 +0000 | |||
3 | +++ playground/demo-shell/window_manager.cpp 2015-05-05 05:53:22 +0000 | |||
4 | @@ -209,7 +209,7 @@ | |||
5 | 209 | if (event.key.type == mir_event_type_key && | 209 | if (event.key.type == mir_event_type_key && |
6 | 210 | event.key.action == mir_key_action_down) | 210 | event.key.action == mir_key_action_down) |
7 | 211 | { | 211 | { |
9 | 212 | if (event.key.modifiers & mir_key_modifier_alt && | 212 | if (event.key.modifiers & mir_input_event_modifier_alt && |
10 | 213 | event.key.scan_code == KEY_TAB) // TODO: Use keycode once we support keymapping on the server side | 213 | event.key.scan_code == KEY_TAB) // TODO: Use keycode once we support keymapping on the server side |
11 | 214 | { | 214 | { |
12 | 215 | focus_controller->focus_next_session(); | 215 | focus_controller->focus_next_session(); |
13 | @@ -217,7 +217,7 @@ | |||
14 | 217 | focus_controller->raise({surface}); | 217 | focus_controller->raise({surface}); |
15 | 218 | return true; | 218 | return true; |
16 | 219 | } | 219 | } |
18 | 220 | else if (event.key.modifiers & mir_key_modifier_alt && | 220 | else if (event.key.modifiers & mir_input_event_modifier_alt && |
19 | 221 | event.key.scan_code == KEY_GRAVE) | 221 | event.key.scan_code == KEY_GRAVE) |
20 | 222 | { | 222 | { |
21 | 223 | if (auto const prev = focus_controller->focused_surface()) | 223 | if (auto const prev = focus_controller->focused_surface()) |
22 | @@ -229,7 +229,7 @@ | |||
23 | 229 | } | 229 | } |
24 | 230 | return true; | 230 | return true; |
25 | 231 | } | 231 | } |
27 | 232 | else if (event.key.modifiers & mir_key_modifier_alt && | 232 | else if (event.key.modifiers & mir_input_event_modifier_alt && |
28 | 233 | event.key.scan_code == KEY_F4) | 233 | event.key.scan_code == KEY_F4) |
29 | 234 | { | 234 | { |
30 | 235 | auto const surf = focus_controller->focused_surface(); | 235 | auto const surf = focus_controller->focused_surface(); |
31 | @@ -237,7 +237,7 @@ | |||
32 | 237 | surf->request_client_surface_close(); | 237 | surf->request_client_surface_close(); |
33 | 238 | return true; | 238 | return true; |
34 | 239 | } | 239 | } |
36 | 240 | else if ((event.key.modifiers & mir_key_modifier_alt && | 240 | else if ((event.key.modifiers & mir_input_event_modifier_alt && |
37 | 241 | event.key.scan_code == KEY_P) || | 241 | event.key.scan_code == KEY_P) || |
38 | 242 | (event.key.scan_code == KEY_POWER)) | 242 | (event.key.scan_code == KEY_POWER)) |
39 | 243 | { | 243 | { |
40 | @@ -258,15 +258,15 @@ | |||
41 | 258 | compositor->start(); | 258 | compositor->start(); |
42 | 259 | return true; | 259 | return true; |
43 | 260 | } | 260 | } |
46 | 261 | else if ((event.key.modifiers & mir_key_modifier_alt) && | 261 | else if ((event.key.modifiers & mir_input_event_modifier_alt) && |
47 | 262 | (event.key.modifiers & mir_key_modifier_ctrl) && | 262 | (event.key.modifiers & mir_input_event_modifier_ctrl) && |
48 | 263 | (event.key.scan_code == KEY_ESC)) | 263 | (event.key.scan_code == KEY_ESC)) |
49 | 264 | { | 264 | { |
50 | 265 | std::abort(); | 265 | std::abort(); |
51 | 266 | return true; | 266 | return true; |
52 | 267 | } | 267 | } |
55 | 268 | else if ((event.key.modifiers & mir_key_modifier_alt) && | 268 | else if ((event.key.modifiers & mir_input_event_modifier_alt) && |
56 | 269 | (event.key.modifiers & mir_key_modifier_ctrl) && | 269 | (event.key.modifiers & mir_input_event_modifier_ctrl) && |
57 | 270 | (event.key.scan_code == KEY_L) && | 270 | (event.key.scan_code == KEY_L) && |
58 | 271 | focus_controller) | 271 | focus_controller) |
59 | 272 | { | 272 | { |
60 | @@ -276,8 +276,8 @@ | |||
61 | 276 | app->set_lifecycle_state(mir_lifecycle_state_will_suspend); | 276 | app->set_lifecycle_state(mir_lifecycle_state_will_suspend); |
62 | 277 | } | 277 | } |
63 | 278 | } | 278 | } |
66 | 279 | else if ((event.key.modifiers & mir_key_modifier_alt) && | 279 | else if ((event.key.modifiers & mir_input_event_modifier_alt) && |
67 | 280 | (event.key.modifiers & mir_key_modifier_ctrl)) | 280 | (event.key.modifiers & mir_input_event_modifier_ctrl)) |
68 | 281 | { | 281 | { |
69 | 282 | MirOrientation orientation = mir_orientation_normal; | 282 | MirOrientation orientation = mir_orientation_normal; |
70 | 283 | bool rotating = true; | 283 | bool rotating = true; |
71 | @@ -366,13 +366,13 @@ | |||
72 | 366 | compositor->start(); | 366 | compositor->start(); |
73 | 367 | return true; | 367 | return true; |
74 | 368 | } | 368 | } |
76 | 369 | else if (event.key.modifiers & mir_key_modifier_meta && | 369 | else if (event.key.modifiers & mir_input_event_modifier_meta && |
77 | 370 | event.key.scan_code == KEY_N) | 370 | event.key.scan_code == KEY_N) |
78 | 371 | { | 371 | { |
79 | 372 | toggle(inverse); | 372 | toggle(inverse); |
80 | 373 | return true; | 373 | return true; |
81 | 374 | } | 374 | } |
83 | 375 | else if (event.key.modifiers & mir_key_modifier_meta && | 375 | else if (event.key.modifiers & mir_input_event_modifier_meta && |
84 | 376 | event.key.scan_code == KEY_C) | 376 | event.key.scan_code == KEY_C) |
85 | 377 | { | 377 | { |
86 | 378 | toggle(contrast); | 378 | toggle(contrast); |
87 | @@ -389,7 +389,7 @@ | |||
88 | 389 | 389 | ||
89 | 390 | float new_zoom_mag = 0.0f; // zero means unchanged | 390 | float new_zoom_mag = 0.0f; // zero means unchanged |
90 | 391 | 391 | ||
92 | 392 | if (event.motion.modifiers & mir_key_modifier_meta && | 392 | if (event.motion.modifiers & mir_input_event_modifier_meta && |
93 | 393 | action == mir_motion_action_scroll) | 393 | action == mir_motion_action_scroll) |
94 | 394 | { | 394 | { |
95 | 395 | zoom_exponent += event.motion.pointer_coordinates[0].vscroll; | 395 | zoom_exponent += event.motion.pointer_coordinates[0].vscroll; |
96 | @@ -421,7 +421,7 @@ | |||
97 | 421 | 421 | ||
98 | 422 | auto const surf = focus_controller->focused_surface(); | 422 | auto const surf = focus_controller->focused_surface(); |
99 | 423 | if (surf && | 423 | if (surf && |
101 | 424 | (event.motion.modifiers & mir_key_modifier_alt || | 424 | (event.motion.modifiers & mir_input_event_modifier_alt || |
102 | 425 | fingers >= 3)) | 425 | fingers >= 3)) |
103 | 426 | { | 426 | { |
104 | 427 | geometry::Displacement pinch_dir; | 427 | geometry::Displacement pinch_dir; |
105 | 428 | 428 | ||
106 | === modified file 'src/client/events/event_builders.cpp' | |||
107 | --- src/client/events/event_builders.cpp 2015-05-05 05:53:22 +0000 | |||
108 | +++ src/client/events/event_builders.cpp 2015-05-05 05:53:22 +0000 | |||
109 | @@ -107,49 +107,6 @@ | |||
110 | 107 | BOOST_THROW_EXCEPTION(std::logic_error("Invalid key action")); | 107 | BOOST_THROW_EXCEPTION(std::logic_error("Invalid key action")); |
111 | 108 | } | 108 | } |
112 | 109 | } | 109 | } |
113 | 110 | MirKeyModifier old_modifiers_from_new(MirInputEventModifiers modifiers) | ||
114 | 111 | { | ||
115 | 112 | int old_modifiers = mir_key_modifier_none; | ||
116 | 113 | |||
117 | 114 | if (modifiers & mir_input_event_modifier_none) | ||
118 | 115 | old_modifiers |= mir_key_modifier_none; | ||
119 | 116 | if (modifiers & mir_input_event_modifier_alt) | ||
120 | 117 | old_modifiers |= mir_key_modifier_alt; | ||
121 | 118 | if (modifiers & mir_input_event_modifier_alt_left) | ||
122 | 119 | old_modifiers |= mir_key_modifier_alt_left; | ||
123 | 120 | if (modifiers & mir_input_event_modifier_alt_right) | ||
124 | 121 | old_modifiers |= mir_key_modifier_alt_right; | ||
125 | 122 | if (modifiers & mir_input_event_modifier_shift) | ||
126 | 123 | old_modifiers |= mir_key_modifier_shift; | ||
127 | 124 | if (modifiers & mir_input_event_modifier_shift_left) | ||
128 | 125 | old_modifiers |= mir_key_modifier_shift_left; | ||
129 | 126 | if (modifiers & mir_input_event_modifier_shift_right) | ||
130 | 127 | old_modifiers |= mir_key_modifier_shift_right; | ||
131 | 128 | if (modifiers & mir_input_event_modifier_sym) | ||
132 | 129 | old_modifiers |= mir_key_modifier_sym; | ||
133 | 130 | if (modifiers & mir_input_event_modifier_function) | ||
134 | 131 | old_modifiers |= mir_key_modifier_function; | ||
135 | 132 | if (modifiers & mir_input_event_modifier_ctrl) | ||
136 | 133 | old_modifiers |= mir_key_modifier_ctrl; | ||
137 | 134 | if (modifiers & mir_input_event_modifier_ctrl_left) | ||
138 | 135 | old_modifiers |= mir_key_modifier_ctrl_left; | ||
139 | 136 | if (modifiers & mir_input_event_modifier_ctrl_right) | ||
140 | 137 | old_modifiers |= mir_key_modifier_ctrl_right; | ||
141 | 138 | if (modifiers & mir_input_event_modifier_meta) | ||
142 | 139 | old_modifiers |= mir_key_modifier_meta; | ||
143 | 140 | if (modifiers & mir_input_event_modifier_meta_left) | ||
144 | 141 | old_modifiers |= mir_key_modifier_meta_left; | ||
145 | 142 | if (modifiers & mir_input_event_modifier_meta_right) | ||
146 | 143 | old_modifiers |= mir_key_modifier_meta_right; | ||
147 | 144 | if (modifiers & mir_input_event_modifier_caps_lock) | ||
148 | 145 | old_modifiers |= mir_key_modifier_caps_lock; | ||
149 | 146 | if (modifiers & mir_input_event_modifier_num_lock) | ||
150 | 147 | old_modifiers |= mir_key_modifier_num_lock; | ||
151 | 148 | if (modifiers & mir_input_event_modifier_scroll_lock) | ||
152 | 149 | old_modifiers |= mir_key_modifier_scroll_lock; | ||
153 | 150 | |||
154 | 151 | return static_cast<MirKeyModifier>(old_modifiers); | ||
155 | 152 | } | ||
156 | 153 | } | 110 | } |
157 | 154 | 111 | ||
158 | 155 | mir::EventUPtr mev::make_event(MirInputDeviceId device_id, int64_t timestamp, | 112 | mir::EventUPtr mev::make_event(MirInputDeviceId device_id, int64_t timestamp, |
159 | @@ -168,7 +125,7 @@ | |||
160 | 168 | kev.repeat_count = 1; | 125 | kev.repeat_count = 1; |
161 | 169 | kev.key_code = key_code; | 126 | kev.key_code = key_code; |
162 | 170 | kev.scan_code = scan_code; | 127 | kev.scan_code = scan_code; |
164 | 171 | kev.modifiers = old_modifiers_from_new(modifiers); | 128 | kev.modifiers = modifiers; |
165 | 172 | 129 | ||
166 | 173 | return make_event_uptr(e); | 130 | return make_event_uptr(e); |
167 | 174 | } | 131 | } |
168 | @@ -214,7 +171,7 @@ | |||
169 | 214 | auto& mev = e->motion; | 171 | auto& mev = e->motion; |
170 | 215 | mev.device_id = device_id; | 172 | mev.device_id = device_id; |
171 | 216 | mev.event_time = timestamp; | 173 | mev.event_time = timestamp; |
173 | 217 | mev.modifiers = old_modifiers_from_new(modifiers); | 174 | mev.modifiers = modifiers; |
174 | 218 | mev.action = mir_motion_action_move; | 175 | mev.action = mir_motion_action_move; |
175 | 219 | mev.source_id = AINPUT_SOURCE_TOUCHSCREEN; | 176 | mev.source_id = AINPUT_SOURCE_TOUCHSCREEN; |
176 | 220 | 177 | ||
177 | @@ -314,7 +271,7 @@ | |||
178 | 314 | auto& mev = e->motion; | 271 | auto& mev = e->motion; |
179 | 315 | mev.device_id = device_id; | 272 | mev.device_id = device_id; |
180 | 316 | mev.event_time = timestamp; | 273 | mev.event_time = timestamp; |
182 | 317 | mev.modifiers = old_modifiers_from_new(modifiers); | 274 | mev.modifiers = modifiers; |
183 | 318 | mev.action = old_action_from_pointer_action(action); | 275 | mev.action = old_action_from_pointer_action(action); |
184 | 319 | mev.source_id = AINPUT_SOURCE_MOUSE; | 276 | mev.source_id = AINPUT_SOURCE_MOUSE; |
185 | 320 | 277 | ||
186 | 321 | 278 | ||
187 | === modified file 'src/client/input/android/CMakeLists.txt' | |||
188 | --- src/client/input/android/CMakeLists.txt 2015-03-31 02:35:42 +0000 | |||
189 | +++ src/client/input/android/CMakeLists.txt 2015-05-05 05:53:22 +0000 | |||
190 | @@ -19,6 +19,7 @@ | |||
191 | 19 | ${CMAKE_CURRENT_SOURCE_DIR}/android_input_lexicon.cpp | 19 | ${CMAKE_CURRENT_SOURCE_DIR}/android_input_lexicon.cpp |
192 | 20 | ${CMAKE_CURRENT_SOURCE_DIR}/android_input_receiver.cpp | 20 | ${CMAKE_CURRENT_SOURCE_DIR}/android_input_receiver.cpp |
193 | 21 | ${CMAKE_CURRENT_SOURCE_DIR}/android_input_platform.cpp | 21 | ${CMAKE_CURRENT_SOURCE_DIR}/android_input_platform.cpp |
194 | 22 | ${CMAKE_CURRENT_SOURCE_DIR}/event_conversion_helpers.cpp | ||
195 | 22 | ) | 23 | ) |
196 | 23 | 24 | ||
197 | 24 | set(ANDROID_SHARED_INPUT_SOURCES ${ANDROID_SHARED_INPUT_SOURCES} PARENT_SCOPE) | 25 | set(ANDROID_SHARED_INPUT_SOURCES ${ANDROID_SHARED_INPUT_SOURCES} PARENT_SCOPE) |
198 | 25 | 26 | ||
199 | === modified file 'src/client/input/android/android_input_lexicon.cpp' | |||
200 | --- src/client/input/android/android_input_lexicon.cpp 2015-05-05 05:53:22 +0000 | |||
201 | +++ src/client/input/android/android_input_lexicon.cpp 2015-05-05 05:53:22 +0000 | |||
202 | @@ -18,6 +18,7 @@ | |||
203 | 18 | */ | 18 | */ |
204 | 19 | 19 | ||
205 | 20 | #include "mir/input/android/android_input_lexicon.h" | 20 | #include "mir/input/android/android_input_lexicon.h" |
206 | 21 | #include "mir/input/android/event_conversion_helpers.h" | ||
207 | 21 | #include "mir/events/event_private.h" | 22 | #include "mir/events/event_private.h" |
208 | 22 | 23 | ||
209 | 23 | #include <androidfw/Input.h> | 24 | #include <androidfw/Input.h> |
210 | @@ -35,7 +36,7 @@ | |||
211 | 35 | mir_event.key.device_id = android_event->getDeviceId(); | 36 | mir_event.key.device_id = android_event->getDeviceId(); |
212 | 36 | mir_event.key.source_id = android_event->getSource(); | 37 | mir_event.key.source_id = android_event->getSource(); |
213 | 37 | mir_event.key.action = static_cast<MirKeyAction>(kev->getAction()); | 38 | mir_event.key.action = static_cast<MirKeyAction>(kev->getAction()); |
215 | 38 | mir_event.key.modifiers = kev->getMetaState(); | 39 | mir_event.key.modifiers = mia::mir_modifiers_from_android(kev->getMetaState()); |
216 | 39 | mir_event.key.key_code = kev->getKeyCode(); | 40 | mir_event.key.key_code = kev->getKeyCode(); |
217 | 40 | mir_event.key.scan_code = kev->getScanCode(); | 41 | mir_event.key.scan_code = kev->getScanCode(); |
218 | 41 | mir_event.key.repeat_count = kev->getRepeatCount(); | 42 | mir_event.key.repeat_count = kev->getRepeatCount(); |
219 | @@ -49,7 +50,7 @@ | |||
220 | 49 | mir_event.motion.device_id = android_event->getDeviceId(); | 50 | mir_event.motion.device_id = android_event->getDeviceId(); |
221 | 50 | mir_event.motion.source_id = android_event->getSource(); | 51 | mir_event.motion.source_id = android_event->getSource(); |
222 | 51 | mir_event.motion.action = mev->getAction(); | 52 | mir_event.motion.action = mev->getAction(); |
224 | 52 | mir_event.motion.modifiers = mev->getMetaState(); | 53 | mir_event.motion.modifiers = mia::mir_modifiers_from_android(mev->getMetaState()); |
225 | 53 | mir_event.motion.button_state = static_cast<MirMotionButton>(mev->getButtonState()); | 54 | mir_event.motion.button_state = static_cast<MirMotionButton>(mev->getButtonState()); |
226 | 54 | mir_event.motion.event_time = mev->getEventTime().count(); | 55 | mir_event.motion.event_time = mev->getEventTime().count(); |
227 | 55 | mir_event.motion.pointer_count = mev->getPointerCount(); | 56 | mir_event.motion.pointer_count = mev->getPointerCount(); |
228 | 56 | 57 | ||
229 | === added file 'src/client/input/android/event_conversion_helpers.cpp' | |||
230 | --- src/client/input/android/event_conversion_helpers.cpp 1970-01-01 00:00:00 +0000 | |||
231 | +++ src/client/input/android/event_conversion_helpers.cpp 2015-05-05 05:53:22 +0000 | |||
232 | @@ -0,0 +1,70 @@ | |||
233 | 1 | /* | ||
234 | 2 | * Copyright © 2015 Canonical Ltd. | ||
235 | 3 | * | ||
236 | 4 | * This program is free software: you can redistribute it and/or modify it | ||
237 | 5 | * under the terms of the GNU Lesser General Public License version 3, | ||
238 | 6 | * as published by the Free Software Foundation. | ||
239 | 7 | * | ||
240 | 8 | * This program is distributed in the hope that it will be useful, | ||
241 | 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
242 | 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
243 | 11 | * GNU Lesser General Public License for more details. | ||
244 | 12 | * | ||
245 | 13 | * You should have received a copy of the GNU Lesser General Public License | ||
246 | 14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
247 | 15 | * | ||
248 | 16 | * Authored by: Robert Carr <robert.carr@canonical.com> | ||
249 | 17 | */ | ||
250 | 18 | |||
251 | 19 | #include "mir/input/android/event_conversion_helpers.h" | ||
252 | 20 | |||
253 | 21 | #include <androidfw/Input.h> | ||
254 | 22 | |||
255 | 23 | namespace mia = mir::input::android; | ||
256 | 24 | |||
257 | 25 | MirInputEventModifiers mia::mir_modifiers_from_android(int32_t android_modifiers) | ||
258 | 26 | { | ||
259 | 27 | MirInputEventModifiers ret = 0; | ||
260 | 28 | if (android_modifiers == 0) ret |= mir_input_event_modifier_none; | ||
261 | 29 | if (android_modifiers & AMETA_ALT_ON) ret |= mir_input_event_modifier_alt; | ||
262 | 30 | if (android_modifiers & AMETA_ALT_LEFT_ON) ret |= mir_input_event_modifier_alt_left; | ||
263 | 31 | if (android_modifiers & AMETA_ALT_RIGHT_ON) ret |= mir_input_event_modifier_alt_right; | ||
264 | 32 | if (android_modifiers & AMETA_SHIFT_ON) ret |= mir_input_event_modifier_shift; | ||
265 | 33 | if (android_modifiers & AMETA_SHIFT_LEFT_ON) ret |= mir_input_event_modifier_shift_left; | ||
266 | 34 | if (android_modifiers & AMETA_SHIFT_RIGHT_ON) ret |= mir_input_event_modifier_shift_right; | ||
267 | 35 | if (android_modifiers & AMETA_SYM_ON) ret |= mir_input_event_modifier_sym; | ||
268 | 36 | if (android_modifiers & AMETA_FUNCTION_ON) ret |= mir_input_event_modifier_function; | ||
269 | 37 | if (android_modifiers & AMETA_CTRL_ON) ret |= mir_input_event_modifier_ctrl; | ||
270 | 38 | if (android_modifiers & AMETA_CTRL_LEFT_ON) ret |= mir_input_event_modifier_ctrl_left; | ||
271 | 39 | if (android_modifiers & AMETA_CTRL_RIGHT_ON) ret |= mir_input_event_modifier_ctrl_right; | ||
272 | 40 | if (android_modifiers & AMETA_META_ON) ret |= mir_input_event_modifier_meta; | ||
273 | 41 | if (android_modifiers & AMETA_META_LEFT_ON) ret |= mir_input_event_modifier_meta_left; | ||
274 | 42 | if (android_modifiers & AMETA_META_RIGHT_ON) ret |= mir_input_event_modifier_meta_right; | ||
275 | 43 | if (android_modifiers & AMETA_CAPS_LOCK_ON) ret |= mir_input_event_modifier_caps_lock; | ||
276 | 44 | if (android_modifiers & AMETA_NUM_LOCK_ON) ret |= mir_input_event_modifier_num_lock; | ||
277 | 45 | if (android_modifiers & AMETA_SCROLL_LOCK_ON) ret |= mir_input_event_modifier_scroll_lock; | ||
278 | 46 | return ret; | ||
279 | 47 | } | ||
280 | 48 | |||
281 | 49 | int32_t mia::android_modifiers_from_mir(MirInputEventModifiers mir_modifiers) | ||
282 | 50 | { | ||
283 | 51 | int32_t ret = AMETA_NONE; | ||
284 | 52 | if (mir_modifiers & mir_input_event_modifier_alt) ret |= AMETA_ALT_ON; | ||
285 | 53 | if (mir_modifiers & mir_input_event_modifier_alt_left) ret |= AMETA_ALT_LEFT_ON; | ||
286 | 54 | if (mir_modifiers & mir_input_event_modifier_alt_right) ret |= AMETA_ALT_RIGHT_ON; | ||
287 | 55 | if (mir_modifiers & mir_input_event_modifier_shift) ret |= AMETA_SHIFT_ON; | ||
288 | 56 | if (mir_modifiers & mir_input_event_modifier_shift_left) ret |= AMETA_SHIFT_LEFT_ON; | ||
289 | 57 | if (mir_modifiers & mir_input_event_modifier_shift_right) ret |= AMETA_SHIFT_RIGHT_ON; | ||
290 | 58 | if (mir_modifiers & mir_input_event_modifier_sym) ret |= AMETA_SYM_ON; | ||
291 | 59 | if (mir_modifiers & mir_input_event_modifier_function) ret |= AMETA_FUNCTION_ON; | ||
292 | 60 | if (mir_modifiers & mir_input_event_modifier_ctrl) ret |= AMETA_CTRL_ON; | ||
293 | 61 | if (mir_modifiers & mir_input_event_modifier_ctrl_left) ret |= AMETA_CTRL_LEFT_ON; | ||
294 | 62 | if (mir_modifiers & mir_input_event_modifier_ctrl_right) ret |= AMETA_CTRL_RIGHT_ON; | ||
295 | 63 | if (mir_modifiers & mir_input_event_modifier_meta) ret |= AMETA_META_ON; | ||
296 | 64 | if (mir_modifiers & mir_input_event_modifier_meta_left) ret |= AMETA_META_LEFT_ON; | ||
297 | 65 | if (mir_modifiers & mir_input_event_modifier_meta_right) ret |= AMETA_META_RIGHT_ON; | ||
298 | 66 | if (mir_modifiers & mir_input_event_modifier_caps_lock) ret |= AMETA_CAPS_LOCK_ON; | ||
299 | 67 | if (mir_modifiers & mir_input_event_modifier_num_lock) ret |= AMETA_NUM_LOCK_ON; | ||
300 | 68 | if (mir_modifiers & mir_input_event_modifier_scroll_lock) ret |= AMETA_SCROLL_LOCK_ON; | ||
301 | 69 | return ret; | ||
302 | 70 | } | ||
303 | 0 | 71 | ||
304 | === modified file 'src/client/input/input_event.cpp' | |||
305 | --- src/client/input/input_event.cpp 2015-04-01 19:39:19 +0000 | |||
306 | +++ src/client/input/input_event.cpp 2015-05-05 05:53:22 +0000 | |||
307 | @@ -239,66 +239,17 @@ | |||
308 | 239 | return old_kev.scan_code; | 239 | return old_kev.scan_code; |
309 | 240 | } | 240 | } |
310 | 241 | 241 | ||
311 | 242 | namespace | ||
312 | 243 | { | ||
313 | 244 | MirInputEventModifiers old_modifiers_to_new(unsigned int old_modifier) | ||
314 | 245 | { | ||
315 | 246 | MirInputEventModifiers modifier = 0; | ||
316 | 247 | |||
317 | 248 | if (old_modifier & mir_key_modifier_none) | ||
318 | 249 | modifier |= mir_input_event_modifier_none; | ||
319 | 250 | if (old_modifier & mir_key_modifier_alt) | ||
320 | 251 | modifier |= mir_input_event_modifier_alt; | ||
321 | 252 | if (old_modifier & mir_key_modifier_alt_left) | ||
322 | 253 | modifier |= mir_input_event_modifier_alt_left; | ||
323 | 254 | if (old_modifier & mir_key_modifier_alt_right) | ||
324 | 255 | modifier |= mir_input_event_modifier_alt_right; | ||
325 | 256 | if (old_modifier & mir_key_modifier_shift) | ||
326 | 257 | modifier |= mir_input_event_modifier_shift; | ||
327 | 258 | if (old_modifier & mir_key_modifier_shift_left) | ||
328 | 259 | modifier |= mir_input_event_modifier_shift_left; | ||
329 | 260 | if (old_modifier & mir_key_modifier_shift_right) | ||
330 | 261 | modifier |= mir_input_event_modifier_shift_right; | ||
331 | 262 | if (old_modifier & mir_key_modifier_sym) | ||
332 | 263 | modifier |= mir_input_event_modifier_sym; | ||
333 | 264 | if (old_modifier & mir_key_modifier_function) | ||
334 | 265 | modifier |= mir_input_event_modifier_function; | ||
335 | 266 | if (old_modifier & mir_key_modifier_ctrl) | ||
336 | 267 | modifier |= mir_input_event_modifier_ctrl; | ||
337 | 268 | if (old_modifier & mir_key_modifier_ctrl_left) | ||
338 | 269 | modifier |= mir_input_event_modifier_ctrl_left; | ||
339 | 270 | if (old_modifier & mir_key_modifier_ctrl_right) | ||
340 | 271 | modifier |= mir_input_event_modifier_ctrl_right; | ||
341 | 272 | if (old_modifier & mir_key_modifier_meta) | ||
342 | 273 | modifier |= mir_input_event_modifier_meta; | ||
343 | 274 | if (old_modifier & mir_key_modifier_meta_left) | ||
344 | 275 | modifier |= mir_input_event_modifier_meta_left; | ||
345 | 276 | if (old_modifier & mir_key_modifier_meta_right) | ||
346 | 277 | modifier |= mir_input_event_modifier_meta_right; | ||
347 | 278 | if (old_modifier & mir_key_modifier_caps_lock) | ||
348 | 279 | modifier |= mir_input_event_modifier_caps_lock; | ||
349 | 280 | if (old_modifier & mir_key_modifier_num_lock) | ||
350 | 281 | modifier |= mir_input_event_modifier_num_lock; | ||
351 | 282 | if (old_modifier & mir_key_modifier_scroll_lock) | ||
352 | 283 | modifier |= mir_input_event_modifier_scroll_lock; | ||
353 | 284 | |||
354 | 285 | if (modifier) | ||
355 | 286 | return modifier; | ||
356 | 287 | return mir_input_event_modifier_none; | ||
357 | 288 | } | ||
358 | 289 | } | ||
359 | 290 | |||
360 | 291 | MirInputEventModifiers mir_keyboard_event_modifiers(MirKeyboardEvent const* kev) | 242 | MirInputEventModifiers mir_keyboard_event_modifiers(MirKeyboardEvent const* kev) |
361 | 292 | { | 243 | { |
362 | 293 | auto const& old_kev = old_kev_from_new(kev); | 244 | auto const& old_kev = old_kev_from_new(kev); |
364 | 294 | return old_modifiers_to_new(old_kev.modifiers); | 245 | return old_kev.modifiers; |
365 | 295 | } | 246 | } |
366 | 296 | /* Touch event accessors */ | 247 | /* Touch event accessors */ |
367 | 297 | 248 | ||
368 | 298 | MirInputEventModifiers mir_touch_event_modifiers(MirTouchEvent const* tev) | 249 | MirInputEventModifiers mir_touch_event_modifiers(MirTouchEvent const* tev) |
369 | 299 | { | 250 | { |
370 | 300 | auto const& old_mev = old_mev_from_new(tev); | 251 | auto const& old_mev = old_mev_from_new(tev); |
372 | 301 | return old_modifiers_to_new(old_mev.modifiers); | 252 | return old_mev.modifiers; |
373 | 302 | } | 253 | } |
374 | 303 | 254 | ||
375 | 304 | MirTouchEvent const* mir_input_event_get_touch_event(MirInputEvent const* ev) | 255 | MirTouchEvent const* mir_input_event_get_touch_event(MirInputEvent const* ev) |
376 | @@ -453,7 +404,7 @@ | |||
377 | 453 | MirInputEventModifiers mir_pointer_event_modifiers(MirPointerEvent const* pev) | 404 | MirInputEventModifiers mir_pointer_event_modifiers(MirPointerEvent const* pev) |
378 | 454 | { | 405 | { |
379 | 455 | auto const& old_mev = old_mev_from_new(pev); | 406 | auto const& old_mev = old_mev_from_new(pev); |
381 | 456 | return old_modifiers_to_new(old_mev.modifiers); | 407 | return old_mev.modifiers; |
382 | 457 | } | 408 | } |
383 | 458 | 409 | ||
384 | 459 | MirPointerAction mir_pointer_event_action(MirPointerEvent const* pev) | 410 | MirPointerAction mir_pointer_event_action(MirPointerEvent const* pev) |
385 | 460 | 411 | ||
386 | === modified file 'src/client/symbols.map' | |||
387 | --- src/client/symbols.map 2015-04-30 17:41:03 +0000 | |||
388 | +++ src/client/symbols.map 2015-05-05 05:53:22 +0000 | |||
389 | @@ -200,6 +200,8 @@ | |||
390 | 200 | mir::events::make_event*; | 200 | mir::events::make_event*; |
391 | 201 | mir::events::add_touch*; | 201 | mir::events::add_touch*; |
392 | 202 | mir::input::android::Lexicon::translate*; | 202 | mir::input::android::Lexicon::translate*; |
393 | 203 | mir::input::android::android_modifiers_from_mir*; | ||
394 | 204 | mir::input::android::mir_modifiers_from_android*; | ||
395 | 203 | mir::client::DefaultConnectionConfiguration::DefaultConnectionConfiguration*; | 205 | mir::client::DefaultConnectionConfiguration::DefaultConnectionConfiguration*; |
396 | 204 | mir::client::DefaultConnectionConfiguration::the_surface_map*; | 206 | mir::client::DefaultConnectionConfiguration::the_surface_map*; |
397 | 205 | mir::client::DefaultConnectionConfiguration::the_rpc_channel*; | 207 | mir::client::DefaultConnectionConfiguration::the_rpc_channel*; |
398 | 206 | 208 | ||
399 | === modified file 'src/include/common/mir/events/event_private.h' | |||
400 | --- src/include/common/mir/events/event_private.h 2015-05-05 05:53:22 +0000 | |||
401 | +++ src/include/common/mir/events/event_private.h 2015-05-05 05:53:22 +0000 | |||
402 | @@ -51,27 +51,6 @@ | |||
403 | 51 | } MirKeyAction; | 51 | } MirKeyAction; |
404 | 52 | 52 | ||
405 | 53 | typedef enum { | 53 | typedef enum { |
406 | 54 | mir_key_modifier_none = 0, | ||
407 | 55 | mir_key_modifier_alt = 0x02, | ||
408 | 56 | mir_key_modifier_alt_left = 0x10, | ||
409 | 57 | mir_key_modifier_alt_right = 0x20, | ||
410 | 58 | mir_key_modifier_shift = 0x01, | ||
411 | 59 | mir_key_modifier_shift_left = 0x40, | ||
412 | 60 | mir_key_modifier_shift_right = 0x80, | ||
413 | 61 | mir_key_modifier_sym = 0x04, | ||
414 | 62 | mir_key_modifier_function = 0x08, | ||
415 | 63 | mir_key_modifier_ctrl = 0x1000, | ||
416 | 64 | mir_key_modifier_ctrl_left = 0x2000, | ||
417 | 65 | mir_key_modifier_ctrl_right = 0x4000, | ||
418 | 66 | mir_key_modifier_meta = 0x10000, | ||
419 | 67 | mir_key_modifier_meta_left = 0x20000, | ||
420 | 68 | mir_key_modifier_meta_right = 0x40000, | ||
421 | 69 | mir_key_modifier_caps_lock = 0x100000, | ||
422 | 70 | mir_key_modifier_num_lock = 0x200000, | ||
423 | 71 | mir_key_modifier_scroll_lock = 0x400000 | ||
424 | 72 | } MirKeyModifier; | ||
425 | 73 | |||
426 | 74 | typedef enum { | ||
427 | 75 | mir_motion_action_down = 0, | 54 | mir_motion_action_down = 0, |
428 | 76 | mir_motion_action_up = 1, | 55 | mir_motion_action_up = 1, |
429 | 77 | mir_motion_action_move = 2, | 56 | mir_motion_action_move = 2, |
430 | @@ -111,7 +90,7 @@ | |||
431 | 111 | int32_t device_id; | 90 | int32_t device_id; |
432 | 112 | int32_t source_id; | 91 | int32_t source_id; |
433 | 113 | MirKeyAction action; | 92 | MirKeyAction action; |
435 | 114 | unsigned int modifiers; | 93 | MirInputEventModifiers modifiers; |
436 | 115 | 94 | ||
437 | 116 | int32_t key_code; | 95 | int32_t key_code; |
438 | 117 | int32_t scan_code; | 96 | int32_t scan_code; |
439 | @@ -150,7 +129,7 @@ | |||
440 | 150 | * this way for now until we can drop SF/Hybris support in QtUbuntu. | 129 | * this way for now until we can drop SF/Hybris support in QtUbuntu. |
441 | 151 | */ | 130 | */ |
442 | 152 | int action; | 131 | int action; |
444 | 153 | unsigned int modifiers; | 132 | MirInputEventModifiers modifiers; |
445 | 154 | 133 | ||
446 | 155 | MirMotionButton button_state; | 134 | MirMotionButton button_state; |
447 | 156 | nsecs_t event_time; | 135 | nsecs_t event_time; |
448 | 157 | 136 | ||
449 | === added file 'src/include/common/mir/input/android/event_conversion_helpers.h' | |||
450 | --- src/include/common/mir/input/android/event_conversion_helpers.h 1970-01-01 00:00:00 +0000 | |||
451 | +++ src/include/common/mir/input/android/event_conversion_helpers.h 2015-05-05 05:53:22 +0000 | |||
452 | @@ -0,0 +1,36 @@ | |||
453 | 1 | /* | ||
454 | 2 | * Copyright © 2015 Canonical Ltd. | ||
455 | 3 | * | ||
456 | 4 | * This program is free software: you can redistribute it and/or modify it | ||
457 | 5 | * under the terms of the GNU Lesser General Public License version 3, | ||
458 | 6 | * as published by the Free Software Foundation. | ||
459 | 7 | * | ||
460 | 8 | * This program is distributed in the hope that it will be useful, | ||
461 | 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
462 | 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
463 | 11 | * GNU Lesser General Public License for more details. | ||
464 | 12 | * | ||
465 | 13 | * You should have received a copy of the GNU Lesser General Public License | ||
466 | 14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
467 | 15 | * | ||
468 | 16 | * Authored by: Robert Carr <robert.carr@canonical.com> | ||
469 | 17 | */ | ||
470 | 18 | |||
471 | 19 | #ifndef MIR_INPUT_EVENT_CONVERSION_HELPERS_H_ | ||
472 | 20 | #define MIR_INPUT_EVENT_CONVERSION_HELPERS_H_ | ||
473 | 21 | |||
474 | 22 | #include "mir_toolkit/event.h" | ||
475 | 23 | |||
476 | 24 | namespace mir | ||
477 | 25 | { | ||
478 | 26 | namespace input | ||
479 | 27 | { | ||
480 | 28 | namespace android | ||
481 | 29 | { | ||
482 | 30 | MirInputEventModifiers mir_modifiers_from_android(int32_t android_modifiers); | ||
483 | 31 | int32_t android_modifiers_from_mir(MirInputEventModifiers modifiers); | ||
484 | 32 | } | ||
485 | 33 | } | ||
486 | 34 | } | ||
487 | 35 | |||
488 | 36 | #endif // MIR_INPUT_EVENT_CONVERSION_HELPERS_H_ | ||
489 | 0 | 37 | ||
490 | === modified file 'src/server/input/android/android_input_dispatcher.cpp' | |||
491 | --- src/server/input/android/android_input_dispatcher.cpp 2015-05-05 05:53:22 +0000 | |||
492 | +++ src/server/input/android/android_input_dispatcher.cpp 2015-05-05 05:53:22 +0000 | |||
493 | @@ -21,6 +21,7 @@ | |||
494 | 21 | #include "android_input_constants.h" | 21 | #include "android_input_constants.h" |
495 | 22 | #include "android_input_thread.h" | 22 | #include "android_input_thread.h" |
496 | 23 | 23 | ||
497 | 24 | #include "mir/input/android/event_conversion_helpers.h" | ||
498 | 24 | #include "mir/events/event_private.h" | 25 | #include "mir/events/event_private.h" |
499 | 25 | 26 | ||
500 | 26 | #include <InputListener.h> // NotifyArgs | 27 | #include <InputListener.h> // NotifyArgs |
501 | @@ -75,7 +76,7 @@ | |||
502 | 75 | 0, /* flags */ | 76 | 0, /* flags */ |
503 | 76 | event.key.key_code, | 77 | event.key.key_code, |
504 | 77 | event.key.scan_code, | 78 | event.key.scan_code, |
506 | 78 | event.key.modifiers, | 79 | mia::android_modifiers_from_mir(event.key.modifiers), |
507 | 79 | std::chrono::nanoseconds(event.key.event_time)); | 80 | std::chrono::nanoseconds(event.key.event_time)); |
508 | 80 | 81 | ||
509 | 81 | dispatcher->notifyKey(¬ify_key_args); | 82 | dispatcher->notifyKey(¬ify_key_args); |
510 | @@ -111,7 +112,7 @@ | |||
511 | 111 | policy_flags, | 112 | policy_flags, |
512 | 112 | event.motion.action, | 113 | event.motion.action, |
513 | 113 | 0, /* flags */ | 114 | 0, /* flags */ |
515 | 114 | event.motion.modifiers, | 115 | mia::android_modifiers_from_mir(event.motion.modifiers), |
516 | 115 | event.motion.button_state, | 116 | event.motion.button_state, |
517 | 116 | 0, /* edge_flags */ | 117 | 0, /* edge_flags */ |
518 | 117 | event.motion.pointer_count, | 118 | event.motion.pointer_count, |
519 | 118 | 119 | ||
520 | === modified file 'src/server/input/android/input_sender.cpp' | |||
521 | --- src/server/input/android/input_sender.cpp 2015-05-05 05:53:22 +0000 | |||
522 | +++ src/server/input/android/input_sender.cpp 2015-05-05 05:53:22 +0000 | |||
523 | @@ -21,6 +21,7 @@ | |||
524 | 21 | #include "input_sender.h" | 21 | #include "input_sender.h" |
525 | 22 | #include "input_send_entry.h" | 22 | #include "input_send_entry.h" |
526 | 23 | 23 | ||
527 | 24 | #include "mir/input/android/event_conversion_helpers.h" | ||
528 | 24 | #include "mir/input/input_send_observer.h" | 25 | #include "mir/input/input_send_observer.h" |
529 | 25 | #include "mir/input/input_channel.h" | 26 | #include "mir/input/input_channel.h" |
530 | 26 | #include "mir/input/input_report.h" | 27 | #include "mir/input/input_report.h" |
531 | @@ -244,7 +245,7 @@ | |||
532 | 244 | 0, /* Flags */ | 245 | 0, /* Flags */ |
533 | 245 | event.key_code, | 246 | event.key_code, |
534 | 246 | event.scan_code, | 247 | event.scan_code, |
536 | 247 | event.modifiers, | 248 | mia::android_modifiers_from_mir(event.modifiers), |
537 | 248 | event.repeat_count, | 249 | event.repeat_count, |
538 | 249 | std::chrono::nanoseconds(event.event_time), | 250 | std::chrono::nanoseconds(event.event_time), |
539 | 250 | std::chrono::nanoseconds(event.event_time) | 251 | std::chrono::nanoseconds(event.event_time) |
540 | @@ -284,7 +285,7 @@ | |||
541 | 284 | event.action, | 285 | event.action, |
542 | 285 | 0, /* flags */ | 286 | 0, /* flags */ |
543 | 286 | 0, /* edge flags */ | 287 | 0, /* edge flags */ |
545 | 287 | static_cast<int32_t>(event.modifiers), | 288 | mia::android_modifiers_from_mir(event.modifiers), |
546 | 288 | static_cast<int32_t>(event.button_state), | 289 | static_cast<int32_t>(event.button_state), |
547 | 289 | 0.0f, // event.x_offset, | 290 | 0.0f, // event.x_offset, |
548 | 290 | 0.0f, // event.y_offset, | 291 | 0.0f, // event.y_offset, |
549 | 291 | 292 | ||
550 | === modified file 'src/server/input/android/input_translator.cpp' | |||
551 | --- src/server/input/android/input_translator.cpp 2015-05-05 05:53:22 +0000 | |||
552 | +++ src/server/input/android/input_translator.cpp 2015-05-05 05:53:22 +0000 | |||
553 | @@ -18,6 +18,7 @@ | |||
554 | 18 | 18 | ||
555 | 19 | #include "input_translator.h" | 19 | #include "input_translator.h" |
556 | 20 | 20 | ||
557 | 21 | #include "mir/input/android/event_conversion_helpers.h" | ||
558 | 21 | #include "mir/events/event_private.h" | 22 | #include "mir/events/event_private.h" |
559 | 22 | 23 | ||
560 | 23 | #include "androidfw/Input.h" | 24 | #include "androidfw/Input.h" |
561 | @@ -100,25 +101,31 @@ | |||
562 | 100 | if (!args) | 101 | if (!args) |
563 | 101 | return; | 102 | return; |
564 | 102 | uint32_t policy_flags = args->policyFlags; | 103 | uint32_t policy_flags = args->policyFlags; |
566 | 103 | int32_t modifiers = args->metaState; | 104 | MirInputEventModifiers mir_modifiers = mia::mir_modifiers_from_android(args->metaState); |
567 | 104 | 105 | ||
568 | 105 | if (policy_flags & droidinput::POLICY_FLAG_ALT) | 106 | if (policy_flags & droidinput::POLICY_FLAG_ALT) |
570 | 106 | modifiers |= mir_key_modifier_alt | mir_key_modifier_alt_left; | 107 | mir_modifiers |= mir_input_event_modifier_alt | mir_input_event_modifier_alt_left; |
571 | 107 | if (policy_flags & droidinput::POLICY_FLAG_ALT_GR) | 108 | if (policy_flags & droidinput::POLICY_FLAG_ALT_GR) |
573 | 108 | modifiers |= mir_key_modifier_alt | mir_key_modifier_alt_right; | 109 | mir_modifiers |= mir_input_event_modifier_alt | mir_input_event_modifier_alt_right; |
574 | 109 | if (policy_flags & droidinput::POLICY_FLAG_SHIFT) | 110 | if (policy_flags & droidinput::POLICY_FLAG_SHIFT) |
576 | 110 | modifiers |= mir_key_modifier_shift | mir_key_modifier_shift_left; | 111 | mir_modifiers |= mir_input_event_modifier_shift | mir_input_event_modifier_shift_left; |
577 | 111 | if (policy_flags & droidinput::POLICY_FLAG_CAPS_LOCK) | 112 | if (policy_flags & droidinput::POLICY_FLAG_CAPS_LOCK) |
579 | 112 | modifiers |= mir_key_modifier_caps_lock; | 113 | mir_modifiers |= mir_input_event_modifier_caps_lock; |
580 | 113 | if (policy_flags & droidinput::POLICY_FLAG_FUNCTION) | 114 | if (policy_flags & droidinput::POLICY_FLAG_FUNCTION) |
582 | 114 | modifiers |= mir_key_modifier_function; | 115 | mir_modifiers |= mir_input_event_modifier_function; |
583 | 116 | |||
584 | 117 | // If we've added a modifier to none we have to remove the none flag. | ||
585 | 118 | if (mir_modifiers != mir_input_event_modifier_none && mir_modifiers & mir_input_event_modifier_none) | ||
586 | 119 | { | ||
587 | 120 | mir_modifiers &= ~mir_input_event_modifier_none; | ||
588 | 121 | } | ||
589 | 115 | 122 | ||
590 | 116 | MirEvent mir_event; | 123 | MirEvent mir_event; |
591 | 117 | mir_event.type = mir_event_type_key; | 124 | mir_event.type = mir_event_type_key; |
592 | 118 | mir_event.key.device_id = args->deviceId; | 125 | mir_event.key.device_id = args->deviceId; |
593 | 119 | mir_event.key.source_id = args->source; | 126 | mir_event.key.source_id = args->source; |
594 | 120 | mir_event.key.action = static_cast<MirKeyAction>(args->action); | 127 | mir_event.key.action = static_cast<MirKeyAction>(args->action); |
596 | 121 | mir_event.key.modifiers = modifiers; | 128 | mir_event.key.modifiers = mir_modifiers; |
597 | 122 | mir_event.key.key_code = args->keyCode; | 129 | mir_event.key.key_code = args->keyCode; |
598 | 123 | mir_event.key.scan_code = args->scanCode; | 130 | mir_event.key.scan_code = args->scanCode; |
599 | 124 | mir_event.key.repeat_count = 0; | 131 | mir_event.key.repeat_count = 0; |
600 | @@ -140,7 +147,7 @@ | |||
601 | 140 | mir_event.motion.device_id = args->deviceId; | 147 | mir_event.motion.device_id = args->deviceId; |
602 | 141 | mir_event.motion.source_id = args->source; | 148 | mir_event.motion.source_id = args->source; |
603 | 142 | mir_event.motion.action = args->action; | 149 | mir_event.motion.action = args->action; |
605 | 143 | mir_event.motion.modifiers = args->metaState; | 150 | mir_event.motion.modifiers = mia::mir_modifiers_from_android(args->metaState); |
606 | 144 | mir_event.motion.button_state = static_cast<MirMotionButton>(args->buttonState); | 151 | mir_event.motion.button_state = static_cast<MirMotionButton>(args->buttonState); |
607 | 145 | mir_event.motion.event_time = args->eventTime.count(); | 152 | mir_event.motion.event_time = args->eventTime.count(); |
608 | 146 | mir_event.motion.pointer_count = args->pointerCount; | 153 | mir_event.motion.pointer_count = args->pointerCount; |
609 | 147 | 154 | ||
610 | === modified file 'src/server/input/vt_filter.cpp' | |||
611 | --- src/server/input/vt_filter.cpp 2015-04-01 19:39:19 +0000 | |||
612 | +++ src/server/input/vt_filter.cpp 2015-05-05 05:53:22 +0000 | |||
613 | @@ -39,8 +39,8 @@ | |||
614 | 39 | { | 39 | { |
615 | 40 | if (event.type == mir_event_type_key && | 40 | if (event.type == mir_event_type_key && |
616 | 41 | event.key.action == mir_key_action_down && | 41 | event.key.action == mir_key_action_down && |
619 | 42 | (event.key.modifiers & mir_key_modifier_alt) && | 42 | (event.key.modifiers & mir_input_event_modifier_alt) && |
620 | 43 | (event.key.modifiers & mir_key_modifier_ctrl)) | 43 | (event.key.modifiers & mir_input_event_modifier_ctrl)) |
621 | 44 | { | 44 | { |
622 | 45 | switch (event.key.scan_code) | 45 | switch (event.key.scan_code) |
623 | 46 | { | 46 | { |
624 | 47 | 47 | ||
625 | === modified file 'tests/unit-tests/input/android/test_android_input_dispatcher.cpp' | |||
626 | --- tests/unit-tests/input/android/test_android_input_dispatcher.cpp 2015-05-05 05:53:22 +0000 | |||
627 | +++ tests/unit-tests/input/android/test_android_input_dispatcher.cpp 2015-05-05 05:53:22 +0000 | |||
628 | @@ -179,7 +179,7 @@ | |||
629 | 179 | event.motion.device_id = 3; | 179 | event.motion.device_id = 3; |
630 | 180 | event.motion.source_id = 4; | 180 | event.motion.source_id = 4; |
631 | 181 | event.motion.action = mir_motion_action_scroll; | 181 | event.motion.action = mir_motion_action_scroll; |
633 | 182 | event.motion.modifiers = 6; | 182 | event.motion.modifiers = mir_input_event_modifier_shift, |
634 | 183 | event.motion.button_state = | 183 | event.motion.button_state = |
635 | 184 | static_cast<MirMotionButton>(mir_motion_button_forward | mir_motion_button_secondary); | 184 | static_cast<MirMotionButton>(mir_motion_button_forward | mir_motion_button_secondary); |
636 | 185 | 185 | ||
637 | @@ -214,7 +214,7 @@ | |||
638 | 214 | default_policy_flags, | 214 | default_policy_flags, |
639 | 215 | event.motion.action, | 215 | event.motion.action, |
640 | 216 | 0, /* flags */ | 216 | 0, /* flags */ |
642 | 217 | event.motion.modifiers, | 217 | AMETA_SHIFT_ON, |
643 | 218 | event.motion.button_state, | 218 | event.motion.button_state, |
644 | 219 | 0, /* edge_flags */ | 219 | 0, /* edge_flags */ |
645 | 220 | event.motion.pointer_count, | 220 | event.motion.pointer_count, |
646 | @@ -240,7 +240,7 @@ | |||
647 | 240 | event.key.scan_code = 4; | 240 | event.key.scan_code = 4; |
648 | 241 | event.key.key_code = 5; | 241 | event.key.key_code = 5; |
649 | 242 | event.key.repeat_count = 0; | 242 | event.key.repeat_count = 0; |
651 | 243 | event.key.modifiers = 7; | 243 | event.key.modifiers = mir_input_event_modifier_shift; |
652 | 244 | 244 | ||
653 | 245 | droidinput::NotifyKeyArgs expected(std::chrono::nanoseconds(event.key.event_time), | 245 | droidinput::NotifyKeyArgs expected(std::chrono::nanoseconds(event.key.event_time), |
654 | 246 | event.key.device_id, | 246 | event.key.device_id, |
655 | @@ -250,7 +250,7 @@ | |||
656 | 250 | 0, /* flags */ | 250 | 0, /* flags */ |
657 | 251 | event.key.key_code, | 251 | event.key.key_code, |
658 | 252 | event.key.scan_code, | 252 | event.key.scan_code, |
660 | 253 | event.key.modifiers, | 253 | AMETA_SHIFT_ON, |
661 | 254 | std::chrono::nanoseconds(event.key.event_time)); | 254 | std::chrono::nanoseconds(event.key.event_time)); |
662 | 255 | 255 | ||
663 | 256 | EXPECT_CALL(*dispatcher, notifyKey(KeyArgsMatches(expected))); | 256 | EXPECT_CALL(*dispatcher, notifyKey(KeyArgsMatches(expected))); |
664 | 257 | 257 | ||
665 | === modified file 'tests/unit-tests/input/android/test_android_input_lexicon.cpp' | |||
666 | --- tests/unit-tests/input/android/test_android_input_lexicon.cpp 2015-05-05 05:53:22 +0000 | |||
667 | +++ tests/unit-tests/input/android/test_android_input_lexicon.cpp 2015-05-05 05:53:22 +0000 | |||
668 | @@ -38,7 +38,7 @@ | |||
669 | 38 | const int32_t flags = 4; | 38 | const int32_t flags = 4; |
670 | 39 | const int32_t key_code = 5; | 39 | const int32_t key_code = 5; |
671 | 40 | const int32_t scan_code = 6; | 40 | const int32_t scan_code = 6; |
673 | 41 | const int32_t meta_state = 7; | 41 | const int32_t meta_state = AMETA_ALT_ON; |
674 | 42 | const int32_t repeat_count = 8; | 42 | const int32_t repeat_count = 8; |
675 | 43 | auto const down_time = std::chrono::nanoseconds(9); | 43 | auto const down_time = std::chrono::nanoseconds(9); |
676 | 44 | auto const event_time = std::chrono::nanoseconds(10); | 44 | auto const event_time = std::chrono::nanoseconds(10); |
677 | @@ -54,7 +54,7 @@ | |||
678 | 54 | EXPECT_EQ(device_id, mir_ev.key.device_id); | 54 | EXPECT_EQ(device_id, mir_ev.key.device_id); |
679 | 55 | EXPECT_EQ(source_id, mir_ev.key.source_id); | 55 | EXPECT_EQ(source_id, mir_ev.key.source_id); |
680 | 56 | EXPECT_EQ(action, mir_ev.key.action); | 56 | EXPECT_EQ(action, mir_ev.key.action); |
682 | 57 | EXPECT_EQ((unsigned int)meta_state, mir_ev.key.modifiers); | 57 | EXPECT_EQ(mir_input_event_modifier_alt, mir_ev.key.modifiers); |
683 | 58 | 58 | ||
684 | 59 | auto mir_key_ev = &mir_ev.key; | 59 | auto mir_key_ev = &mir_ev.key; |
685 | 60 | // Key event specific properties | 60 | // Key event specific properties |
686 | @@ -129,7 +129,6 @@ | |||
687 | 129 | EXPECT_EQ(device_id, mir_ev.motion.device_id); | 129 | EXPECT_EQ(device_id, mir_ev.motion.device_id); |
688 | 130 | EXPECT_EQ(source_id, mir_ev.motion.source_id); | 130 | EXPECT_EQ(source_id, mir_ev.motion.source_id); |
689 | 131 | EXPECT_EQ(action, mir_ev.motion.action); | 131 | EXPECT_EQ(action, mir_ev.motion.action); |
690 | 132 | EXPECT_EQ((unsigned int)meta_state, mir_ev.motion.modifiers); | ||
691 | 133 | 132 | ||
692 | 134 | // Motion event specific properties | 133 | // Motion event specific properties |
693 | 135 | EXPECT_EQ(mir_ev.type, mir_event_type_motion); | 134 | EXPECT_EQ(mir_ev.type, mir_event_type_motion); |
694 | @@ -237,7 +236,6 @@ | |||
695 | 237 | EXPECT_EQ(device_id, mir_ev.motion.device_id); | 236 | EXPECT_EQ(device_id, mir_ev.motion.device_id); |
696 | 238 | EXPECT_EQ(source_id, mir_ev.motion.source_id); | 237 | EXPECT_EQ(source_id, mir_ev.motion.source_id); |
697 | 239 | EXPECT_EQ(action, mir_ev.motion.action); | 238 | EXPECT_EQ(action, mir_ev.motion.action); |
698 | 240 | EXPECT_EQ((unsigned int)meta_state, mir_ev.motion.modifiers); | ||
699 | 241 | 239 | ||
700 | 242 | // Motion event specific properties | 240 | // Motion event specific properties |
701 | 243 | EXPECT_EQ(mir_ev.type, mir_event_type_motion); | 241 | EXPECT_EQ(mir_ev.type, mir_event_type_motion); |
702 | 244 | 242 | ||
703 | === modified file 'tests/unit-tests/input/android/test_input_translator.cpp' | |||
704 | --- tests/unit-tests/input/android/test_input_translator.cpp 2015-05-05 05:53:22 +0000 | |||
705 | +++ tests/unit-tests/input/android/test_input_translator.cpp 2015-05-05 05:53:22 +0000 | |||
706 | @@ -252,7 +252,7 @@ | |||
707 | 252 | expected.key.scan_code = 4; | 252 | expected.key.scan_code = 4; |
708 | 253 | expected.key.key_code = 5; | 253 | expected.key.key_code = 5; |
709 | 254 | expected.key.repeat_count = 0; | 254 | expected.key.repeat_count = 0; |
711 | 255 | expected.key.modifiers = 7; | 255 | expected.key.modifiers = mir_input_event_modifier_shift; |
712 | 256 | 256 | ||
713 | 257 | InSequence seq; | 257 | InSequence seq; |
714 | 258 | EXPECT_CALL(dispatcher, dispatch(mt::MirKeyEventMatches(expected))).Times(1); | 258 | EXPECT_CALL(dispatcher, dispatch(mt::MirKeyEventMatches(expected))).Times(1); |
715 | @@ -265,7 +265,7 @@ | |||
716 | 265 | 0, /* flags */ | 265 | 0, /* flags */ |
717 | 266 | expected.key.key_code, | 266 | expected.key.key_code, |
718 | 267 | expected.key.scan_code, | 267 | expected.key.scan_code, |
720 | 268 | expected.key.modifiers, | 268 | AMETA_SHIFT_ON, |
721 | 269 | std::chrono::nanoseconds(expected.key.event_time)); | 269 | std::chrono::nanoseconds(expected.key.event_time)); |
722 | 270 | 270 | ||
723 | 271 | translator.notifyKey(¬ified); | 271 | translator.notifyKey(¬ified); |
724 | 272 | 272 | ||
725 | === modified file 'tests/unit-tests/input/test_input_event.cpp' | |||
726 | --- tests/unit-tests/input/test_input_event.cpp 2015-04-01 19:39:19 +0000 | |||
727 | +++ tests/unit-tests/input/test_input_event.cpp 2015-05-05 05:53:22 +0000 | |||
728 | @@ -150,17 +150,17 @@ | |||
729 | 150 | { | 150 | { |
730 | 151 | xkb_keysym_t key_code = 171; | 151 | xkb_keysym_t key_code = 171; |
731 | 152 | int scan_code = 31; | 152 | int scan_code = 31; |
733 | 153 | MirKeyModifier old_modifiers = mir_key_modifier_shift; | 153 | MirInputEventModifiers modifiers = mir_input_event_modifier_shift; |
734 | 154 | 154 | ||
735 | 155 | auto old_ev = a_key_ev(); | 155 | auto old_ev = a_key_ev(); |
736 | 156 | old_ev.key.key_code = key_code; | 156 | old_ev.key.key_code = key_code; |
737 | 157 | old_ev.key.scan_code = scan_code; | 157 | old_ev.key.scan_code = scan_code; |
739 | 158 | old_ev.key.modifiers = old_modifiers; | 158 | old_ev.key.modifiers = modifiers; |
740 | 159 | 159 | ||
741 | 160 | auto new_kev = mir_input_event_get_keyboard_event(mir_event_get_input_event(&old_ev)); | 160 | auto new_kev = mir_input_event_get_keyboard_event(mir_event_get_input_event(&old_ev)); |
742 | 161 | EXPECT_EQ(key_code, mir_keyboard_event_key_code(new_kev)); | 161 | EXPECT_EQ(key_code, mir_keyboard_event_key_code(new_kev)); |
743 | 162 | EXPECT_EQ(scan_code, mir_keyboard_event_scan_code(new_kev)); | 162 | EXPECT_EQ(scan_code, mir_keyboard_event_scan_code(new_kev)); |
745 | 163 | EXPECT_EQ(mir_input_event_modifier_shift, mir_keyboard_event_modifiers(new_kev)); | 163 | EXPECT_EQ(modifiers, mir_keyboard_event_modifiers(new_kev)); |
746 | 164 | } | 164 | } |
747 | 165 | 165 | ||
748 | 166 | TEST(TouchEventProperties, touch_count_taken_from_pointer_count) | 166 | TEST(TouchEventProperties, touch_count_taken_from_pointer_count) |
749 | @@ -296,12 +296,13 @@ | |||
750 | 296 | 296 | ||
751 | 297 | TEST(PointerInputEventProperties, modifiers_taken_from_old_style_ev) | 297 | TEST(PointerInputEventProperties, modifiers_taken_from_old_style_ev) |
752 | 298 | { | 298 | { |
753 | 299 | MirInputEventModifiers modifiers = mir_input_event_modifier_shift; | ||
754 | 299 | auto old_ev = a_motion_ev(AINPUT_SOURCE_MOUSE); | 300 | auto old_ev = a_motion_ev(AINPUT_SOURCE_MOUSE); |
756 | 300 | old_ev.motion.modifiers = mir_key_modifier_shift; | 301 | old_ev.motion.modifiers = modifiers; |
757 | 301 | 302 | ||
758 | 302 | auto pointer_event = | 303 | auto pointer_event = |
759 | 303 | mir_input_event_get_pointer_event(mir_event_get_input_event(&old_ev)); | 304 | mir_input_event_get_pointer_event(mir_event_get_input_event(&old_ev)); |
761 | 304 | EXPECT_EQ(mir_input_event_modifier_shift, mir_pointer_event_modifiers(pointer_event)); | 305 | EXPECT_EQ(modifiers, mir_pointer_event_modifiers(pointer_event)); |
762 | 305 | } | 306 | } |
763 | 306 | 307 | ||
764 | 307 | namespace | 308 | namespace |
FAILED: Continuous integration, rev:2542 jenkins. qa.ubuntu. com/job/ mir-ci/ 3698/ jenkins. qa.ubuntu. com/job/ mir-android- vivid-i386- build/2293/ console jenkins. qa.ubuntu. com/job/ mir-clang- vivid-amd64- build/2292 jenkins. qa.ubuntu. com/job/ mir-mediumtests -vivid- touch/2241/ console jenkins. qa.ubuntu. com/job/ mir-vivid- amd64-ci/ 1695/console jenkins. qa.ubuntu. com/job/ mir-mediumtests -builder- vivid-armhf/ 2241/console
http://
Executed test runs:
FAILURE: http://
SUCCESS: http://
FAILURE: http://
FAILURE: http://
FAILURE: http://
Click here to trigger a rebuild: s-jenkins. ubuntu- ci:8080/ job/mir- ci/3698/ rebuild
http://