Support selecting an acceleration profile for touchpad devices

Signed-off-by: Evan Goode <mail@evangoo.de>
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2426>
This commit is contained in:
Evan Goode 2022-09-06 13:15:42 -04:00 committed by Marge Bot
parent f08dc7a4ec
commit 0742170062
5 changed files with 48 additions and 0 deletions

View File

@ -167,6 +167,13 @@ meta_input_settings_dummy_set_mouse_accel_profile (MetaInputSettings *
{
}
static void
meta_input_settings_dummy_set_touchpad_accel_profile (MetaInputSettings *settings,
ClutterInputDevice *device,
GDesktopPointerAccelProfile profile)
{
}
static void
meta_input_settings_dummy_set_trackball_accel_profile (MetaInputSettings *settings,
ClutterInputDevice *device,
@ -270,6 +277,8 @@ meta_input_settings_dummy_class_init (MetaInputSettingsDummyClass *klass)
meta_input_settings_dummy_set_tablet_area;
input_settings_class->set_mouse_accel_profile =
meta_input_settings_dummy_set_mouse_accel_profile;
input_settings_class->set_touchpad_accel_profile =
meta_input_settings_dummy_set_touchpad_accel_profile;
input_settings_class->set_trackball_accel_profile =
meta_input_settings_dummy_set_trackball_accel_profile;
input_settings_class->set_stylus_pressure =

View File

@ -124,6 +124,9 @@ struct _MetaInputSettingsClass
void (* set_mouse_accel_profile) (MetaInputSettings *settings,
ClutterInputDevice *device,
GDesktopPointerAccelProfile profile);
void (* set_touchpad_accel_profile) (MetaInputSettings *settings,
ClutterInputDevice *device,
GDesktopPointerAccelProfile profile);
void (* set_trackball_accel_profile) (MetaInputSettings *settings,
ClutterInputDevice *device,
GDesktopPointerAccelProfile profile);

View File

@ -388,6 +388,10 @@ do_update_pointer_accel_profile (MetaInputSettings *input_settings,
input_settings_class->set_mouse_accel_profile (input_settings,
device,
profile);
else if (settings == priv->touchpad_settings)
input_settings_class->set_touchpad_accel_profile (input_settings,
device,
profile);
else if (settings == priv->trackball_settings)
input_settings_class->set_trackball_accel_profile (input_settings,
device,
@ -1184,6 +1188,8 @@ meta_input_settings_changed_cb (GSettings *settings,
update_device_speed (input_settings, NULL);
else if (strcmp (key, "natural-scroll") == 0)
update_device_natural_scroll (input_settings, NULL);
else if (strcmp (key, "accel-profile") == 0)
update_pointer_accel_profile (input_settings, settings, NULL);
else if (strcmp (key, "tap-to-click") == 0)
update_touchpad_tap_enabled (input_settings, NULL);
else if (strcmp (key, "tap-button-map") == 0)

View File

@ -554,12 +554,26 @@ meta_input_settings_native_set_mouse_accel_profile (MetaInputSettings *
return;
if ((caps &
(CLUTTER_INPUT_CAPABILITY_TRACKBALL |
CLUTTER_INPUT_CAPABILITY_TOUCHPAD |
CLUTTER_INPUT_CAPABILITY_TRACKPOINT)) != 0)
return;
set_device_accel_profile (device, profile);
}
static void
meta_input_settings_native_set_touchpad_accel_profile (MetaInputSettings *settings,
ClutterInputDevice *device,
GDesktopPointerAccelProfile profile)
{
ClutterInputCapabilities caps = clutter_input_device_get_capabilities (device);
if ((caps & CLUTTER_INPUT_CAPABILITY_TOUCHPAD) == 0)
return;
set_device_accel_profile (device, profile);
}
static void
meta_input_settings_native_set_trackball_accel_profile (MetaInputSettings *settings,
ClutterInputDevice *device,
@ -800,6 +814,7 @@ meta_input_settings_native_class_init (MetaInputSettingsNativeClass *klass)
input_settings_class->set_tablet_area = meta_input_settings_native_set_tablet_area;
input_settings_class->set_mouse_accel_profile = meta_input_settings_native_set_mouse_accel_profile;
input_settings_class->set_touchpad_accel_profile = meta_input_settings_native_set_touchpad_accel_profile;
input_settings_class->set_trackball_accel_profile = meta_input_settings_native_set_trackball_accel_profile;
input_settings_class->set_stylus_pressure = meta_input_settings_native_set_stylus_pressure;

View File

@ -569,12 +569,26 @@ meta_input_settings_x11_set_mouse_accel_profile (MetaInputSettings *set
return;
if ((caps &
(CLUTTER_INPUT_CAPABILITY_TRACKBALL |
CLUTTER_INPUT_CAPABILITY_TOUCHPAD |
CLUTTER_INPUT_CAPABILITY_TRACKPOINT)) != 0)
return;
set_device_accel_profile (settings, device, profile);
}
static void
meta_input_settings_x11_set_touchpad_accel_profile (MetaInputSettings *settings,
ClutterInputDevice *device,
GDesktopPointerAccelProfile profile)
{
ClutterInputCapabilities caps = clutter_input_device_get_capabilities (device);
if ((caps & CLUTTER_INPUT_CAPABILITY_TOUCHPAD) == 0)
return;
set_device_accel_profile (settings, device, profile);
}
static void
meta_input_settings_x11_set_trackball_accel_profile (MetaInputSettings *settings,
ClutterInputDevice *device,
@ -873,6 +887,7 @@ meta_input_settings_x11_class_init (MetaInputSettingsX11Class *klass)
input_settings_class->set_tablet_area = meta_input_settings_x11_set_tablet_area;
input_settings_class->set_mouse_accel_profile = meta_input_settings_x11_set_mouse_accel_profile;
input_settings_class->set_touchpad_accel_profile = meta_input_settings_x11_set_touchpad_accel_profile;
input_settings_class->set_trackball_accel_profile = meta_input_settings_x11_set_trackball_accel_profile;
input_settings_class->set_stylus_pressure = meta_input_settings_x11_set_stylus_pressure;