From e0444a3d35e35a8b1caf6ce6732f907c4d2f61bd Mon Sep 17 00:00:00 2001 From: Carlos Garnacho Date: Thu, 19 Nov 2020 13:51:42 +0100 Subject: 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: --- src/backends/x11/meta-input-device-x11.c | 3 ++- src/backends/x11/meta-seat-x11.c | 20 ++++++++++---------- 2 files changed, 12 insertions(+), 11 deletions(-) (limited to 'src') diff --git a/src/backends/x11/meta-input-device-x11.c b/src/backends/x11/meta-input-device-x11.c index 545a3a339..0c4e023d1 100644 --- a/src/backends/x11/meta-input-device-x11.c +++ b/src/backends/x11/meta-input-device-x11.c @@ -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) diff --git a/src/backends/x11/meta-seat-x11.c b/src/backends/x11/meta-seat-x11.c index 5a889b905..ce1fae3c0 100644 --- a/src/backends/x11/meta-seat-x11.c +++ b/src/backends/x11/meta-seat-x11.c @@ -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, -- cgit v1.2.1