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 static void
meta_input_settings_dummy_set_trackball_accel_profile (MetaInputSettings *settings, meta_input_settings_dummy_set_trackball_accel_profile (MetaInputSettings *settings,
ClutterInputDevice *device, ClutterInputDevice *device,
@ -270,6 +277,8 @@ meta_input_settings_dummy_class_init (MetaInputSettingsDummyClass *klass)
meta_input_settings_dummy_set_tablet_area; meta_input_settings_dummy_set_tablet_area;
input_settings_class->set_mouse_accel_profile = input_settings_class->set_mouse_accel_profile =
meta_input_settings_dummy_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 = input_settings_class->set_trackball_accel_profile =
meta_input_settings_dummy_set_trackball_accel_profile; meta_input_settings_dummy_set_trackball_accel_profile;
input_settings_class->set_stylus_pressure = input_settings_class->set_stylus_pressure =

View File

@ -124,6 +124,9 @@ struct _MetaInputSettingsClass
void (* set_mouse_accel_profile) (MetaInputSettings *settings, void (* set_mouse_accel_profile) (MetaInputSettings *settings,
ClutterInputDevice *device, ClutterInputDevice *device,
GDesktopPointerAccelProfile profile); GDesktopPointerAccelProfile profile);
void (* set_touchpad_accel_profile) (MetaInputSettings *settings,
ClutterInputDevice *device,
GDesktopPointerAccelProfile profile);
void (* set_trackball_accel_profile) (MetaInputSettings *settings, void (* set_trackball_accel_profile) (MetaInputSettings *settings,
ClutterInputDevice *device, ClutterInputDevice *device,
GDesktopPointerAccelProfile profile); 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, input_settings_class->set_mouse_accel_profile (input_settings,
device, device,
profile); profile);
else if (settings == priv->touchpad_settings)
input_settings_class->set_touchpad_accel_profile (input_settings,
device,
profile);
else if (settings == priv->trackball_settings) else if (settings == priv->trackball_settings)
input_settings_class->set_trackball_accel_profile (input_settings, input_settings_class->set_trackball_accel_profile (input_settings,
device, device,
@ -1184,6 +1188,8 @@ meta_input_settings_changed_cb (GSettings *settings,
update_device_speed (input_settings, NULL); update_device_speed (input_settings, NULL);
else if (strcmp (key, "natural-scroll") == 0) else if (strcmp (key, "natural-scroll") == 0)
update_device_natural_scroll (input_settings, NULL); 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) else if (strcmp (key, "tap-to-click") == 0)
update_touchpad_tap_enabled (input_settings, NULL); update_touchpad_tap_enabled (input_settings, NULL);
else if (strcmp (key, "tap-button-map") == 0) else if (strcmp (key, "tap-button-map") == 0)

View File

@ -554,12 +554,26 @@ meta_input_settings_native_set_mouse_accel_profile (MetaInputSettings *
return; return;
if ((caps & if ((caps &
(CLUTTER_INPUT_CAPABILITY_TRACKBALL | (CLUTTER_INPUT_CAPABILITY_TRACKBALL |
CLUTTER_INPUT_CAPABILITY_TOUCHPAD |
CLUTTER_INPUT_CAPABILITY_TRACKPOINT)) != 0) CLUTTER_INPUT_CAPABILITY_TRACKPOINT)) != 0)
return; return;
set_device_accel_profile (device, profile); 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 static void
meta_input_settings_native_set_trackball_accel_profile (MetaInputSettings *settings, meta_input_settings_native_set_trackball_accel_profile (MetaInputSettings *settings,
ClutterInputDevice *device, 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_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_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_trackball_accel_profile = meta_input_settings_native_set_trackball_accel_profile;
input_settings_class->set_stylus_pressure = meta_input_settings_native_set_stylus_pressure; 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; return;
if ((caps & if ((caps &
(CLUTTER_INPUT_CAPABILITY_TRACKBALL | (CLUTTER_INPUT_CAPABILITY_TRACKBALL |
CLUTTER_INPUT_CAPABILITY_TOUCHPAD |
CLUTTER_INPUT_CAPABILITY_TRACKPOINT)) != 0) CLUTTER_INPUT_CAPABILITY_TRACKPOINT)) != 0)
return; return;
set_device_accel_profile (settings, device, profile); 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 static void
meta_input_settings_x11_set_trackball_accel_profile (MetaInputSettings *settings, meta_input_settings_x11_set_trackball_accel_profile (MetaInputSettings *settings,
ClutterInputDevice *device, 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_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_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_trackball_accel_profile = meta_input_settings_x11_set_trackball_accel_profile;
input_settings_class->set_stylus_pressure = meta_input_settings_x11_set_stylus_pressure; input_settings_class->set_stylus_pressure = meta_input_settings_x11_set_stylus_pressure;