Index: xfce4-settings-helper/pointers.c =================================================================== --- xfce4-settings-helper/pointers.c (revision 29636) +++ xfce4-settings-helper/pointers.c (working copy) @@ -270,15 +270,19 @@ buttonmap = g_new0 (guchar, num_buttons); /* get the button mapping */ - XGetDeviceButtonMapping (xdisplay, device, buttonmap, num_buttons); - + gdk_error_trap_push (); + XGetPointerMapping (xdisplay, buttonmap, num_buttons); + if (gdk_error_trap_pop ()) + { + g_warning ("Failed to get button mapping"); + goto out; + } if (right_handed != -1) { /* get the right button number */ - right_button = num_buttons < 3 ? 2 : 3; - + right_button = MIN (num_buttons, 3); /* check the buttons and swap them if needed */ - xfce_pointers_helper_change_button_mapping_swap (buttonmap, num_buttons, 1, right_button, !!right_handed); + xfce_pointers_helper_change_button_mapping_swap (buttonmap, num_buttons, 1, right_button, right_handed); } if (reverse_scrolling != -1 && num_buttons >= 5) @@ -286,10 +290,12 @@ /* check the buttons and swap them if needed */ xfce_pointers_helper_change_button_mapping_swap (buttonmap, num_buttons, 4, 5, !reverse_scrolling); } - /* set the new button mapping */ + gdk_error_trap_push (); XSetDeviceButtonMapping (xdisplay, device, buttonmap, num_buttons); - + if (gdk_error_trap_pop ()) + g_warning ("Failed to set button mapping"); +out: /* cleanup */ g_free (buttonmap); }