summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEmmanuele Bassi <ebassi@linux.intel.com>2011-02-22 17:12:34 +0000
committerEmmanuele Bassi <ebassi@linux.intel.com>2011-02-28 14:16:23 +0000
commitd3a7b7502e3a1d1a2df2ca60298fbe3639aa008e (patch)
tree117d1e67391a8b9f0f891147ab58e9bc03c5a1b1
parent26ec3efbff6da99bd443cd5b587a980bb7a3a75a (diff)
downloadclutter-d3a7b7502e3a1d1a2df2ca60298fbe3639aa008e.tar.gz
event: Add setters for ClutterEvent members
Creating a synthetic event requires direct access to the ClutterEvent union members; this access does not map in bindings to high-level languages, especially run-time bindings using GObject-Introspection. It's also midly annoying from C, as it unnecessarily exposes the guts of ClutterEvent - something we might want to fix in the future. http://bugzilla.clutter-project.org/show_bug.cgi?id=2575
-rw-r--r--clutter/clutter-event-private.h4
-rw-r--r--clutter/clutter-event.c368
-rw-r--r--clutter/clutter-event.h127
-rw-r--r--clutter/x11/clutter-device-manager-xi2.c18
-rw-r--r--doc/reference/clutter/clutter-sections.txt15
-rw-r--r--tests/conform/test-clutter-text.c41
6 files changed, 443 insertions, 130 deletions
diff --git a/clutter/clutter-event-private.h b/clutter/clutter-event-private.h
index d9673196d..1b3f9bbb0 100644
--- a/clutter/clutter-event-private.h
+++ b/clutter/clutter-event-private.h
@@ -18,10 +18,6 @@ gpointer _clutter_event_get_platform_data (const ClutterEvent *eve
void _clutter_event_push (const ClutterEvent *event,
gboolean do_copy);
-void _clutter_event_set_device (ClutterEvent *event,
- ClutterInputDevice *device);
-void _clutter_event_set_source_device (ClutterEvent *event,
- ClutterInputDevice *device);
G_END_DECLS
diff --git a/clutter/clutter-event.c b/clutter/clutter-event.c
index 036d0694d..e1b297be9 100644
--- a/clutter/clutter-event.c
+++ b/clutter/clutter-event.c
@@ -87,6 +87,15 @@ _clutter_event_get_platform_data (const ClutterEvent *event)
return ((ClutterEventPrivate *) event)->platform_data;
}
+/*< private >
+ * _clutter_event_set_platform_data:
+ * @event: a #ClutterEvent
+ * @data: a pointer to platform-specific data
+ *
+ * Sets the pointer to platform-specific data inside an event
+ *
+ * Since: 1.4
+ */
void
_clutter_event_set_platform_data (ClutterEvent *event,
gpointer data)
@@ -132,6 +141,24 @@ clutter_event_get_time (const ClutterEvent *event)
}
/**
+ * clutter_event_set_time:
+ * @event: a #ClutterEvent
+ * @time_: the time of the event
+ *
+ * Sets the time of the event.
+ *
+ * Since: 1.8
+ */
+void
+clutter_event_set_time (ClutterEvent *event,
+ guint32 time_)
+{
+ g_return_if_fail (event != NULL);
+
+ event->any.time = time_;
+}
+
+/**
* clutter_event_get_state:
* @event: a #ClutterEvent
*
@@ -170,6 +197,46 @@ clutter_event_get_state (const ClutterEvent *event)
}
/**
+ * clutter_event_set_state:
+ * @event: a #ClutterEvent
+ * @state: the modifier state to set
+ *
+ * Sets the modifier state of the event.
+ *
+ * Since: 1.8
+ */
+void
+clutter_event_set_state (ClutterEvent *event,
+ ClutterModifierType state)
+{
+ g_return_if_fail (event != NULL);
+
+ switch (event->type)
+ {
+ case CLUTTER_KEY_PRESS:
+ case CLUTTER_KEY_RELEASE:
+ event->key.modifier_state = state;
+ break;
+
+ case CLUTTER_BUTTON_PRESS:
+ case CLUTTER_BUTTON_RELEASE:
+ event->button.modifier_state = state;
+ break;
+
+ case CLUTTER_MOTION:
+ event->motion.modifier_state = state;
+ break;
+
+ case CLUTTER_SCROLL:
+ event->scroll.modifier_state = state;
+ break;
+
+ default:
+ break;
+ }
+}
+
+/**
* clutter_event_get_coords:
* @event: a #ClutterEvent
* @x: (out): return location for the X coordinate, or %NULL
@@ -232,6 +299,58 @@ clutter_event_get_coords (const ClutterEvent *event,
}
/**
+ * clutter_event_set_coords:
+ * @event: a #ClutterEvent
+ * @x: the X coordinate of the event
+ * @y: the Y coordinate of the event
+ *
+ * Sets the coordinates of the @event.
+ *
+ * Since: 1.8
+ */
+void
+clutter_event_set_coords (ClutterEvent *event,
+ gfloat x,
+ gfloat y)
+{
+ g_return_if_fail (event != NULL);
+
+ switch (event->type)
+ {
+ case CLUTTER_NOTHING:
+ case CLUTTER_KEY_PRESS:
+ case CLUTTER_KEY_RELEASE:
+ case CLUTTER_STAGE_STATE:
+ case CLUTTER_DESTROY_NOTIFY:
+ case CLUTTER_CLIENT_MESSAGE:
+ case CLUTTER_DELETE:
+ break;
+
+ case CLUTTER_ENTER:
+ case CLUTTER_LEAVE:
+ event->crossing.x = x;
+ event->crossing.y = y;
+ break;
+
+ case CLUTTER_BUTTON_PRESS:
+ case CLUTTER_BUTTON_RELEASE:
+ event->button.x = x;
+ event->button.y = y;
+ break;
+
+ case CLUTTER_MOTION:
+ event->motion.x = x;
+ event->motion.y = y;
+ break;
+
+ case CLUTTER_SCROLL:
+ event->scroll.x = x;
+ event->scroll.y = y;
+ break;
+ }
+}
+
+/**
* clutter_event_get_source:
* @event: a #ClutterEvent
*
@@ -251,6 +370,25 @@ clutter_event_get_source (const ClutterEvent *event)
}
/**
+ * clutter_event_set_source:
+ * @event: a #ClutterEvent
+ * @actor: (allow-none): a #ClutterActor, or %NULL
+ *
+ * Sets the source #ClutterActor of @event.
+ *
+ * Since: 1.8
+ */
+void
+clutter_event_set_source (ClutterEvent *event,
+ ClutterActor *actor)
+{
+ g_return_if_fail (event != NULL);
+ g_return_if_fail (actor == NULL || CLUTTER_IS_ACTOR (actor));
+
+ event->any.source = actor;
+}
+
+/**
* clutter_event_get_stage:
* @event: a #ClutterEvent
*
@@ -270,6 +408,28 @@ clutter_event_get_stage (const ClutterEvent *event)
}
/**
+ * clutter_event_set_stage:
+ * @event: a #ClutterEvent
+ * @stage: (allow-none): a #ClutterStage, or %NULL
+ *
+ * Sets the source #ClutterStage of the event.
+ *
+ * Since: 1.8
+ */
+void
+clutter_event_set_stage (ClutterEvent *event,
+ ClutterStage *stage)
+{
+ g_return_if_fail (event != NULL);
+ g_return_if_fail (stage == NULL || CLUTTER_IS_STAGE (stage));
+
+ if (event->any.stage == stage)
+ return;
+
+ event->any.stage = stage;
+}
+
+/**
* clutter_event_get_flags:
* @event: a #ClutterEvent
*
@@ -288,6 +448,28 @@ clutter_event_get_flags (const ClutterEvent *event)
}
/**
+ * clutter_event_set_flags:
+ * @event: a #ClutterEvent
+ * @flags: a binary OR of #ClutterEventFlags values
+ *
+ * Sets the #ClutterEventFlags of @event
+ *
+ * Since: 1.8
+ */
+void
+clutter_event_set_flags (ClutterEvent *event,
+ ClutterEventFlags flags)
+{
+ g_return_if_fail (event != NULL);
+
+ if (event->any.flags == flags)
+ return;
+
+ event->any.flags = flags;
+ event->any.flags |= CLUTTER_EVENT_FLAG_SYNTHETIC;
+}
+
+/**
* clutter_event_get_related:
* @event: a #ClutterEvent of type %CLUTTER_ENTER or of
* type %CLUTTER_LEAVE
@@ -309,6 +491,30 @@ clutter_event_get_related (const ClutterEvent *event)
}
/**
+ * clutter_event_set_related
+ * @event: a #ClutterEvent of type %CLUTTER_ENTER or %CLUTTER_LEAVE
+ * @actor: (allow-none): a #ClutterActor or %NULL
+ *
+ * Sets the related actor of a crossing event
+ *
+ * Since: 1.8
+ */
+void
+clutter_event_set_related (ClutterEvent *event,
+ ClutterActor *actor)
+{
+ g_return_if_fail (event != NULL);
+ g_return_if_fail (event->type == CLUTTER_ENTER ||
+ event->type == CLUTTER_LEAVE);
+ g_return_if_fail (actor == NULL || CLUTTER_IS_ACTOR (actor));
+
+ if (event->crossing.related == actor)
+ return;
+
+ event->crossing.related = actor;
+}
+
+/**
* clutter_event_get_scroll_direction:
* @event: a #ClutterEvent of type %CLUTTER_SCROLL
*
@@ -328,6 +534,25 @@ clutter_event_get_scroll_direction (const ClutterEvent *event)
}
/**
+ * clutter_event_set_scroll_direction:
+ * @event: a #ClutterEvent
+ * @direction: the scrolling direction
+ *
+ * Sets the direction of the scrolling of @event
+ *
+ * Since: 1.8
+ */
+void
+clutter_event_set_scroll_direction (ClutterEvent *event,
+ ClutterScrollDirection direction)
+{
+ g_return_if_fail (event != NULL);
+ g_return_if_fail (event->type == CLUTTER_SCROLL);
+
+ event->scroll.direction = direction;
+}
+
+/**
* clutter_event_get_button:
* @event: a #ClutterEvent of type %CLUTTER_BUTTON_PRESS or
* of type %CLUTTER_BUTTON_RELEASE
@@ -349,6 +574,27 @@ clutter_event_get_button (const ClutterEvent *event)
}
/**
+ * clutter_event_set_button:
+ * @event: a #ClutterEvent or type %CLUTTER_BUTTON_PRESS or
+ * of type %CLUTTER_BUTTON_RELEASE
+ * @button: the button number
+ *
+ * Sets the button number of @event
+ *
+ * Since: 1.8
+ */
+void
+clutter_event_set_button (ClutterEvent *event,
+ guint32 button)
+{
+ g_return_if_fail (event != NULL);
+ g_return_if_fail (event->type == CLUTTER_BUTTON_PRESS ||
+ event->type == CLUTTER_BUTTON_RELEASE);
+
+ event->button.button = button;
+}
+
+/**
* clutter_event_get_click_count:
* @event: a #ClutterEvent of type %CLUTTER_BUTTON_PRESS or
* of type %CLUTTER_BUTTON_RELEASE
@@ -393,6 +639,27 @@ clutter_event_get_key_symbol (const ClutterEvent *event)
}
/**
+ * clutter_event_set_key_symbol:
+ * @event: a #ClutterEvent of type %CLUTTER_KEY_PRESS
+ * or %CLUTTER_KEY_RELEASE
+ * @key_sym: the key symbol representing the key
+ *
+ * Sets the key symbol of @event.
+ *
+ * Since: 1.8
+ */
+void
+clutter_event_set_key_symbol (ClutterEvent *event,
+ guint key_sym)
+{
+ g_return_if_fail (event != NULL);
+ g_return_if_fail (event->type == CLUTTER_KEY_PRESS ||
+ event->type == CLUTTER_KEY_RELEASE);
+
+ event->key.keyval = key_sym;
+}
+
+/**
* clutter_event_get_key_code:
* @event: a #ClutterEvent of type %CLUTTER_KEY_PRESS or
* of type %CLUTTER_KEY_RELEASE
@@ -414,8 +681,30 @@ clutter_event_get_key_code (const ClutterEvent *event)
}
/**
+ * clutter_event_set_key_code:
+ * @event: a #ClutterEvent of type %CLUTTER_KEY_PRESS
+ * or %CLUTTER_KEY_RELEASE
+ * @key_code: the keycode representing the key
+ *
+ * Sets the keycode of the @event.
+ *
+ * Since: 1.8
+ */
+void
+clutter_event_set_key_code (ClutterEvent *event,
+ guint16 key_code)
+{
+ g_return_if_fail (event != NULL);
+ g_return_if_fail (event->type == CLUTTER_KEY_PRESS ||
+ event->type == CLUTTER_KEY_RELEASE);
+
+ event->key.hardware_keycode = key_code;
+}
+
+/**
* clutter_event_get_key_unicode:
- * @event: A #ClutterKeyEvent
+ * @event: a #ClutterEvent of type %CLUTTER_KEY_PRESS
+ * or %CLUTTER_KEY_RELEASE
*
* Retrieves the unicode value for the key that caused @keyev.
*
@@ -435,6 +724,27 @@ clutter_event_get_key_unicode (const ClutterEvent *event)
}
/**
+ * clutter_event_set_key_unicode:
+ * @event: a #ClutterEvent of type %CLUTTER_KEY_PRESS
+ * or %CLUTTER_KEY_RELEASE
+ * @key_unicode: the Unicode value representing the key
+ *
+ * Sets the Unicode value of @event.
+ *
+ * Since: 1.8
+ */
+void
+clutter_event_set_key_unicode (ClutterEvent *event,
+ guint32 key_unicode)
+{
+ g_return_if_fail (event != NULL);
+ g_return_if_fail (event->type == CLUTTER_KEY_PRESS ||
+ event->type == CLUTTER_KEY_RELEASE);
+
+ event->key.unicode_value = key_unicode;
+}
+
+/**
* clutter_keysym_to_unicode:
* @keyval: a key symbol
*
@@ -532,7 +842,7 @@ clutter_event_get_device_type (const ClutterEvent *event)
/**
* clutter_event_set_device:
* @event: a #ClutterEvent
- * @device: a #ClutterInputDevice
+ * @device: (allow-none): a #ClutterInputDevice, or %NULL
*
* Sets the device for @event.
*
@@ -652,7 +962,7 @@ clutter_event_get_device (const ClutterEvent *event)
*
* Creates a new #ClutterEvent of the specified type.
*
- * Return value: A newly allocated #ClutterEvent.
+ * Return value: (transfer full): A newly allocated #ClutterEvent.
*/
ClutterEvent *
clutter_event_new (ClutterEventType type)
@@ -679,7 +989,7 @@ clutter_event_new (ClutterEventType type)
*
* Copies @event.
*
- * Return value: A newly allocated #ClutterEvent
+ * Return value: (transfer full): A newly allocated #ClutterEvent
*/
ClutterEvent *
clutter_event_copy (const ClutterEvent *event)
@@ -853,8 +1163,6 @@ _clutter_event_push (const ClutterEvent *event,
ClutterEvent *copy;
copy = clutter_event_copy (event);
- copy->any.flags |= CLUTTER_EVENT_FLAG_SYNTHETIC;
-
event = copy;
}
@@ -979,58 +1287,26 @@ clutter_event_get_source_device (const ClutterEvent *event)
return clutter_event_get_device (event);
}
-void
-_clutter_event_set_device (ClutterEvent *event,
- ClutterInputDevice *device)
-{
- switch (event->type)
- {
- case CLUTTER_NOTHING:
- case CLUTTER_STAGE_STATE:
- case CLUTTER_DESTROY_NOTIFY:
- case CLUTTER_CLIENT_MESSAGE:
- case CLUTTER_DELETE:
- case CLUTTER_ENTER:
- case CLUTTER_LEAVE:
- break;
-
- case CLUTTER_BUTTON_PRESS:
- case CLUTTER_BUTTON_RELEASE:
- event->button.device = device;
- break;
-
- case CLUTTER_MOTION:
- event->motion.device = device;
- break;
-
- case CLUTTER_SCROLL:
- event->scroll.device = device;
- break;
-
- case CLUTTER_KEY_PRESS:
- case CLUTTER_KEY_RELEASE:
- event->key.device = device;
- break;
- }
-}
-
-/*< private >
+/**
* clutter_event_set_source_device:
* @event: a #ClutterEvent
- * @device: a #ClutterInputDevice
+ * @device: (allow-none): a #ClutterInputDevice
*
* Sets the source #ClutterInputDevice for @event.
*
* The #ClutterEvent must have been created using clutter_event_new().
*
- * Since: 1.6
+ * Since: 1.8
*/
void
-_clutter_event_set_source_device (ClutterEvent *event,
- ClutterInputDevice *device)
+clutter_event_set_source_device (ClutterEvent *event,
+ ClutterInputDevice *device)
{
ClutterEventPrivate *real_event;
+ g_return_if_fail (event != NULL);
+ g_return_if_fail (device == NULL || CLUTTER_IS_INPUT_DEVICE (device));
+
if (!is_event_allocated (event))
return;
diff --git a/clutter/clutter-event.h b/clutter/clutter-event.h
index ebaa8807c..a1a9d0341 100644
--- a/clutter/clutter-event.h
+++ b/clutter/clutter-event.h
@@ -63,7 +63,7 @@ G_BEGIN_DECLS
*
* Since: 0.6
*/
-typedef enum {
+typedef enum { /*< flags prefix=CLUTTER_EVENT >*/
CLUTTER_EVENT_NONE = 0,
CLUTTER_EVENT_FLAG_SYNTHETIC = 1 << 0
} ClutterEventFlags;
@@ -88,8 +88,7 @@ typedef enum {
*
* Since: 0.4
*/
-typedef enum
-{
+typedef enum { /*< prefix=CLUTTER >*/
CLUTTER_NOTHING = 0,
CLUTTER_KEY_PRESS,
CLUTTER_KEY_RELEASE,
@@ -116,8 +115,7 @@ typedef enum
*
* Since: 0.4
*/
-typedef enum
-{
+typedef enum { /*< prefix=CLUTTER_SCROLL >*/
CLUTTER_SCROLL_UP,
CLUTTER_SCROLL_DOWN,
CLUTTER_SCROLL_LEFT,
@@ -134,8 +132,7 @@ typedef enum
*
* Since: 0.4
*/
-typedef enum
-{
+typedef enum {
CLUTTER_STAGE_STATE_FULLSCREEN = (1<<1),
CLUTTER_STAGE_STATE_OFFSCREEN = (1<<2),
CLUTTER_STAGE_STATE_ACTIVATED = (1<<3)
@@ -387,50 +384,78 @@ union _ClutterEvent
GType clutter_event_get_type (void) G_GNUC_CONST;
-gboolean clutter_events_pending (void);
-ClutterEvent * clutter_event_get (void);
-ClutterEvent * clutter_event_peek (void);
-void clutter_event_put (const ClutterEvent *event);
-
-ClutterEvent * clutter_event_new (ClutterEventType type);
-ClutterEvent * clutter_event_copy (const ClutterEvent *event);
-void clutter_event_free (ClutterEvent *event);
-
-ClutterEventType clutter_event_type (const ClutterEvent *event);
-ClutterEventFlags clutter_event_get_flags (const ClutterEvent *event);
-guint32 clutter_event_get_time (const ClutterEvent *event);
-ClutterModifierType clutter_event_get_state (const ClutterEvent *event);
-gint clutter_event_get_device_id (const ClutterEvent *event);
-ClutterInputDeviceType clutter_event_get_device_type (const ClutterEvent *event);
-ClutterInputDevice * clutter_event_get_device (const ClutterEvent *event);
-ClutterInputDevice * clutter_event_get_source_device (const ClutterEvent *event);
-ClutterActor * clutter_event_get_source (const ClutterEvent *event);
-ClutterStage * clutter_event_get_stage (const ClutterEvent *event);
-
-void clutter_event_get_coords (const ClutterEvent *event,
- gfloat *x,
- gfloat *y);
-gdouble * clutter_event_get_axes (const ClutterEvent *event,
- guint *n_axes);
-
-guint clutter_event_get_key_symbol (const ClutterEvent *event);
-guint16 clutter_event_get_key_code (const ClutterEvent *event);
-guint32 clutter_event_get_key_unicode (const ClutterEvent *event);
-
-guint32 clutter_event_get_button (const ClutterEvent *event);
-guint clutter_event_get_click_count (const ClutterEvent *event);
-
-ClutterActor * clutter_event_get_related (const ClutterEvent *event);
-
-ClutterScrollDirection clutter_event_get_scroll_direction (const ClutterEvent *event);
-
-void clutter_event_set_device (ClutterEvent *event,
- ClutterInputDevice *device);
-
-guint32 clutter_keysym_to_unicode (guint keyval);
-
-guint32 clutter_get_current_event_time (void);
-G_CONST_RETURN ClutterEvent *clutter_get_current_event (void);
+gboolean clutter_events_pending (void);
+ClutterEvent * clutter_event_get (void);
+ClutterEvent * clutter_event_peek (void);
+void clutter_event_put (const ClutterEvent *event);
+
+ClutterEvent * clutter_event_new (ClutterEventType type);
+ClutterEvent * clutter_event_copy (const ClutterEvent *event);
+void clutter_event_free (ClutterEvent *event);
+
+ClutterEventType clutter_event_type (const ClutterEvent *event);
+void clutter_event_set_flags (ClutterEvent *event,
+ ClutterEventFlags flags);
+ClutterEventFlags clutter_event_get_flags (const ClutterEvent *event);
+void clutter_event_set_time (ClutterEvent *event,
+ guint32 time_);
+guint32 clutter_event_get_time (const ClutterEvent *event);
+void clutter_event_set_state (ClutterEvent *event,
+ ClutterModifierType state);
+ClutterModifierType clutter_event_get_state (const ClutterEvent *event);
+void clutter_event_set_device (ClutterEvent *event,
+ ClutterInputDevice *device);
+ClutterInputDevice * clutter_event_get_device (const ClutterEvent *event);
+void clutter_event_set_source_device (ClutterEvent *event,
+ ClutterInputDevice *device);
+
+ClutterInputDevice * clutter_event_get_source_device (const ClutterEvent *event);
+ClutterActor * clutter_event_get_source (const ClutterEvent *event);
+void clutter_event_set_stage (ClutterEvent *event,
+ ClutterStage *stage);
+ClutterStage * clutter_event_get_stage (const ClutterEvent *event);
+
+gint clutter_event_get_device_id (const ClutterEvent *event);
+ClutterInputDeviceType clutter_event_get_device_type (const ClutterEvent *event);
+
+void clutter_event_set_coords (ClutterEvent *event,
+ gfloat x,
+ gfloat y);
+void clutter_event_get_coords (const ClutterEvent *event,
+ gfloat *x,
+ gfloat *y);
+
+gdouble * clutter_event_get_axes (const ClutterEvent *event,
+ guint *n_axes);
+
+void clutter_event_set_key_symbol (ClutterEvent *event,
+ guint key_sym);
+guint clutter_event_get_key_symbol (const ClutterEvent *event);
+void clutter_event_set_key_code (ClutterEvent *event,
+ guint16 key_code);
+guint16 clutter_event_get_key_code (const ClutterEvent *event);
+void clutter_event_set_key_unicode (ClutterEvent *event,
+ guint32 key_unicode);
+guint32 clutter_event_get_key_unicode (const ClutterEvent *event);
+
+void clutter_event_set_button (ClutterEvent *event,
+ guint32 button);
+guint32 clutter_event_get_button (const ClutterEvent *event);
+guint clutter_event_get_click_count (const ClutterEvent *event);
+
+void clutter_event_set_related (ClutterEvent *event,
+ ClutterActor *actor);
+ClutterActor * clutter_event_get_related (const ClutterEvent *event);
+
+void clutter_event_set_scroll_direction (ClutterEvent *event,
+ ClutterScrollDirection direction);
+ClutterScrollDirection clutter_event_get_scroll_direction (const ClutterEvent *event);
+
+guint32 clutter_keysym_to_unicode (guint keyval);
+
+guint32 clutter_get_current_event_time (void);
+
+G_CONST_RETURN ClutterEvent *clutter_get_current_event (void);
G_END_DECLS
diff --git a/clutter/x11/clutter-device-manager-xi2.c b/clutter/x11/clutter-device-manager-xi2.c
index e240c7ff3..5cd53bb67 100644
--- a/clutter/x11/clutter-device-manager-xi2.c
+++ b/clutter/x11/clutter-device-manager-xi2.c
@@ -657,11 +657,11 @@ clutter_device_manager_xi2_translate_event (ClutterEventTranslator *translator,
source_device = g_hash_table_lookup (manager_xi2->devices_by_id,
GINT_TO_POINTER (xev->sourceid));
- _clutter_event_set_source_device (event, source_device);
+ clutter_event_set_source_device (event, source_device);
device = g_hash_table_lookup (manager_xi2->devices_by_id,
GINT_TO_POINTER (xev->deviceid));
- _clutter_event_set_device (event, device);
+ clutter_event_set_device (event, device);
/* XXX keep this in sync with the evdev device manager */
n = print_keysym (event->key.keyval, buffer, sizeof (buffer));
@@ -729,11 +729,11 @@ clutter_device_manager_xi2_translate_event (ClutterEventTranslator *translator,
source_device = g_hash_table_lookup (manager_xi2->devices_by_id,
GINT_TO_POINTER (xev->sourceid));
- _clutter_event_set_source_device (event, source_device);
+ clutter_event_set_source_device (event, source_device);
device = g_hash_table_lookup (manager_xi2->devices_by_id,
GINT_TO_POINTER (xev->deviceid));
- _clutter_event_set_device (event, device);
+ clutter_event_set_device (event, device);
event->scroll.axes = translate_axes (event->scroll.device,
event->scroll.x,
@@ -760,11 +760,11 @@ clutter_device_manager_xi2_translate_event (ClutterEventTranslator *translator,
source_device = g_hash_table_lookup (manager_xi2->devices_by_id,
GINT_TO_POINTER (xev->sourceid));
- _clutter_event_set_source_device (event, source_device);
+ clutter_event_set_source_device (event, source_device);
device = g_hash_table_lookup (manager_xi2->devices_by_id,
GINT_TO_POINTER (xev->deviceid));
- _clutter_event_set_device (event, device);
+ clutter_event_set_device (event, device);
event->button.axes = translate_axes (event->button.device,
event->button.x,
@@ -813,11 +813,11 @@ clutter_device_manager_xi2_translate_event (ClutterEventTranslator *translator,
source_device = g_hash_table_lookup (manager_xi2->devices_by_id,
GINT_TO_POINTER (xev->sourceid));
- _clutter_event_set_source_device (event, source_device);
+ clutter_event_set_source_device (event, source_device);
device = g_hash_table_lookup (manager_xi2->devices_by_id,
GINT_TO_POINTER (xev->deviceid));
- _clutter_event_set_device (event, device);
+ clutter_event_set_device (event, device);
event->motion.axes = translate_axes (event->motion.device,
event->motion.x,
@@ -890,7 +890,7 @@ clutter_device_manager_xi2_translate_event (ClutterEventTranslator *translator,
}
clutter_event_set_device (event, device);
- _clutter_event_set_source_device (event, source_device);
+ clutter_event_set_source_device (event, source_device);
retval = CLUTTER_TRANSLATE_QUEUE;
}
diff --git a/doc/reference/clutter/clutter-sections.txt b/doc/reference/clutter/clutter-sections.txt
index baf505db0..ba95702eb 100644
--- a/doc/reference/clutter/clutter-sections.txt
+++ b/doc/reference/clutter/clutter-sections.txt
@@ -1023,11 +1023,17 @@ clutter_event_free
clutter_event_type
<SUBSECTION>
+clutter_event_set_coords
clutter_event_get_coords
+clutter_event_set_state
clutter_event_get_state
+clutter_event_set_time
clutter_event_get_time
+clutter_event_set_source
clutter_event_get_source
+clutter_event_set_stage
clutter_event_get_stage
+clutter_event_set_flags
clutter_event_get_flags
clutter_event_get_axes
@@ -1038,27 +1044,34 @@ clutter_event_put
clutter_events_pending
<SUBSECTION>
+clutter_event_set_button
clutter_event_get_button
clutter_event_get_click_count
<SUBSECTION>
+clutter_event_set_key_symbol
clutter_event_get_key_symbol
+clutter_event_set_key_code
clutter_event_get_key_code
+clutter_event_set_key_unicode
clutter_event_get_key_unicode
clutter_keysym_to_unicode
<SUBSECTION>
+clutter_event_set_related
clutter_event_get_related
<SUBSECTION>
+clutter_event_set_scroll_direction
clutter_event_get_scroll_direction
<SUBSECTION>
clutter_event_set_device
clutter_event_get_device
+clutter_event_set_source_device
+clutter_event_get_source_device
clutter_event_get_device_id
clutter_event_get_device_type
-clutter_event_get_source_device
<SUBSECTION>
clutter_get_current_event_time
diff --git a/tests/conform/test-clutter-text.c b/tests/conform/test-clutter-text.c
index 7afec1780..ca24fe2be 100644
--- a/tests/conform/test-clutter-text.c
+++ b/tests/conform/test-clutter-text.c
@@ -300,40 +300,43 @@ text_password_char (void)
clutter_actor_destroy (CLUTTER_ACTOR (text));
}
-static void
-init_event (ClutterKeyEvent *event)
+static ClutterEvent *
+init_event (void)
{
- event->type = CLUTTER_KEY_PRESS;
- event->time = 0; /* not needed */
- event->flags = CLUTTER_EVENT_FLAG_SYNTHETIC;
- event->stage = NULL; /* not needed */
- event->source = NULL; /* not needed */
- event->modifier_state = 0;
- event->hardware_keycode = 0; /* not needed */
+ ClutterEvent *retval = clutter_event_new (CLUTTER_KEY_PRESS);
+
+ clutter_event_set_time (retval, CLUTTER_CURRENT_TIME);
+ clutter_event_set_flags (retval, CLUTTER_EVENT_FLAG_SYNTHETIC);
+
+ return retval;
}
static void
send_keyval (ClutterText *text, int keyval)
{
- ClutterKeyEvent event;
+ ClutterEvent *event = init_event ();
- init_event (&event);
- event.keyval = keyval;
- event.unicode_value = 0; /* should be ignored for cursor keys etc. */
+ /* Unicode should be ignored for cursor keys etc. */
+ clutter_event_set_key_unicode (event, 0);
+ clutter_event_set_key_symbol (event, keyval);
- clutter_actor_event (CLUTTER_ACTOR (text), (ClutterEvent *) &event, FALSE);
+ clutter_actor_event (CLUTTER_ACTOR (text), event, FALSE);
+
+ clutter_event_free (event);
}
static void
send_unichar (ClutterText *text, gunichar unichar)
{
- ClutterKeyEvent event;
+ ClutterEvent *event = init_event ();
+
+ /* Key symbol should be ignored for printable characters */
+ clutter_event_set_key_symbol (event, 0);
+ clutter_event_set_key_unicode (event, unichar);
- init_event (&event);
- event.keyval = 0; /* should be ignored for printable characters */
- event.unicode_value = unichar;
+ clutter_actor_event (CLUTTER_ACTOR (text), event, FALSE);
- clutter_actor_event (CLUTTER_ACTOR (text), (ClutterEvent *) &event, FALSE);
+ clutter_event_free (event);
}
void