summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCarlos Garnacho <carlosg@gnome.org>2015-04-15 13:05:53 +0200
committerCarlos Garnacho <carlosg@gnome.org>2015-04-15 13:33:12 +0200
commit8dfb88b669c0f1de3f36d32729adad25f31a46d1 (patch)
tree246d08613c00e66c92410a78fe1568b8f81bba86
parent2e3086e2aa59d3cea5e0814516b3d5cb04143302 (diff)
backend: Apply the right settings to the right input devices
Since 8769b3d55, the checks performed on which update_* function was called for each device got quite more lax, leading to failed asserts on code that assumed the previous behavior. Change update_[mouse|touchpad|trackball]_* to bail out early if the device received has not the right type, and remove the asserts. https://bugzilla.gnome.org/show_bug.cgi?id=747886
-rw-r--r--src/backends/meta-input-settings.c31
1 files changed, 28 insertions, 3 deletions
diff --git a/src/backends/meta-input-settings.c b/src/backends/meta-input-settings.c
index 004044e1..05870a16 100644
--- a/src/backends/meta-input-settings.c
+++ b/src/backends/meta-input-settings.c
@@ -209,6 +209,10 @@ update_touchpad_left_handed (MetaInputSettings *input_settings,
MetaInputSettingsPrivate *priv;
gboolean enabled = FALSE;
+ if (device &&
+ clutter_input_device_get_device_type (device) != CLUTTER_TOUCHPAD_DEVICE)
+ return;
+
priv = meta_input_settings_get_instance_private (input_settings);
input_settings_class = META_INPUT_SETTINGS_GET_CLASS (input_settings);
handedness = g_settings_get_enum (priv->touchpad_settings, "left-handed");
@@ -230,7 +234,6 @@ update_touchpad_left_handed (MetaInputSettings *input_settings,
if (device)
{
- g_assert (clutter_input_device_get_device_type (device) == CLUTTER_TOUCHPAD_DEVICE);
settings_device_set_bool_setting (input_settings, device,
input_settings_class->set_left_handed,
enabled);
@@ -251,13 +254,16 @@ update_mouse_left_handed (MetaInputSettings *input_settings,
MetaInputSettingsPrivate *priv;
gboolean enabled;
+ if (device &&
+ clutter_input_device_get_device_type (device) != CLUTTER_POINTER_DEVICE)
+ return;
+
priv = meta_input_settings_get_instance_private (input_settings);
input_settings_class = META_INPUT_SETTINGS_GET_CLASS (input_settings);
enabled = g_settings_get_boolean (priv->mouse_settings, "left-handed");
if (device)
{
- g_assert (clutter_input_device_get_device_type (device) == CLUTTER_POINTER_DEVICE);
settings_device_set_bool_setting (input_settings, device,
input_settings_class->set_left_handed,
enabled);
@@ -366,6 +372,10 @@ update_touchpad_tap_enabled (MetaInputSettings *input_settings,
MetaInputSettingsPrivate *priv;
gboolean enabled;
+ if (device &&
+ clutter_input_device_get_device_type (device) != CLUTTER_TOUCHPAD_DEVICE)
+ return;
+
priv = meta_input_settings_get_instance_private (input_settings);
input_settings_class = META_INPUT_SETTINGS_GET_CLASS (input_settings);
enabled = g_settings_get_boolean (priv->touchpad_settings, "tap-to-click");
@@ -392,6 +402,10 @@ update_touchpad_scroll_method (MetaInputSettings *input_settings,
GDesktopTouchpadScrollMethod method;
MetaInputSettingsPrivate *priv;
+ if (device &&
+ clutter_input_device_get_device_type (device) != CLUTTER_TOUCHPAD_DEVICE)
+ return;
+
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");
@@ -418,6 +432,10 @@ update_touchpad_click_method (MetaInputSettings *input_settings,
GDesktopTouchpadScrollMethod method;
MetaInputSettingsPrivate *priv;
+ if (device &&
+ clutter_input_device_get_device_type (device) != CLUTTER_TOUCHPAD_DEVICE)
+ return;
+
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, "click-method");
@@ -444,6 +462,10 @@ update_touchpad_send_events (MetaInputSettings *input_settings,
MetaInputSettingsPrivate *priv;
GDesktopDeviceSendEvents mode;
+ if (device &&
+ clutter_input_device_get_device_type (device) != CLUTTER_TOUCHPAD_DEVICE)
+ return;
+
priv = meta_input_settings_get_instance_private (input_settings);
input_settings_class = META_INPUT_SETTINGS_GET_CLASS (input_settings);
mode = g_settings_get_enum (priv->touchpad_settings, "send-events");
@@ -486,13 +508,16 @@ update_trackball_scroll_button (MetaInputSettings *input_settings,
MetaInputSettingsPrivate *priv;
guint button;
+ if (device && !device_is_trackball (device))
+ return;
+
priv = meta_input_settings_get_instance_private (input_settings);
input_settings_class = META_INPUT_SETTINGS_GET_CLASS (input_settings);
/* This key is 'i' in the schema but it also specifies a minimum
* range of 0 so the cast here is safe. */
button = (guint) g_settings_get_int (priv->trackball_settings, "scroll-wheel-emulation-button");
- if (device && device_is_trackball (device))
+ if (device)
{
input_settings_class->set_scroll_button (input_settings, device, button);
}