mirror of
https://github.com/brl/mutter.git
synced 2024-11-29 19:40:43 -05:00
event: Add ClutterInputDeviceTool information to clutter events
These can be used to determine the tool that's being in use for a given event
This commit is contained in:
parent
63b1a55283
commit
efd90eb471
@ -54,6 +54,8 @@ typedef struct _ClutterEventPrivate {
|
|||||||
gdouble delta_x;
|
gdouble delta_x;
|
||||||
gdouble delta_y;
|
gdouble delta_y;
|
||||||
|
|
||||||
|
ClutterInputDeviceTool *tool;
|
||||||
|
|
||||||
gpointer platform_data;
|
gpointer platform_data;
|
||||||
|
|
||||||
ClutterModifierType button_state;
|
ClutterModifierType button_state;
|
||||||
@ -1206,6 +1208,54 @@ clutter_event_get_device (const ClutterEvent *event)
|
|||||||
return device;
|
return device;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* clutter_event_set_device_tool:
|
||||||
|
* @event: a #ClutterEvent
|
||||||
|
* @tool: (nullable): a #ClutterInputDeviceTool
|
||||||
|
*
|
||||||
|
* Sets the tool in use for this event
|
||||||
|
*
|
||||||
|
* Since: 1.28
|
||||||
|
**/
|
||||||
|
void
|
||||||
|
clutter_event_set_device_tool (ClutterEvent *event,
|
||||||
|
ClutterInputDeviceTool *tool)
|
||||||
|
{
|
||||||
|
g_return_if_fail (event != NULL);
|
||||||
|
|
||||||
|
if (is_event_allocated (event))
|
||||||
|
{
|
||||||
|
ClutterEventPrivate *real_event = (ClutterEventPrivate *) event;
|
||||||
|
|
||||||
|
real_event->tool = tool;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* clutter_event_get_device_tool:
|
||||||
|
* @event: a #ClutterEvent
|
||||||
|
*
|
||||||
|
* Returns the device tool that originated this event
|
||||||
|
*
|
||||||
|
* Returns: (transfer none): The tool of this event
|
||||||
|
*
|
||||||
|
* Since: 1.28
|
||||||
|
**/
|
||||||
|
ClutterInputDeviceTool *
|
||||||
|
clutter_event_get_device_tool (const ClutterEvent *event)
|
||||||
|
{
|
||||||
|
g_return_val_if_fail (event != NULL, NULL);
|
||||||
|
|
||||||
|
if (is_event_allocated (event))
|
||||||
|
{
|
||||||
|
ClutterEventPrivate *real_event = (ClutterEventPrivate *) event;
|
||||||
|
|
||||||
|
return real_event->tool;
|
||||||
|
}
|
||||||
|
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* clutter_event_new:
|
* clutter_event_new:
|
||||||
* @type: The type of event.
|
* @type: The type of event.
|
||||||
@ -1269,6 +1319,7 @@ clutter_event_copy (const ClutterEvent *event)
|
|||||||
new_real_event->button_state = real_event->button_state;
|
new_real_event->button_state = real_event->button_state;
|
||||||
new_real_event->latched_state = real_event->latched_state;
|
new_real_event->latched_state = real_event->latched_state;
|
||||||
new_real_event->locked_state = real_event->locked_state;
|
new_real_event->locked_state = real_event->locked_state;
|
||||||
|
new_real_event->tool = real_event->tool;
|
||||||
}
|
}
|
||||||
|
|
||||||
device = clutter_event_get_device (event);
|
device = clutter_event_get_device (event);
|
||||||
|
@ -575,6 +575,13 @@ void clutter_event_set_source_device (ClutterEvent
|
|||||||
|
|
||||||
CLUTTER_AVAILABLE_IN_1_6
|
CLUTTER_AVAILABLE_IN_1_6
|
||||||
ClutterInputDevice * clutter_event_get_source_device (const ClutterEvent *event);
|
ClutterInputDevice * clutter_event_get_source_device (const ClutterEvent *event);
|
||||||
|
|
||||||
|
CLUTTER_AVAILABLE_IN_ALL
|
||||||
|
void clutter_event_set_device_tool (ClutterEvent *event,
|
||||||
|
ClutterInputDeviceTool *tool);
|
||||||
|
CLUTTER_AVAILABLE_IN_ALL
|
||||||
|
ClutterInputDeviceTool *clutter_event_get_device_tool (const ClutterEvent *event);
|
||||||
|
|
||||||
CLUTTER_AVAILABLE_IN_1_8
|
CLUTTER_AVAILABLE_IN_1_8
|
||||||
void clutter_event_set_source (ClutterEvent *event,
|
void clutter_event_set_source (ClutterEvent *event,
|
||||||
ClutterActor *actor);
|
ClutterActor *actor);
|
||||||
|
Loading…
Reference in New Issue
Block a user