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



commit 21a2a53fea1499eb191cb01e575461a679e199c0
Author: Bastien Nocera <hadess hadess net>
Date:   Tue Oct 8 17:57:47 2013 +0200

    wacom: Update from gnome-settings-daemon

 panels/wacom/gsd-input-helper.c |    5 ++
 panels/wacom/gsd-wacom-device.c |   80 +++++++++++++++++++++++++++++++++++++--
 panels/wacom/gsd-wacom-device.h |    1 +
 3 files changed, 82 insertions(+), 4 deletions(-)
---
diff --git a/panels/wacom/gsd-input-helper.c b/panels/wacom/gsd-input-helper.c
index d5d2a2a..fc4f10c 100644
--- a/panels/wacom/gsd-input-helper.c
+++ b/panels/wacom/gsd-input-helper.c
@@ -504,6 +504,7 @@ run_custom_command (GdkDevice              *device,
         int exit_status;
         gboolean rc;
         int id;
+        char *out;
 
         settings = g_settings_new (INPUT_DEVICES_SCHEMA);
         cmd = g_settings_get_string (settings, KEY_HOTPLUG_COMMAND);
@@ -525,6 +526,10 @@ run_custom_command (GdkDevice              *device,
         argv[5] = (char*) gdk_device_get_name (device);
         argv[6] = NULL;
 
+        out = g_strjoinv (" ", argv);
+        g_debug ("About to launch command: %s", out);
+        g_free (out);
+
         rc = g_spawn_sync (g_get_home_dir (), argv, NULL, G_SPAWN_SEARCH_PATH,
                            NULL, NULL, NULL, NULL, &exit_status, NULL);
 
diff --git a/panels/wacom/gsd-wacom-device.c b/panels/wacom/gsd-wacom-device.c
index 8a11477..c598060 100644
--- a/panels/wacom/gsd-wacom-device.c
+++ b/panels/wacom/gsd-wacom-device.c
@@ -583,12 +583,14 @@ find_output_by_heuristic (GnomeRRScreen *rr_screen, GsdWacomDevice *device)
 {
        GnomeRROutput *rr_output;
 
+       if (gsd_wacom_device_is_isd (device))
+               return find_builtin_output (rr_screen);
+
        /* TODO: This heuristic will fail for non-Wacom display
         * tablets and may give the wrong result if multiple Wacom
         * display tablets are connected.
         */
        rr_output = find_output_by_edid (rr_screen, "WAC", NULL, NULL);
-
        if (!rr_output)
                rr_output = find_builtin_output (rr_screen);
 
@@ -703,7 +705,7 @@ set_display_by_output (GsdWacomDevice  *device,
        if (rr_output == NULL) {
          o_vendor  = g_strdup ("");
          o_product = g_strdup ("");
-         o_serial = g_strdup ("");
+         o_serial  = g_strdup ("");
        } else {
          gnome_rr_output_get_ids_from_edid (rr_output,
                                             &o_vendor,
@@ -1271,8 +1273,7 @@ gsd_wacom_device_add_buttons_dir (WacomDevice      *wacom_device,
 
                name = g_strdup_printf (button_str, button_num++);
                id = g_strdup_printf ("%s%c", button_str_id, i);
-               if (libwacom_get_button_flag (wacom_device, i) & WACOM_BUTTON_OLED)
-                       has_oled = TRUE;
+               has_oled = (libwacom_get_button_flag (wacom_device, i) & WACOM_BUTTON_OLED) != 0;
                l = g_list_append (l, gsd_wacom_tablet_button_new (name,
                                                                   id,
                                                                   settings_path,
@@ -1904,6 +1905,77 @@ gsd_wacom_device_get_area (GsdWacomDevice *device)
        return device_area;
 }
 
+static gboolean
+fill_old_axis (int     device_id,
+              gint  **items)
+{
+       int ndevices, i;
+       XDeviceInfoPtr list, slist;
+       gboolean retval = FALSE;
+
+       slist = list = (XDeviceInfoPtr) XListInputDevices (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()), 
&ndevices);
+
+       for (i = 0; i < ndevices; i++, list++) {
+               XAnyClassPtr any = (XAnyClassPtr) (list->inputclassinfo);
+               int j;
+
+               /* Core pointer and keyboard */
+               if (list->use == IsXKeyboard || list->use == IsXPointer)
+                       continue;
+
+               if (list->id != device_id)
+                       continue;
+
+               for (j = 0; j < list->num_classes; j++) {
+                       if (any->class == ValuatorClass) {
+                               XValuatorInfoPtr V = (XValuatorInfoPtr) any;
+                               XAxisInfoPtr ax = (XAxisInfoPtr) V->axes;
+
+                               if (V->mode == Absolute && V->num_axes >= 2) {
+                                       *items[0] = ax[0].min_value;
+                                       *items[1] = ax[0].max_value;
+                                       *items[2] = ax[1].min_value;
+                                       *items[3] = ax[1].max_value;
+                                       g_debug ("Found factory values for device calibration");
+                                       retval = TRUE;
+                                       break;
+                               }
+                       }
+
+                       /*
+                        * Increment 'any' to point to the next item in the linked
+                        * list.  The length is in bytes, so 'any' must be cast to
+                        * a character pointer before being incremented.
+                        */
+                       any = (XAnyClassPtr) ((char *) any + any->length);
+               }
+       }
+       XFreeDeviceList(slist);
+
+       return retval;
+}
+
+gint *
+gsd_wacom_device_get_default_area (GsdWacomDevice *device)
+{
+       int id;
+       gint *device_area;
+       gboolean ret;
+
+       g_return_val_if_fail (GSD_IS_WACOM_DEVICE (device), NULL);
+
+       g_object_get (device->priv->gdk_device, "device-id", &id, NULL);
+
+       device_area = g_new0 (int, 4);
+       ret = fill_old_axis (id, &device_area);
+       if (!ret) {
+               g_free (device_area);
+               return NULL;
+       }
+
+       return device_area;
+}
+
 const char *
 gsd_wacom_device_type_to_string (GsdWacomDeviceType type)
 {
diff --git a/panels/wacom/gsd-wacom-device.h b/panels/wacom/gsd-wacom-device.h
index 3657e88..3753218 100644
--- a/panels/wacom/gsd-wacom-device.h
+++ b/panels/wacom/gsd-wacom-device.h
@@ -173,6 +173,7 @@ GsdWacomStylus * gsd_wacom_device_get_stylus_for_type (GsdWacomDevice     *devic
 
 GsdWacomDeviceType gsd_wacom_device_get_device_type (GsdWacomDevice *device);
 gint           * gsd_wacom_device_get_area          (GsdWacomDevice *device);
+gint           * gsd_wacom_device_get_default_area  (GsdWacomDevice *device);
 const char     * gsd_wacom_device_type_to_string    (GsdWacomDeviceType type);
 GList          * gsd_wacom_device_get_buttons       (GsdWacomDevice *device);
 GsdWacomTabletButton *gsd_wacom_device_get_button   (GsdWacomDevice   *device,


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