From 46643b895cccddac178098f55884c088b2eee694 Mon Sep 17 00:00:00 2001 From: Carlos Garnacho Date: Tue, 6 Sep 2022 10:20:21 +0200 Subject: [PATCH] backends: Use capabilities to figure out trackballs in MetaInputSettings Port these configuration methods to use capabilities, instead of using the internal vfunc. Part-of: --- src/backends/meta-input-settings.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/src/backends/meta-input-settings.c b/src/backends/meta-input-settings.c index 7d03d7182..1e00c6e47 100644 --- a/src/backends/meta-input-settings.c +++ b/src/backends/meta-input-settings.c @@ -930,12 +930,18 @@ update_trackball_scroll_button (MetaInputSettings *input_settings, MetaInputSettingsPrivate *priv; guint button; gboolean button_lock; + ClutterInputCapabilities caps; priv = meta_input_settings_get_instance_private (input_settings); input_settings_class = META_INPUT_SETTINGS_GET_CLASS (input_settings); - if (device && !input_settings_class->is_trackball_device (input_settings, device)) - return; + if (device) + { + caps = clutter_input_device_get_capabilities (device); + + if ((caps & CLUTTER_INPUT_CAPABILITY_TRACKBALL) == 0) + return; + } /* This key is 'i' in the schema but it also specifies a minimum * range of 0 so the cast here is safe. */ @@ -953,8 +959,9 @@ update_trackball_scroll_button (MetaInputSettings *input_settings, for (l = priv->devices; l; l = l->next) { device = l->data; + caps = clutter_input_device_get_capabilities (device); - if (input_settings_class->is_trackball_device (input_settings, device)) + if ((caps & CLUTTER_INPUT_CAPABILITY_TRACKBALL) != 0) input_settings_class->set_scroll_button (input_settings, device, button, button_lock); } }