diff --git a/src/backends/meta-cursor-renderer.c b/src/backends/meta-cursor-renderer.c index 53b1a10a2..095cdbe6d 100644 --- a/src/backends/meta-cursor-renderer.c +++ b/src/backends/meta-cursor-renderer.c @@ -46,6 +46,7 @@ enum PROP_0, PROP_BACKEND, + PROP_DEVICE, N_PROPS }; @@ -59,6 +60,7 @@ struct _MetaCursorRendererPrivate float current_x; float current_y; + ClutterInputDevice *device; MetaCursorSprite *displayed_cursor; MetaCursorSprite *overlay_cursor; @@ -205,6 +207,9 @@ meta_cursor_renderer_get_property (GObject *object, case PROP_BACKEND: g_value_set_object (value, priv->backend); break; + case PROP_DEVICE: + g_value_set_object (value, priv->device); + break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); break; @@ -226,6 +231,9 @@ meta_cursor_renderer_set_property (GObject *object, case PROP_BACKEND: priv->backend = g_value_get_object (value); break; + case PROP_DEVICE: + priv->device = g_value_get_object (value); + break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); break; @@ -286,6 +294,14 @@ meta_cursor_renderer_class_init (MetaCursorRendererClass *klass) G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY | G_PARAM_STATIC_STRINGS); + obj_props[PROP_DEVICE] = + g_param_spec_object ("device", + "device", + "Input device", + CLUTTER_TYPE_INPUT_DEVICE, + G_PARAM_READWRITE | + G_PARAM_CONSTRUCT_ONLY | + G_PARAM_STATIC_STRINGS); g_object_class_install_properties (object_class, N_PROPS, obj_props); signals[CURSOR_PAINTED] = g_signal_new ("cursor-painted", @@ -396,10 +412,12 @@ meta_cursor_renderer_update_cursor (MetaCursorRenderer *renderer, } MetaCursorRenderer * -meta_cursor_renderer_new (MetaBackend *backend) +meta_cursor_renderer_new (MetaBackend *backend, + ClutterInputDevice *device) { return g_object_new (META_TYPE_CURSOR_RENDERER, "backend", backend, + "device", device, NULL); } @@ -511,3 +529,12 @@ meta_cursor_renderer_is_hw_cursors_inhibited (MetaCursorRenderer *renderer, return FALSE; } + +ClutterInputDevice * +meta_cursor_renderer_get_input_device (MetaCursorRenderer *renderer) +{ + MetaCursorRendererPrivate *priv = + meta_cursor_renderer_get_instance_private (renderer); + + return priv->device; +} diff --git a/src/backends/meta-cursor-renderer.h b/src/backends/meta-cursor-renderer.h index 7d89af487..38621027c 100644 --- a/src/backends/meta-cursor-renderer.h +++ b/src/backends/meta-cursor-renderer.h @@ -54,7 +54,8 @@ struct _MetaCursorRendererClass MetaCursorSprite *cursor_sprite); }; -MetaCursorRenderer * meta_cursor_renderer_new (MetaBackend *backend); +MetaCursorRenderer * meta_cursor_renderer_new (MetaBackend *backend, + ClutterInputDevice *device); void meta_cursor_renderer_set_cursor (MetaCursorRenderer *renderer, MetaCursorSprite *cursor_sprite); @@ -83,6 +84,7 @@ graphene_rect_t meta_cursor_renderer_calculate_rect (MetaCursorRenderer *rendere void meta_cursor_renderer_emit_painted (MetaCursorRenderer *renderer, MetaCursorSprite *cursor_sprite); +ClutterInputDevice * meta_cursor_renderer_get_input_device (MetaCursorRenderer *renderer); void meta_cursor_renderer_update_stage_overlay (MetaCursorRenderer *renderer, MetaCursorSprite *cursor_sprite); diff --git a/src/backends/native/meta-cursor-renderer-native.c b/src/backends/native/meta-cursor-renderer-native.c index 3c6688df4..e4b7c07c6 100644 --- a/src/backends/native/meta-cursor-renderer-native.c +++ b/src/backends/native/meta-cursor-renderer-native.c @@ -1724,7 +1724,8 @@ init_hw_cursor_support (MetaCursorRendererNative *cursor_renderer_native) } MetaCursorRendererNative * -meta_cursor_renderer_native_new (MetaBackend *backend) +meta_cursor_renderer_native_new (MetaBackend *backend, + ClutterInputDevice *device) { MetaMonitorManager *monitor_manager = meta_backend_get_monitor_manager (backend); @@ -1733,6 +1734,7 @@ meta_cursor_renderer_native_new (MetaBackend *backend) cursor_renderer_native = g_object_new (META_TYPE_CURSOR_RENDERER_NATIVE, "backend", backend, + "device", device, NULL); priv = meta_cursor_renderer_native_get_instance_private (cursor_renderer_native); diff --git a/src/backends/native/meta-cursor-renderer-native.h b/src/backends/native/meta-cursor-renderer-native.h index d3560e48f..26c698cda 100644 --- a/src/backends/native/meta-cursor-renderer-native.h +++ b/src/backends/native/meta-cursor-renderer-native.h @@ -33,6 +33,7 @@ G_DECLARE_FINAL_TYPE (MetaCursorRendererNative, meta_cursor_renderer_native, META, CURSOR_RENDERER_NATIVE, MetaCursorRenderer) -MetaCursorRendererNative * meta_cursor_renderer_native_new (MetaBackend *backend); +MetaCursorRendererNative * meta_cursor_renderer_native_new (MetaBackend *backend, + ClutterInputDevice *device); #endif /* META_CURSOR_RENDERER_NATIVE_H */ diff --git a/src/backends/native/meta-seat-native.c b/src/backends/native/meta-seat-native.c index 586ac50bd..fcf0ad96e 100644 --- a/src/backends/native/meta-seat-native.c +++ b/src/backends/native/meta-seat-native.c @@ -1865,7 +1865,7 @@ update_tablet_cursor_state (MetaSeatNative *seat_native, g_object_unref); } - cursor_renderer = meta_cursor_renderer_new (meta_get_backend ()); + cursor_renderer = meta_cursor_renderer_new (meta_get_backend (), device); g_hash_table_insert (seat_native->tablet_cursors, device, cursor_renderer); } @@ -3332,7 +3332,8 @@ meta_seat_native_maybe_ensure_cursor_renderer (MetaSeatNative *seat_native, MetaCursorRendererNative *cursor_renderer_native; cursor_renderer_native = - meta_cursor_renderer_native_new (meta_get_backend ()); + meta_cursor_renderer_native_new (meta_get_backend (), + seat_native->core_pointer); seat_native->cursor_renderer = META_CURSOR_RENDERER (cursor_renderer_native); } diff --git a/src/backends/x11/cm/meta-backend-x11-cm.c b/src/backends/x11/cm/meta-backend-x11-cm.c index b00f1ca06..35e1acf9f 100644 --- a/src/backends/x11/cm/meta-backend-x11-cm.c +++ b/src/backends/x11/cm/meta-backend-x11-cm.c @@ -127,6 +127,7 @@ meta_backend_x11_cm_get_cursor_renderer (MetaBackend *backend, x11_cm->cursor_renderer = g_object_new (META_TYPE_CURSOR_RENDERER_X11, "backend", backend, + "device", device, NULL); } diff --git a/src/backends/x11/nested/meta-backend-x11-nested.c b/src/backends/x11/nested/meta-backend-x11-nested.c index 27143ce14..041f4b87a 100644 --- a/src/backends/x11/nested/meta-backend-x11-nested.c +++ b/src/backends/x11/nested/meta-backend-x11-nested.c @@ -76,6 +76,7 @@ meta_backend_x11_nested_get_cursor_renderer (MetaBackend *backend, priv->cursor_renderer = g_object_new (META_TYPE_CURSOR_RENDERER_X11_NESTED, "backend", backend, + "device", device, NULL); }