/* * _clutter_input_device_update: * @device: a #ClutterInputDevice * * Updates the input @device by determining the #ClutterActor underneath the * pointer's cursor * * This function calls _clutter_input_device_set_actor() if needed. * * This function only works for #ClutterInputDevice of type * %CLUTTER_POINTER_DEVICE. * * Since: 1.2 */ ClutterActor * _clutter_input_device_update (ClutterInputDevice *device, gboolean emit_crossing) { ClutterStage *stage; ClutterActor *new_cursor_actor; ClutterActor *old_cursor_actor; gint x, y; if (device->device_type == CLUTTER_KEYBOARD_DEVICE) return NULL; stage = device->stage; if (G_UNLIKELY (stage == NULL)) { CLUTTER_NOTE (EVENT, "No stage defined for device '%s'", clutter_input_device_get_device_name (device)); return NULL; } clutter_input_device_get_device_coords (device, &x, &y); old_cursor_actor = device->cursor_actor; new_cursor_actor = _clutter_do_pick (stage, x, y, CLUTTER_PICK_REACTIVE); /* if the pick could not find an actor then we do not update the * input device, to avoid ghost enter/leave events; the pick should * never fail, except for bugs in the glReadPixels() implementation * in which case this is the safest course of action anyway */ if (new_cursor_actor == NULL) return NULL; CLUTTER_NOTE (EVENT, "Actor under cursor (device %d, at %d, %d): %s", clutter_input_device_get_device_id (device), x, y, clutter_actor_get_name (new_cursor_actor) != NULL ? clutter_actor_get_name (new_cursor_actor) : G_OBJECT_TYPE_NAME (new_cursor_actor)); /* short-circuit here */ if (new_cursor_actor == old_cursor_actor) return old_cursor_actor; _clutter_input_device_set_actor (device, new_cursor_actor, emit_crossing); return device->cursor_actor; }
static void get_pointer_and_view_coords (ClutterActor *self, gint *mouse_x, gint *mouse_y, gfloat *box_x, gfloat *box_y, gfloat *width, gfloat *height) { StScrollViewPrivate *priv = ST_SCROLL_VIEW (self)->priv; clutter_input_device_get_device_coords (priv->mouse_pointer, mouse_x, mouse_y); clutter_actor_get_transformed_position (self, box_x, box_y); clutter_actor_get_transformed_size (self, width, height); }