summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormonsta <[email protected]>2017-01-02 19:57:49 +0300
committermonsta <[email protected]>2017-01-02 19:57:49 +0300
commit9cfeedda62e1a19cba33f9eb74351d9f5473fc42 (patch)
tree5d18a022562808101d9647be9f427b79381a36c9
parent3a6a6bfd4a6cc87fcf8c92df53d1cadf579bfc75 (diff)
downloadmate-control-center-9cfeedda62e1a19cba33f9eb74351d9f5473fc42.tar.bz2
mate-control-center-9cfeedda62e1a19cba33f9eb74351d9f5473fc42.tar.xz
mouse: move xinput check into separate function
-rw-r--r--capplets/mouse/mate-mouse-properties.c23
1 files changed, 15 insertions, 8 deletions
diff --git a/capplets/mouse/mate-mouse-properties.c b/capplets/mouse/mate-mouse-properties.c
index bc9246d6..732e5e8d 100644
--- a/capplets/mouse/mate-mouse-properties.c
+++ b/capplets/mouse/mate-mouse-properties.c
@@ -218,6 +218,20 @@ synaptics_check_capabilities (GtkBuilder *dialog)
}
static gboolean
+have_xinput_extension (void)
+{
+ XExtensionVersion *version;
+ gboolean result;
+
+ /* Input device properties require version 1.5 or higher */
+ version = XGetExtensionVersion (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()), "XInputExtension");
+ result = version->present && ((version->major_version * 1000 + version->minor_version) >= 1005);
+ XFree (version);
+
+ return result;
+}
+
+static gboolean
find_synaptics (void)
{
gboolean ret = FALSE;
@@ -227,15 +241,9 @@ find_synaptics (void)
int realformat;
unsigned long nitems, bytes_after;
unsigned char *data;
- XExtensionVersion *version;
- /* Input device properties require version 1.5 or higher */
- version = XGetExtensionVersion (GDK_DISPLAY_XDISPLAY(gdk_display_get_default()), "XInputExtension");
- if (!version->present ||
- (version->major_version * 1000 + version->minor_version) < 1005) {
- XFree (version);
+ if (!have_xinput_extension ())
return FALSE;
- }
prop = XInternAtom (GDK_DISPLAY_XDISPLAY(gdk_display_get_default()), "Synaptics Off", True);
if (!prop)
@@ -268,7 +276,6 @@ find_synaptics (void)
break;
}
- XFree (version);
XFreeDeviceList (devicelist);
return ret;