[gnome-control-center] mouse: Use g-s-d helper to detect touchpad



commit 01fbd4fee0271571d8d685be124e7c6e7c48dbde
Author: Bastien Nocera <hadess hadess net>
Date:   Thu Dec 9 12:07:48 2010 +0000

    mouse: Use g-s-d helper to detect touchpad

 panels/mouse/gnome-mouse-properties.c |   59 +-------------------------------
 1 files changed, 2 insertions(+), 57 deletions(-)
---
diff --git a/panels/mouse/gnome-mouse-properties.c b/panels/mouse/gnome-mouse-properties.c
index 98be9a0..a6307b5 100644
--- a/panels/mouse/gnome-mouse-properties.c
+++ b/panels/mouse/gnome-mouse-properties.c
@@ -31,6 +31,7 @@
 #include <math.h>
 
 #include "gnome-mouse-properties.h"
+#include "gsd-input-helper.h"
 
 #include <sys/types.h>
 #include <sys/stat.h>
@@ -216,62 +217,6 @@ synaptics_check_capabilities (GtkBuilder *dialog)
 	XFreeDeviceList (devicelist);
 }
 
-static gboolean
-find_synaptics (void)
-{
-	gboolean ret = FALSE;
-	int numdevices, i;
-	XDeviceInfo *devicelist;
-	Atom realtype, prop;
-	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);
-		return False;
-	}
-
-	prop = XInternAtom (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()), "Synaptics Off", True);
-	if (!prop)
-		return False;
-
-	devicelist = XListInputDevices (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()), &numdevices);
-	for (i = 0; i < numdevices; i++) {
-		if (devicelist[i].use != IsXExtensionPointer)
-			continue;
-
-		gdk_error_trap_push();
-		XDevice *device = XOpenDevice (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()),
-					       devicelist[i].id);
-		if (gdk_error_trap_pop ())
-			continue;
-
-		gdk_error_trap_push ();
-		if ((XGetDeviceProperty (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()), device, prop, 0, 1, False,
-					 XA_INTEGER, &realtype, &realformat, &nitems,
-					 &bytes_after, &data) == Success) && (realtype != None)) {
-			XFree (data);
-			ret = TRUE;
-		}
-		gdk_error_trap_pop_ignored ();
-
-		XCloseDevice (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()), device);
-
-		if (ret)
-			break;
-	}
-
-	XFree (version);
-	XFreeDeviceList (devicelist);
-
-	return ret;
-}
-
 /* Set up the property editors in the dialog. */
 static void
 setup_dialog (GtkBuilder *dialog)
@@ -316,7 +261,7 @@ setup_dialog (GtkBuilder *dialog)
 			 G_SETTINGS_BIND_DEFAULT);
 
 	/* Trackpad page */
-	if (find_synaptics () == FALSE)
+	if (touchpad_is_present () == FALSE)
 		gtk_notebook_remove_page (GTK_NOTEBOOK (WID ("prefs_widget")), -1);
 	else {
 		g_settings_bind (touchpad_settings, "disable-while-typing",



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]