Mir
event_matchers.h
Go to the documentation of this file.
1 /*
2  * Copyright © 2013-2014 Canonical Ltd.
3  *
4  * This program is free software: you can redistribute it and/or modify it
5  * under the terms of the GNU General Public License version 2 or 3,
6  * as published by the Free Software Foundation.
7  *
8  * This program is distributed in the hope that it will be useful,
9  * but WITHOUT ANY WARRANTY; without even the implied warranty of
10  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11  * GNU General Public License for more details.
12  *
13  * You should have received a copy of the GNU General Public License
14  * along with this program. If not, see <http://www.gnu.org/licenses/>.
15  *
16  * Authored by: Robert Carr <robert.carr@canonical.com>
17  * Andreas Pokorny <andreas.pokorny@canonical.com>
18  */
19 
20 #ifndef MIR_TEST_CLIENT_EVENT_MATCHERS_H_
21 #define MIR_TEST_CLIENT_EVENT_MATCHERS_H_
22 
23 #include <cmath>
24 
25 #include "mir_toolkit/event.h"
26 
27 #include <xkbcommon/xkbcommon.h>
28 #include <xkbcommon/xkbcommon-keysyms.h>
29 
30 #include <memory>
31 
32 #include <gmock/gmock.h>
33 
34 
35 void PrintTo(MirEvent const& event, std::ostream *os);
36 void PrintTo(MirEvent const* event, std::ostream *os);
37 
38 namespace mir
39 {
40 namespace test
41 {
46 inline MirEvent const* to_address(MirEvent const* event)
47 {
48  return event;
49 }
50 
51 inline MirEvent const* to_address(MirEvent const& event)
52 {
53  return &event;
54 }
55 
56 inline MirEvent const* to_address(std::shared_ptr<MirEvent const> const& event)
57 {
58  return event.get();
59 }
60 
61 inline MirEvent const& to_ref(MirEvent const* event)
62 {
63  return *event;
64 }
65 
66 inline MirEvent const& to_ref(MirEvent const& event)
67 {
68  return event;
69 }
70 
71 inline MirKeyboardEvent const* maybe_key_event(MirEvent const* event)
72 {
74  return nullptr;
75  auto input_event = mir_event_get_input_event(event);
77  return nullptr;
78  return mir_input_event_get_keyboard_event(input_event);
79 }
80 
81 inline MirTouchEvent const* maybe_touch_event(MirEvent const* event)
82 {
84  return nullptr;
85  auto input_event = mir_event_get_input_event(event);
87  return nullptr;
88  return mir_input_event_get_touch_event(input_event);
89 }
90 
91 inline MirPointerEvent const* maybe_pointer_event(MirEvent const* event)
92 {
94  return nullptr;
95  auto input_event = mir_event_get_input_event(event);
97  return nullptr;
98  return mir_input_event_get_pointer_event(input_event);
99 }
104 MATCHER(KeyDownEvent, "")
105 {
106  auto kev = maybe_key_event(to_address(arg));
107  if (kev == nullptr)
108  return false;
109 
111  return false;
112 
113  return true;
114 }
115 
116 MATCHER(KeyRepeatEvent, "")
117 {
118  auto kev = maybe_key_event(to_address(arg));
119  if (kev == nullptr)
120  return false;
121 
123  return false;
124 
125  return true;
126 }
127 
128 MATCHER(KeyUpEvent, "")
129 {
130  auto kev = maybe_key_event(to_address(arg));
131  if (kev == nullptr)
132  return false;
133 
135  return false;
136 
137  return true;
138 }
139 
140 MATCHER_P(KeyWithModifiers, modifiers, "")
141 {
142  auto kev = maybe_key_event(to_address(arg));
143  if (kev == nullptr)
144  return false;
145 
146  if(mir_keyboard_event_modifiers(kev) != modifiers)
147  {
148  return false;
149  }
150 
151  return true;
152 }
153 
154 MATCHER_P(KeyOfSymbol, keysym, "")
155 {
156  auto kev = maybe_key_event(to_address(arg));
157  if (kev == nullptr)
158  return false;
159 
160  if(mir_keyboard_event_key_code(kev) != static_cast<xkb_keysym_t>(keysym))
161  return false;
162 
163  return true;
164 }
165 
166 MATCHER_P(KeyWithText, text, "")
167 {
168  auto kev = maybe_key_event(to_address(arg));
169  if (kev == nullptr)
170  return false;
171 
172  if(strcmp(mir_keyboard_event_key_text(kev), text))
173  return false;
174 
175  return true;
176 }
177 
178 MATCHER_P(KeyOfScanCode, code, "")
179 {
180  auto kev = maybe_key_event(to_address(arg));
181  if (kev == nullptr)
182  return false;
183 
184  if(mir_keyboard_event_scan_code(kev) != code)
185  return false;
186 
187  return true;
188 }
189 
190 MATCHER_P(MirKeyboardEventMatches, event, "")
191 {
192  auto expected = maybe_key_event(to_address(event));
193  auto actual = maybe_key_event(to_address(arg));
194 
195  if (expected == nullptr || actual == nullptr)
196  return false;
197 
198  return mir_keyboard_event_action(expected) == mir_keyboard_event_action(actual) &&
202 }
203 
204 MATCHER_P(MirTouchEventMatches, event, "")
205 {
206  auto expected = maybe_touch_event(to_address(event));
207  auto actual = maybe_touch_event(to_address(arg));
208 
209  if (expected == nullptr || actual == nullptr)
210  return false;
211 
212  auto tc = mir_touch_event_point_count(actual);
213  if (mir_touch_event_point_count(expected) != tc)
214  return false;
215 
216  for (unsigned i = 0; i != tc; i++)
217  {
218  if (mir_touch_event_id(actual, i) != mir_touch_event_id(expected, i) ||
219  mir_touch_event_action(actual, i) != mir_touch_event_action(expected, i) ||
220  mir_touch_event_tooltype(actual, i) != mir_touch_event_tooltype(expected, i) ||
225  {
226  return false;
227  }
228  }
229  return true;
230 }
231 
232 MATCHER(PointerEnterEvent, "")
233 {
234  auto pev = maybe_pointer_event(to_address(arg));
235  if (pev == nullptr)
236  return false;
238  return true;
239  return false;
240 }
241 
242 MATCHER(PointerLeaveEvent, "")
243 {
244  auto pev = maybe_pointer_event(to_address(arg));
245  if (pev == nullptr)
246  return false;
248  return true;
249  return false;
250 }
251 
252 inline bool button_event_matches(MirPointerEvent const* pev, float x, float y, MirPointerAction action, MirPointerButtons button_state,
253  bool check_action = true, bool check_buttons = true, bool check_axes = true)
254 {
255  if (pev == nullptr)
256  return false;
257  if (check_action && mir_pointer_event_action(pev) != action)
258  return false;
259  if (check_buttons && mir_pointer_event_buttons(pev) != button_state)
260  return false;
261  if (check_axes && mir_pointer_event_axis_value(pev, mir_pointer_axis_x) != x)
262  return false;
263  if (check_axes && mir_pointer_event_axis_value(pev, mir_pointer_axis_y) != y)
264  return false;
265  return true;
266 }
267 
268 MATCHER_P2(ButtonDownEvent, x, y, "")
269 {
270  auto pev = maybe_pointer_event(to_address(arg));
271  return button_event_matches(pev, x, y, mir_pointer_action_button_down, 0, true, false);
272 }
273 
274 MATCHER_P2(ButtonDownEventWithButton, pos, button, "")
275 {
276  auto pev = maybe_pointer_event(to_address(arg));
277  if (pev == nullptr)
278  return false;
280  return false;
281  if (mir_pointer_event_button_state(pev, static_cast<MirPointerButton>(button)) == false)
282  return false;
283  if (mir_pointer_event_axis_value(pev, mir_pointer_axis_x) != pos.x.as_int())
284  return false;
285  if (mir_pointer_event_axis_value(pev, mir_pointer_axis_y) != pos.y.as_int())
286  return false;
287  return true;
288 }
289 
290 MATCHER_P2(ButtonUpEvent, x, y, "")
291 {
292  auto pev = maybe_pointer_event(to_address(arg));
293  return button_event_matches(pev, x, y, mir_pointer_action_button_up, 0, true, false);
294 }
295 
296 MATCHER_P3(ButtonsDown, x, y, buttons, "")
297 {
298  auto pev = maybe_pointer_event(to_address(arg));
299  return button_event_matches(pev, x, y, mir_pointer_action_button_down, buttons, false);
300 }
301 
302 MATCHER_P3(ButtonsUp, x, y, buttons, "")
303 {
304  auto pev = maybe_pointer_event(to_address(arg));
305  return button_event_matches(pev, x, y, mir_pointer_action_button_up, buttons, false);
306 }
307 
308 MATCHER_P2(ButtonUpEventWithButton, pos, button, "")
309 {
310  auto pev = maybe_pointer_event(to_address(arg));
311  if (pev == nullptr)
312  return false;
314  return false;
315  if (mir_pointer_event_button_state(pev, button) == true)
316  return false;
317  if (mir_pointer_event_axis_value(pev, mir_pointer_axis_x) != pos.x.as_int())
318  return false;
319  if (mir_pointer_event_axis_value(pev, mir_pointer_axis_y) != pos.y.as_int())
320  return false;
321  return true;
322 }
323 
324 MATCHER_P2(PointerAxisChange, scroll_axis, value, "")
325 {
326  auto parg = to_address(arg);
327  auto pev = maybe_pointer_event(parg);
328  if (pev == nullptr)
329  return false;
331  return false;
332  if (mir_pointer_event_axis_value(pev, scroll_axis) != value)
333  return false;
334  return true;
335 }
336 
337 MATCHER_P2(TouchEvent, x, y, "")
338 {
339  auto tev = maybe_touch_event(to_address(arg));
340  if (tev == nullptr)
341  return false;
342 
344  return false;
345  if (std::abs(mir_touch_event_axis_value(tev, 0, mir_touch_axis_x) - x) > 0.5f)
346  return false;
347  if (std::abs(mir_touch_event_axis_value(tev, 0, mir_touch_axis_y) - y) > 0.5f)
348  return false;
349 
350  return true;
351 }
352 
353 MATCHER_P4(TouchContact, slot, action, x, y, "")
354 {
355  auto tev = maybe_touch_event(to_address(arg));
356  if (tev == nullptr)
357  return false;
358 
359  if (mir_touch_event_action(tev, slot) != action)
360  return false;
361  if (std::abs(mir_touch_event_axis_value(tev, slot, mir_touch_axis_x) - x) > 0.5f)
362  return false;
363  if (std::abs(mir_touch_event_axis_value(tev, slot, mir_touch_axis_y) - y) > 0.5f)
364  return false;
365 
366  return true;
367 }
368 
369 MATCHER_P2(TouchUpEvent, x, y, "")
370 {
371  auto tev = maybe_touch_event(to_address(arg));
372  if (tev == nullptr)
373  return false;
374 
376  return false;
378  return false;
380  return false;
381 
382  return true;
383 }
384 
385 MATCHER_P2(PointerEventWithPosition, x, y, "")
386 {
387  auto pev = maybe_pointer_event(to_address(arg));
388  if (pev == nullptr)
389  return false;
391  return false;
393  return false;
395  return false;
396  return true;
397 }
398 
399 MATCHER_P2(PointerEnterEventWithPosition, x, y, "")
400 {
401  auto pev = maybe_pointer_event(to_address(arg));
402  if (pev == nullptr)
403  return false;
405  return false;
407  return false;
409  return false;
410  return true;
411 }
412 
413 
414 MATCHER_P(PointerEventWithModifiers, modifiers, "")
415 {
416  auto pev = maybe_pointer_event(to_address(arg));
417  if (pev && mir_pointer_event_modifiers(pev) == modifiers)
418  return true;
419  return false;
420 }
421 
422 MATCHER_P2(PointerEventWithDiff, expect_dx, expect_dy, "")
423 {
424  auto pev = maybe_pointer_event(to_address(arg));
425  if (pev == nullptr)
426  return false;
428  return false;
429  auto const error = 0.00001f;
430  auto const actual_dx = mir_pointer_event_axis_value(pev,
432  if (std::abs(expect_dx - actual_dx) > error)
433  return false;
434  auto const actual_dy = mir_pointer_event_axis_value(pev,
436  if (std::abs(expect_dy - actual_dy) > error)
437  return false;
438  return true;
439 }
440 
441 MATCHER_P2(PointerEnterEventWithDiff, expect_dx, expect_dy, "")
442 {
443  auto pev = maybe_pointer_event(to_address(arg));
444  if (pev == nullptr)
445  return false;
447  return false;
448  auto const error = 0.00001f;
449  auto const actual_dx = mir_pointer_event_axis_value(pev,
451  if (std::abs(expect_dx - actual_dx) > error)
452  return false;
453  auto const actual_dy = mir_pointer_event_axis_value(pev,
455  if (std::abs(expect_dy - actual_dy) > error)
456  return false;
457  return true;
458 }
459 
460 
461 MATCHER_P4(TouchEventInDirection, x0, y0, x1, y1, "")
462 {
463  auto tev = maybe_touch_event(to_address(arg));
464  if (tev == nullptr)
465  return false;
466 
468  return false;
469 
470  auto x2 = mir_touch_event_axis_value(tev, 0, mir_touch_axis_x);
471  auto y2 = mir_touch_event_axis_value(tev, 0, mir_touch_axis_y);
472 
473  float dx1 = x1 - x0;
474  float dy1 = y1 - y0;
475 
476  float dx2 = x2 - x0;
477  float dy2 = y2 - y0;
478 
479  float dot_product = dx1 * dx2 + dy1 * dy2;
480 
481  // Return true if both vectors are roughly the same direction (within
482  // 90 degrees).
483  return dot_product > 0.0f;
484 }
485 
486 MATCHER(TouchMovementEvent, "")
487 {
488  auto tev = maybe_touch_event(to_address(arg));
489  if (tev == nullptr)
490  return false;
491 
493  return false;
494 
495  return true;
496 }
497 
498 MATCHER(PointerMovementEvent, "")
499 {
500  auto pev = maybe_pointer_event(to_address(arg));
501  if (pev == nullptr)
502  return false;
503 
505  return false;
506 
507  return true;
508 }
509 
510 MATCHER_P2(WindowEvent, attrib, value, "")
511 {
512  auto as_address = to_address(arg);
513  if (mir_event_get_type(as_address) != mir_event_type_window)
514  return false;
515  auto surface_ev = mir_event_get_window_event(as_address);
516  auto window_attrib = mir_window_event_get_attribute(surface_ev);
517  if (window_attrib != attrib)
518  return false;
519  if (mir_window_event_get_attribute_value(surface_ev) != value)
520  return false;
521  return true;
522 }
523 
524 MATCHER_P(KeymapEventForDevice, device_id, "")
525 {
526  auto as_address = to_address(arg);
527  if (mir_event_get_type(as_address) != mir_event_type_keymap)
528  return false;
529  auto kmev = mir_event_get_keymap_event(as_address);
530  return device_id == mir_keymap_event_get_device_id(kmev);
531 }
532 
533 MATCHER_P(OrientationEvent, direction, "")
534 {
535  auto as_address = to_address(arg);
537  return false;
538  auto oev = mir_event_get_orientation_event(as_address);
539  if (mir_orientation_event_get_direction(oev) != direction)
540  return false;
541  return true;
542 }
543 
544 
545 MATCHER_P(InputDeviceIdMatches, device_id, "")
546 {
548  return false;
549  auto input_event = mir_event_get_input_event(to_address(arg));
550  return mir_input_event_get_device_id(input_event) == device_id;
551 }
552 
553 #pragma GCC diagnostic push
554 #pragma GCC diagnostic ignored "-Wdeprecated-declarations"
555 MATCHER(InputConfigurationEvent, "")
556 {
557  auto as_address = to_address(arg);
558  if (mir_event_get_type(as_address) != mir_event_type_input_configuration)
559  return true;
560  return false;
561 }
562 #pragma GCC diagnostic pop
563 
564 MATCHER(InputDeviceStateEvent, "")
565 {
566  auto as_address = to_address(arg);
568  return true;
569  return false;
570 }
571 
572 MATCHER_P(DeviceStateWithPressedKeys, keys, "")
573 {
574  auto as_address = to_address(arg);
576  return false;
577  auto device_state = mir_event_get_input_device_state_event(as_address);
578  for (size_t index = 0, count = mir_input_device_state_event_device_count(device_state);
579  index != count; ++index)
580  {
581  auto key_count = mir_input_device_state_event_device_pressed_keys_count(device_state, index);
582  auto it_keys = begin(keys);
583  auto end_keys = end(keys);
584  decltype(key_count) num_required_keys = distance(it_keys, end_keys);
585  if (num_required_keys != key_count)
586  continue;
587 
588  std::vector<uint32_t> pressed_keys;
589  for (uint32_t i = 0; i < key_count; i++)
590  {
591  pressed_keys.push_back(
593  }
594 
595  if (!std::equal(it_keys, end_keys, std::begin(pressed_keys)))
596  continue;
597  return true;
598  }
599  return false;
600 }
601 
602 MATCHER_P2(DeviceStateWithPosition, x, y, "")
603 {
604  auto as_address = to_address(arg);
606  return false;
607  auto device_state = mir_event_get_input_device_state_event(as_address);
610 }
611 
612 MATCHER_P(RectanglesMatches, rectangles, "")
613 {
614  return arg == rectangles;
615 }
616 
617 }
618 }
619 
620 #endif
uint32_t mir_input_device_state_event_device_count(MirInputDeviceStateEvent const *ev)
Retrieve the number of attached input devices.
AutoUnblockThread is a helper thread class that can gracefully shutdown at destruction time...
Definition: sw_splash.h:26
Definition: touch_event.h:49
float mir_touch_event_axis_value(MirTouchEvent const *event, size_t touch_index, MirTouchAxis axis)
Retrieve the axis value for a given axis on an indexed touch.
MATCHER(KeyDownEvent, "")
Definition: event_matchers.h:104
MirKeyboardEvent const * maybe_key_event(MirEvent const *event)
Definition: event_matchers.h:71
void PrintTo(MirEvent const &event, std::ostream *os)
char const * mir_keyboard_event_key_text(MirKeyboardEvent const *event)
Retrieve the text the key press would emit as null terminated utf8 string.
MirEventType mir_event_get_type(MirEvent const *event)
Retrieves the type of a MirEvent.
MATCHER_P(DisplayConfigMatches, config, "")
Definition: display_config_matchers.h:119
MirKeyboardEvent const * mir_input_event_get_keyboard_event(MirInputEvent const *event)
Retrieve the MirKeyboardEvent associated with a given input event.
Definition: pointer_event.h:48
unsigned int mir_touch_event_point_count(MirTouchEvent const *event)
Retrieve the number of touches reported for a given touch event.
MirInputDeviceId mir_input_event_get_device_id(MirInputEvent const *event)
Retrieves the device id responsible for generating an input event.
Definition: touch_event.h:61
MirInputDeviceStateEvent const * mir_event_get_input_device_state_event(MirEvent const *event)
Retrieve the MirInputDeviceStateEvent associated with a MirEvent of type mir_event_type_input_device_...
struct MirPointerEvent MirPointerEvent
An event type describing a change in pointer device state.
Definition: pointer_event.h:35
MirInputEventModifiers mir_keyboard_event_modifiers(MirKeyboardEvent const *event)
Retrieve the modifier keys pressed when the key action occured.
MirPointerEvent const * maybe_pointer_event(MirEvent const *event)
Definition: event_matchers.h:91
MirPointerAction mir_pointer_event_action(MirPointerEvent const *event)
Retrieve the action which occured to generate a given pointer event.
MirWindowAttrib mir_window_event_get_attribute(MirWindowEvent const *event)
Retrieve the attribute index configured with a given MirWindowEvent.
MirPointerAction
Possible pointer actions.
Definition: pointer_event.h:40
MATCHER_P3(ButtonsDown, x, y, buttons, "")
Definition: event_matchers.h:296
uint32_t mir_input_device_state_event_device_pressed_keys_for_index(MirInputDeviceStateEvent const *ev, uint32_t index, uint32_t pressed_index)
MirOrientationEvent const * mir_event_get_orientation_event(MirEvent const *event)
Retrieve the MirOrientationEvent associated with a MirEvent of type mir_event_type_orientation.
Definition: event.h:45
Definition: pointer_event.h:44
MirInputDeviceId mir_keymap_event_get_device_id(MirKeymapEvent const *ev)
Retrieve the device id the keymap reported by this MirKeymapEvent applies to.
Definition: event.h:55
Definition: keyboard_event.h:53
Definition: input_event.h:39
MirPointerEvent const * mir_input_event_get_pointer_event(MirInputEvent const *event)
Retrieve the MirPointerEvent associated with a given input event.
float mir_pointer_event_axis_value(MirPointerEvent const *event, MirPointerAxis axis)
Retrieve the axis value reported by a given pointer event.
Definition: touch_event.h:47
struct MirTouchEvent MirTouchEvent
An event type describing a change in touch device state.
Definition: touch_event.h:33
Definition: touch_event.h:63
Definition: pointer_event.h:70
MirKeymapEvent const * mir_event_get_keymap_event(MirEvent const *event)
Retrieve the MirKeymapEvent associated with a MirEvent of type mir_event_type_keymap.
Definition: event.h:50
MirInputEventModifiers mir_pointer_event_modifiers(MirPointerEvent const *event)
Retrieve the modifier keys pressed when the pointer action occured.
float mir_input_device_state_event_pointer_axis(MirInputDeviceStateEvent const *ev, MirPointerAxis axis)
Retrieve the pointer position.
Definition: pointer_event.h:42
MirTouchTooltype mir_touch_event_tooltype(MirTouchEvent const *event, size_t touch_index)
Retrieve the tooltype for touch at given index.
Definition: keyboard_event.h:50
MirEvent const & to_ref(MirEvent const *event)
Definition: event_matchers.h:61
Definition: pointer_event.h:60
struct MirEvent MirEvent
Definition: event.h:84
Definition: event.h:51
MirEvent const * to_address(MirEvent const *event)
Definition: event_matchers.h:46
MirInputEvent const * mir_event_get_input_event(MirEvent const *event)
Retrieve the MirInputEvent associated with a MirEvent of type mir_event_type_input.
Definition: touch_event.h:51
MirWindowEvent const * mir_event_get_window_event(MirEvent const *event)
Retrieve the MirWindowEvent associated with a MirEvent of type mir_event_type_window.
unsigned int MirPointerButtons
Definition: pointer_event.h:88
int mir_keyboard_event_scan_code(MirKeyboardEvent const *event)
Retrieve the raw hardware scan code associated with the key acted on.
bool button_event_matches(MirPointerEvent const *pev, float x, float y, MirPointerAction action, MirPointerButtons button_state, bool check_action=true, bool check_buttons=true, bool check_axes=true)
Definition: event_matchers.h:252
MirPointerButtons mir_pointer_event_buttons(MirPointerEvent const *event)
Retreive the pointer button state as a masked set of values.
int mir_window_event_get_attribute_value(MirWindowEvent const *event)
Retrieve the new value of the associated attribute for a given MirWindowEvent.
MirOrientation mir_orientation_event_get_direction(MirOrientationEvent const *ev)
Retrieve the new orientation reported by this MirOrientationEvent.
Definition: pointer_event.h:68
struct MirKeyboardEvent MirKeyboardEvent
An event type describing a change in keyboard state.
Definition: keyboard_event.h:41
xkb_keysym_t mir_keyboard_event_key_code(MirKeyboardEvent const *event)
Retrieve the xkb mapped keycode associated with the key acted on.
MirTouchEvent const * mir_input_event_get_touch_event(MirInputEvent const *event)
Retrieve the MirTouchEvent associated with a given input event.
Definition: pointer_event.h:50
Definition: pointer_event.h:62
Definition: input_event.h:37
Definition: event.h:42
MirInputEventType mir_input_event_get_type(MirInputEvent const *event)
Retrieve the type of an input event.
MirKeyboardAction mir_keyboard_event_action(MirKeyboardEvent const *event)
Retrieve the action which triggered a given key event.
MATCHER_P2(ButtonDownEvent, x, y, "")
Definition: event_matchers.h:268
MirTouchId mir_touch_event_id(MirTouchEvent const *event, size_t touch_index)
Retrieve the TouchID for a touch at given index.
Definition: pointer_event.h:46
MirTouchEvent const * maybe_touch_event(MirEvent const *event)
Definition: event_matchers.h:81
MATCHER_P4(TouchContact, slot, action, x, y, "")
Definition: event_matchers.h:353
Definition: keyboard_event.h:48
uint32_t mir_input_device_state_event_device_pressed_keys_count(MirInputDeviceStateEvent const *ev, uint32_t index)
Retrieve the size of scan code array of the device identified by the index.
MirTouchAction mir_touch_event_action(MirTouchEvent const *event, size_t touch_index)
Retrieve the action which occured for a touch at given index.
Definition: input_event.h:38
bool mir_pointer_event_button_state(MirPointerEvent const *event, MirPointerButton button)
Retrieve the state of a given pointer button when the action occurred.

Copyright © 2012-2018 Canonical Ltd.
Generated on Tue Feb 20 03:16:44 UTC 2018