diff --git a/configure.ac b/configure.ac index 1ee3d09bf..627836917 100644 --- a/configure.ac +++ b/configure.ac @@ -63,7 +63,7 @@ MUTTER_PC_MODULES=" gio-unix-2.0 >= 2.35.1 pango >= 1.2.0 cairo >= 1.10.0 - gsettings-desktop-schemas >= 3.15.92 + gsettings-desktop-schemas >= 3.19.3 $CLUTTER_PACKAGE >= 1.25.1 cogl-1.0 >= 1.17.1 upower-glib >= 0.99.0 diff --git a/src/backends/meta-input-settings-private.h b/src/backends/meta-input-settings-private.h index 18c1edbcf..ec207f2c5 100644 --- a/src/backends/meta-input-settings-private.h +++ b/src/backends/meta-input-settings-private.h @@ -63,9 +63,9 @@ struct _MetaInputSettingsClass void (* set_invert_scroll) (MetaInputSettings *settings, ClutterInputDevice *device, gboolean inverted); - void (* set_scroll_method) (MetaInputSettings *settings, - ClutterInputDevice *device, - GDesktopTouchpadScrollMethod mode); + void (* set_edge_scroll) (MetaInputSettings *settings, + ClutterInputDevice *device, + gboolean enabled); void (* set_scroll_button) (MetaInputSettings *settings, ClutterInputDevice *device, guint button); diff --git a/src/backends/meta-input-settings.c b/src/backends/meta-input-settings.c index 2f8ed7763..5c509fa68 100644 --- a/src/backends/meta-input-settings.c +++ b/src/backends/meta-input-settings.c @@ -395,11 +395,11 @@ update_touchpad_tap_enabled (MetaInputSettings *input_settings, } static void -update_touchpad_scroll_method (MetaInputSettings *input_settings, - ClutterInputDevice *device) +update_touchpad_edge_scroll (MetaInputSettings *input_settings, + ClutterInputDevice *device) { MetaInputSettingsClass *input_settings_class; - GDesktopTouchpadScrollMethod method; + gboolean edge_scroll_enabled; MetaInputSettingsPrivate *priv; if (device && @@ -408,19 +408,19 @@ update_touchpad_scroll_method (MetaInputSettings *input_settings, priv = meta_input_settings_get_instance_private (input_settings); input_settings_class = META_INPUT_SETTINGS_GET_CLASS (input_settings); - method = g_settings_get_enum (priv->touchpad_settings, "scroll-method"); + edge_scroll_enabled = g_settings_get_boolean (priv->touchpad_settings, "edge-scrolling-enabled"); if (device) { - settings_device_set_uint_setting (input_settings, device, - input_settings_class->set_scroll_method, - method); + settings_device_set_bool_setting (input_settings, device, + input_settings_class->set_edge_scroll, + edge_scroll_enabled); } else { - settings_set_uint_setting (input_settings, CLUTTER_TOUCHPAD_DEVICE, - (ConfigUintFunc) input_settings_class->set_scroll_method, - method); + settings_set_bool_setting (input_settings, CLUTTER_TOUCHPAD_DEVICE, + (ConfigBoolFunc) input_settings_class->set_edge_scroll, + edge_scroll_enabled); } } @@ -645,8 +645,8 @@ meta_input_settings_changed_cb (GSettings *settings, update_touchpad_tap_enabled (input_settings, NULL); else if (strcmp (key, "send-events") == 0) update_touchpad_send_events (input_settings, NULL); - else if (strcmp (key, "scroll-method") == 0) - update_touchpad_scroll_method (input_settings, NULL); + else if (strcmp (key, "edge-scrolling-enabled") == 0) + update_touchpad_edge_scroll (input_settings, NULL); else if (strcmp (key, "click-method") == 0) update_touchpad_click_method (input_settings, NULL); } @@ -771,7 +771,7 @@ apply_device_settings (MetaInputSettings *input_settings, update_device_natural_scroll (input_settings, device); update_touchpad_tap_enabled (input_settings, device); update_touchpad_send_events (input_settings, device); - update_touchpad_scroll_method (input_settings, device); + update_touchpad_edge_scroll (input_settings, device); update_touchpad_click_method (input_settings, device); update_trackball_scroll_button (input_settings, device); diff --git a/src/backends/native/meta-input-settings-native.c b/src/backends/native/meta-input-settings-native.c index fd2f80b39..4b4e8c24a 100644 --- a/src/backends/native/meta-input-settings-native.c +++ b/src/backends/native/meta-input-settings-native.c @@ -154,30 +154,30 @@ device_set_click_method (struct libinput_device *libinput_device, } static void -meta_input_settings_native_set_scroll_method (MetaInputSettings *settings, - ClutterInputDevice *device, - GDesktopTouchpadScrollMethod mode) +meta_input_settings_native_set_edge_scroll (MetaInputSettings *settings, + ClutterInputDevice *device, + gboolean edge_scrolling_enabled) { enum libinput_config_scroll_method scroll_method = 0; struct libinput_device *libinput_device; + enum libinput_config_scroll_method supported; libinput_device = clutter_evdev_input_device_get_libinput_device (device); + supported = libinput_device_config_scroll_get_methods (libinput_device); - switch (mode) + if (supported & LIBINPUT_CONFIG_SCROLL_2FG) { - case G_DESKTOP_TOUCHPAD_SCROLL_METHOD_DISABLED: - scroll_method = LIBINPUT_CONFIG_SCROLL_NO_SCROLL; - break; - case G_DESKTOP_TOUCHPAD_SCROLL_METHOD_EDGE_SCROLLING: - scroll_method = LIBINPUT_CONFIG_SCROLL_EDGE; - break; - case G_DESKTOP_TOUCHPAD_SCROLL_METHOD_TWO_FINGER_SCROLLING: scroll_method = LIBINPUT_CONFIG_SCROLL_2FG; - break; - default: - g_assert_not_reached (); - return; - } + } + else if (supported & LIBINPUT_CONFIG_SCROLL_EDGE && + edge_scrolling_enabled) + { + scroll_method = LIBINPUT_CONFIG_SCROLL_EDGE; + } + else + { + scroll_method = LIBINPUT_CONFIG_SCROLL_NO_SCROLL; + } device_set_scroll_method (libinput_device, scroll_method); } @@ -252,7 +252,7 @@ meta_input_settings_native_class_init (MetaInputSettingsNativeClass *klass) input_settings_class->set_left_handed = meta_input_settings_native_set_left_handed; input_settings_class->set_tap_enabled = meta_input_settings_native_set_tap_enabled; input_settings_class->set_invert_scroll = meta_input_settings_native_set_invert_scroll; - input_settings_class->set_scroll_method = meta_input_settings_native_set_scroll_method; + input_settings_class->set_edge_scroll = meta_input_settings_native_set_edge_scroll; input_settings_class->set_scroll_button = meta_input_settings_native_set_scroll_button; input_settings_class->set_click_method = meta_input_settings_native_set_click_method; input_settings_class->set_keyboard_repeat = meta_input_settings_native_set_keyboard_repeat; diff --git a/src/backends/x11/meta-input-settings-x11.c b/src/backends/x11/meta-input-settings-x11.c index e582dfc1f..79d567bf6 100644 --- a/src/backends/x11/meta-input-settings-x11.c +++ b/src/backends/x11/meta-input-settings-x11.c @@ -199,9 +199,9 @@ meta_input_settings_x11_set_invert_scroll (MetaInputSettings *settings, } static void -meta_input_settings_x11_set_scroll_method (MetaInputSettings *settings, - ClutterInputDevice *device, - GDesktopTouchpadScrollMethod mode) +meta_input_settings_x11_set_edge_scroll (MetaInputSettings *settings, + ClutterInputDevice *device, + gboolean edge_scroll_enabled) { guchar values[3] = { 0 }; /* 2fg, edge, button. The last value is unused */ guchar *available; @@ -211,26 +211,21 @@ meta_input_settings_x11_set_scroll_method (MetaInputSettings *setting if (!available) return; - switch (mode) + if (available[0]) { - case G_DESKTOP_TOUCHPAD_SCROLL_METHOD_DISABLED: - break; - case G_DESKTOP_TOUCHPAD_SCROLL_METHOD_EDGE_SCROLLING: - values[1] = 1; - break; - case G_DESKTOP_TOUCHPAD_SCROLL_METHOD_TWO_FINGER_SCROLLING: values[0] = 1; - break; - default: - g_assert_not_reached (); + } + else if (available[1] && edge_scroll_enabled) + { + values[1] = 1; + } + else + { + /* Disabled */ } - if ((values[0] && !available[0]) || (values[1] && !available[1])) - g_warning ("Device '%s' does not support scroll mode %d\n", - clutter_input_device_get_device_name (device), mode); - else - change_property (device, "libinput Scroll Method Enabled", - XA_INTEGER, 8, &values, 3); + change_property (device, "libinput Scroll Method Enabled", + XA_INTEGER, 8, &values, 3); meta_XFree (available); } @@ -321,7 +316,7 @@ meta_input_settings_x11_class_init (MetaInputSettingsX11Class *klass) input_settings_class->set_left_handed = meta_input_settings_x11_set_left_handed; input_settings_class->set_tap_enabled = meta_input_settings_x11_set_tap_enabled; input_settings_class->set_invert_scroll = meta_input_settings_x11_set_invert_scroll; - input_settings_class->set_scroll_method = meta_input_settings_x11_set_scroll_method; + input_settings_class->set_edge_scroll = meta_input_settings_x11_set_edge_scroll; input_settings_class->set_scroll_button = meta_input_settings_x11_set_scroll_button; input_settings_class->set_click_method = meta_input_settings_x11_set_click_method; input_settings_class->set_keyboard_repeat = meta_input_settings_x11_set_keyboard_repeat;