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
This commit is contained in:
parent
2e3086e2aa
commit
8dfb88b669
@ -209,6 +209,10 @@ update_touchpad_left_handed (MetaInputSettings *input_settings,
|
|||||||
MetaInputSettingsPrivate *priv;
|
MetaInputSettingsPrivate *priv;
|
||||||
gboolean enabled = FALSE;
|
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);
|
priv = meta_input_settings_get_instance_private (input_settings);
|
||||||
input_settings_class = META_INPUT_SETTINGS_GET_CLASS (input_settings);
|
input_settings_class = META_INPUT_SETTINGS_GET_CLASS (input_settings);
|
||||||
handedness = g_settings_get_enum (priv->touchpad_settings, "left-handed");
|
handedness = g_settings_get_enum (priv->touchpad_settings, "left-handed");
|
||||||
@ -230,7 +234,6 @@ update_touchpad_left_handed (MetaInputSettings *input_settings,
|
|||||||
|
|
||||||
if (device)
|
if (device)
|
||||||
{
|
{
|
||||||
g_assert (clutter_input_device_get_device_type (device) == CLUTTER_TOUCHPAD_DEVICE);
|
|
||||||
settings_device_set_bool_setting (input_settings, device,
|
settings_device_set_bool_setting (input_settings, device,
|
||||||
input_settings_class->set_left_handed,
|
input_settings_class->set_left_handed,
|
||||||
enabled);
|
enabled);
|
||||||
@ -251,13 +254,16 @@ update_mouse_left_handed (MetaInputSettings *input_settings,
|
|||||||
MetaInputSettingsPrivate *priv;
|
MetaInputSettingsPrivate *priv;
|
||||||
gboolean enabled;
|
gboolean enabled;
|
||||||
|
|
||||||
|
if (device &&
|
||||||
|
clutter_input_device_get_device_type (device) != CLUTTER_POINTER_DEVICE)
|
||||||
|
return;
|
||||||
|
|
||||||
priv = meta_input_settings_get_instance_private (input_settings);
|
priv = meta_input_settings_get_instance_private (input_settings);
|
||||||
input_settings_class = META_INPUT_SETTINGS_GET_CLASS (input_settings);
|
input_settings_class = META_INPUT_SETTINGS_GET_CLASS (input_settings);
|
||||||
enabled = g_settings_get_boolean (priv->mouse_settings, "left-handed");
|
enabled = g_settings_get_boolean (priv->mouse_settings, "left-handed");
|
||||||
|
|
||||||
if (device)
|
if (device)
|
||||||
{
|
{
|
||||||
g_assert (clutter_input_device_get_device_type (device) == CLUTTER_POINTER_DEVICE);
|
|
||||||
settings_device_set_bool_setting (input_settings, device,
|
settings_device_set_bool_setting (input_settings, device,
|
||||||
input_settings_class->set_left_handed,
|
input_settings_class->set_left_handed,
|
||||||
enabled);
|
enabled);
|
||||||
@ -366,6 +372,10 @@ update_touchpad_tap_enabled (MetaInputSettings *input_settings,
|
|||||||
MetaInputSettingsPrivate *priv;
|
MetaInputSettingsPrivate *priv;
|
||||||
gboolean enabled;
|
gboolean enabled;
|
||||||
|
|
||||||
|
if (device &&
|
||||||
|
clutter_input_device_get_device_type (device) != CLUTTER_TOUCHPAD_DEVICE)
|
||||||
|
return;
|
||||||
|
|
||||||
priv = meta_input_settings_get_instance_private (input_settings);
|
priv = meta_input_settings_get_instance_private (input_settings);
|
||||||
input_settings_class = META_INPUT_SETTINGS_GET_CLASS (input_settings);
|
input_settings_class = META_INPUT_SETTINGS_GET_CLASS (input_settings);
|
||||||
enabled = g_settings_get_boolean (priv->touchpad_settings, "tap-to-click");
|
enabled = g_settings_get_boolean (priv->touchpad_settings, "tap-to-click");
|
||||||
@ -392,6 +402,10 @@ update_touchpad_scroll_method (MetaInputSettings *input_settings,
|
|||||||
GDesktopTouchpadScrollMethod method;
|
GDesktopTouchpadScrollMethod method;
|
||||||
MetaInputSettingsPrivate *priv;
|
MetaInputSettingsPrivate *priv;
|
||||||
|
|
||||||
|
if (device &&
|
||||||
|
clutter_input_device_get_device_type (device) != CLUTTER_TOUCHPAD_DEVICE)
|
||||||
|
return;
|
||||||
|
|
||||||
priv = meta_input_settings_get_instance_private (input_settings);
|
priv = meta_input_settings_get_instance_private (input_settings);
|
||||||
input_settings_class = META_INPUT_SETTINGS_GET_CLASS (input_settings);
|
input_settings_class = META_INPUT_SETTINGS_GET_CLASS (input_settings);
|
||||||
method = g_settings_get_enum (priv->touchpad_settings, "scroll-method");
|
method = g_settings_get_enum (priv->touchpad_settings, "scroll-method");
|
||||||
@ -418,6 +432,10 @@ update_touchpad_click_method (MetaInputSettings *input_settings,
|
|||||||
GDesktopTouchpadScrollMethod method;
|
GDesktopTouchpadScrollMethod method;
|
||||||
MetaInputSettingsPrivate *priv;
|
MetaInputSettingsPrivate *priv;
|
||||||
|
|
||||||
|
if (device &&
|
||||||
|
clutter_input_device_get_device_type (device) != CLUTTER_TOUCHPAD_DEVICE)
|
||||||
|
return;
|
||||||
|
|
||||||
priv = meta_input_settings_get_instance_private (input_settings);
|
priv = meta_input_settings_get_instance_private (input_settings);
|
||||||
input_settings_class = META_INPUT_SETTINGS_GET_CLASS (input_settings);
|
input_settings_class = META_INPUT_SETTINGS_GET_CLASS (input_settings);
|
||||||
method = g_settings_get_enum (priv->touchpad_settings, "click-method");
|
method = g_settings_get_enum (priv->touchpad_settings, "click-method");
|
||||||
@ -444,6 +462,10 @@ update_touchpad_send_events (MetaInputSettings *input_settings,
|
|||||||
MetaInputSettingsPrivate *priv;
|
MetaInputSettingsPrivate *priv;
|
||||||
GDesktopDeviceSendEvents mode;
|
GDesktopDeviceSendEvents mode;
|
||||||
|
|
||||||
|
if (device &&
|
||||||
|
clutter_input_device_get_device_type (device) != CLUTTER_TOUCHPAD_DEVICE)
|
||||||
|
return;
|
||||||
|
|
||||||
priv = meta_input_settings_get_instance_private (input_settings);
|
priv = meta_input_settings_get_instance_private (input_settings);
|
||||||
input_settings_class = META_INPUT_SETTINGS_GET_CLASS (input_settings);
|
input_settings_class = META_INPUT_SETTINGS_GET_CLASS (input_settings);
|
||||||
mode = g_settings_get_enum (priv->touchpad_settings, "send-events");
|
mode = g_settings_get_enum (priv->touchpad_settings, "send-events");
|
||||||
@ -486,13 +508,16 @@ update_trackball_scroll_button (MetaInputSettings *input_settings,
|
|||||||
MetaInputSettingsPrivate *priv;
|
MetaInputSettingsPrivate *priv;
|
||||||
guint button;
|
guint button;
|
||||||
|
|
||||||
|
if (device && !device_is_trackball (device))
|
||||||
|
return;
|
||||||
|
|
||||||
priv = meta_input_settings_get_instance_private (input_settings);
|
priv = meta_input_settings_get_instance_private (input_settings);
|
||||||
input_settings_class = META_INPUT_SETTINGS_GET_CLASS (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
|
/* This key is 'i' in the schema but it also specifies a minimum
|
||||||
* range of 0 so the cast here is safe. */
|
* range of 0 so the cast here is safe. */
|
||||||
button = (guint) g_settings_get_int (priv->trackball_settings, "scroll-wheel-emulation-button");
|
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);
|
input_settings_class->set_scroll_button (input_settings, device, button);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user