summaryrefslogtreecommitdiff
path: root/plugins/mouse/msd-mouse-manager.c
diff options
context:
space:
mode:
authormonsta <[email protected]>2016-12-22 19:48:57 +0300
committermonsta <[email protected]>2016-12-22 19:50:17 +0300
commit456325e9057e57f09d381ea000d9f2dce4774ec8 (patch)
tree7b0d306c9a1fc5906826d5e50c00be430cd083b7 /plugins/mouse/msd-mouse-manager.c
parentbe168388a752fe61ba213751435e67fbc955c9fe (diff)
downloadmate-settings-daemon-456325e9057e57f09d381ea000d9f2dce4774ec8.tar.bz2
mate-settings-daemon-456325e9057e57f09d381ea000d9f2dce4774ec8.tar.xz
mouse: move bool property helpers closer to the top
Diffstat (limited to 'plugins/mouse/msd-mouse-manager.c')
-rw-r--r--plugins/mouse/msd-mouse-manager.c116
1 files changed, 58 insertions, 58 deletions
diff --git a/plugins/mouse/msd-mouse-manager.c b/plugins/mouse/msd-mouse-manager.c
index 9be3397..43ed9c1 100644
--- a/plugins/mouse/msd-mouse-manager.c
+++ b/plugins/mouse/msd-mouse-manager.c
@@ -244,6 +244,64 @@ touchpad_has_single_button (XDevice *device)
}
static void
+property_set_bool (XDeviceInfo *device_info,
+ XDevice *device,
+ const char *property_name,
+ int property_index,
+ gboolean enabled)
+{
+ int rc;
+ unsigned long nitems, bytes_after;
+ unsigned char *data;
+ int act_format;
+ Atom act_type, property;
+
+ property = property_from_name (property_name);
+ if (!property)
+ return;
+
+ gdk_error_trap_push ();
+ rc = XGetDeviceProperty (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()), device,
+ property, 0, 1, False,
+ XA_INTEGER, &act_type, &act_format, &nitems,
+ &bytes_after, &data);
+
+ if (rc == Success && act_type == XA_INTEGER && act_format == 8 && nitems > property_index) {
+ data[property_index] = enabled ? 1 : 0;
+ XChangeDeviceProperty (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()), device,
+ property, XA_INTEGER, 8,
+ PropModeReplace, data, nitems);
+ }
+
+ if (rc == Success)
+ XFree (data);
+
+ if (gdk_error_trap_pop ()) {
+ g_warning ("Error while setting %s on \"%s\"", property_name, device_info->name);
+ }
+}
+
+static void
+touchpad_set_bool (XDeviceInfo *device_info,
+ const char *property_name,
+ int property_index,
+ gboolean enabled)
+{
+ XDevice *device;
+
+ device = device_is_touchpad (device_info);
+ if (device == NULL) {
+ return;
+ }
+
+ property_set_bool (device_info, device, property_name, property_index, enabled);
+
+ gdk_error_trap_push ();
+ XCloseDevice (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()), device);
+ gdk_error_trap_pop_ignored ();
+}
+
+static void
set_left_handed (MsdMouseManager *manager,
XDeviceInfo *device_info,
gboolean mouse_left_handed,
@@ -822,64 +880,6 @@ set_natural_scroll_all (MsdMouseManager *manager)
}
static void
-property_set_bool (XDeviceInfo *device_info,
- XDevice *device,
- const char *property_name,
- int property_index,
- gboolean enabled)
-{
- int rc;
- unsigned long nitems, bytes_after;
- unsigned char *data;
- int act_format;
- Atom act_type, property;
-
- property = property_from_name (property_name);
- if (!property)
- return;
-
- gdk_error_trap_push ();
- rc = XGetDeviceProperty (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()), device,
- property, 0, 1, False,
- XA_INTEGER, &act_type, &act_format, &nitems,
- &bytes_after, &data);
-
- if (rc == Success && act_type == XA_INTEGER && act_format == 8 && nitems > property_index) {
- data[property_index] = enabled ? 1 : 0;
- XChangeDeviceProperty (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()), device,
- property, XA_INTEGER, 8,
- PropModeReplace, data, nitems);
- }
-
- if (rc == Success)
- XFree (data);
-
- if (gdk_error_trap_pop ()) {
- g_warning ("Error while setting %s on \"%s\"", property_name, device_info->name);
- }
-}
-
-static void
-touchpad_set_bool (XDeviceInfo *device_info,
- const char *property_name,
- int property_index,
- gboolean enabled)
-{
- XDevice *device;
-
- device = device_is_touchpad (device_info);
- if (device == NULL) {
- return;
- }
-
- property_set_bool (device_info, device, property_name, property_index, enabled);
-
- gdk_error_trap_push ();
- XCloseDevice (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()), device);
- gdk_error_trap_pop_ignored ();
-}
-
-static void
set_scrolling (XDeviceInfo *device_info,
GSettings *settings)
{