mirror of
https://github.com/brl/mutter.git
synced 2024-12-24 12:02:04 +00:00
event: Add ClutterTouchEvent
The ClutterTouchEvent structure contains the data relative to a touch event.
This commit is contained in:
parent
ab3582be1c
commit
d15b828cc5
@ -703,6 +703,16 @@ typedef enum { /*< flags prefix=CLUTTER_EVENT >*/
|
|||||||
* @CLUTTER_DESTROY_NOTIFY: Destroy notification event
|
* @CLUTTER_DESTROY_NOTIFY: Destroy notification event
|
||||||
* @CLUTTER_CLIENT_MESSAGE: Client message event
|
* @CLUTTER_CLIENT_MESSAGE: Client message event
|
||||||
* @CLUTTER_DELETE: Stage delete event
|
* @CLUTTER_DELETE: Stage delete event
|
||||||
|
* @CLUTTER_TOUCH_BEGIN: A new touch event sequence has started;
|
||||||
|
* event added in 1.10
|
||||||
|
* @CLUTTER_TOUCH_UPDATE: A touch event sequence has been updated;
|
||||||
|
* event added in 1.10
|
||||||
|
* @CLUTTER_TOUCH_END: A touch event sequence has finished;
|
||||||
|
* event added in 1.10
|
||||||
|
* @CLUTTER_TOUCH_CANCEL: A touch event sequence has been canceled;
|
||||||
|
* event added in 1.10
|
||||||
|
* @CLUTTER_EVENT_LAST: Marks the end of the #ClutterEventType enumeration;
|
||||||
|
* added in 1.10
|
||||||
*
|
*
|
||||||
* Types of events.
|
* Types of events.
|
||||||
*
|
*
|
||||||
@ -721,7 +731,13 @@ typedef enum { /*< prefix=CLUTTER >*/
|
|||||||
CLUTTER_STAGE_STATE,
|
CLUTTER_STAGE_STATE,
|
||||||
CLUTTER_DESTROY_NOTIFY,
|
CLUTTER_DESTROY_NOTIFY,
|
||||||
CLUTTER_CLIENT_MESSAGE,
|
CLUTTER_CLIENT_MESSAGE,
|
||||||
CLUTTER_DELETE
|
CLUTTER_DELETE,
|
||||||
|
CLUTTER_TOUCH_BEGIN,
|
||||||
|
CLUTTER_TOUCH_UPDATE,
|
||||||
|
CLUTTER_TOUCH_END,
|
||||||
|
CLUTTER_TOUCH_CANCEL,
|
||||||
|
|
||||||
|
CLUTTER_EVENT_LAST /* helper */
|
||||||
} ClutterEventType;
|
} ClutterEventType;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -185,6 +185,12 @@ clutter_event_get_state (const ClutterEvent *event)
|
|||||||
case CLUTTER_BUTTON_RELEASE:
|
case CLUTTER_BUTTON_RELEASE:
|
||||||
return event->button.modifier_state;
|
return event->button.modifier_state;
|
||||||
|
|
||||||
|
case CLUTTER_TOUCH_BEGIN:
|
||||||
|
case CLUTTER_TOUCH_UPDATE:
|
||||||
|
case CLUTTER_TOUCH_END:
|
||||||
|
case CLUTTER_TOUCH_CANCEL:
|
||||||
|
return event->touch.modifier_state;
|
||||||
|
|
||||||
case CLUTTER_MOTION:
|
case CLUTTER_MOTION:
|
||||||
return event->motion.modifier_state;
|
return event->motion.modifier_state;
|
||||||
|
|
||||||
@ -229,6 +235,13 @@ clutter_event_set_state (ClutterEvent *event,
|
|||||||
event->motion.modifier_state = state;
|
event->motion.modifier_state = state;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case CLUTTER_TOUCH_BEGIN:
|
||||||
|
case CLUTTER_TOUCH_UPDATE:
|
||||||
|
case CLUTTER_TOUCH_END:
|
||||||
|
case CLUTTER_TOUCH_CANCEL:
|
||||||
|
event->touch.modifier_state = state;
|
||||||
|
break;
|
||||||
|
|
||||||
case CLUTTER_SCROLL:
|
case CLUTTER_SCROLL:
|
||||||
event->scroll.modifier_state = state;
|
event->scroll.modifier_state = state;
|
||||||
break;
|
break;
|
||||||
@ -268,6 +281,7 @@ clutter_event_get_coords (const ClutterEvent *event,
|
|||||||
case CLUTTER_DESTROY_NOTIFY:
|
case CLUTTER_DESTROY_NOTIFY:
|
||||||
case CLUTTER_CLIENT_MESSAGE:
|
case CLUTTER_CLIENT_MESSAGE:
|
||||||
case CLUTTER_DELETE:
|
case CLUTTER_DELETE:
|
||||||
|
case CLUTTER_EVENT_LAST:
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case CLUTTER_ENTER:
|
case CLUTTER_ENTER:
|
||||||
@ -287,6 +301,14 @@ clutter_event_get_coords (const ClutterEvent *event,
|
|||||||
event_y = event->motion.y;
|
event_y = event->motion.y;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case CLUTTER_TOUCH_BEGIN:
|
||||||
|
case CLUTTER_TOUCH_UPDATE:
|
||||||
|
case CLUTTER_TOUCH_END:
|
||||||
|
case CLUTTER_TOUCH_CANCEL:
|
||||||
|
event_x = event->touch.x;
|
||||||
|
event_y = event->touch.y;
|
||||||
|
break;
|
||||||
|
|
||||||
case CLUTTER_SCROLL:
|
case CLUTTER_SCROLL:
|
||||||
event_x = event->scroll.x;
|
event_x = event->scroll.x;
|
||||||
event_y = event->scroll.y;
|
event_y = event->scroll.y;
|
||||||
@ -326,6 +348,7 @@ clutter_event_set_coords (ClutterEvent *event,
|
|||||||
case CLUTTER_DESTROY_NOTIFY:
|
case CLUTTER_DESTROY_NOTIFY:
|
||||||
case CLUTTER_CLIENT_MESSAGE:
|
case CLUTTER_CLIENT_MESSAGE:
|
||||||
case CLUTTER_DELETE:
|
case CLUTTER_DELETE:
|
||||||
|
case CLUTTER_EVENT_LAST:
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case CLUTTER_ENTER:
|
case CLUTTER_ENTER:
|
||||||
@ -345,6 +368,14 @@ clutter_event_set_coords (ClutterEvent *event,
|
|||||||
event->motion.y = y;
|
event->motion.y = y;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case CLUTTER_TOUCH_BEGIN:
|
||||||
|
case CLUTTER_TOUCH_UPDATE:
|
||||||
|
case CLUTTER_TOUCH_END:
|
||||||
|
case CLUTTER_TOUCH_CANCEL:
|
||||||
|
event->touch.x = x;
|
||||||
|
event->touch.y = y;
|
||||||
|
break;
|
||||||
|
|
||||||
case CLUTTER_SCROLL:
|
case CLUTTER_SCROLL:
|
||||||
event->scroll.x = x;
|
event->scroll.x = x;
|
||||||
event->scroll.y = y;
|
event->scroll.y = y;
|
||||||
@ -812,6 +843,32 @@ clutter_event_set_key_unicode (ClutterEvent *event,
|
|||||||
event->key.unicode_value = key_unicode;
|
event->key.unicode_value = key_unicode;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* clutter_event_get_event_sequence:
|
||||||
|
* @event: a #ClutterEvent of type %CLUTTER_TOUCH_BEGIN,
|
||||||
|
* %CLUTTER_TOUCH_UPDATE, %CLUTTER_TOUCH_END, or
|
||||||
|
* %CLUTTER_TOUCH_CANCEL
|
||||||
|
*
|
||||||
|
* Retrieves the #ClutterEventSequence of @event.
|
||||||
|
*
|
||||||
|
* Return value: (transfer none): the event sequence, or %NULL
|
||||||
|
*
|
||||||
|
* Since: 1.10
|
||||||
|
*/
|
||||||
|
ClutterEventSequence *
|
||||||
|
clutter_event_get_event_sequence (const ClutterEvent *event)
|
||||||
|
{
|
||||||
|
g_return_val_if_fail (event != NULL, NULL);
|
||||||
|
|
||||||
|
if (event->type == CLUTTER_TOUCH_BEGIN ||
|
||||||
|
event->type == CLUTTER_TOUCH_UPDATE ||
|
||||||
|
event->type == CLUTTER_TOUCH_END ||
|
||||||
|
event->type == CLUTTER_TOUCH_CANCEL)
|
||||||
|
return event->touch.sequence;
|
||||||
|
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* clutter_event_get_device_id:
|
* clutter_event_get_device_id:
|
||||||
* @event: a clutter event
|
* @event: a clutter event
|
||||||
@ -890,6 +947,7 @@ clutter_event_set_device (ClutterEvent *event,
|
|||||||
case CLUTTER_DESTROY_NOTIFY:
|
case CLUTTER_DESTROY_NOTIFY:
|
||||||
case CLUTTER_CLIENT_MESSAGE:
|
case CLUTTER_CLIENT_MESSAGE:
|
||||||
case CLUTTER_DELETE:
|
case CLUTTER_DELETE:
|
||||||
|
case CLUTTER_EVENT_LAST:
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case CLUTTER_ENTER:
|
case CLUTTER_ENTER:
|
||||||
@ -910,6 +968,13 @@ clutter_event_set_device (ClutterEvent *event,
|
|||||||
event->scroll.device = device;
|
event->scroll.device = device;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case CLUTTER_TOUCH_BEGIN:
|
||||||
|
case CLUTTER_TOUCH_UPDATE:
|
||||||
|
case CLUTTER_TOUCH_END:
|
||||||
|
case CLUTTER_TOUCH_CANCEL:
|
||||||
|
event->touch.device = device;
|
||||||
|
break;
|
||||||
|
|
||||||
case CLUTTER_KEY_PRESS:
|
case CLUTTER_KEY_PRESS:
|
||||||
case CLUTTER_KEY_RELEASE:
|
case CLUTTER_KEY_RELEASE:
|
||||||
event->key.device = device;
|
event->key.device = device;
|
||||||
@ -954,6 +1019,7 @@ clutter_event_get_device (const ClutterEvent *event)
|
|||||||
case CLUTTER_DESTROY_NOTIFY:
|
case CLUTTER_DESTROY_NOTIFY:
|
||||||
case CLUTTER_CLIENT_MESSAGE:
|
case CLUTTER_CLIENT_MESSAGE:
|
||||||
case CLUTTER_DELETE:
|
case CLUTTER_DELETE:
|
||||||
|
case CLUTTER_EVENT_LAST:
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case CLUTTER_ENTER:
|
case CLUTTER_ENTER:
|
||||||
@ -974,6 +1040,13 @@ clutter_event_get_device (const ClutterEvent *event)
|
|||||||
device = event->scroll.device;
|
device = event->scroll.device;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case CLUTTER_TOUCH_BEGIN:
|
||||||
|
case CLUTTER_TOUCH_UPDATE:
|
||||||
|
case CLUTTER_TOUCH_END:
|
||||||
|
case CLUTTER_TOUCH_CANCEL:
|
||||||
|
device = event->touch.device;
|
||||||
|
break;
|
||||||
|
|
||||||
case CLUTTER_KEY_PRESS:
|
case CLUTTER_KEY_PRESS:
|
||||||
case CLUTTER_KEY_RELEASE:
|
case CLUTTER_KEY_RELEASE:
|
||||||
device = event->key.device;
|
device = event->key.device;
|
||||||
@ -1068,6 +1141,15 @@ clutter_event_copy (const ClutterEvent *event)
|
|||||||
sizeof (gdouble) * n_axes);
|
sizeof (gdouble) * n_axes);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case CLUTTER_TOUCH_BEGIN:
|
||||||
|
case CLUTTER_TOUCH_UPDATE:
|
||||||
|
case CLUTTER_TOUCH_END:
|
||||||
|
case CLUTTER_TOUCH_CANCEL:
|
||||||
|
if (event->touch.axes != NULL)
|
||||||
|
new_event->touch.axes = g_memdup (event->motion.axes,
|
||||||
|
sizeof (gdouble) * n_axes);
|
||||||
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -1108,6 +1190,13 @@ clutter_event_free (ClutterEvent *event)
|
|||||||
g_free (event->scroll.axes);
|
g_free (event->scroll.axes);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case CLUTTER_TOUCH_BEGIN:
|
||||||
|
case CLUTTER_TOUCH_UPDATE:
|
||||||
|
case CLUTTER_TOUCH_END:
|
||||||
|
case CLUTTER_TOUCH_CANCEL:
|
||||||
|
g_free (event->touch.axes);
|
||||||
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -1372,6 +1461,7 @@ clutter_event_get_axes (const ClutterEvent *event,
|
|||||||
case CLUTTER_LEAVE:
|
case CLUTTER_LEAVE:
|
||||||
case CLUTTER_KEY_PRESS:
|
case CLUTTER_KEY_PRESS:
|
||||||
case CLUTTER_KEY_RELEASE:
|
case CLUTTER_KEY_RELEASE:
|
||||||
|
case CLUTTER_EVENT_LAST:
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case CLUTTER_SCROLL:
|
case CLUTTER_SCROLL:
|
||||||
@ -1383,6 +1473,13 @@ clutter_event_get_axes (const ClutterEvent *event,
|
|||||||
retval = event->button.axes;
|
retval = event->button.axes;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case CLUTTER_TOUCH_BEGIN:
|
||||||
|
case CLUTTER_TOUCH_UPDATE:
|
||||||
|
case CLUTTER_TOUCH_END:
|
||||||
|
case CLUTTER_TOUCH_CANCEL:
|
||||||
|
retval = event->touch.axes;
|
||||||
|
break;
|
||||||
|
|
||||||
case CLUTTER_MOTION:
|
case CLUTTER_MOTION:
|
||||||
retval = event->motion.axes;
|
retval = event->motion.axes;
|
||||||
break;
|
break;
|
||||||
|
@ -113,6 +113,9 @@ typedef struct _ClutterMotionEvent ClutterMotionEvent;
|
|||||||
typedef struct _ClutterScrollEvent ClutterScrollEvent;
|
typedef struct _ClutterScrollEvent ClutterScrollEvent;
|
||||||
typedef struct _ClutterStageStateEvent ClutterStageStateEvent;
|
typedef struct _ClutterStageStateEvent ClutterStageStateEvent;
|
||||||
typedef struct _ClutterCrossingEvent ClutterCrossingEvent;
|
typedef struct _ClutterCrossingEvent ClutterCrossingEvent;
|
||||||
|
typedef struct _ClutterTouchEvent ClutterTouchEvent;
|
||||||
|
|
||||||
|
typedef struct _ClutterEventSequence ClutterEventSequence;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* ClutterAnyEvent:
|
* ClutterAnyEvent:
|
||||||
@ -329,6 +332,54 @@ struct _ClutterStageStateEvent
|
|||||||
ClutterStageState new_state;
|
ClutterStageState new_state;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* ClutterTouchEvent:
|
||||||
|
* @type: event type
|
||||||
|
* @time: event time
|
||||||
|
* @flags: event flags
|
||||||
|
* @stage: event source stage
|
||||||
|
* @source: event source actor (unused)
|
||||||
|
* @x: the X coordinate of the pointer, relative to the stage
|
||||||
|
* @y: the Y coordinate of the pointer, relative to the stage
|
||||||
|
* @axes: @x and @y, translated to the axes of @device, or %NULL
|
||||||
|
* @state: (type ClutterModifierType): a bit-mask representing the state
|
||||||
|
* of modifier keys (e.g. Control, Shift, and Alt) and the pointer
|
||||||
|
* buttons. See #ClutterModifierType
|
||||||
|
* @sequence: the event sequence that this event belongs to
|
||||||
|
* @device: the device that originated the event
|
||||||
|
*
|
||||||
|
* Used for touch events.
|
||||||
|
*
|
||||||
|
* The @type field will be one of %CLUTTER_TOUCH_BEGIN, %CLUTTER_TOUCH_END,
|
||||||
|
* %CLUTTER_TOUCH_UPDATE, or %CLUTTER_TOUCH_CANCEL.
|
||||||
|
*
|
||||||
|
* Touch events are grouped into sequences; each touch sequence will begin
|
||||||
|
* with a %CLUTTER_TOUCH_BEGIN event, progress with %CLUTTER_TOUCH_UPDATE
|
||||||
|
* events, and end either with a %CLUTTER_TOUCH_END event or with a
|
||||||
|
* %CLUTTER_TOUCH_CANCEL event.
|
||||||
|
*
|
||||||
|
* With multi-touch capable devices there can be multiple event sequence
|
||||||
|
* running at the same time.
|
||||||
|
*
|
||||||
|
* Since: 1.10
|
||||||
|
*/
|
||||||
|
struct _ClutterTouchEvent
|
||||||
|
{
|
||||||
|
ClutterEventType type;
|
||||||
|
guint32 time;
|
||||||
|
ClutterEventFlags flags;
|
||||||
|
ClutterStage *stage;
|
||||||
|
ClutterActor *source;
|
||||||
|
|
||||||
|
gfloat x;
|
||||||
|
gfloat y;
|
||||||
|
guint state;
|
||||||
|
ClutterEventSequence *sequence;
|
||||||
|
ClutterModifierType modifier_state;
|
||||||
|
gdouble *axes;
|
||||||
|
ClutterInputDevice *device;
|
||||||
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* ClutterEvent:
|
* ClutterEvent:
|
||||||
*
|
*
|
||||||
@ -348,6 +399,7 @@ union _ClutterEvent
|
|||||||
ClutterScrollEvent scroll;
|
ClutterScrollEvent scroll;
|
||||||
ClutterStageStateEvent stage_state;
|
ClutterStageStateEvent stage_state;
|
||||||
ClutterCrossingEvent crossing;
|
ClutterCrossingEvent crossing;
|
||||||
|
ClutterTouchEvent touch;
|
||||||
};
|
};
|
||||||
|
|
||||||
GType clutter_event_get_type (void) G_GNUC_CONST;
|
GType clutter_event_get_type (void) G_GNUC_CONST;
|
||||||
@ -429,6 +481,9 @@ void clutter_event_get_scroll_delta (const ClutterEv
|
|||||||
gdouble *dx,
|
gdouble *dx,
|
||||||
gdouble *dy);
|
gdouble *dy);
|
||||||
|
|
||||||
|
CLUTTER_AVAILABLE_IN_1_10
|
||||||
|
ClutterEventSequence * clutter_event_get_event_sequence (const ClutterEvent *event);
|
||||||
|
|
||||||
guint32 clutter_keysym_to_unicode (guint keyval);
|
guint32 clutter_keysym_to_unicode (guint keyval);
|
||||||
CLUTTER_AVAILABLE_IN_1_10
|
CLUTTER_AVAILABLE_IN_1_10
|
||||||
guint clutter_unicode_to_keysym (guint32 wc);
|
guint clutter_unicode_to_keysym (guint32 wc);
|
||||||
|
@ -2611,6 +2611,12 @@ _clutter_process_event_details (ClutterActor *stage,
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
case CLUTTER_TOUCH_BEGIN:
|
||||||
|
case CLUTTER_TOUCH_UPDATE:
|
||||||
|
case CLUTTER_TOUCH_END:
|
||||||
|
case CLUTTER_TOUCH_CANCEL:
|
||||||
|
break;
|
||||||
|
|
||||||
case CLUTTER_STAGE_STATE:
|
case CLUTTER_STAGE_STATE:
|
||||||
/* fullscreen / focus - forward to stage */
|
/* fullscreen / focus - forward to stage */
|
||||||
event->any.source = stage;
|
event->any.source = stage;
|
||||||
@ -2619,6 +2625,9 @@ _clutter_process_event_details (ClutterActor *stage,
|
|||||||
|
|
||||||
case CLUTTER_CLIENT_MESSAGE:
|
case CLUTTER_CLIENT_MESSAGE:
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case CLUTTER_EVENT_LAST:
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -622,6 +622,7 @@ clutter_event_get_coords
|
|||||||
clutter_event_get_device
|
clutter_event_get_device
|
||||||
clutter_event_get_device_id
|
clutter_event_get_device_id
|
||||||
clutter_event_get_device_type
|
clutter_event_get_device_type
|
||||||
|
clutter_event_get_event_sequence
|
||||||
clutter_event_get_flags
|
clutter_event_get_flags
|
||||||
clutter_event_free
|
clutter_event_free
|
||||||
clutter_event_get
|
clutter_event_get
|
||||||
|
Loading…
Reference in New Issue
Block a user