[gnome-control-center] mouse: Fix compile-time warnings



commit 383882a4c58a8a6ae6d66c36a0d112566879d695
Author: Bastien Nocera <hadess hadess net>
Date:   Mon Sep 20 18:06:41 2010 +0100

    mouse: Fix compile-time warnings
    
    Including missing declarations, and deprecated use of GDK_DISPLAY.

 panels/mouse/Makefile.am              |    1 +
 panels/mouse/gnome-mouse-properties.c |   33 ++++++++++++++++++---------------
 panels/mouse/gnome-mouse-properties.h |   29 +++++++++++++++++++++++++++++
 3 files changed, 48 insertions(+), 15 deletions(-)
---
diff --git a/panels/mouse/Makefile.am b/panels/mouse/Makefile.am
index ef6ff15..dd04089 100644
--- a/panels/mouse/Makefile.am
+++ b/panels/mouse/Makefile.am
@@ -19,6 +19,7 @@ libmouse_properties_la_SOURCES =	\
 	cc-mouse-panel.c		\
 	cc-mouse-panel.h		\
 	gnome-mouse-properties.c	\
+	gnome-mouse-properties.h	\
 	gnome-mouse-accessibility.c	\
 	gnome-mouse-accessibility.h	\
 	capplet-stock-icons.c		\
diff --git a/panels/mouse/gnome-mouse-properties.c b/panels/mouse/gnome-mouse-properties.c
index 81122bd..a7f3f61 100644
--- a/panels/mouse/gnome-mouse-properties.c
+++ b/panels/mouse/gnome-mouse-properties.c
@@ -34,6 +34,7 @@
 #include "gconf-property-editor.h"
 #include "gnome-mouse-accessibility.h"
 #include "capplet-stock-icons.h"
+#include "gnome-mouse-properties.h"
 
 #include <sys/types.h>
 #include <sys/stat.h>
@@ -88,11 +89,11 @@ get_default_mouse_info (int *default_numerator, int *default_denominator, int *d
 	int tmp_num, tmp_den, tmp_threshold;
 
 	/* Query X for the default value */
-	XGetPointerControl (GDK_DISPLAY (), &numerator, &denominator,
+	XGetPointerControl (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()), &numerator, &denominator,
 			    &threshold);
-	XChangePointerControl (GDK_DISPLAY (), True, True, -1, -1, -1);
-	XGetPointerControl (GDK_DISPLAY (), &tmp_num, &tmp_den, &tmp_threshold);
-	XChangePointerControl (GDK_DISPLAY (), True, True, numerator, denominator, threshold);
+	XChangePointerControl (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()), True, True, -1, -1, -1);
+	XGetPointerControl (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()), &tmp_num, &tmp_den, &tmp_threshold);
+	XChangePointerControl (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()), True, True, numerator, denominator, threshold);
 
 	if (default_numerator)
 		*default_numerator = tmp_num;
@@ -338,23 +339,23 @@ synaptics_check_capabilities (GtkBuilder *dialog)
 	unsigned long nitems, bytes_after;
 	unsigned char *data;
 
-	prop = XInternAtom (GDK_DISPLAY (), "Synaptics Capabilities", True);
+	prop = XInternAtom (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()), "Synaptics Capabilities", True);
 	if (!prop)
 		return;
 
-	devicelist = XListInputDevices (GDK_DISPLAY (), &numdevices);
+	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 (),
+		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 (), device, prop, 0, 2, False,
+		if ((XGetDeviceProperty (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()), device, prop, 0, 2, False,
 					 XA_INTEGER, &realtype, &realformat, &nitems,
 					 &bytes_after, &data) == Success) && (realtype != None)) {
 			/* Property data is booleans for has_left, has_middle,
@@ -371,7 +372,7 @@ synaptics_check_capabilities (GtkBuilder *dialog)
 		}
 		gdk_error_trap_pop ();
 
-		XCloseDevice (GDK_DISPLAY (), device);
+		XCloseDevice (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()), device);
 	}
 	XFreeDeviceList (devicelist);
 #endif
@@ -391,30 +392,30 @@ find_synaptics (void)
 	XExtensionVersion *version;
 
 	/* Input device properties require version 1.5 or higher */
-	version = XGetExtensionVersion (GDK_DISPLAY (), "XInputExtension");
+	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 (), "Synaptics Off", True);
+	prop = XInternAtom (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()), "Synaptics Off", True);
 	if (!prop)
 		return False;
 
-	devicelist = XListInputDevices (GDK_DISPLAY (), &numdevices);
+	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 (),
+		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 (), device, prop, 0, 1, False,
+		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);
@@ -422,7 +423,7 @@ find_synaptics (void)
 		}
 		gdk_error_trap_pop ();
 
-		XCloseDevice (GDK_DISPLAY (), device);
+		XCloseDevice (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()), device);
 
 		if (ret)
 			break;
@@ -606,6 +607,8 @@ gnome_mouse_properties_init (GConfClient *client, GtkBuilder *dialog)
 			g_free (page_name);
 		}
 
+	} else {
+		dialog_win = NULL;
 	}
 
 	return dialog_win;
diff --git a/panels/mouse/gnome-mouse-properties.h b/panels/mouse/gnome-mouse-properties.h
new file mode 100644
index 0000000..104a454
--- /dev/null
+++ b/panels/mouse/gnome-mouse-properties.h
@@ -0,0 +1,29 @@
+/* -*- mode: c; style: linux -*- */
+
+/* mouse-properties-capplet.c
+ * Copyright (C) 2001 Red Hat, Inc.
+ * Copyright (C) 2001 Ximian, Inc.
+ *
+ * Written by: Jonathon Blandford <jrb redhat com>,
+ *             Bradford Hovinen <hovinen ximian com>,
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+ * 02111-1307, USA.
+ */
+
+#include <gtk/gtk.h>
+
+GtkWidget *gnome_mouse_properties_init (GConfClient *client, GtkBuilder *dialog);
+



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