mirror of
https://github.com/brl/mutter.git
synced 2024-11-25 01:20:42 -05:00
clutter: Move ClutterInputDevice fields to private struct
All that is left in the "public" struct is all state that ClutterStage delegates on ClutterInputDevice. That should move somewhere else, but not here, not now. All private fields belong to construct-only properties, with only getter API, and idempotent vmethods (except keyboard a11y, atm). This should be enough to make ClutterInputDevice obviously thread safe, outside the backend. Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1403>
This commit is contained in:
parent
71b4c0ee02
commit
e0444a3d35
@ -53,15 +53,6 @@ struct _ClutterInputDevice
|
||||
{
|
||||
GObject parent_instance;
|
||||
|
||||
ClutterInputDeviceType device_type;
|
||||
ClutterInputMode device_mode;
|
||||
|
||||
char *device_name;
|
||||
|
||||
ClutterSeat *seat;
|
||||
|
||||
ClutterBackend *backend;
|
||||
|
||||
/* the actor underneath the pointer */
|
||||
ClutterActor *cursor_actor;
|
||||
GHashTable *inv_touch_sequence_actors;
|
||||
@ -74,10 +65,7 @@ struct _ClutterInputDevice
|
||||
|
||||
/* the current click count */
|
||||
int click_count;
|
||||
|
||||
/* the current state */
|
||||
int current_button_number;
|
||||
ClutterModifierType current_state;
|
||||
|
||||
/* the current touch points targets */
|
||||
GHashTable *touch_sequence_actors;
|
||||
@ -88,17 +76,6 @@ struct _ClutterInputDevice
|
||||
uint32_t previous_time;
|
||||
int previous_button_number;
|
||||
|
||||
char *vendor_id;
|
||||
char *product_id;
|
||||
char *node_path;
|
||||
|
||||
int n_rings;
|
||||
int n_strips;
|
||||
int n_mode_groups;
|
||||
|
||||
guint has_cursor : 1;
|
||||
guint is_enabled : 1;
|
||||
|
||||
/* Accessiblity */
|
||||
ClutterVirtualInputDevice *accessibility_virtual_device;
|
||||
ClutterPtrA11yData *ptr_a11y_data;
|
||||
|
@ -80,17 +80,43 @@ static void on_cursor_actor_reactive_changed (ClutterActor *actor,
|
||||
|
||||
static GParamSpec *obj_props[PROP_LAST] = { NULL, };
|
||||
|
||||
G_DEFINE_TYPE (ClutterInputDevice, clutter_input_device, G_TYPE_OBJECT);
|
||||
typedef struct _ClutterInputDevicePrivate ClutterInputDevicePrivate;
|
||||
|
||||
struct _ClutterInputDevicePrivate
|
||||
{
|
||||
ClutterInputDeviceType device_type;
|
||||
ClutterInputMode device_mode;
|
||||
|
||||
char *device_name;
|
||||
|
||||
ClutterSeat *seat;
|
||||
|
||||
ClutterBackend *backend;
|
||||
|
||||
char *vendor_id;
|
||||
char *product_id;
|
||||
char *node_path;
|
||||
|
||||
int n_rings;
|
||||
int n_strips;
|
||||
int n_mode_groups;
|
||||
|
||||
gboolean has_cursor;
|
||||
};
|
||||
|
||||
G_DEFINE_TYPE_WITH_PRIVATE (ClutterInputDevice, clutter_input_device, G_TYPE_OBJECT);
|
||||
|
||||
static void
|
||||
clutter_input_device_dispose (GObject *gobject)
|
||||
{
|
||||
ClutterInputDevice *device = CLUTTER_INPUT_DEVICE (gobject);
|
||||
ClutterInputDevicePrivate *priv =
|
||||
clutter_input_device_get_instance_private (device);
|
||||
|
||||
g_clear_pointer (&device->device_name, g_free);
|
||||
g_clear_pointer (&device->vendor_id, g_free);
|
||||
g_clear_pointer (&device->product_id, g_free);
|
||||
g_clear_pointer (&device->node_path, g_free);
|
||||
g_clear_pointer (&priv->device_name, g_free);
|
||||
g_clear_pointer (&priv->vendor_id, g_free);
|
||||
g_clear_pointer (&priv->product_id, g_free);
|
||||
g_clear_pointer (&priv->node_path, g_free);
|
||||
|
||||
if (device->accessibility_virtual_device)
|
||||
g_clear_object (&device->accessibility_virtual_device);
|
||||
@ -141,55 +167,57 @@ clutter_input_device_set_property (GObject *gobject,
|
||||
GParamSpec *pspec)
|
||||
{
|
||||
ClutterInputDevice *self = CLUTTER_INPUT_DEVICE (gobject);
|
||||
ClutterInputDevicePrivate *priv =
|
||||
clutter_input_device_get_instance_private (self);
|
||||
|
||||
switch (prop_id)
|
||||
{
|
||||
case PROP_DEVICE_TYPE:
|
||||
self->device_type = g_value_get_enum (value);
|
||||
priv->device_type = g_value_get_enum (value);
|
||||
break;
|
||||
|
||||
case PROP_SEAT:
|
||||
self->seat = g_value_get_object (value);
|
||||
priv->seat = g_value_get_object (value);
|
||||
break;
|
||||
|
||||
case PROP_DEVICE_MODE:
|
||||
self->device_mode = g_value_get_enum (value);
|
||||
priv->device_mode = g_value_get_enum (value);
|
||||
break;
|
||||
|
||||
case PROP_BACKEND:
|
||||
self->backend = g_value_get_object (value);
|
||||
priv->backend = g_value_get_object (value);
|
||||
break;
|
||||
|
||||
case PROP_NAME:
|
||||
self->device_name = g_value_dup_string (value);
|
||||
priv->device_name = g_value_dup_string (value);
|
||||
break;
|
||||
|
||||
case PROP_HAS_CURSOR:
|
||||
self->has_cursor = g_value_get_boolean (value);
|
||||
priv->has_cursor = g_value_get_boolean (value);
|
||||
break;
|
||||
|
||||
case PROP_VENDOR_ID:
|
||||
self->vendor_id = g_value_dup_string (value);
|
||||
priv->vendor_id = g_value_dup_string (value);
|
||||
break;
|
||||
|
||||
case PROP_PRODUCT_ID:
|
||||
self->product_id = g_value_dup_string (value);
|
||||
priv->product_id = g_value_dup_string (value);
|
||||
break;
|
||||
|
||||
case PROP_N_RINGS:
|
||||
self->n_rings = g_value_get_int (value);
|
||||
priv->n_rings = g_value_get_int (value);
|
||||
break;
|
||||
|
||||
case PROP_N_STRIPS:
|
||||
self->n_strips = g_value_get_int (value);
|
||||
priv->n_strips = g_value_get_int (value);
|
||||
break;
|
||||
|
||||
case PROP_N_MODE_GROUPS:
|
||||
self->n_mode_groups = g_value_get_int (value);
|
||||
priv->n_mode_groups = g_value_get_int (value);
|
||||
break;
|
||||
|
||||
case PROP_DEVICE_NODE:
|
||||
self->node_path = g_value_dup_string (value);
|
||||
priv->node_path = g_value_dup_string (value);
|
||||
break;
|
||||
|
||||
default:
|
||||
@ -205,55 +233,57 @@ clutter_input_device_get_property (GObject *gobject,
|
||||
GParamSpec *pspec)
|
||||
{
|
||||
ClutterInputDevice *self = CLUTTER_INPUT_DEVICE (gobject);
|
||||
ClutterInputDevicePrivate *priv =
|
||||
clutter_input_device_get_instance_private (self);
|
||||
|
||||
switch (prop_id)
|
||||
{
|
||||
case PROP_DEVICE_TYPE:
|
||||
g_value_set_enum (value, self->device_type);
|
||||
g_value_set_enum (value, priv->device_type);
|
||||
break;
|
||||
|
||||
case PROP_SEAT:
|
||||
g_value_set_object (value, self->seat);
|
||||
g_value_set_object (value, priv->seat);
|
||||
break;
|
||||
|
||||
case PROP_DEVICE_MODE:
|
||||
g_value_set_enum (value, self->device_mode);
|
||||
g_value_set_enum (value, priv->device_mode);
|
||||
break;
|
||||
|
||||
case PROP_BACKEND:
|
||||
g_value_set_object (value, self->backend);
|
||||
g_value_set_object (value, priv->backend);
|
||||
break;
|
||||
|
||||
case PROP_NAME:
|
||||
g_value_set_string (value, self->device_name);
|
||||
g_value_set_string (value, priv->device_name);
|
||||
break;
|
||||
|
||||
case PROP_HAS_CURSOR:
|
||||
g_value_set_boolean (value, self->has_cursor);
|
||||
g_value_set_boolean (value, priv->has_cursor);
|
||||
break;
|
||||
|
||||
case PROP_VENDOR_ID:
|
||||
g_value_set_string (value, self->vendor_id);
|
||||
g_value_set_string (value, priv->vendor_id);
|
||||
break;
|
||||
|
||||
case PROP_PRODUCT_ID:
|
||||
g_value_set_string (value, self->product_id);
|
||||
g_value_set_string (value, priv->product_id);
|
||||
break;
|
||||
|
||||
case PROP_N_RINGS:
|
||||
g_value_set_int (value, self->n_rings);
|
||||
g_value_set_int (value, priv->n_rings);
|
||||
break;
|
||||
|
||||
case PROP_N_STRIPS:
|
||||
g_value_set_int (value, self->n_strips);
|
||||
g_value_set_int (value, priv->n_strips);
|
||||
break;
|
||||
|
||||
case PROP_N_MODE_GROUPS:
|
||||
g_value_set_int (value, self->n_mode_groups);
|
||||
g_value_set_int (value, priv->n_mode_groups);
|
||||
break;
|
||||
|
||||
case PROP_DEVICE_NODE:
|
||||
g_value_set_string (value, self->node_path);
|
||||
g_value_set_string (value, priv->node_path);
|
||||
break;
|
||||
|
||||
default:
|
||||
@ -418,7 +448,10 @@ clutter_input_device_class_init (ClutterInputDeviceClass *klass)
|
||||
static void
|
||||
clutter_input_device_init (ClutterInputDevice *self)
|
||||
{
|
||||
self->device_type = CLUTTER_POINTER_DEVICE;
|
||||
ClutterInputDevicePrivate *priv =
|
||||
clutter_input_device_get_instance_private (self);
|
||||
|
||||
priv->device_type = CLUTTER_POINTER_DEVICE;
|
||||
|
||||
self->click_count = 0;
|
||||
|
||||
@ -615,10 +648,13 @@ _clutter_input_device_set_actor (ClutterInputDevice *device,
|
||||
ClutterInputDeviceType
|
||||
clutter_input_device_get_device_type (ClutterInputDevice *device)
|
||||
{
|
||||
ClutterInputDevicePrivate *priv =
|
||||
clutter_input_device_get_instance_private (device);
|
||||
|
||||
g_return_val_if_fail (CLUTTER_IS_INPUT_DEVICE (device),
|
||||
CLUTTER_POINTER_DEVICE);
|
||||
|
||||
return device->device_type;
|
||||
return priv->device_type;
|
||||
}
|
||||
|
||||
/*
|
||||
@ -645,7 +681,9 @@ clutter_input_device_update (ClutterInputDevice *device,
|
||||
ClutterActor *new_cursor_actor;
|
||||
ClutterActor *old_cursor_actor;
|
||||
graphene_point_t point = GRAPHENE_POINT_INIT (-1.0f, -1.0f);
|
||||
ClutterInputDeviceType device_type = device->device_type;
|
||||
ClutterInputDevicePrivate *priv =
|
||||
clutter_input_device_get_instance_private (device);
|
||||
ClutterInputDeviceType device_type = priv->device_type;
|
||||
uint32_t time_ms;
|
||||
|
||||
g_assert (device_type != CLUTTER_KEYBOARD_DEVICE &&
|
||||
@ -734,9 +772,12 @@ clutter_input_device_get_actor (ClutterInputDevice *device,
|
||||
const gchar *
|
||||
clutter_input_device_get_device_name (ClutterInputDevice *device)
|
||||
{
|
||||
ClutterInputDevicePrivate *priv =
|
||||
clutter_input_device_get_instance_private (device);
|
||||
|
||||
g_return_val_if_fail (CLUTTER_IS_INPUT_DEVICE (device), NULL);
|
||||
|
||||
return device->device_name;
|
||||
return priv->device_name;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -753,9 +794,12 @@ clutter_input_device_get_device_name (ClutterInputDevice *device)
|
||||
gboolean
|
||||
clutter_input_device_get_has_cursor (ClutterInputDevice *device)
|
||||
{
|
||||
ClutterInputDevicePrivate *priv =
|
||||
clutter_input_device_get_instance_private (device);
|
||||
|
||||
g_return_val_if_fail (CLUTTER_IS_INPUT_DEVICE (device), FALSE);
|
||||
|
||||
return device->has_cursor;
|
||||
return priv->has_cursor;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -771,10 +815,13 @@ clutter_input_device_get_has_cursor (ClutterInputDevice *device)
|
||||
ClutterInputMode
|
||||
clutter_input_device_get_device_mode (ClutterInputDevice *device)
|
||||
{
|
||||
ClutterInputDevicePrivate *priv =
|
||||
clutter_input_device_get_instance_private (device);
|
||||
|
||||
g_return_val_if_fail (CLUTTER_IS_INPUT_DEVICE (device),
|
||||
CLUTTER_INPUT_MODE_FLOATING);
|
||||
|
||||
return device->device_mode;
|
||||
return priv->device_mode;
|
||||
}
|
||||
|
||||
/*< private >
|
||||
@ -817,7 +864,10 @@ static void
|
||||
on_grab_actor_destroy (ClutterActor *actor,
|
||||
ClutterInputDevice *device)
|
||||
{
|
||||
switch (device->device_type)
|
||||
ClutterInputDevicePrivate *priv =
|
||||
clutter_input_device_get_instance_private (device);
|
||||
|
||||
switch (priv->device_type)
|
||||
{
|
||||
case CLUTTER_POINTER_DEVICE:
|
||||
case CLUTTER_TABLET_DEVICE:
|
||||
@ -857,11 +907,13 @@ clutter_input_device_grab (ClutterInputDevice *device,
|
||||
ClutterActor *actor)
|
||||
{
|
||||
ClutterActor **grab_actor;
|
||||
ClutterInputDevicePrivate *priv =
|
||||
clutter_input_device_get_instance_private (device);
|
||||
|
||||
g_return_if_fail (CLUTTER_IS_INPUT_DEVICE (device));
|
||||
g_return_if_fail (CLUTTER_IS_ACTOR (actor));
|
||||
|
||||
switch (device->device_type)
|
||||
switch (priv->device_type)
|
||||
{
|
||||
case CLUTTER_POINTER_DEVICE:
|
||||
case CLUTTER_TABLET_DEVICE:
|
||||
@ -904,10 +956,12 @@ void
|
||||
clutter_input_device_ungrab (ClutterInputDevice *device)
|
||||
{
|
||||
ClutterActor **grab_actor;
|
||||
ClutterInputDevicePrivate *priv =
|
||||
clutter_input_device_get_instance_private (device);
|
||||
|
||||
g_return_if_fail (CLUTTER_IS_INPUT_DEVICE (device));
|
||||
|
||||
switch (device->device_type)
|
||||
switch (priv->device_type)
|
||||
{
|
||||
case CLUTTER_POINTER_DEVICE:
|
||||
case CLUTTER_TABLET_DEVICE:
|
||||
@ -946,9 +1000,12 @@ clutter_input_device_ungrab (ClutterInputDevice *device)
|
||||
ClutterActor *
|
||||
clutter_input_device_get_grabbed_actor (ClutterInputDevice *device)
|
||||
{
|
||||
ClutterInputDevicePrivate *priv =
|
||||
clutter_input_device_get_instance_private (device);
|
||||
|
||||
g_return_val_if_fail (CLUTTER_IS_INPUT_DEVICE (device), NULL);
|
||||
|
||||
switch (device->device_type)
|
||||
switch (priv->device_type)
|
||||
{
|
||||
case CLUTTER_POINTER_DEVICE:
|
||||
case CLUTTER_TABLET_DEVICE:
|
||||
@ -1113,10 +1170,13 @@ clutter_input_device_sequence_get_grabbed_actor (ClutterInputDevice *device,
|
||||
const gchar *
|
||||
clutter_input_device_get_vendor_id (ClutterInputDevice *device)
|
||||
{
|
||||
ClutterInputDevicePrivate *priv =
|
||||
clutter_input_device_get_instance_private (device);
|
||||
|
||||
g_return_val_if_fail (CLUTTER_IS_INPUT_DEVICE (device), NULL);
|
||||
g_return_val_if_fail (clutter_input_device_get_device_mode (device) != CLUTTER_INPUT_MODE_LOGICAL, NULL);
|
||||
|
||||
return device->vendor_id;
|
||||
return priv->vendor_id;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -1132,36 +1192,48 @@ clutter_input_device_get_vendor_id (ClutterInputDevice *device)
|
||||
const gchar *
|
||||
clutter_input_device_get_product_id (ClutterInputDevice *device)
|
||||
{
|
||||
ClutterInputDevicePrivate *priv =
|
||||
clutter_input_device_get_instance_private (device);
|
||||
|
||||
g_return_val_if_fail (CLUTTER_IS_INPUT_DEVICE (device), NULL);
|
||||
g_return_val_if_fail (clutter_input_device_get_device_mode (device) != CLUTTER_INPUT_MODE_LOGICAL, NULL);
|
||||
|
||||
return device->product_id;
|
||||
return priv->product_id;
|
||||
}
|
||||
|
||||
gint
|
||||
clutter_input_device_get_n_rings (ClutterInputDevice *device)
|
||||
{
|
||||
ClutterInputDevicePrivate *priv =
|
||||
clutter_input_device_get_instance_private (device);
|
||||
|
||||
g_return_val_if_fail (CLUTTER_IS_INPUT_DEVICE (device), 0);
|
||||
|
||||
return device->n_rings;
|
||||
return priv->n_rings;
|
||||
}
|
||||
|
||||
gint
|
||||
clutter_input_device_get_n_strips (ClutterInputDevice *device)
|
||||
{
|
||||
ClutterInputDevicePrivate *priv =
|
||||
clutter_input_device_get_instance_private (device);
|
||||
|
||||
g_return_val_if_fail (CLUTTER_IS_INPUT_DEVICE (device), 0);
|
||||
|
||||
return device->n_strips;
|
||||
return priv->n_strips;
|
||||
}
|
||||
|
||||
gint
|
||||
clutter_input_device_get_n_mode_groups (ClutterInputDevice *device)
|
||||
{
|
||||
ClutterInputDevicePrivate *priv =
|
||||
clutter_input_device_get_instance_private (device);
|
||||
|
||||
g_return_val_if_fail (CLUTTER_IS_INPUT_DEVICE (device), 0);
|
||||
g_return_val_if_fail (clutter_input_device_get_device_type (device) ==
|
||||
CLUTTER_PAD_DEVICE, 0);
|
||||
|
||||
return device->n_mode_groups;
|
||||
return priv->n_mode_groups;
|
||||
}
|
||||
|
||||
gint
|
||||
@ -1206,13 +1278,15 @@ gint
|
||||
clutter_input_device_get_mode_switch_button_group (ClutterInputDevice *device,
|
||||
guint button)
|
||||
{
|
||||
ClutterInputDevicePrivate *priv =
|
||||
clutter_input_device_get_instance_private (device);
|
||||
gint group;
|
||||
|
||||
g_return_val_if_fail (CLUTTER_IS_INPUT_DEVICE (device), -1);
|
||||
g_return_val_if_fail (clutter_input_device_get_device_type (device) ==
|
||||
CLUTTER_PAD_DEVICE, -1);
|
||||
|
||||
for (group = 0; group < device->n_mode_groups; group++)
|
||||
for (group = 0; group < priv->n_mode_groups; group++)
|
||||
{
|
||||
if (clutter_input_device_is_mode_switch_button (device, group, button))
|
||||
return group;
|
||||
@ -1224,9 +1298,12 @@ clutter_input_device_get_mode_switch_button_group (ClutterInputDevice *device,
|
||||
const gchar *
|
||||
clutter_input_device_get_device_node (ClutterInputDevice *device)
|
||||
{
|
||||
ClutterInputDevicePrivate *priv =
|
||||
clutter_input_device_get_instance_private (device);
|
||||
|
||||
g_return_val_if_fail (CLUTTER_IS_INPUT_DEVICE (device), NULL);
|
||||
|
||||
return device->node_path;
|
||||
return priv->node_path;
|
||||
}
|
||||
|
||||
gboolean
|
||||
@ -1250,7 +1327,10 @@ clutter_input_device_is_grouped (ClutterInputDevice *device,
|
||||
ClutterSeat *
|
||||
clutter_input_device_get_seat (ClutterInputDevice *device)
|
||||
{
|
||||
ClutterInputDevicePrivate *priv =
|
||||
clutter_input_device_get_instance_private (device);
|
||||
|
||||
g_return_val_if_fail (CLUTTER_IS_INPUT_DEVICE (device), NULL);
|
||||
|
||||
return device->seat;
|
||||
return priv->seat;
|
||||
}
|
||||
|
@ -36,8 +36,9 @@ static gboolean
|
||||
is_secondary_click_enabled (ClutterInputDevice *device)
|
||||
{
|
||||
ClutterPointerA11ySettings settings;
|
||||
ClutterSeat *seat = clutter_input_device_get_seat (device);
|
||||
|
||||
clutter_seat_get_pointer_a11y_settings (device->seat, &settings);
|
||||
clutter_seat_get_pointer_a11y_settings (seat, &settings);
|
||||
|
||||
return (settings.controls & CLUTTER_A11Y_SECONDARY_CLICK_ENABLED);
|
||||
}
|
||||
@ -46,8 +47,9 @@ static gboolean
|
||||
is_dwell_click_enabled (ClutterInputDevice *device)
|
||||
{
|
||||
ClutterPointerA11ySettings settings;
|
||||
ClutterSeat *seat = clutter_input_device_get_seat (device);
|
||||
|
||||
clutter_seat_get_pointer_a11y_settings (device->seat, &settings);
|
||||
clutter_seat_get_pointer_a11y_settings (seat, &settings);
|
||||
|
||||
return (settings.controls & CLUTTER_A11Y_DWELL_ENABLED);
|
||||
}
|
||||
@ -56,8 +58,9 @@ static unsigned int
|
||||
get_secondary_click_delay (ClutterInputDevice *device)
|
||||
{
|
||||
ClutterPointerA11ySettings settings;
|
||||
ClutterSeat *seat = clutter_input_device_get_seat (device);
|
||||
|
||||
clutter_seat_get_pointer_a11y_settings (device->seat, &settings);
|
||||
clutter_seat_get_pointer_a11y_settings (seat, &settings);
|
||||
|
||||
return settings.secondary_click_delay;
|
||||
}
|
||||
@ -66,8 +69,9 @@ static unsigned int
|
||||
get_dwell_delay (ClutterInputDevice *device)
|
||||
{
|
||||
ClutterPointerA11ySettings settings;
|
||||
ClutterSeat *seat = clutter_input_device_get_seat (device);
|
||||
|
||||
clutter_seat_get_pointer_a11y_settings (device->seat, &settings);
|
||||
clutter_seat_get_pointer_a11y_settings (seat, &settings);
|
||||
|
||||
return settings.dwell_delay;
|
||||
}
|
||||
@ -76,8 +80,9 @@ static unsigned int
|
||||
get_dwell_threshold (ClutterInputDevice *device)
|
||||
{
|
||||
ClutterPointerA11ySettings settings;
|
||||
ClutterSeat *seat = clutter_input_device_get_seat (device);
|
||||
|
||||
clutter_seat_get_pointer_a11y_settings (device->seat, &settings);
|
||||
clutter_seat_get_pointer_a11y_settings (seat, &settings);
|
||||
|
||||
return settings.dwell_threshold;
|
||||
}
|
||||
@ -86,8 +91,9 @@ static ClutterPointerA11yDwellMode
|
||||
get_dwell_mode (ClutterInputDevice *device)
|
||||
{
|
||||
ClutterPointerA11ySettings settings;
|
||||
ClutterSeat *seat = clutter_input_device_get_seat (device);
|
||||
|
||||
clutter_seat_get_pointer_a11y_settings (device->seat, &settings);
|
||||
clutter_seat_get_pointer_a11y_settings (seat, &settings);
|
||||
|
||||
return settings.dwell_mode;
|
||||
}
|
||||
@ -96,8 +102,9 @@ static ClutterPointerA11yDwellClickType
|
||||
get_dwell_click_type (ClutterInputDevice *device)
|
||||
{
|
||||
ClutterPointerA11ySettings settings;
|
||||
ClutterSeat *seat = clutter_input_device_get_seat (device);
|
||||
|
||||
clutter_seat_get_pointer_a11y_settings (device->seat, &settings);
|
||||
clutter_seat_get_pointer_a11y_settings (seat, &settings);
|
||||
|
||||
return settings.dwell_click_type;
|
||||
}
|
||||
@ -107,8 +114,9 @@ get_dwell_click_type_for_direction (ClutterInputDevice *device,
|
||||
ClutterPointerA11yDwellDirection direction)
|
||||
{
|
||||
ClutterPointerA11ySettings settings;
|
||||
ClutterSeat *seat = clutter_input_device_get_seat (device);
|
||||
|
||||
clutter_seat_get_pointer_a11y_settings (device->seat, &settings);
|
||||
clutter_seat_get_pointer_a11y_settings (seat, &settings);
|
||||
|
||||
if (direction == settings.dwell_gesture_single)
|
||||
return CLUTTER_A11Y_DWELL_CLICK_TYPE_PRIMARY;
|
||||
@ -163,11 +171,12 @@ static gboolean
|
||||
trigger_secondary_click (gpointer data)
|
||||
{
|
||||
ClutterInputDevice *device = data;
|
||||
ClutterSeat *seat = clutter_input_device_get_seat (device);
|
||||
|
||||
device->ptr_a11y_data->secondary_click_triggered = TRUE;
|
||||
device->ptr_a11y_data->secondary_click_timer = 0;
|
||||
|
||||
g_signal_emit_by_name (device->seat,
|
||||
g_signal_emit_by_name (seat,
|
||||
"ptr-a11y-timeout-stopped",
|
||||
device,
|
||||
CLUTTER_A11Y_TIMEOUT_TYPE_SECONDARY_CLICK,
|
||||
@ -180,11 +189,12 @@ static void
|
||||
start_secondary_click_timeout (ClutterInputDevice *device)
|
||||
{
|
||||
unsigned int delay = get_secondary_click_delay (device);
|
||||
ClutterSeat *seat = clutter_input_device_get_seat (device);
|
||||
|
||||
device->ptr_a11y_data->secondary_click_timer =
|
||||
clutter_threads_add_timeout (delay, trigger_secondary_click, device);
|
||||
|
||||
g_signal_emit_by_name (device->seat,
|
||||
g_signal_emit_by_name (seat,
|
||||
"ptr-a11y-timeout-started",
|
||||
device,
|
||||
CLUTTER_A11Y_TIMEOUT_TYPE_SECONDARY_CLICK,
|
||||
@ -194,12 +204,14 @@ start_secondary_click_timeout (ClutterInputDevice *device)
|
||||
static void
|
||||
stop_secondary_click_timeout (ClutterInputDevice *device)
|
||||
{
|
||||
ClutterSeat *seat = clutter_input_device_get_seat (device);
|
||||
|
||||
if (device->ptr_a11y_data->secondary_click_timer)
|
||||
{
|
||||
g_clear_handle_id (&device->ptr_a11y_data->secondary_click_timer,
|
||||
g_source_remove);
|
||||
|
||||
g_signal_emit_by_name (device->seat,
|
||||
g_signal_emit_by_name (seat,
|
||||
"ptr-a11y-timeout-stopped",
|
||||
device,
|
||||
CLUTTER_A11Y_TIMEOUT_TYPE_SECONDARY_CLICK,
|
||||
@ -302,8 +314,9 @@ update_dwell_click_type (ClutterInputDevice *device)
|
||||
{
|
||||
ClutterPointerA11ySettings settings;
|
||||
ClutterPointerA11yDwellClickType dwell_click_type;
|
||||
ClutterSeat *seat = clutter_input_device_get_seat (device);
|
||||
|
||||
clutter_seat_get_pointer_a11y_settings (device->seat, &settings);
|
||||
clutter_seat_get_pointer_a11y_settings (seat, &settings);
|
||||
|
||||
dwell_click_type = settings.dwell_click_type;
|
||||
switch (dwell_click_type)
|
||||
@ -328,9 +341,9 @@ update_dwell_click_type (ClutterInputDevice *device)
|
||||
if (dwell_click_type != settings.dwell_click_type)
|
||||
{
|
||||
settings.dwell_click_type = dwell_click_type;
|
||||
clutter_seat_set_pointer_a11y_settings (device->seat, &settings);
|
||||
clutter_seat_set_pointer_a11y_settings (seat, &settings);
|
||||
|
||||
g_signal_emit_by_name (device->seat,
|
||||
g_signal_emit_by_name (seat,
|
||||
"ptr-a11y-dwell-click-type-changed",
|
||||
dwell_click_type);
|
||||
}
|
||||
@ -424,6 +437,7 @@ trigger_dwell_gesture (gpointer data)
|
||||
ClutterInputDevice *device = data;
|
||||
ClutterPointerA11yDwellDirection direction;
|
||||
unsigned int delay = get_dwell_delay (device);
|
||||
ClutterSeat *seat = clutter_input_device_get_seat (device);
|
||||
|
||||
restore_dwell_position (device);
|
||||
direction = get_dwell_direction (device);
|
||||
@ -435,7 +449,7 @@ trigger_dwell_gesture (gpointer data)
|
||||
device->ptr_a11y_data->dwell_timer =
|
||||
clutter_threads_add_timeout (delay, trigger_clear_dwell_gesture, device);
|
||||
|
||||
g_signal_emit_by_name (device->seat,
|
||||
g_signal_emit_by_name (seat,
|
||||
"ptr-a11y-timeout-stopped",
|
||||
device,
|
||||
CLUTTER_A11Y_TIMEOUT_TYPE_GESTURE,
|
||||
@ -448,12 +462,13 @@ static void
|
||||
start_dwell_gesture_timeout (ClutterInputDevice *device)
|
||||
{
|
||||
unsigned int delay = get_dwell_delay (device);
|
||||
ClutterSeat *seat = clutter_input_device_get_seat (device);
|
||||
|
||||
device->ptr_a11y_data->dwell_timer =
|
||||
clutter_threads_add_timeout (delay, trigger_dwell_gesture, device);
|
||||
device->ptr_a11y_data->dwell_gesture_started = TRUE;
|
||||
|
||||
g_signal_emit_by_name (device->seat,
|
||||
g_signal_emit_by_name (seat,
|
||||
"ptr-a11y-timeout-started",
|
||||
device,
|
||||
CLUTTER_A11Y_TIMEOUT_TYPE_GESTURE,
|
||||
@ -464,10 +479,11 @@ static gboolean
|
||||
trigger_dwell_click (gpointer data)
|
||||
{
|
||||
ClutterInputDevice *device = data;
|
||||
ClutterSeat *seat = clutter_input_device_get_seat (device);
|
||||
|
||||
device->ptr_a11y_data->dwell_timer = 0;
|
||||
|
||||
g_signal_emit_by_name (device->seat,
|
||||
g_signal_emit_by_name (seat,
|
||||
"ptr-a11y-timeout-stopped",
|
||||
device,
|
||||
CLUTTER_A11Y_TIMEOUT_TYPE_DWELL,
|
||||
@ -493,11 +509,12 @@ static void
|
||||
start_dwell_timeout (ClutterInputDevice *device)
|
||||
{
|
||||
unsigned int delay = get_dwell_delay (device);
|
||||
ClutterSeat *seat = clutter_input_device_get_seat (device);
|
||||
|
||||
device->ptr_a11y_data->dwell_timer =
|
||||
clutter_threads_add_timeout (delay, trigger_dwell_click, device);
|
||||
|
||||
g_signal_emit_by_name (device->seat,
|
||||
g_signal_emit_by_name (seat,
|
||||
"ptr-a11y-timeout-started",
|
||||
device,
|
||||
CLUTTER_A11Y_TIMEOUT_TYPE_DWELL,
|
||||
@ -507,12 +524,14 @@ start_dwell_timeout (ClutterInputDevice *device)
|
||||
static void
|
||||
stop_dwell_timeout (ClutterInputDevice *device)
|
||||
{
|
||||
ClutterSeat *seat = clutter_input_device_get_seat (device);
|
||||
|
||||
if (device->ptr_a11y_data->dwell_timer)
|
||||
{
|
||||
g_clear_handle_id (&device->ptr_a11y_data->dwell_timer, g_source_remove);
|
||||
device->ptr_a11y_data->dwell_gesture_started = FALSE;
|
||||
|
||||
g_signal_emit_by_name (device->seat,
|
||||
g_signal_emit_by_name (seat,
|
||||
"ptr-a11y-timeout-stopped",
|
||||
device,
|
||||
CLUTTER_A11Y_TIMEOUT_TYPE_DWELL,
|
||||
@ -570,8 +589,9 @@ static gboolean
|
||||
is_device_core_pointer (ClutterInputDevice *device)
|
||||
{
|
||||
ClutterInputDevice *core_pointer;
|
||||
ClutterSeat *seat = clutter_input_device_get_seat (device);
|
||||
|
||||
core_pointer = clutter_seat_get_pointer (device->seat);
|
||||
core_pointer = clutter_seat_get_pointer (seat);
|
||||
if (core_pointer == NULL)
|
||||
return FALSE;
|
||||
|
||||
@ -581,11 +601,13 @@ is_device_core_pointer (ClutterInputDevice *device)
|
||||
void
|
||||
_clutter_input_pointer_a11y_add_device (ClutterInputDevice *device)
|
||||
{
|
||||
ClutterSeat *seat = clutter_input_device_get_seat (device);
|
||||
|
||||
if (!is_device_core_pointer (device))
|
||||
return;
|
||||
|
||||
device->accessibility_virtual_device =
|
||||
clutter_seat_create_virtual_device (device->seat,
|
||||
clutter_seat_create_virtual_device (seat,
|
||||
CLUTTER_POINTER_DEVICE);
|
||||
|
||||
device->ptr_a11y_data = g_new0 (ClutterPtrA11yData, 1);
|
||||
|
@ -447,7 +447,8 @@ meta_input_device_x11_get_pointer_location (ClutterInputDevice *device,
|
||||
MetaInputDeviceX11 *device_xi2 = META_INPUT_DEVICE_X11 (device);
|
||||
|
||||
g_return_val_if_fail (META_IS_INPUT_DEVICE_X11 (device), FALSE);
|
||||
g_return_val_if_fail (device->device_type == CLUTTER_POINTER_DEVICE, FALSE);
|
||||
g_return_val_if_fail (clutter_input_device_get_device_type (device) ==
|
||||
CLUTTER_POINTER_DEVICE, FALSE);
|
||||
|
||||
/* Throttle XServer queries and roundtrips using an idle timeout */
|
||||
if (device_xi2->inhibit_pointer_query_timer == 0)
|
||||
|
@ -897,7 +897,7 @@ translate_raw_event (MetaSeatX11 *seat_x11,
|
||||
case XI_RawMotion:
|
||||
g_debug ("raw motion: device:%d '%s'",
|
||||
meta_input_device_x11_get_device_id (device),
|
||||
device->device_name);
|
||||
clutter_input_device_get_device_name (device));
|
||||
|
||||
/* We don't get actual pointer location with raw events, and we cannot
|
||||
* rely on `clutter_input_device_get_coords()` either because of
|
||||
@ -914,7 +914,7 @@ translate_raw_event (MetaSeatX11 *seat_x11,
|
||||
? "press "
|
||||
: "release",
|
||||
meta_input_device_x11_get_device_id (device),
|
||||
device->device_name,
|
||||
clutter_input_device_get_device_name (device),
|
||||
xev->detail);
|
||||
_clutter_input_pointer_a11y_on_button_event (device,
|
||||
xev->detail,
|
||||
@ -1019,7 +1019,7 @@ translate_pad_event (ClutterEvent *event,
|
||||
: "pad strip",
|
||||
(unsigned int) xev->event,
|
||||
meta_input_device_x11_get_device_id (device),
|
||||
device->device_name,
|
||||
clutter_input_device_get_device_name (device),
|
||||
event->any.time, value);
|
||||
|
||||
return TRUE;
|
||||
@ -1946,7 +1946,7 @@ meta_seat_x11_translate_event (MetaSeatX11 *seat,
|
||||
: "pad button release",
|
||||
(unsigned int) stage_x11->xwin,
|
||||
meta_input_device_x11_get_device_id (device),
|
||||
device->device_name,
|
||||
clutter_input_device_get_device_name (device),
|
||||
event->any.time,
|
||||
event->pad_button.button);
|
||||
retval = TRUE;
|
||||
@ -1996,7 +1996,7 @@ meta_seat_x11_translate_event (MetaSeatX11 *seat,
|
||||
"emulated:%s)",
|
||||
(unsigned int) stage_x11->xwin,
|
||||
meta_input_device_x11_get_device_id (device),
|
||||
device->device_name,
|
||||
clutter_input_device_get_device_name (device),
|
||||
event->any.time,
|
||||
event->scroll.direction == CLUTTER_SCROLL_UP ? "up" :
|
||||
event->scroll.direction == CLUTTER_SCROLL_DOWN ? "down" :
|
||||
@ -2042,7 +2042,7 @@ meta_seat_x11_translate_event (MetaSeatX11 *seat,
|
||||
: "button release",
|
||||
(unsigned int) stage_x11->xwin,
|
||||
meta_input_device_x11_get_device_id (device),
|
||||
device->device_name,
|
||||
clutter_input_device_get_device_name (device),
|
||||
event->any.time,
|
||||
event->button.button,
|
||||
event->button.x,
|
||||
@ -2105,7 +2105,7 @@ meta_seat_x11_translate_event (MetaSeatX11 *seat,
|
||||
g_debug ("smooth scroll: win:0x%x device:%d '%s' (x:%.2f, y:%.2f, delta:%f, %f)",
|
||||
(unsigned int) stage_x11->xwin,
|
||||
meta_input_device_x11_get_device_id (event->scroll.device),
|
||||
event->scroll.device->device_name,
|
||||
clutter_input_device_get_device_name (event->scroll.device),
|
||||
event->scroll.x,
|
||||
event->scroll.y,
|
||||
delta_x, delta_y);
|
||||
@ -2141,7 +2141,7 @@ meta_seat_x11_translate_event (MetaSeatX11 *seat,
|
||||
g_debug ("motion: win:0x%x device:%d '%s' (x:%.2f, y:%.2f, axes:%s)",
|
||||
(unsigned int) stage_x11->xwin,
|
||||
meta_input_device_x11_get_device_id (event->motion.device),
|
||||
event->motion.device->device_name,
|
||||
clutter_input_device_get_device_name (event->motion.device),
|
||||
event->motion.x,
|
||||
event->motion.y,
|
||||
event->motion.axes != NULL ? "yes" : "no");
|
||||
@ -2213,7 +2213,7 @@ meta_seat_x11_translate_event (MetaSeatX11 *seat,
|
||||
event->type == CLUTTER_TOUCH_BEGIN ? "begin" : "end",
|
||||
(unsigned int) stage_x11->xwin,
|
||||
meta_input_device_x11_get_device_id (event->touch.device),
|
||||
event->touch.device->device_name,
|
||||
clutter_input_device_get_device_name (event->touch.device),
|
||||
GPOINTER_TO_UINT (event->touch.sequence),
|
||||
event->touch.x,
|
||||
event->touch.y,
|
||||
@ -2264,7 +2264,7 @@ meta_seat_x11_translate_event (MetaSeatX11 *seat,
|
||||
g_debug ("touch update: win:0x%x device:%d '%s' (seq:%d, x:%.2f, y:%.2f, axes:%s)",
|
||||
(unsigned int) stage_x11->xwin,
|
||||
meta_input_device_x11_get_device_id (event->touch.device),
|
||||
event->touch.device->device_name,
|
||||
clutter_input_device_get_device_name (event->touch.device),
|
||||
GPOINTER_TO_UINT (event->touch.sequence),
|
||||
event->touch.x,
|
||||
event->touch.y,
|
||||
|
Loading…
Reference in New Issue
Block a user