summaryrefslogtreecommitdiff
path: root/plugins/mouse
diff options
context:
space:
mode:
authormonsta <[email protected]>2016-10-26 16:47:59 +0300
committermonsta <[email protected]>2016-10-26 16:47:59 +0300
commitef230c73fb5133ca37c60b185268ab4ddfa2635c (patch)
treedad27b8424abd6f72451fddefc9e200cc2cbd5c8 /plugins/mouse
parentac150a1950d2db358b42d1e26cb59e2a76cf65b5 (diff)
downloadmate-settings-daemon-ef230c73fb5133ca37c60b185268ab4ddfa2635c.tar.bz2
mate-settings-daemon-ef230c73fb5133ca37c60b185268ab4ddfa2635c.tar.xz
mouse: don't apply any settings if XInput isn't present
and drop some fallback code as well adapted from: https://git.gnome.org/browse/gnome-settings-daemon/commit/?id=4d6ecb300358fcef4310a7f696a032d8a0afb80e https://git.gnome.org/browse/gnome-settings-daemon/commit/?id=3a244a490df4453c41469d8eeb789d96412f80b1
Diffstat (limited to 'plugins/mouse')
-rw-r--r--plugins/mouse/msd-mouse-manager.c55
1 files changed, 6 insertions, 49 deletions
diff --git a/plugins/mouse/msd-mouse-manager.c b/plugins/mouse/msd-mouse-manager.c
index 4399a51..f91623a 100644
--- a/plugins/mouse/msd-mouse-manager.c
+++ b/plugins/mouse/msd-mouse-manager.c
@@ -227,9 +227,8 @@ touchpad_has_single_button (XDevice *device)
return is_single_button;
}
-
static void
-set_xinput_devices_left_handed (MsdMouseManager * manager, gboolean left_handed)
+set_left_handed (MsdMouseManager * manager, gboolean left_handed)
{
XDeviceInfo *device_info;
gint n_devices;
@@ -331,9 +330,6 @@ set_devicepresence_handler (MsdMouseManager *manager)
XEventClass class_presence;
int xi_presence;
- if (!supports_xinput_devices ())
- return;
-
display = gdk_x11_get_default_xdisplay ();
gdk_error_trap_push ();
@@ -348,50 +344,6 @@ set_devicepresence_handler (MsdMouseManager *manager)
}
static void
-set_left_handed (MsdMouseManager *manager,
- gboolean left_handed)
-{
- guchar *buttons ;
- gsize buttons_capacity = 16;
- gint n_buttons, i;
-
- if (supports_xinput_devices ()) {
- /* When XInput support is available, never set the
- * button ordering on the core pointer as that would
- * revert the changes we make on the devices themselves */
- set_xinput_devices_left_handed (manager, left_handed);
- return;
- }
-
- buttons = g_new (guchar, buttons_capacity);
- n_buttons = XGetPointerMapping (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()),
- buttons,
- (gint) buttons_capacity);
- while (n_buttons > buttons_capacity) {
- buttons_capacity = n_buttons;
- buttons = (guchar *) g_realloc (buttons,
- buttons_capacity * sizeof (guchar));
-
- n_buttons = XGetPointerMapping (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()),
- buttons,
- (gint) buttons_capacity);
- }
-
- configure_button_layout (buttons, n_buttons, left_handed);
-
- /* X refuses to change the mapping while buttons are engaged,
- * so if this is the case we'll retry a few times
- */
- for (i = 0;
- i < 20 && XSetPointerMapping (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()), buttons, n_buttons) == MappingBusy;
- ++i) {
- g_usleep (300);
- }
-
- g_free (buttons);
-}
-
-static void
set_motion_acceleration (MsdMouseManager *manager,
gfloat motion_acceleration)
{
@@ -1025,6 +977,11 @@ msd_mouse_manager_start (MsdMouseManager *manager,
{
mate_settings_profile_start (NULL);
+ if (!supports_xinput_devices ()) {
+ g_debug ("XInput is not supported, not applying any settings");
+ return TRUE;
+ }
+
g_idle_add ((GSourceFunc) msd_mouse_manager_idle_cb, manager);
mate_settings_profile_end (NULL);