~noskcaj/unity-control-center/gnome-desktop-3.10b

« back to all changes in this revision

Viewing changes to panels/wacom/gsd-wacom-device.c

  • Committer: Jackson Doak
  • Author(s): Giovanni Campagna
  • Date: 2014-03-15 19:31:19 UTC
  • Revision ID: noskcaj@ubuntu.com-20140315193119-jhx4zqtw1ha11n5d
wacom: adapt to GnomeRR API changes

GnomeRR now returns the EDID IDs as strings directly, so we don't
need to convert them to compare to the settings. Also, we don't
need to filter disconnected outputs, it's done by mutter now.

https://bugzilla.gnome.org/show_bug.cgi?id=705573

Show diffs side-by-side

added added

removed removed

Lines of Context:
521
521
        rr_outputs = gnome_rr_screen_list_outputs (rr_screen);
522
522
 
523
523
        for (i = 0; rr_outputs[i] != NULL; i++) {
524
 
                gchar *o_vendor_s;
525
 
                gchar *o_product_s;
526
 
                int o_product;
527
 
                gchar *o_serial_s;
528
 
                int o_serial;
 
524
                gchar *o_vendor;
 
525
                gchar *o_product;
 
526
                gchar *o_serial;
529
527
                gboolean match;
530
528
 
531
 
                if (!gnome_rr_output_is_connected (rr_outputs[i]))
532
 
                        continue;
533
 
 
534
 
                if (!gnome_rr_output_get_ids_from_edid (rr_outputs[i],
535
 
                                                        &o_vendor_s,
536
 
                                                        &o_product,
537
 
                                                        &o_serial))
538
 
                        continue;
539
 
 
540
 
                o_product_s = g_strdup_printf ("%d", o_product);
541
 
                o_serial_s  = g_strdup_printf ("%d", o_serial);
 
529
                gnome_rr_output_get_ids_from_edid (rr_outputs[i],
 
530
                                                   &o_vendor,
 
531
                                                   &o_product,
 
532
                                                   &o_serial);
542
533
 
543
534
                g_debug ("Checking for match between '%s','%s','%s' and '%s','%s','%s'", \
544
 
                         vendor, product, serial, o_vendor_s, o_product_s, o_serial_s);
545
 
 
546
 
                match = (vendor  == NULL || g_strcmp0 (vendor,  o_vendor_s)  == 0) && \
547
 
                        (product == NULL || g_strcmp0 (product, o_product_s) == 0) && \
548
 
                        (serial  == NULL || g_strcmp0 (serial,  o_serial_s)  == 0);
549
 
 
550
 
                g_free (o_vendor_s);
551
 
                g_free (o_product_s);
552
 
                g_free (o_serial_s);
 
535
                         vendor, product, serial, o_vendor, o_product, o_serial);
 
536
 
 
537
                match = (vendor  == NULL || g_strcmp0 (vendor,  o_vendor)  == 0) && \
 
538
                        (product == NULL || g_strcmp0 (product, o_product) == 0) && \
 
539
                        (serial  == NULL || g_strcmp0 (serial,  o_serial)  == 0);
 
540
 
 
541
                g_free (o_vendor);
 
542
                g_free (o_product);
 
543
                g_free (o_serial);
553
544
 
554
545
                if (match) {
555
546
                        retval = rr_outputs[i];
573
564
 
574
565
        rr_outputs = gnome_rr_screen_list_outputs (rr_screen);
575
566
        for (i = 0; rr_outputs[i] != NULL; i++) {
576
 
                if (!gnome_rr_output_is_connected (rr_outputs[i]))
577
 
                        continue;
578
 
 
579
567
                if (gnome_rr_output_is_laptop(rr_outputs[i])) {
580
568
                        retval = rr_outputs[i];
581
569
                        break;
699
687
        GVariant    *c_array;
700
688
        GVariant    *n_array;
701
689
        gsize        nvalues;
702
 
        gchar       *o_vendor_s, *o_product_s, *o_serial_s;
703
 
        int          o_product, o_serial;
 
690
        gchar       *o_vendor, *o_product, *o_serial;
704
691
        const gchar *values[3];
705
692
 
706
693
        tablet  = gsd_wacom_device_get_settings (device);
711
698
                return;
712
699
        }
713
700
 
714
 
        if (rr_output == NULL ||
715
 
            !gnome_rr_output_get_ids_from_edid (rr_output,
716
 
                                                &o_vendor_s,
717
 
                                                &o_product,
718
 
                                                &o_serial)) {
719
 
                o_vendor_s  = g_strdup ("");
720
 
                o_product_s = g_strdup ("");
721
 
                o_serial_s  = g_strdup ("");
 
701
        if (rr_output == NULL) {
 
702
          o_vendor  = g_strdup ("");
 
703
          o_product = g_strdup ("");
 
704
          o_serial = g_strdup ("");
722
705
        } else {
723
 
                o_product_s = g_strdup_printf ("%d", o_product);
724
 
                o_serial_s  = g_strdup_printf ("%d", o_serial);
 
706
          gnome_rr_output_get_ids_from_edid (rr_output,
 
707
                                             &o_vendor,
 
708
                                             &o_product,
 
709
                                             &o_serial);
725
710
        }
726
711
 
727
 
        values[0] = o_vendor_s;
728
 
        values[1] = o_product_s;
729
 
        values[2] = o_serial_s;
 
712
        values[0] = o_vendor;
 
713
        values[1] = o_product;
 
714
        values[2] = o_serial;
730
715
        n_array = g_variant_new_strv ((const gchar * const *) &values, 3);
731
716
        g_settings_set_value (tablet, "display", n_array);
732
717
 
733
 
        g_free (o_vendor_s);
734
 
        g_free (o_product_s);
735
 
        g_free (o_serial_s);
 
718
        g_free (o_vendor);
 
719
        g_free (o_product);
 
720
        g_free (o_serial);
736
721
}
737
722
 
738
723
static GsdWacomRotation