Merge lp:~vanvugt/mir/touch-event into lp:mir
- touch-event
- Merge into development-branch
Status: | Rejected |
---|---|
Rejected by: | kevin gunn |
Proposed branch: | lp:~vanvugt/mir/touch-event |
Merge into: | lp:mir |
Diff against target: |
1029 lines (+259/-193) 17 files modified
client-ABI-sha1sums (+2/-2) common-ABI-sha1sums (+3/-3) examples/fingerpaint.c (+10/-13) examples/server_example_input_filter.cpp (+5/-7) include/common/mir/events/event_builders.h (+2/-2) include/common/mir_toolkit/events/input/input_event.h (+4/-4) include/common/mir_toolkit/events/input/touch_event.h (+27/-27) platform-ABI-sha1sums (+3/-3) server-ABI-sha1sums (+3/-3) src/client/logging/input_receiver_report.cpp (+12/-12) src/client/lttng/input_receiver_report.cpp (+10/-10) src/common/events/event_builders.cpp (+9/-9) src/common/input/input_event.cpp (+81/-30) src/common/symbols.map (+26/-6) tests/include/mir_test/event_matchers.h (+20/-20) tests/unit-tests/input/test_event_builders.cpp (+15/-15) tests/unit-tests/input/test_input_event.cpp (+27/-27) |
To merge this branch: | bzr merge lp:~vanvugt/mir/touch-event |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Robert Carr (community) | Disapprove | ||
PS Jenkins bot (community) | continuous-integration | Approve | |
Cemil Azizoglu (community) | Approve | ||
Alan Griffiths | Approve | ||
Alberto Aguirre (community) | Approve | ||
Review via email: mp+247791@code.launchpad.net |
Commit message
Refine touch event API naming that was introduced in Mir 0.10:
MirTouchInputEvent -> MirTouchEvent
MirTouchInputEv
MirTouchInputEv
MirTouchInputEv
mir_input_
mir_touch_
mir_touch_
mir_touch_
mir_touch_
mir_touch_
mir_touch_
Full ABI compatibility is retained so nobody needs to recompile. Although if anyone is compiling new code they will be forced to use the new API.
More related proposals to come later.
Description of the change
Daniel van Vugt (vanvugt) wrote : | # |
PS Jenkins bot (ps-jenkins) wrote : | # |
PASSED: Continuous integration, rev:2271
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://
Daniel van Vugt (vanvugt) wrote : | # |
Please don't ask me to fix 1415321 at the same time. This will get all too big too quickly... :)
Cemil Azizoglu (cemil-azizoglu) wrote : | # |
As I mentioned in the previous version, consistency is important and I don't think it makes sense to consider only the touch events when renaming. We need a general encoding for all the event names, as some encoding chosen within the context of touch events may not work for others.
Or if you think this is all that's needed then I will change my vote and review, but if there will be more renaming forthcoming then they all should be considered in one MP.
Daniel van Vugt (vanvugt) wrote : | # |
I don't think that is sensible. You're asking me to turn what is several bite-sized merge proposals into one very large one. Either way, it will eventually be consistent.
Also, we don't need to fix everything in one release. We only immediately need to fix what appeared in Mir 0.10 so that it's not still in the 0.11 release (that's Mir(Touch|
Daniel van Vugt (vanvugt) wrote : | # |
BTW, the small "bite-size" is now almost 1000 lines. You're asking for something much bigger than that all at once.
PS Jenkins bot (ps-jenkins) wrote : | # |
PASSED: Continuous integration, rev:2273
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://
Cemil Azizoglu (cemil-azizoglu) wrote : | # |
A few of us have commented (in previous version of this MP) that names may still end up inconsistent, leaving us no better off than we are. Instead of changing some subset of names, let's see (and hopefully reach an agreement) on the encoding of the names so we have an idea if the names chosen for this subset will extend in a consistent manner to others. If there is an agreement in that, it'd be okay to propose in chunks.
Alan Griffiths (alan-griffiths) wrote : | # |
Cemil asking for a "roadmap" of the renames to be agreed seems reasonable.
Daniel van Vugt (vanvugt) wrote : | # |
Sorry, I thought it was obvious...
- Rename MirXXXInputEvent to MirXXXEvent
- Remove superfluous words like in MirTouchInputEv
- Rename mir_foo_event_get_* to mir_foo_event_*
- Transition the new stuff from Mir 0.10 (Touch, Pointer) immediately, so it's not still broken in 0.11 and people don't _use_ those versions at all.
- Transition everything else ASAP. As soon as this lands I will commit to finishing the rest.
What I could do is propose all these things as separate stacked proposals. But with that much work outstanding it will likely be an hour or two maintenance each day just to fix the conflicts as other work lands.
PS Jenkins bot (ps-jenkins) wrote : | # |
PASSED: Continuous integration, rev:2275
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 : | # |
> Sorry, I thought it was obvious...
> - Rename MirXXXInputEvent to MirXXXEvent
> - Remove superfluous words like in MirTouchInputEv
> MirTouchAction
> - Rename mir_foo_event_get_* to mir_foo_event_*
> - Transition the new stuff from Mir 0.10 (Touch, Pointer) immediately, so
> it's not still broken in 0.11 and people don't _use_ those versions at all.
> - Transition everything else ASAP. As soon as this lands I will commit to
> finishing the rest.
>
> What I could do is propose all these things as separate stacked proposals. But
> with that much work outstanding it will likely be an hour or two maintenance
> each day just to fix the conflicts as other work lands.
I'm happy with this plan. Can you get Cemil to accept it?
PS Jenkins bot (ps-jenkins) wrote : | # |
PASSED: Continuous integration, rev:2281
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://
Robert Carr (robertcarr) wrote : | # |
I prefer the naming scheme:
https:/
I would call it a matter of taste and abstain but the proposed scheme here does not solve the MirKeyEvent conflict so I think its worth going with MirTouchInput over MirTouchEvent
kevin gunn (kgunn72) wrote : | # |
As much discussion as this has generated, it seems to prove the point, the names shouldn't have words dropped.
Unmerged revisions
- 2282. By Daniel van Vugt
-
Merge latest trunk
Preview Diff
1 | === modified file 'client-ABI-sha1sums' |
2 | --- client-ABI-sha1sums 2015-02-03 18:51:02 +0000 |
3 | +++ client-ABI-sha1sums 2015-02-04 10:05:11 +0000 |
4 | @@ -15,10 +15,10 @@ |
5 | f4d39e9893ce6308bddd83a49b90f0051f565323 include/common/mir_toolkit/event.h |
6 | 2507f2929415aa423f9551d3c595c439fe1c6efd include/common/mir_toolkit/events/event_deprecated.h |
7 | 75f81e8250bd76c5281b8792aeadf5319eb2f169 include/common/mir_toolkit/events/event.h |
8 | -003b178a1d2418e03a13c54ca02353fa24beb1d6 include/common/mir_toolkit/events/input/input_event.h |
9 | +4f1ac1ceb69bcd63f2a4ffb874e0104802a520e9 include/common/mir_toolkit/events/input/input_event.h |
10 | 7748a12138474e9be218eeb8f14b372af0fcec7e include/common/mir_toolkit/events/input/key_input_event.h |
11 | 489e8bae7c3e949ac449b09bd3bf554dae0e8986 include/common/mir_toolkit/events/input/pointer_input_event.h |
12 | -de7c23453e6d897296f32e49d9ba952a1baa0200 include/common/mir_toolkit/events/input/touch_input_event.h |
13 | +f4aa06030672cf07c72e282ac5c9cea1f901e2e2 include/common/mir_toolkit/events/input/touch_event.h |
14 | 8642e85a50e2de651589da3ced70e0fc0a915f26 include/common/mir_toolkit/events/orientation_event.h |
15 | f623dcf3c2ed134c1be20106eb54bcccc84af462 include/common/mir_toolkit/events/prompt_session_event.h |
16 | 633893b0def2b71f969872908a5b3529bc2fbf10 include/common/mir_toolkit/events/resize_event.h |
17 | |
18 | === modified file 'common-ABI-sha1sums' |
19 | --- common-ABI-sha1sums 2015-02-02 12:18:18 +0000 |
20 | +++ common-ABI-sha1sums 2015-02-04 10:05:11 +0000 |
21 | @@ -1,7 +1,7 @@ |
22 | 3329ada91412ded2f127aee9a92f065e57b81cb2 include/common/mir/cached_ptr.h |
23 | d20a846dfa0e46fb276b4c181a6a5a56e7a884da include/common/mir/dispatch/dispatchable.h |
24 | 7bdc0e58dc228ac655a618208bf133c6a499ca13 include/common/mir/dispatch/simple_dispatch_thread.h |
25 | -4bbb26ec91310e250d3d7803575c36fd8cd8b87c include/common/mir/events/event_builders.h |
26 | +71af07bd2a8f29c72125688593b3b412c28796f0 include/common/mir/events/event_builders.h |
27 | 82ff9499ef62739379616e02164dc98f9914c329 include/common/mir/fd.h |
28 | fe0275d9c64e7a2d99990382d04b1fe956d7b7e4 include/common/mir/frontend/surface_id.h |
29 | 212be468fdca8134c1dff7a9cd61ecec76b26967 include/common/mir/geometry/dimensions.h |
30 | @@ -26,10 +26,10 @@ |
31 | f4d39e9893ce6308bddd83a49b90f0051f565323 include/common/mir_toolkit/event.h |
32 | 2507f2929415aa423f9551d3c595c439fe1c6efd include/common/mir_toolkit/events/event_deprecated.h |
33 | 75f81e8250bd76c5281b8792aeadf5319eb2f169 include/common/mir_toolkit/events/event.h |
34 | -003b178a1d2418e03a13c54ca02353fa24beb1d6 include/common/mir_toolkit/events/input/input_event.h |
35 | +4f1ac1ceb69bcd63f2a4ffb874e0104802a520e9 include/common/mir_toolkit/events/input/input_event.h |
36 | 7748a12138474e9be218eeb8f14b372af0fcec7e include/common/mir_toolkit/events/input/key_input_event.h |
37 | 489e8bae7c3e949ac449b09bd3bf554dae0e8986 include/common/mir_toolkit/events/input/pointer_input_event.h |
38 | -de7c23453e6d897296f32e49d9ba952a1baa0200 include/common/mir_toolkit/events/input/touch_input_event.h |
39 | +f4aa06030672cf07c72e282ac5c9cea1f901e2e2 include/common/mir_toolkit/events/input/touch_event.h |
40 | 8642e85a50e2de651589da3ced70e0fc0a915f26 include/common/mir_toolkit/events/orientation_event.h |
41 | f623dcf3c2ed134c1be20106eb54bcccc84af462 include/common/mir_toolkit/events/prompt_session_event.h |
42 | 633893b0def2b71f969872908a5b3529bc2fbf10 include/common/mir_toolkit/events/resize_event.h |
43 | |
44 | === modified file 'examples/fingerpaint.c' |
45 | --- examples/fingerpaint.c 2015-01-22 09:00:14 +0000 |
46 | +++ examples/fingerpaint.c 2015-02-04 10:05:11 +0000 |
47 | @@ -212,7 +212,7 @@ |
48 | static float max_pressure = 1.0f; |
49 | |
50 | MirInputEvent const* input_event = mir_event_get_input_event(event); |
51 | - MirTouchInputEvent const* tev = NULL; |
52 | + MirTouchEvent const* tev = NULL; |
53 | MirPointerInputEvent const* pev = NULL; |
54 | unsigned touch_count = 0; |
55 | bool ended = false; |
56 | @@ -221,11 +221,10 @@ |
57 | switch (type) |
58 | { |
59 | case mir_input_event_type_touch: |
60 | - tev = mir_input_event_get_touch_input_event(input_event); |
61 | - touch_count = mir_touch_input_event_get_touch_count(tev); |
62 | + tev = mir_input_event_get_touch_event(input_event); |
63 | + touch_count = mir_touch_event_point_count(tev); |
64 | ended = touch_count == 1 && |
65 | - (mir_touch_input_event_get_touch_action(tev, 0) == |
66 | - mir_touch_input_event_action_up); |
67 | + (mir_touch_event_action(tev, 0) == mir_touch_action_up); |
68 | break; |
69 | case mir_input_event_type_pointer: |
70 | pev = mir_input_event_get_pointer_input_event(input_event); |
71 | @@ -259,14 +258,12 @@ |
72 | |
73 | if (tev != NULL) |
74 | { |
75 | - x = mir_touch_input_event_get_touch_axis_value(tev, p, |
76 | - mir_touch_input_axis_x); |
77 | - y = mir_touch_input_event_get_touch_axis_value(tev, p, |
78 | - mir_touch_input_axis_y); |
79 | - float size = mir_touch_input_event_get_touch_axis_value( |
80 | - tev, p, mir_touch_input_axis_size); |
81 | - pressure = mir_touch_input_event_get_touch_axis_value(tev, |
82 | - p, mir_touch_input_axis_pressure); |
83 | + x = mir_touch_event_axis_value(tev, p, mir_touch_axis_x); |
84 | + y = mir_touch_event_axis_value(tev, p, mir_touch_axis_y); |
85 | + float size = mir_touch_event_axis_value(tev, p, |
86 | + mir_touch_axis_size); |
87 | + pressure = mir_touch_event_axis_value(tev, p, |
88 | + mir_touch_axis_pressure); |
89 | radius = size * 50.0f + 1.0f; |
90 | } |
91 | else if (pev != NULL) |
92 | |
93 | === modified file 'examples/server_example_input_filter.cpp' |
94 | --- examples/server_example_input_filter.cpp 2015-01-21 07:34:50 +0000 |
95 | +++ examples/server_example_input_filter.cpp 2015-02-04 10:05:11 +0000 |
96 | @@ -46,18 +46,16 @@ |
97 | void print_touch_event(MirInputEvent const* ev) |
98 | { |
99 | auto event_time = mir_input_event_get_event_time(ev); |
100 | - auto tev = mir_input_event_get_touch_input_event(ev); |
101 | - auto tc = mir_touch_input_event_get_touch_count(tev); |
102 | + auto tev = mir_input_event_get_touch_event(ev); |
103 | + auto tc = mir_touch_event_point_count(tev); |
104 | |
105 | std::cout << "Handline touch event time=" << event_time |
106 | << " touch_count=" << tc << std::endl; |
107 | for (unsigned i = 0; i < tc; i++) |
108 | { |
109 | - auto id = mir_touch_input_event_get_touch_id(tev, i); |
110 | - auto px = mir_touch_input_event_get_touch_axis_value(tev, i, |
111 | - mir_touch_input_axis_x); |
112 | - auto py = mir_touch_input_event_get_touch_axis_value(tev, i, |
113 | - mir_touch_input_axis_y); |
114 | + auto id = mir_touch_event_id(tev, i); |
115 | + auto px = mir_touch_event_axis_value(tev, i, mir_touch_axis_x); |
116 | + auto py = mir_touch_event_axis_value(tev, i, mir_touch_axis_y); |
117 | |
118 | std::cout << " " |
119 | << " id=" << id |
120 | |
121 | === modified file 'include/common/mir/events/event_builders.h' |
122 | --- include/common/mir/events/event_builders.h 2015-01-29 04:34:12 +0000 |
123 | +++ include/common/mir/events/event_builders.h 2015-02-04 10:05:11 +0000 |
124 | @@ -55,8 +55,8 @@ |
125 | // Touch event |
126 | EventUPtr make_event(MirInputDeviceId device_id, int64_t timestamp, |
127 | MirInputEventModifiers modifiers); |
128 | -void add_touch(MirEvent &event, MirTouchInputEventTouchId touch_id, MirTouchInputEventTouchAction action, |
129 | - MirTouchInputEventTouchTooltype tooltype, float x_axis_value, float y_axis_value, |
130 | +void add_touch(MirEvent &event, MirTouchId touch_id, MirTouchAction action, |
131 | + MirTouchTooltype tooltype, float x_axis_value, float y_axis_value, |
132 | float pressure_value, float touch_major_value, float touch_minor_value, float size_value); |
133 | |
134 | // Pointer event |
135 | |
136 | === modified file 'include/common/mir_toolkit/events/input/input_event.h' |
137 | --- include/common/mir_toolkit/events/input/input_event.h 2015-01-27 03:02:22 +0000 |
138 | +++ include/common/mir_toolkit/events/input/input_event.h 2015-02-04 10:05:11 +0000 |
139 | @@ -69,7 +69,7 @@ |
140 | /**@}*/ |
141 | #endif |
142 | |
143 | -#include "mir_toolkit/events/input/touch_input_event.h" |
144 | +#include "mir_toolkit/events/input/touch_event.h" |
145 | #include "mir_toolkit/events/input/key_input_event.h" |
146 | #include "mir_toolkit/events/input/pointer_input_event.h" |
147 | |
148 | @@ -115,13 +115,13 @@ |
149 | MirKeyInputEvent const* mir_input_event_get_key_input_event(MirInputEvent const* ev); |
150 | |
151 | /* |
152 | - * Retrieve the MirTouchInputEvent associated with a given input event. |
153 | + * Retrieve the MirTouchEvent associated with a given input event. |
154 | * |
155 | * \param[in] event The input event |
156 | - * \return The MirTouchInputEvent or NULL if event type is not |
157 | + * \return The MirTouchEvent or NULL if event type is not |
158 | * mir_input_event_type_touch |
159 | */ |
160 | -MirTouchInputEvent const* mir_input_event_get_touch_input_event(MirInputEvent const* ev); |
161 | +MirTouchEvent const* mir_input_event_get_touch_event(MirInputEvent const* ev); |
162 | |
163 | /* |
164 | * Retrieve the MirPointerInputEvent associated with a given input event. |
165 | |
166 | === renamed file 'include/common/mir_toolkit/events/input/touch_input_event.h' => 'include/common/mir_toolkit/events/input/touch_event.h' |
167 | --- include/common/mir_toolkit/events/input/touch_input_event.h 2014-12-29 03:44:41 +0000 |
168 | +++ include/common/mir_toolkit/events/input/touch_event.h 2015-02-04 10:05:11 +0000 |
169 | @@ -16,8 +16,8 @@ |
170 | * Authored by: Robert Carr <robert.carr@canonical.com> |
171 | */ |
172 | |
173 | -#ifndef MIR_TOOLKIT_TOUCH_INPUT_EVENT_H_ |
174 | -#define MIR_TOOLKIT_TOUCH_INPUT_EVENT_H_ |
175 | +#ifndef MIR_TOOLKIT_TOUCH_EVENT_H_ |
176 | +#define MIR_TOOLKIT_TOUCH_EVENT_H_ |
177 | |
178 | #ifdef __cplusplus |
179 | /** |
180 | @@ -30,59 +30,59 @@ |
181 | /** |
182 | * An event type describing a change in touch device state. |
183 | */ |
184 | -typedef struct MirTouchInputEvent MirTouchInputEvent; |
185 | +typedef struct MirTouchEvent MirTouchEvent; |
186 | |
187 | /** |
188 | * An identifier for a touch-point. TouchId's are unique per-gesture. |
189 | * That is to say, once a touch has gone down at time T, no other touch will |
190 | * use that touch's ID until all touches at time T have come up. |
191 | */ |
192 | -typedef int32_t MirTouchInputEventTouchId; |
193 | +typedef int32_t MirTouchId; |
194 | |
195 | /** |
196 | * Possible per touch actions for state changing |
197 | */ |
198 | typedef enum { |
199 | /* This touch point is going up */ |
200 | - mir_touch_input_event_action_up = 0, |
201 | + mir_touch_action_up = 0, |
202 | /* This touch point is going down */ |
203 | - mir_touch_input_event_action_down = 1, |
204 | + mir_touch_action_down = 1, |
205 | /* Axis values have changed on this touch point */ |
206 | - mir_touch_input_event_action_change = 2 |
207 | -} MirTouchInputEventTouchAction; |
208 | + mir_touch_action_change = 2 |
209 | +} MirTouchAction; |
210 | |
211 | /** |
212 | * Identifiers for touch axis |
213 | */ |
214 | typedef enum { |
215 | /* Axis representing the x coordinate for the touch */ |
216 | - mir_touch_input_axis_x = 0, |
217 | + mir_touch_axis_x = 0, |
218 | /* Axis representing the y coordinate for the touch */ |
219 | - mir_touch_input_axis_y = 1, |
220 | + mir_touch_axis_y = 1, |
221 | /* Axis representing pressure of the touch */ |
222 | - mir_touch_input_axis_pressure = 2, |
223 | + mir_touch_axis_pressure = 2, |
224 | /* Axis representing the length of the major axis of an ellipse |
225 | centered at the touch point */ |
226 | - mir_touch_input_axis_touch_major = 3, |
227 | + mir_touch_axis_touch_major = 3, |
228 | /* Axis representing the length of the minor axis of an ellipse |
229 | centered at the touch point */ |
230 | - mir_touch_input_axis_touch_minor = 4, |
231 | + mir_touch_axis_touch_minor = 4, |
232 | /* Axis representing the diameter of a circle centered on the touch |
233 | point */ |
234 | - mir_touch_input_axis_size = 5 |
235 | -} MirTouchInputEventTouchAxis; |
236 | + mir_touch_axis_size = 5 |
237 | +} MirTouchAxis; |
238 | |
239 | /** |
240 | * Identifiers for per-touch tool types |
241 | */ |
242 | typedef enum { |
243 | // Tool type could not be determined |
244 | - mir_touch_input_tool_type_unknown = 0, |
245 | + mir_touch_tooltype_unknown = 0, |
246 | // Touch is made with a finger |
247 | - mir_touch_input_tool_type_finger = 1, |
248 | + mir_touch_tooltype_finger = 1, |
249 | // Touch is made with a stylus |
250 | - mir_touch_input_tool_type_stylus = 2 |
251 | -} MirTouchInputEventTouchTooltype; |
252 | + mir_touch_tooltype_stylus = 2 |
253 | +} MirTouchTooltype; |
254 | |
255 | /** |
256 | * Retrieve the modifier keys pressed when the touch action occured. |
257 | @@ -90,7 +90,7 @@ |
258 | * \param [in] event The key event |
259 | * \return The modifier mask |
260 | */ |
261 | -MirInputEventModifiers mir_touch_input_event_get_modifiers(MirTouchInputEvent const* event); |
262 | +MirInputEventModifiers mir_touch_event_modifiers(MirTouchEvent const* event); |
263 | |
264 | /** |
265 | * Retrieve the number of touches reported for a given touch event. Each touch |
266 | @@ -99,7 +99,7 @@ |
267 | * \param [in] event The touch event |
268 | * \return The number of touches |
269 | */ |
270 | -unsigned int mir_touch_input_event_get_touch_count(MirTouchInputEvent const* event); |
271 | +unsigned int mir_touch_event_point_count(MirTouchEvent const* event); |
272 | |
273 | /** |
274 | * Retrieve the TouchID for a touch at given index. |
275 | @@ -108,7 +108,7 @@ |
276 | * \param [in] touch_index The touch index. Must be less than (touch_count - 1). |
277 | * \return ID of the touch at index |
278 | */ |
279 | -MirTouchInputEventTouchId mir_touch_input_event_get_touch_id(MirTouchInputEvent const* event, size_t touch_index); |
280 | +MirTouchId mir_touch_event_id(MirTouchEvent const* event, size_t touch_index); |
281 | |
282 | /** |
283 | * Retrieve the action which occured for a touch at given index. |
284 | @@ -117,7 +117,7 @@ |
285 | * \param [in] touch_index The touch index. Must be less than (touch_count - 1). |
286 | * \return Action performed for the touch at index. |
287 | */ |
288 | -MirTouchInputEventTouchAction mir_touch_input_event_get_touch_action(MirTouchInputEvent const* event, size_t touch_index); |
289 | +MirTouchAction mir_touch_event_action(MirTouchEvent const* event, size_t touch_index); |
290 | |
291 | /** |
292 | * Retrieve the tooltype for touch at given index. |
293 | @@ -126,7 +126,7 @@ |
294 | * \param [in] touch_index The touch index. Must be less than (touch_count - 1). |
295 | * \return Tooltype used for the touch at index |
296 | */ |
297 | -MirTouchInputEventTouchTooltype mir_touch_input_event_get_touch_tooltype(MirTouchInputEvent const* event, |
298 | +MirTouchTooltype mir_touch_event_tooltype(MirTouchEvent const* event, |
299 | size_t touch_index); |
300 | |
301 | |
302 | @@ -138,12 +138,12 @@ |
303 | * \param [in] axis The axis to retreive a value from |
304 | * \return The value of the given axis |
305 | */ |
306 | -float mir_touch_input_event_get_touch_axis_value(MirTouchInputEvent const* event, |
307 | - size_t touch_index, MirTouchInputEventTouchAxis axis); |
308 | +float mir_touch_event_axis_value(MirTouchEvent const* event, |
309 | + size_t touch_index, MirTouchAxis axis); |
310 | |
311 | #ifdef __cplusplus |
312 | } |
313 | /**@}*/ |
314 | #endif |
315 | |
316 | -#endif /* MIR_TOOLKIT_TOUCH_INPUT_EVENT_H_ */ |
317 | +#endif /* MIR_TOOLKIT_TOUCH_EVENT_H_ */ |
318 | |
319 | === modified file 'platform-ABI-sha1sums' |
320 | --- platform-ABI-sha1sums 2015-02-02 12:18:18 +0000 |
321 | +++ platform-ABI-sha1sums 2015-02-04 10:05:11 +0000 |
322 | @@ -1,7 +1,7 @@ |
323 | 3329ada91412ded2f127aee9a92f065e57b81cb2 include/common/mir/cached_ptr.h |
324 | d20a846dfa0e46fb276b4c181a6a5a56e7a884da include/common/mir/dispatch/dispatchable.h |
325 | 7bdc0e58dc228ac655a618208bf133c6a499ca13 include/common/mir/dispatch/simple_dispatch_thread.h |
326 | -4bbb26ec91310e250d3d7803575c36fd8cd8b87c include/common/mir/events/event_builders.h |
327 | +71af07bd2a8f29c72125688593b3b412c28796f0 include/common/mir/events/event_builders.h |
328 | 82ff9499ef62739379616e02164dc98f9914c329 include/common/mir/fd.h |
329 | fe0275d9c64e7a2d99990382d04b1fe956d7b7e4 include/common/mir/frontend/surface_id.h |
330 | 212be468fdca8134c1dff7a9cd61ecec76b26967 include/common/mir/geometry/dimensions.h |
331 | @@ -26,10 +26,10 @@ |
332 | f4d39e9893ce6308bddd83a49b90f0051f565323 include/common/mir_toolkit/event.h |
333 | 2507f2929415aa423f9551d3c595c439fe1c6efd include/common/mir_toolkit/events/event_deprecated.h |
334 | 75f81e8250bd76c5281b8792aeadf5319eb2f169 include/common/mir_toolkit/events/event.h |
335 | -003b178a1d2418e03a13c54ca02353fa24beb1d6 include/common/mir_toolkit/events/input/input_event.h |
336 | +4f1ac1ceb69bcd63f2a4ffb874e0104802a520e9 include/common/mir_toolkit/events/input/input_event.h |
337 | 7748a12138474e9be218eeb8f14b372af0fcec7e include/common/mir_toolkit/events/input/key_input_event.h |
338 | 489e8bae7c3e949ac449b09bd3bf554dae0e8986 include/common/mir_toolkit/events/input/pointer_input_event.h |
339 | -de7c23453e6d897296f32e49d9ba952a1baa0200 include/common/mir_toolkit/events/input/touch_input_event.h |
340 | +f4aa06030672cf07c72e282ac5c9cea1f901e2e2 include/common/mir_toolkit/events/input/touch_event.h |
341 | 8642e85a50e2de651589da3ced70e0fc0a915f26 include/common/mir_toolkit/events/orientation_event.h |
342 | f623dcf3c2ed134c1be20106eb54bcccc84af462 include/common/mir_toolkit/events/prompt_session_event.h |
343 | 633893b0def2b71f969872908a5b3529bc2fbf10 include/common/mir_toolkit/events/resize_event.h |
344 | |
345 | === modified file 'server-ABI-sha1sums' |
346 | --- server-ABI-sha1sums 2015-02-03 15:07:44 +0000 |
347 | +++ server-ABI-sha1sums 2015-02-04 10:05:11 +0000 |
348 | @@ -1,7 +1,7 @@ |
349 | 3329ada91412ded2f127aee9a92f065e57b81cb2 include/common/mir/cached_ptr.h |
350 | d20a846dfa0e46fb276b4c181a6a5a56e7a884da include/common/mir/dispatch/dispatchable.h |
351 | 7bdc0e58dc228ac655a618208bf133c6a499ca13 include/common/mir/dispatch/simple_dispatch_thread.h |
352 | -4bbb26ec91310e250d3d7803575c36fd8cd8b87c include/common/mir/events/event_builders.h |
353 | +71af07bd2a8f29c72125688593b3b412c28796f0 include/common/mir/events/event_builders.h |
354 | 82ff9499ef62739379616e02164dc98f9914c329 include/common/mir/fd.h |
355 | fe0275d9c64e7a2d99990382d04b1fe956d7b7e4 include/common/mir/frontend/surface_id.h |
356 | 212be468fdca8134c1dff7a9cd61ecec76b26967 include/common/mir/geometry/dimensions.h |
357 | @@ -26,10 +26,10 @@ |
358 | f4d39e9893ce6308bddd83a49b90f0051f565323 include/common/mir_toolkit/event.h |
359 | 2507f2929415aa423f9551d3c595c439fe1c6efd include/common/mir_toolkit/events/event_deprecated.h |
360 | 75f81e8250bd76c5281b8792aeadf5319eb2f169 include/common/mir_toolkit/events/event.h |
361 | -003b178a1d2418e03a13c54ca02353fa24beb1d6 include/common/mir_toolkit/events/input/input_event.h |
362 | +4f1ac1ceb69bcd63f2a4ffb874e0104802a520e9 include/common/mir_toolkit/events/input/input_event.h |
363 | 7748a12138474e9be218eeb8f14b372af0fcec7e include/common/mir_toolkit/events/input/key_input_event.h |
364 | 489e8bae7c3e949ac449b09bd3bf554dae0e8986 include/common/mir_toolkit/events/input/pointer_input_event.h |
365 | -de7c23453e6d897296f32e49d9ba952a1baa0200 include/common/mir_toolkit/events/input/touch_input_event.h |
366 | +f4aa06030672cf07c72e282ac5c9cea1f901e2e2 include/common/mir_toolkit/events/input/touch_event.h |
367 | 8642e85a50e2de651589da3ced70e0fc0a915f26 include/common/mir_toolkit/events/orientation_event.h |
368 | f623dcf3c2ed134c1be20106eb54bcccc84af462 include/common/mir_toolkit/events/prompt_session_event.h |
369 | 633893b0def2b71f969872908a5b3529bc2fbf10 include/common/mir_toolkit/events/resize_event.h |
370 | |
371 | === modified file 'src/client/logging/input_receiver_report.cpp' |
372 | --- src/client/logging/input_receiver_report.cpp 2015-02-02 12:18:18 +0000 |
373 | +++ src/client/logging/input_receiver_report.cpp 2015-02-04 10:05:11 +0000 |
374 | @@ -58,26 +58,26 @@ |
375 | |
376 | static void format_touch_event(std::stringstream &ss, MirInputEvent const* ev) |
377 | { |
378 | - auto tev = mir_input_event_get_touch_input_event(ev); |
379 | + auto tev = mir_input_event_get_touch_event(ev); |
380 | |
381 | - ss << "MirTouchInputEvent{" << std::endl; |
382 | + ss << "MirTouchEvent{" << std::endl; |
383 | ss << " type: touch" << std::endl; |
384 | ss << " device_id: " << mir_input_event_get_device_id(ev) << std::endl; |
385 | - ss << " modifiers: " << mir_touch_input_event_get_modifiers(tev) << std::endl; |
386 | + ss << " modifiers: " << mir_touch_event_modifiers(tev) << std::endl; |
387 | ss << " event_time: " << ml::input_timestamp(std::chrono::nanoseconds(mir_input_event_get_event_time(ev))) << std::endl; |
388 | - auto touch_count = mir_touch_input_event_get_touch_count(tev); |
389 | + auto touch_count = mir_touch_event_point_count(tev); |
390 | ss << " touch_count: " << touch_count << std::endl; |
391 | for (unsigned int i = 0; i < touch_count; i++) |
392 | { |
393 | ss << " touch[" << i << "]{" << std::endl; |
394 | - ss << " id: " << mir_touch_input_event_get_touch_id(tev, i) << std::endl; |
395 | - ss << " x: " << mir_touch_input_event_get_touch_axis_value(tev, i, mir_touch_input_axis_x) << std::endl; |
396 | - ss << " y: " << mir_touch_input_event_get_touch_axis_value(tev, i, mir_touch_input_axis_y) << std::endl; |
397 | - ss << " touch_major: " << mir_touch_input_event_get_touch_axis_value(tev, i, mir_touch_input_axis_touch_major) << std::endl; |
398 | - ss << " touch_minor: " << mir_touch_input_event_get_touch_axis_value(tev, i, mir_touch_input_axis_touch_minor) << std::endl; |
399 | - ss << " size: " << mir_touch_input_event_get_touch_axis_value(tev, i, mir_touch_input_axis_size) << std::endl; |
400 | - ss << " pressure: " << mir_touch_input_event_get_touch_axis_value(tev, i, mir_touch_input_axis_pressure) << std::endl; |
401 | - ss << " tool_type: " << mir_touch_input_event_get_touch_tooltype(tev, i) << std::endl; |
402 | + ss << " id: " << mir_touch_event_id(tev, i) << std::endl; |
403 | + ss << " x: " << mir_touch_event_axis_value(tev, i, mir_touch_axis_x) << std::endl; |
404 | + ss << " y: " << mir_touch_event_axis_value(tev, i, mir_touch_axis_y) << std::endl; |
405 | + ss << " touch_major: " << mir_touch_event_axis_value(tev, i, mir_touch_axis_touch_major) << std::endl; |
406 | + ss << " touch_minor: " << mir_touch_event_axis_value(tev, i, mir_touch_axis_touch_minor) << std::endl; |
407 | + ss << " size: " << mir_touch_event_axis_value(tev, i, mir_touch_axis_size) << std::endl; |
408 | + ss << " pressure: " << mir_touch_event_axis_value(tev, i, mir_touch_axis_pressure) << std::endl; |
409 | + ss << " tool_type: " << mir_touch_event_tooltype(tev, i) << std::endl; |
410 | ss << " }" << std::endl; |
411 | } |
412 | ss << "}"; |
413 | |
414 | === modified file 'src/client/lttng/input_receiver_report.cpp' |
415 | --- src/client/lttng/input_receiver_report.cpp 2015-01-29 04:34:12 +0000 |
416 | +++ src/client/lttng/input_receiver_report.cpp 2015-02-04 10:05:11 +0000 |
417 | @@ -61,21 +61,21 @@ |
418 | |
419 | void mir::client::lttng::InputReceiverReport::report_touch(MirInputEvent const* event) const |
420 | { |
421 | - auto tev = mir_input_event_get_touch_input_event(event); |
422 | + auto tev = mir_input_event_get_touch_event(event); |
423 | |
424 | mir_tracepoint(mir_client_input_receiver, touch_event, mir_input_event_get_device_id(event), |
425 | - mir_touch_input_event_get_modifiers(tev), mir_input_event_get_event_time(event)); |
426 | + mir_touch_event_modifiers(tev), mir_input_event_get_event_time(event)); |
427 | |
428 | - for (unsigned int i = 0; i < mir_touch_input_event_get_touch_count(tev); i++) |
429 | + for (unsigned int i = 0; i < mir_touch_event_point_count(tev); i++) |
430 | { |
431 | mir_tracepoint(mir_client_input_receiver, touch_event_coordinate, |
432 | - mir_touch_input_event_get_touch_id(tev, i), |
433 | - mir_touch_input_event_get_touch_axis_value(tev, i, mir_touch_input_axis_x), |
434 | - mir_touch_input_event_get_touch_axis_value(tev, i, mir_touch_input_axis_y), |
435 | - mir_touch_input_event_get_touch_axis_value(tev, i, mir_touch_input_axis_touch_major), |
436 | - mir_touch_input_event_get_touch_axis_value(tev, i, mir_touch_input_axis_touch_minor), |
437 | - mir_touch_input_event_get_touch_axis_value(tev, i, mir_touch_input_axis_size), |
438 | - mir_touch_input_event_get_touch_axis_value(tev, i, mir_touch_input_axis_pressure)); |
439 | + mir_touch_event_id(tev, i), |
440 | + mir_touch_event_axis_value(tev, i, mir_touch_axis_x), |
441 | + mir_touch_event_axis_value(tev, i, mir_touch_axis_y), |
442 | + mir_touch_event_axis_value(tev, i, mir_touch_axis_touch_major), |
443 | + mir_touch_event_axis_value(tev, i, mir_touch_axis_touch_minor), |
444 | + mir_touch_event_axis_value(tev, i, mir_touch_axis_size), |
445 | + mir_touch_event_axis_value(tev, i, mir_touch_axis_pressure)); |
446 | } |
447 | } |
448 | |
449 | |
450 | === modified file 'src/common/events/event_builders.cpp' |
451 | --- src/common/events/event_builders.cpp 2015-01-29 04:34:12 +0000 |
452 | +++ src/common/events/event_builders.cpp 2015-02-04 10:05:11 +0000 |
453 | @@ -227,12 +227,12 @@ |
454 | int const MIR_EVENT_ACTION_POINTER_INDEX_MASK = 0xff00; |
455 | int const MIR_EVENT_ACTION_POINTER_INDEX_SHIFT = 8; |
456 | |
457 | -void update_action_mask(MirMotionEvent &mev, MirTouchInputEventTouchAction action) |
458 | +void update_action_mask(MirMotionEvent &mev, MirTouchAction action) |
459 | { |
460 | int new_mask = (mev.pointer_count - 1) << MIR_EVENT_ACTION_POINTER_INDEX_SHIFT; |
461 | - if (action == mir_touch_input_event_action_up) |
462 | + if (action == mir_touch_action_up) |
463 | new_mask = (new_mask & MIR_EVENT_ACTION_POINTER_INDEX_MASK) | mir_motion_action_pointer_up; |
464 | - else if (action == mir_touch_input_event_action_down) |
465 | + else if (action == mir_touch_action_down) |
466 | new_mask = (new_mask & MIR_EVENT_ACTION_POINTER_INDEX_MASK) | mir_motion_action_pointer_down; |
467 | else |
468 | new_mask = mir_motion_action_move; |
469 | @@ -246,15 +246,15 @@ |
470 | mev.action = new_mask; |
471 | } |
472 | |
473 | -MirMotionToolType old_tooltype_from_new(MirTouchInputEventTouchTooltype tooltype) |
474 | +MirMotionToolType old_tooltype_from_new(MirTouchTooltype tooltype) |
475 | { |
476 | switch (tooltype) |
477 | { |
478 | - case mir_touch_input_tool_type_unknown: |
479 | + case mir_touch_tooltype_unknown: |
480 | return mir_motion_tool_type_unknown; |
481 | - case mir_touch_input_tool_type_finger: |
482 | + case mir_touch_tooltype_finger: |
483 | return mir_motion_tool_type_finger; |
484 | - case mir_touch_input_tool_type_stylus: |
485 | + case mir_touch_tooltype_stylus: |
486 | return mir_motion_tool_type_stylus; |
487 | default: |
488 | BOOST_THROW_EXCEPTION(std::logic_error("Invalid tooltype specified")); |
489 | @@ -262,8 +262,8 @@ |
490 | } |
491 | } |
492 | |
493 | -void mev::add_touch(MirEvent &event, MirTouchInputEventTouchId touch_id, MirTouchInputEventTouchAction action, |
494 | - MirTouchInputEventTouchTooltype tooltype, float x_axis_value, float y_axis_value, |
495 | +void mev::add_touch(MirEvent &event, MirTouchId touch_id, MirTouchAction action, |
496 | + MirTouchTooltype tooltype, float x_axis_value, float y_axis_value, |
497 | float pressure_value, float touch_major_value, float touch_minor_value, float size_value) |
498 | { |
499 | auto& mev = event.motion; |
500 | |
501 | === modified file 'src/common/input/input_event.cpp' |
502 | --- src/common/input/input_event.cpp 2015-01-27 03:02:22 +0000 |
503 | +++ src/common/input/input_event.cpp 2015-02-04 10:05:11 +0000 |
504 | @@ -100,7 +100,7 @@ |
505 | return old_ev->key; |
506 | } |
507 | |
508 | -MirMotionEvent const& old_mev_from_new(MirTouchInputEvent const* ev) |
509 | +MirMotionEvent const& old_mev_from_new(MirTouchEvent const* ev) |
510 | { |
511 | auto old_ev = reinterpret_cast<MirEvent const*>(ev); |
512 | expect_old_event_type(old_ev, mir_event_type_motion); |
513 | @@ -114,7 +114,7 @@ |
514 | return old_ev->motion; |
515 | } |
516 | |
517 | -// Differentiate between MirTouchInputEvents and MirPointerInputEvents based on old device class |
518 | +// Differentiate between MirTouchEvents and MirPointerInputEvents based on old device class |
519 | MirInputEventType type_from_device_class(int32_t source_class) |
520 | { |
521 | switch (source_class) |
522 | @@ -295,13 +295,27 @@ |
523 | } |
524 | /* Touch event accessors */ |
525 | |
526 | -MirInputEventModifiers mir_touch_input_event_get_modifiers(MirTouchInputEvent const* tev) |
527 | +// ABI-compatible MIR_COMMON_3.1 |
528 | +extern "C" |
529 | +MirInputEventModifiers mir_touch_input_event_get_modifiers(MirTouchEvent const* tev) |
530 | +{ |
531 | + return mir_touch_event_modifiers(tev); |
532 | +} |
533 | + |
534 | +MirInputEventModifiers mir_touch_event_modifiers(MirTouchEvent const* tev) |
535 | { |
536 | auto const& old_mev = old_mev_from_new(tev); |
537 | return old_modifiers_to_new(old_mev.modifiers); |
538 | } |
539 | |
540 | -MirTouchInputEvent const* mir_input_event_get_touch_input_event(MirInputEvent const* ev) |
541 | +// ABI-compatible MIR_COMMON_3.1 |
542 | +extern "C" |
543 | +MirTouchEvent const* mir_input_event_get_touch_input_event(MirInputEvent const* ev) |
544 | +{ |
545 | + return mir_input_event_get_touch_event(ev); |
546 | +} |
547 | + |
548 | +MirTouchEvent const* mir_input_event_get_touch_event(MirInputEvent const* ev) |
549 | { |
550 | if(mir_input_event_get_type(ev) != mir_input_event_type_touch) |
551 | { |
552 | @@ -310,16 +324,30 @@ |
553 | abort(); |
554 | } |
555 | |
556 | - return reinterpret_cast<MirTouchInputEvent const*>(ev); |
557 | -} |
558 | - |
559 | -unsigned int mir_touch_input_event_get_touch_count(MirTouchInputEvent const* event) |
560 | + return reinterpret_cast<MirTouchEvent const*>(ev); |
561 | +} |
562 | + |
563 | +// ABI-compatible MIR_COMMON_3.1 |
564 | +extern "C" |
565 | +unsigned int mir_touch_input_event_get_touch_count(MirTouchEvent const* event) |
566 | +{ |
567 | + return mir_touch_event_point_count(event); |
568 | +} |
569 | + |
570 | +unsigned int mir_touch_event_point_count(MirTouchEvent const* event) |
571 | { |
572 | auto const& old_mev = reinterpret_cast<MirEvent const*>(event)->motion; |
573 | return old_mev.pointer_count; |
574 | } |
575 | |
576 | -MirTouchInputEventTouchId mir_touch_input_event_get_touch_id(MirTouchInputEvent const* event, size_t touch_index) |
577 | +// ABI-compatible MIR_COMMON_3.1 |
578 | +extern "C" |
579 | +MirTouchId mir_touch_input_event_get_touch_id(MirTouchEvent const* event, size_t touch_index) |
580 | +{ |
581 | + return mir_touch_event_id(event, touch_index); |
582 | +} |
583 | + |
584 | +MirTouchId mir_touch_event_id(MirTouchEvent const* event, size_t touch_index) |
585 | { |
586 | auto const& old_mev = old_mev_from_new(event); |
587 | |
588 | @@ -332,7 +360,14 @@ |
589 | return old_mev.pointer_coordinates[touch_index].id; |
590 | } |
591 | |
592 | -MirTouchInputEventTouchAction mir_touch_input_event_get_touch_action(MirTouchInputEvent const* event, size_t touch_index) |
593 | +// ABI-compatible MIR_COMMON_3.1 |
594 | +extern "C" |
595 | +MirTouchAction mir_touch_input_event_get_touch_action(MirTouchEvent const* event, size_t touch_index) |
596 | +{ |
597 | + return mir_touch_event_action(event, touch_index); |
598 | +} |
599 | + |
600 | +MirTouchAction mir_touch_event_action(MirTouchEvent const* event, size_t touch_index) |
601 | { |
602 | auto const& old_mev = old_mev_from_new(event); |
603 | |
604 | @@ -350,25 +385,25 @@ |
605 | // For the next two cases we could assert pc=1...because a gesture must |
606 | // be starting or ending. |
607 | case mir_motion_action_down: |
608 | - return mir_touch_input_event_action_down; |
609 | + return mir_touch_action_down; |
610 | case mir_motion_action_up: |
611 | - return mir_touch_input_event_action_up; |
612 | + return mir_touch_action_up; |
613 | // We can't tell which touches have actually moved without tracking state |
614 | // so we report all touchpoints as changed. |
615 | case mir_motion_action_move: |
616 | case mir_motion_action_hover_move: |
617 | - return mir_touch_input_event_action_change; |
618 | + return mir_touch_action_change; |
619 | // All touch points are handled at once so we don't know the index |
620 | case mir_motion_action_pointer_down: |
621 | if (touch_index == masked_index) |
622 | - return mir_touch_input_event_action_down; |
623 | + return mir_touch_action_down; |
624 | else |
625 | - return mir_touch_input_event_action_change; |
626 | + return mir_touch_action_change; |
627 | case mir_motion_action_pointer_up: |
628 | if (touch_index == masked_index) |
629 | - return mir_touch_input_event_action_up; |
630 | + return mir_touch_action_up; |
631 | else |
632 | - return mir_touch_input_event_action_change; |
633 | + return mir_touch_action_change; |
634 | // TODO: How to deal with these? |
635 | case mir_motion_action_cancel: |
636 | case mir_motion_action_outside: |
637 | @@ -376,11 +411,19 @@ |
638 | case mir_motion_action_hover_enter: |
639 | case mir_motion_action_hover_exit: |
640 | default: |
641 | - return mir_touch_input_event_action_change; |
642 | + return mir_touch_action_change; |
643 | } |
644 | } |
645 | |
646 | -MirTouchInputEventTouchTooltype mir_touch_input_event_get_touch_tooltype(MirTouchInputEvent const* event, |
647 | +// ABI-compatible MIR_COMMON_3.1 |
648 | +extern "C" |
649 | +MirTouchTooltype mir_touch_input_event_get_touch_tooltype( |
650 | + MirTouchEvent const* event, size_t touch_index) |
651 | +{ |
652 | + return mir_touch_event_tooltype(event, touch_index); |
653 | +} |
654 | + |
655 | +MirTouchTooltype mir_touch_event_tooltype(MirTouchEvent const* event, |
656 | size_t touch_index) |
657 | { |
658 | auto const& old_mev = old_mev_from_new(event); |
659 | @@ -394,19 +437,27 @@ |
660 | switch (old_mev.pointer_coordinates[touch_index].tool_type) |
661 | { |
662 | case mir_motion_tool_type_finger: |
663 | - return mir_touch_input_tool_type_finger; |
664 | + return mir_touch_tooltype_finger; |
665 | case mir_motion_tool_type_stylus: |
666 | case mir_motion_tool_type_eraser: |
667 | - return mir_touch_input_tool_type_stylus; |
668 | + return mir_touch_tooltype_stylus; |
669 | case mir_motion_tool_type_mouse: |
670 | case mir_motion_tool_type_unknown: |
671 | default: |
672 | - return mir_touch_input_tool_type_unknown; |
673 | + return mir_touch_tooltype_unknown; |
674 | } |
675 | } |
676 | |
677 | -float mir_touch_input_event_get_touch_axis_value(MirTouchInputEvent const* event, |
678 | - size_t touch_index, MirTouchInputEventTouchAxis axis) |
679 | +// ABI-compatible MIR_COMMON_3.1 |
680 | +extern "C" |
681 | +float mir_touch_input_event_get_touch_axis_value(MirTouchEvent const* event, |
682 | + size_t touch_index, MirTouchAxis axis) |
683 | +{ |
684 | + return mir_touch_event_axis_value(event, touch_index, axis); |
685 | +} |
686 | + |
687 | +float mir_touch_event_axis_value(MirTouchEvent const* event, |
688 | + size_t touch_index, MirTouchAxis axis) |
689 | { |
690 | auto const& old_mev = old_mev_from_new(event); |
691 | |
692 | @@ -419,17 +470,17 @@ |
693 | auto const& old_pc = old_mev.pointer_coordinates[touch_index]; |
694 | switch (axis) |
695 | { |
696 | - case mir_touch_input_axis_x: |
697 | + case mir_touch_axis_x: |
698 | return old_pc.x; |
699 | - case mir_touch_input_axis_y: |
700 | + case mir_touch_axis_y: |
701 | return old_pc.y; |
702 | - case mir_touch_input_axis_pressure: |
703 | + case mir_touch_axis_pressure: |
704 | return old_pc.pressure; |
705 | - case mir_touch_input_axis_touch_major: |
706 | + case mir_touch_axis_touch_major: |
707 | return old_pc.touch_major; |
708 | - case mir_touch_input_axis_touch_minor: |
709 | + case mir_touch_axis_touch_minor: |
710 | return old_pc.touch_minor; |
711 | - case mir_touch_input_axis_size: |
712 | + case mir_touch_axis_size: |
713 | return old_pc.size; |
714 | default: |
715 | return -1; |
716 | |
717 | === modified file 'src/common/symbols.map' |
718 | --- src/common/symbols.map 2015-02-02 12:18:18 +0000 |
719 | +++ src/common/symbols.map 2015-02-04 10:05:11 +0000 |
720 | @@ -200,21 +200,27 @@ |
721 | local: *; |
722 | }; |
723 | |
724 | -MIR_COMMON_3.1 { |
725 | +MIR_COMMON_3.1 { # Mir 0.10 |
726 | global: |
727 | - extern "C++" { |
728 | - mir_event_get*; |
729 | - mir_event_get*; |
730 | - mir_input_event_get*; |
731 | + extern "C" { |
732 | + mir_event_get*; |
733 | + mir_input_event_get_device_id; |
734 | + mir_input_event_get_event_time; |
735 | + mir_input_event_get_key_input_event; |
736 | + mir_input_event_get_pointer_input_event; |
737 | + mir_input_event_get_touch_input_event; |
738 | + mir_input_event_get_type; |
739 | mir_key_input_event_get*; |
740 | mir_touch_input_event_get*; |
741 | + }; |
742 | + extern "C++" { |
743 | mir::log*char*; |
744 | mir::logv*; |
745 | mir::libraries_for_path*; |
746 | }; |
747 | } MIR_COMMON_3; |
748 | |
749 | -MIR_COMMON_3.2 { |
750 | +MIR_COMMON_3.2 { # Mir 0.11 |
751 | global: |
752 | extern "C++" { |
753 | mir::dispatch::SimpleDispatchThread::SimpleDispatchThread*; |
754 | @@ -224,3 +230,17 @@ |
755 | mir::events::* |
756 | }; |
757 | } MIR_COMMON_3.1; |
758 | + |
759 | +MIR_COMMON_3.3 { # Mir 0.12 |
760 | + global: |
761 | + extern "C" { |
762 | + mir_input_event_get_touch_event; |
763 | + |
764 | + mir_touch_event_action; |
765 | + mir_touch_event_axis_value; |
766 | + mir_touch_event_point_count; |
767 | + mir_touch_event_id; |
768 | + mir_touch_event_modifiers; |
769 | + mir_touch_event_tooltype; |
770 | + }; |
771 | +} MIR_COMMON_3.2; |
772 | |
773 | === modified file 'tests/include/mir_test/event_matchers.h' |
774 | --- tests/include/mir_test/event_matchers.h 2015-01-27 03:02:22 +0000 |
775 | +++ tests/include/mir_test/event_matchers.h 2015-02-04 10:05:11 +0000 |
776 | @@ -68,14 +68,14 @@ |
777 | return mir_input_event_get_key_input_event(input_event); |
778 | } |
779 | |
780 | -inline MirTouchInputEvent const* maybe_touch_event(MirEvent const* event) |
781 | +inline MirTouchEvent const* maybe_touch_event(MirEvent const* event) |
782 | { |
783 | if (mir_event_get_type(event) != mir_event_type_input) |
784 | return nullptr; |
785 | auto input_event = mir_event_get_input_event(event); |
786 | if (mir_input_event_get_type(input_event) != mir_input_event_type_touch) |
787 | return nullptr; |
788 | - return mir_input_event_get_touch_input_event(input_event); |
789 | + return mir_input_event_get_touch_event(input_event); |
790 | } |
791 | |
792 | inline MirPointerInputEvent const* maybe_pointer_event(MirEvent const* event) |
793 | @@ -176,19 +176,19 @@ |
794 | if (expected == nullptr || actual == nullptr) |
795 | return false; |
796 | |
797 | - auto tc = mir_touch_input_event_get_touch_count(actual); |
798 | - if (mir_touch_input_event_get_touch_count(expected) != tc) |
799 | + auto tc = mir_touch_event_point_count(actual); |
800 | + if (mir_touch_event_point_count(expected) != tc) |
801 | return false; |
802 | |
803 | for (unsigned i = 0; i != tc; i++) |
804 | { |
805 | - if (mir_touch_input_event_get_touch_id(actual, i) != mir_touch_input_event_get_touch_id(expected, i) || |
806 | - mir_touch_input_event_get_touch_action(actual, i) != mir_touch_input_event_get_touch_action(expected, i) || |
807 | - mir_touch_input_event_get_touch_tooltype(actual, i) != mir_touch_input_event_get_touch_tooltype(expected, i) || |
808 | - mir_touch_input_event_get_touch_axis_value(actual, i, mir_touch_input_axis_x) != |
809 | - mir_touch_input_event_get_touch_axis_value(expected, i, mir_touch_input_axis_x) || |
810 | - mir_touch_input_event_get_touch_axis_value(actual, i, mir_touch_input_axis_y) != |
811 | - mir_touch_input_event_get_touch_axis_value(expected, i, mir_touch_input_axis_y)) |
812 | + if (mir_touch_event_id(actual, i) != mir_touch_event_id(expected, i) || |
813 | + mir_touch_event_action(actual, i) != mir_touch_event_action(expected, i) || |
814 | + mir_touch_event_tooltype(actual, i) != mir_touch_event_tooltype(expected, i) || |
815 | + mir_touch_event_axis_value(actual, i, mir_touch_axis_x) != |
816 | + mir_touch_event_axis_value(expected, i, mir_touch_axis_x) || |
817 | + mir_touch_event_axis_value(actual, i, mir_touch_axis_y) != |
818 | + mir_touch_event_axis_value(expected, i, mir_touch_axis_y)) |
819 | { |
820 | return false; |
821 | } |
822 | @@ -254,11 +254,11 @@ |
823 | if (tev == nullptr) |
824 | return false; |
825 | |
826 | - if (mir_touch_input_event_get_touch_action(tev, 0) != mir_touch_input_event_action_down) |
827 | - return false; |
828 | - if (mir_touch_input_event_get_touch_axis_value(tev, 0, mir_touch_input_axis_x) != x) |
829 | - return false; |
830 | - if (mir_touch_input_event_get_touch_axis_value(tev, 0, mir_touch_input_axis_y) != y) |
831 | + if (mir_touch_event_action(tev, 0) != mir_touch_action_down) |
832 | + return false; |
833 | + if (mir_touch_event_axis_value(tev, 0, mir_touch_axis_x) != x) |
834 | + return false; |
835 | + if (mir_touch_event_axis_value(tev, 0, mir_touch_axis_y) != y) |
836 | return false; |
837 | |
838 | return true; |
839 | @@ -284,11 +284,11 @@ |
840 | if (tev == nullptr) |
841 | return false; |
842 | |
843 | - if (mir_touch_input_event_get_touch_action(tev, 0) != mir_touch_input_event_action_change) |
844 | + if (mir_touch_event_action(tev, 0) != mir_touch_action_change) |
845 | return false; |
846 | |
847 | - auto x2 = mir_touch_input_event_get_touch_axis_value(tev, 0, mir_touch_input_axis_x); |
848 | - auto y2 = mir_touch_input_event_get_touch_axis_value(tev, 0, mir_touch_input_axis_y); |
849 | + auto x2 = mir_touch_event_axis_value(tev, 0, mir_touch_axis_x); |
850 | + auto y2 = mir_touch_event_axis_value(tev, 0, mir_touch_axis_y); |
851 | |
852 | float dx1 = x1 - x0; |
853 | float dy1 = y1 - y0; |
854 | @@ -309,7 +309,7 @@ |
855 | if (tev == nullptr) |
856 | return false; |
857 | |
858 | - if (mir_touch_input_event_get_touch_action(tev, 0) != mir_touch_input_event_action_change) |
859 | + if (mir_touch_event_action(tev, 0) != mir_touch_action_change) |
860 | return false; |
861 | |
862 | return true; |
863 | |
864 | === modified file 'tests/unit-tests/input/test_event_builders.cpp' |
865 | --- tests/unit-tests/input/test_event_builders.cpp 2015-01-22 23:04:22 +0000 |
866 | +++ tests/unit-tests/input/test_event_builders.cpp 2015-02-04 10:05:11 +0000 |
867 | @@ -58,9 +58,9 @@ |
868 | TEST_F(InputEventBuilder, makes_valid_touch_event) |
869 | { |
870 | unsigned touch_count = 3; |
871 | - MirTouchInputEventTouchId touch_ids[] = {7, 9, 4}; |
872 | - MirTouchInputEventTouchAction actions[] = { mir_touch_input_event_action_up, mir_touch_input_event_action_change, mir_touch_input_event_action_change}; |
873 | - MirTouchInputEventTouchTooltype tooltypes[] = {mir_touch_input_tool_type_unknown, mir_touch_input_tool_type_finger, mir_touch_input_tool_type_stylus}; |
874 | + MirTouchId touch_ids[] = {7, 9, 4}; |
875 | + MirTouchAction actions[] = { mir_touch_action_up, mir_touch_action_change, mir_touch_action_change}; |
876 | + MirTouchTooltype tooltypes[] = {mir_touch_tooltype_unknown, mir_touch_tooltype_finger, mir_touch_tooltype_stylus}; |
877 | float x_axis_values[] = { 7, 14.3, 19.6 }; |
878 | float y_axis_values[] = { 3, 9, 11 }; |
879 | float pressure_values[] = {3, 9, 14.6}; |
880 | @@ -80,21 +80,21 @@ |
881 | EXPECT_EQ(mir_event_type_input, mir_event_get_type(e)); |
882 | auto ie = mir_event_get_input_event(e); |
883 | EXPECT_EQ(mir_input_event_type_touch, mir_input_event_get_type(ie)); |
884 | - auto tev = mir_input_event_get_touch_input_event(ie); |
885 | - EXPECT_EQ(modifiers, mir_touch_input_event_get_modifiers(tev)); |
886 | - EXPECT_EQ(touch_count, mir_touch_input_event_get_touch_count(tev)); |
887 | + auto tev = mir_input_event_get_touch_event(ie); |
888 | + EXPECT_EQ(modifiers, mir_touch_event_modifiers(tev)); |
889 | + EXPECT_EQ(touch_count, mir_touch_event_point_count(tev)); |
890 | |
891 | for (unsigned i = 0; i < touch_count; i++) |
892 | { |
893 | - EXPECT_EQ(touch_ids[i], mir_touch_input_event_get_touch_id(tev, i)); |
894 | - EXPECT_EQ(actions[i], mir_touch_input_event_get_touch_action(tev, i)); |
895 | - EXPECT_EQ(tooltypes[i], mir_touch_input_event_get_touch_tooltype(tev, i)); |
896 | - EXPECT_EQ(x_axis_values[i], mir_touch_input_event_get_touch_axis_value(tev, i, mir_touch_input_axis_x)); |
897 | - EXPECT_EQ(y_axis_values[i], mir_touch_input_event_get_touch_axis_value(tev, i, mir_touch_input_axis_y)); |
898 | - EXPECT_EQ(pressure_values[i], mir_touch_input_event_get_touch_axis_value(tev, i, mir_touch_input_axis_pressure)); |
899 | - EXPECT_EQ(touch_major_values[i], mir_touch_input_event_get_touch_axis_value(tev, i, mir_touch_input_axis_touch_major)); |
900 | - EXPECT_EQ(touch_minor_values[i], mir_touch_input_event_get_touch_axis_value(tev, i, mir_touch_input_axis_touch_minor)); |
901 | - EXPECT_EQ(size_values[i], mir_touch_input_event_get_touch_axis_value(tev, i, mir_touch_input_axis_size)); |
902 | + EXPECT_EQ(touch_ids[i], mir_touch_event_id(tev, i)); |
903 | + EXPECT_EQ(actions[i], mir_touch_event_action(tev, i)); |
904 | + EXPECT_EQ(tooltypes[i], mir_touch_event_tooltype(tev, i)); |
905 | + EXPECT_EQ(x_axis_values[i], mir_touch_event_axis_value(tev, i, mir_touch_axis_x)); |
906 | + EXPECT_EQ(y_axis_values[i], mir_touch_event_axis_value(tev, i, mir_touch_axis_y)); |
907 | + EXPECT_EQ(pressure_values[i], mir_touch_event_axis_value(tev, i, mir_touch_axis_pressure)); |
908 | + EXPECT_EQ(touch_major_values[i], mir_touch_event_axis_value(tev, i, mir_touch_axis_touch_major)); |
909 | + EXPECT_EQ(touch_minor_values[i], mir_touch_event_axis_value(tev, i, mir_touch_axis_touch_minor)); |
910 | + EXPECT_EQ(size_values[i], mir_touch_event_axis_value(tev, i, mir_touch_axis_size)); |
911 | } |
912 | } |
913 | |
914 | |
915 | === modified file 'tests/unit-tests/input/test_input_event.cpp' |
916 | --- tests/unit-tests/input/test_input_event.cpp 2015-01-27 03:02:22 +0000 |
917 | +++ tests/unit-tests/input/test_input_event.cpp 2015-02-04 10:05:11 +0000 |
918 | @@ -165,7 +165,7 @@ |
919 | EXPECT_EQ(mir_input_event_modifier_shift, mir_key_input_event_get_modifiers(new_kev)); |
920 | } |
921 | |
922 | -TEST(TouchInputEventProperties, touch_count_taken_from_pointer_count) |
923 | +TEST(TouchEventProperties, touch_count_taken_from_pointer_count) |
924 | { |
925 | unsigned const pointer_count = 3; |
926 | auto old_ev = a_motion_ev(AINPUT_SOURCE_TOUCHSCREEN); |
927 | @@ -173,11 +173,11 @@ |
928 | old_ev.motion.action = mir_motion_action_down; |
929 | old_ev.motion.pointer_count = pointer_count; |
930 | |
931 | - auto tev = mir_input_event_get_touch_input_event(mir_event_get_input_event(&old_ev)); |
932 | - EXPECT_EQ(pointer_count, mir_touch_input_event_get_touch_count(tev)); |
933 | + auto tev = mir_input_event_get_touch_event(mir_event_get_input_event(&old_ev)); |
934 | + EXPECT_EQ(pointer_count, mir_touch_event_point_count(tev)); |
935 | } |
936 | |
937 | -TEST(TouchInputEventProperties, touch_id_comes_from_pointer_coordinates) |
938 | +TEST(TouchEventProperties, touch_id_comes_from_pointer_coordinates) |
939 | { |
940 | unsigned const touch_id = 31; |
941 | auto old_ev = a_motion_ev(AINPUT_SOURCE_TOUCHSCREEN); |
942 | @@ -186,22 +186,22 @@ |
943 | old_ev.motion.pointer_count = 1; |
944 | old_ev.motion.pointer_coordinates[0].id = touch_id; |
945 | |
946 | - auto tev = mir_input_event_get_touch_input_event(mir_event_get_input_event(&old_ev)); |
947 | - EXPECT_EQ(touch_id, mir_touch_input_event_get_touch_id(tev, 0)); |
948 | + auto tev = mir_input_event_get_touch_event(mir_event_get_input_event(&old_ev)); |
949 | + EXPECT_EQ(touch_id, mir_touch_event_id(tev, 0)); |
950 | } |
951 | |
952 | // mir_motion_action_up/down represent the start of a gesture. pointers only go up/down one at a time |
953 | -TEST(TouchInputEventProperties, down_and_up_actions_are_taken_from_old_event) |
954 | +TEST(TouchEventProperties, down_and_up_actions_are_taken_from_old_event) |
955 | { |
956 | auto old_ev = a_motion_ev(AINPUT_SOURCE_TOUCHSCREEN); |
957 | old_ev.motion.action = mir_motion_action_down; |
958 | old_ev.motion.pointer_count = 1; |
959 | |
960 | - auto tev = mir_input_event_get_touch_input_event(mir_event_get_input_event(&old_ev)); |
961 | - EXPECT_EQ(mir_touch_input_event_action_down, mir_touch_input_event_get_touch_action(tev, 0)); |
962 | + auto tev = mir_input_event_get_touch_event(mir_event_get_input_event(&old_ev)); |
963 | + EXPECT_EQ(mir_touch_action_down, mir_touch_event_action(tev, 0)); |
964 | } |
965 | |
966 | -TEST(TouchInputEventProperties, touch_up_down_applies_only_to_masked_action) |
967 | +TEST(TouchEventProperties, touch_up_down_applies_only_to_masked_action) |
968 | { |
969 | int const masked_pointer_index = 1; |
970 | |
971 | @@ -210,13 +210,13 @@ |
972 | old_ev.motion.action = (old_ev.motion.action & MIR_EVENT_ACTION_POINTER_INDEX_MASK) | mir_motion_action_pointer_up; |
973 | old_ev.motion.pointer_count = 3; |
974 | |
975 | - auto tev = mir_input_event_get_touch_input_event(mir_event_get_input_event(&old_ev)); |
976 | - EXPECT_EQ(mir_touch_input_event_action_change, mir_touch_input_event_get_touch_action(tev, 0)); |
977 | - EXPECT_EQ(mir_touch_input_event_action_up, mir_touch_input_event_get_touch_action(tev, 1)); |
978 | - EXPECT_EQ(mir_touch_input_event_action_change, mir_touch_input_event_get_touch_action(tev, 2)); |
979 | + auto tev = mir_input_event_get_touch_event(mir_event_get_input_event(&old_ev)); |
980 | + EXPECT_EQ(mir_touch_action_change, mir_touch_event_action(tev, 0)); |
981 | + EXPECT_EQ(mir_touch_action_up, mir_touch_event_action(tev, 1)); |
982 | + EXPECT_EQ(mir_touch_action_change, mir_touch_event_action(tev, 2)); |
983 | } |
984 | |
985 | -TEST(TouchInputEventProperties, tool_type_copied_from_old_pc) |
986 | +TEST(TouchEventProperties, tool_type_copied_from_old_pc) |
987 | { |
988 | auto old_ev = a_motion_ev(AINPUT_SOURCE_TOUCHSCREEN); |
989 | |
990 | @@ -227,13 +227,13 @@ |
991 | old_mev.pointer_coordinates[2].tool_type = mir_motion_tool_type_stylus; |
992 | old_mev.pointer_coordinates[3].tool_type = mir_motion_tool_type_mouse; |
993 | |
994 | - auto tev = mir_input_event_get_touch_input_event(mir_event_get_input_event(&old_ev)); |
995 | - EXPECT_EQ(mir_touch_input_tool_type_unknown, mir_touch_input_event_get_touch_tooltype(tev, 0)); |
996 | - EXPECT_EQ(mir_touch_input_tool_type_finger, mir_touch_input_event_get_touch_tooltype(tev, 1)); |
997 | - EXPECT_EQ(mir_touch_input_tool_type_stylus, mir_touch_input_event_get_touch_tooltype(tev, 2)); |
998 | + auto tev = mir_input_event_get_touch_event(mir_event_get_input_event(&old_ev)); |
999 | + EXPECT_EQ(mir_touch_tooltype_unknown, mir_touch_event_tooltype(tev, 0)); |
1000 | + EXPECT_EQ(mir_touch_tooltype_finger, mir_touch_event_tooltype(tev, 1)); |
1001 | + EXPECT_EQ(mir_touch_tooltype_stylus, mir_touch_event_tooltype(tev, 2)); |
1002 | } |
1003 | |
1004 | -TEST(TouchInputEventProperties, axis_values_used_by_qtmir_copied) |
1005 | +TEST(TouchEventProperties, axis_values_used_by_qtmir_copied) |
1006 | { |
1007 | float x_value = 19, y_value = 23, touch_major = .3, touch_minor = .2, pressure = .9, size = 1111; |
1008 | auto old_ev = a_motion_ev(AINPUT_SOURCE_TOUCHSCREEN); |
1009 | @@ -246,13 +246,13 @@ |
1010 | old_pc.pressure = pressure; |
1011 | old_pc.size = size; |
1012 | |
1013 | - auto tev = mir_input_event_get_touch_input_event(mir_event_get_input_event(&old_ev)); |
1014 | - EXPECT_EQ(x_value, mir_touch_input_event_get_touch_axis_value(tev, 0, mir_touch_input_axis_x)); |
1015 | - EXPECT_EQ(y_value, mir_touch_input_event_get_touch_axis_value(tev, 0, mir_touch_input_axis_y)); |
1016 | - EXPECT_EQ(touch_major, mir_touch_input_event_get_touch_axis_value(tev, 0, mir_touch_input_axis_touch_major)); |
1017 | - EXPECT_EQ(touch_minor, mir_touch_input_event_get_touch_axis_value(tev, 0, mir_touch_input_axis_touch_minor)); |
1018 | - EXPECT_EQ(pressure, mir_touch_input_event_get_touch_axis_value(tev, 0, mir_touch_input_axis_pressure)); |
1019 | - EXPECT_EQ(size, mir_touch_input_event_get_touch_axis_value(tev, 0, mir_touch_input_axis_size)); |
1020 | + auto tev = mir_input_event_get_touch_event(mir_event_get_input_event(&old_ev)); |
1021 | + EXPECT_EQ(x_value, mir_touch_event_axis_value(tev, 0, mir_touch_axis_x)); |
1022 | + EXPECT_EQ(y_value, mir_touch_event_axis_value(tev, 0, mir_touch_axis_y)); |
1023 | + EXPECT_EQ(touch_major, mir_touch_event_axis_value(tev, 0, mir_touch_axis_touch_major)); |
1024 | + EXPECT_EQ(touch_minor, mir_touch_event_axis_value(tev, 0, mir_touch_axis_touch_minor)); |
1025 | + EXPECT_EQ(pressure, mir_touch_event_axis_value(tev, 0, mir_touch_axis_pressure)); |
1026 | + EXPECT_EQ(size, mir_touch_event_axis_value(tev, 0, mir_touch_axis_size)); |
1027 | } |
1028 | |
1029 | /* Pointer and touch event differentiation */ |
Minor nits still bugging me:
(a) mir_touch_ event_point_ count: In the industry, they are called "touch points". And using that word "point" is less convoluted than saying "touch" twice in "mir_touch_ (input_ )event_ (get_)touch_ count". But maybe there are better suggestions...
(b) MirTouchId is immediately confusable with the "size_t touch_index" we use in functions. So might still need a better name.
(c) mir_touch_ event_modifiers : Probably doesn't need to exist at all. Instead we should have a "mir_input_ event_modifiers ". Although that issue is beyond the scope of this proposal(?)