x11: Add EventSequence → touch detail accessor

The ClutterEventSequence structure is a fully opaque type; on X11, it is
just an unsigned integer that gets converted into a pointer, but in the
future it may become a fully fledged data structure.

Obviously, we cannot tell people to just dereference the pointer into an
integer in order to use it, and still retain the ability to change the
type; for this reason, we need a proper accessor function to convert the
EventSequence into a touch detail, to be used with the XInput API.
This commit is contained in:
Emmanuele Bassi 2012-09-05 09:38:17 +01:00
parent 263592739c
commit 950e60f824
5 changed files with 26 additions and 2 deletions

View File

@ -1594,6 +1594,7 @@ clutter_x11_add_filter
clutter_x11_disable_event_retrieval clutter_x11_disable_event_retrieval
clutter_x11_enable_xinput clutter_x11_enable_xinput
clutter_x11_event_get_key_group clutter_x11_event_get_key_group
clutter_x11_event_sequence_get_touch_detail
clutter_x11_filter_return_get_type clutter_x11_filter_return_get_type
clutter_x11_get_current_event_time clutter_x11_get_current_event_time
clutter_x11_get_default_display clutter_x11_get_default_display

View File

@ -1098,10 +1098,11 @@ clutter_device_manager_xi2_translate_event (ClutterEventTranslator *translator,
if (xev->flags & XITouchEmulatingPointer) if (xev->flags & XITouchEmulatingPointer)
_clutter_event_set_pointer_emulated (event, TRUE); _clutter_event_set_pointer_emulated (event, TRUE);
CLUTTER_NOTE (EVENT, "touch %s: win:0x%x device:%s (x:%.2f, y:%.2f, axes:%s)", CLUTTER_NOTE (EVENT, "touch %s: win:0x%x device:%s (seq:%d, x:%.2f, y:%.2f, axes:%s)",
event->type == CLUTTER_TOUCH_BEGIN ? "begin" : "end", event->type == CLUTTER_TOUCH_BEGIN ? "begin" : "end",
(unsigned int) stage_x11->xwin, (unsigned int) stage_x11->xwin,
event->touch.device->device_name, event->touch.device->device_name,
GPOINTER_TO_UINT (event->touch.sequence),
event->touch.x, event->touch.x,
event->touch.y, event->touch.y,
event->touch.axes != NULL ? "yes" : "no"); event->touch.axes != NULL ? "yes" : "no");
@ -1144,9 +1145,10 @@ clutter_device_manager_xi2_translate_event (ClutterEventTranslator *translator,
if (xev->flags & XITouchEmulatingPointer) if (xev->flags & XITouchEmulatingPointer)
_clutter_event_set_pointer_emulated (event, TRUE); _clutter_event_set_pointer_emulated (event, TRUE);
CLUTTER_NOTE (EVENT, "touch update: win:0x%x device:%s (x:%.2f, y:%.2f, axes:%s)", CLUTTER_NOTE (EVENT, "touch update: win:0x%x device:%s (seq:%d, x:%.2f, y:%.2f, axes:%s)",
(unsigned int) stage_x11->xwin, (unsigned int) stage_x11->xwin,
event->touch.device->device_name, event->touch.device->device_name,
GPOINTER_TO_UINT (event->touch.sequence),
event->touch.x, event->touch.x,
event->touch.y, event->touch.y,
event->touch.axes != NULL ? "yes" : "no"); event->touch.axes != NULL ? "yes" : "no");

View File

@ -375,3 +375,21 @@ clutter_x11_event_get_key_group (const ClutterEvent *event)
return event_x11->key_group; return event_x11->key_group;
} }
/**
* clutter_x11_event_sequence_get_touch_detail:
* @sequence: a #ClutterEventSequence
*
* Retrieves the touch detail froma #ClutterEventSequence.
*
* Return value: the touch detail
*
* Since: 1.12
*/
guint
clutter_x11_event_sequence_get_touch_detail (const ClutterEventSequence *sequence)
{
g_return_val_if_fail (sequence != NULL, 0);
return GPOINTER_TO_UINT (sequence);
}

View File

@ -140,6 +140,8 @@ Time clutter_x11_get_current_event_time (void);
gint clutter_x11_event_get_key_group (const ClutterEvent *event); gint clutter_x11_event_get_key_group (const ClutterEvent *event);
guint clutter_x11_event_sequence_get_touch_detail (const ClutterEventSequence *sequence);
G_END_DECLS G_END_DECLS
#endif /* __CLUTTER_X11_H__ */ #endif /* __CLUTTER_X11_H__ */

View File

@ -1364,6 +1364,7 @@ clutter_x11_get_input_devices
clutter_x11_has_xinput clutter_x11_has_xinput
clutter_x11_enable_xinput clutter_x11_enable_xinput
clutter_x11_event_get_key_group clutter_x11_event_get_key_group
clutter_x11_event_sequence_get_touch_detail
<SUBSECTION Private> <SUBSECTION Private>
ClutterX11XInputDevice ClutterX11XInputDevice