[gnome-control-center] wacom: Update from gnome-settings-daemon



commit 8d8cf753528e991578d01203f440fd482fb41060
Author: Olivier Fourdan <ofourdan redhat com>
Date:   Tue Aug 21 17:59:36 2012 +0200

    wacom: Update from gnome-settings-daemon

 panels/wacom/gsd-input-helper.c |   13 +++++++++++++
 panels/wacom/gsd-input-helper.h |    2 ++
 panels/wacom/gsd-wacom-device.c |   14 +++++++-------
 panels/wacom/gsd-wacom-device.h |    3 +++
 4 files changed, 25 insertions(+), 7 deletions(-)
---
diff --git a/panels/wacom/gsd-input-helper.c b/panels/wacom/gsd-input-helper.c
index 78f1873..c15e135 100644
--- a/panels/wacom/gsd-input-helper.c
+++ b/panels/wacom/gsd-input-helper.c
@@ -188,6 +188,12 @@ device_info_is_touchscreen (XDeviceInfo *device_info)
         return (device_info->type == XInternAtom (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()), XI_TOUCHSCREEN, False));
 }
 
+gboolean
+device_info_is_mouse (XDeviceInfo *device_info)
+{
+        return (device_info->type == XInternAtom (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()), XI_MOUSE, False));
+}
+
 static gboolean
 device_type_is_present (InfoIdentifyFunc info_func,
                         DeviceIdentifyFunc device_func)
@@ -250,6 +256,13 @@ touchpad_is_present (void)
                                        device_is_touchpad);
 }
 
+gboolean
+mouse_is_present (void)
+{
+        return device_type_is_present (device_info_is_mouse,
+                                       NULL);
+}
+
 char *
 xdevice_get_device_node (int deviceid)
 {
diff --git a/panels/wacom/gsd-input-helper.h b/panels/wacom/gsd-input-helper.h
index dfde51f..fb898b0 100644
--- a/panels/wacom/gsd-input-helper.h
+++ b/panels/wacom/gsd-input-helper.h
@@ -61,9 +61,11 @@ gboolean  device_is_touchpad       (XDevice                *xdevice);
 
 gboolean  device_info_is_touchpad    (XDeviceInfo         *device_info);
 gboolean  device_info_is_touchscreen (XDeviceInfo         *device_info);
+gboolean  device_info_is_mouse       (XDeviceInfo         *device_info);
 
 gboolean  touchpad_is_present     (void);
 gboolean  touchscreen_is_present  (void);
+gboolean  mouse_is_present        (void);
 
 gboolean  device_set_property     (XDevice                *xdevice,
                                    const char             *device_name,
diff --git a/panels/wacom/gsd-wacom-device.c b/panels/wacom/gsd-wacom-device.c
index fad3e63..c1de506 100644
--- a/panels/wacom/gsd-wacom-device.c
+++ b/panels/wacom/gsd-wacom-device.c
@@ -756,7 +756,7 @@ gsd_wacom_device_set_display (GsdWacomDevice *device,
 		return;
 	}
 
-	if (monitor >= 0)
+	if (monitor > GSD_WACOM_SET_ALL_MONITORS)
 		output = find_output_by_monitor (rr_screen, gdk_screen_get_default (), monitor);
 	set_display_by_output (device, output);
 
@@ -823,25 +823,25 @@ gsd_wacom_device_get_display_monitor (GsdWacomDevice *device)
 	GnomeRRCrtc *crtc;
 	gint area[4];
 
-        g_return_val_if_fail (GSD_IS_WACOM_DEVICE (device), -1);
+        g_return_val_if_fail (GSD_IS_WACOM_DEVICE (device), GSD_WACOM_SET_ALL_MONITORS);
 
 	rr_screen = gnome_rr_screen_new (gdk_screen_get_default (), &error);
 	if (rr_screen == NULL) {
 		g_warning ("Failed to create GnomeRRScreen: %s", error->message);
 		g_error_free (error);
-		return -1;
+		return GSD_WACOM_SET_ALL_MONITORS;
 	}
 
 	rr_output = find_output (rr_screen, device);
 	if (rr_output == NULL) {
 		g_object_unref (rr_screen);
-		return -1;
+		return GSD_WACOM_SET_ALL_MONITORS;
 	}
 
 	if (!is_on (rr_output)) {
 		g_warning ("Output is not active.");
 		g_object_unref (rr_screen);
-		return -1;
+		return GSD_WACOM_SET_ALL_MONITORS;
 	}
 
 	crtc = gnome_rr_output_get_crtc (rr_output);
@@ -855,7 +855,7 @@ gsd_wacom_device_get_display_monitor (GsdWacomDevice *device)
 
 	if (area[2] <= 0 || area[3] <= 0) {
 		g_warning ("Output has non-positive area.");
-		return -1;
+		return GSD_WACOM_SET_ALL_MONITORS;
 	}
 
 	g_debug ("Area: %d,%d %dx%d", area[0], area[1], area[2], area[3]);
@@ -906,7 +906,7 @@ gsd_wacom_device_get_display_rotation (GsdWacomDevice *device)
 	if (rr_screen == NULL) {
 		g_warning ("Failed to create GnomeRRScreen: %s", error->message);
 		g_error_free (error);
-		return -1;
+		return GSD_WACOM_ROTATION_NONE;
 	}
 
 	rr_output = find_output (rr_screen, device);
diff --git a/panels/wacom/gsd-wacom-device.h b/panels/wacom/gsd-wacom-device.h
index 59c4b27..8604ee4 100644
--- a/panels/wacom/gsd-wacom-device.h
+++ b/panels/wacom/gsd-wacom-device.h
@@ -122,6 +122,9 @@ typedef enum {
         WACOM_TYPE_ALL     =     WACOM_TYPE_STYLUS | WACOM_TYPE_ERASER | WACOM_TYPE_CURSOR | WACOM_TYPE_PAD | WACOM_TYPE_TOUCH
 } GsdWacomDeviceType;
 
+/* We use -1 for entire screen when setting/getting monitor value */
+#define GSD_WACOM_SET_ALL_MONITORS -1
+
 GType gsd_wacom_device_get_type     (void);
 
 void     gsd_wacom_device_set_display         (GsdWacomDevice    *device,



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