Merge lp:~robert-ancell/unity-control-center/libusd into lp:unity-control-center

Proposed by Robert Ancell
Status: Merged
Approved by: Iain Lane
Approved revision: 12788
Merged at revision: 12787
Proposed branch: lp:~robert-ancell/unity-control-center/libusd
Merge into: lp:unity-control-center
Diff against target: 1984 lines (+338/-341)
7 files modified
configure.ac (+2/-2)
debian/control (+1/-0)
panels/display/cc-display-panel.c (+232/-233)
panels/display/cc-rr-labeler.c (+19/-19)
panels/display/cc-rr-labeler.h (+3/-4)
panels/wacom/cc-wacom-mapping-panel.c (+14/-15)
panels/wacom/gsd-wacom-device.c (+67/-68)
To merge this branch: bzr merge lp:~robert-ancell/unity-control-center/libusd
Reviewer Review Type Date Requested Status
Iain Lane Approve
PS Jenkins bot (community) continuous-integration Needs Fixing
Review via email: mp+232676@code.launchpad.net

Commit message

Use libunity-settings-daemon to replace functionality that is being changed/removed in libgnome-desktop

Description of the change

Use libunity-settings-daemon to replace functionality that is being changed/removed in libgnome-desktop

To post a comment you must log in.
12786. By Robert Ancell

Merge with trunk

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
12787. By Robert Ancell

libunity-settings-daemon was moved into it's own package

12788. By Robert Ancell

Build-dep on libunity-settings-daemon-dev

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
Robert Ancell (robert-ancell) wrote :

Note that Jenkins can't build this because it requires the associated change from lp:~robert-ancell/unity-settings-daemon/xrandr

Revision history for this message
Iain Lane (laney) wrote :

works for me, thanks

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'configure.ac'
--- configure.ac 2014-02-26 20:00:59 +0000
+++ configure.ac 2014-08-29 10:31:11 +0000
@@ -121,7 +121,7 @@
121 gdk-pixbuf-2.0 >= $GDKPIXBUF_REQUIRED_VERSION)121 gdk-pixbuf-2.0 >= $GDKPIXBUF_REQUIRED_VERSION)
122PKG_CHECK_MODULES(DATETIME_PANEL, $COMMON_MODULES timezonemap122PKG_CHECK_MODULES(DATETIME_PANEL, $COMMON_MODULES timezonemap
123 polkit-gobject-1 >= $POLKIT_REQUIRED_VERSION)123 polkit-gobject-1 >= $POLKIT_REQUIRED_VERSION)
124PKG_CHECK_MODULES(DISPLAY_PANEL, $COMMON_MODULES gnome-desktop-3.0 >= 3.1.0 x11)124PKG_CHECK_MODULES(DISPLAY_PANEL, $COMMON_MODULES libunity-settings-daemon x11)
125PKG_CHECK_MODULES(INFO_PANEL, $COMMON_MODULES libgtop-2.0 gl x11125PKG_CHECK_MODULES(INFO_PANEL, $COMMON_MODULES libgtop-2.0 gl x11
126 polkit-gobject-1 >= $POLKIT_REQUIRED_VERSION webkitgtk-3.0)126 polkit-gobject-1 >= $POLKIT_REQUIRED_VERSION webkitgtk-3.0)
127PKG_CHECK_MODULES(KEYBOARD_PANEL, $COMMON_MODULES127PKG_CHECK_MODULES(KEYBOARD_PANEL, $COMMON_MODULES
@@ -236,7 +236,7 @@
236 PKG_CHECK_MODULES(WACOM_PANEL, $COMMON_MODULES236 PKG_CHECK_MODULES(WACOM_PANEL, $COMMON_MODULES
237 unity-settings-daemon237 unity-settings-daemon
238 xi >= 1.2 x11 libwacom >= $LIBWACOM_REQUIRED_VERSION238 xi >= 1.2 x11 libwacom >= $LIBWACOM_REQUIRED_VERSION
239 gnome-desktop-3.0 >= $GNOME_DESKTOP_REQUIRED_VERSION)239 libunity-settings-daemon)
240 AC_DEFINE(BUILD_WACOM, 1, [Define to 1 to build the Wacom panel])240 AC_DEFINE(BUILD_WACOM, 1, [Define to 1 to build the Wacom panel])
241 have_wacom=yes241 have_wacom=yes
242 fi242 fi
243243
=== modified file 'debian/control'
--- debian/control 2014-05-30 09:34:24 +0000
+++ debian/control 2014-08-29 10:31:11 +0000
@@ -12,6 +12,7 @@
12 gnome-common,12 gnome-common,
13 gnome-pkg-tools (>= 0.10),13 gnome-pkg-tools (>= 0.10),
14 unity-settings-daemon-dev,14 unity-settings-daemon-dev,
15 libunity-settings-daemon-dev,
15 gsettings-desktop-schemas-dev (>= 3.7.2.2),16 gsettings-desktop-schemas-dev (>= 3.7.2.2),
16 hardening-wrapper,17 hardening-wrapper,
17 intltool (>= 0.37.1),18 intltool (>= 0.37.1),
1819
=== modified file 'panels/display/cc-display-panel.c'
--- panels/display/cc-display-panel.c 2014-04-04 08:48:39 +0000
+++ panels/display/cc-display-panel.c 2014-08-29 10:31:11 +0000
@@ -30,9 +30,8 @@
30#include <gtk/gtk.h>30#include <gtk/gtk.h>
31#include <glib.h>31#include <glib.h>
32#include "scrollarea.h"32#include "scrollarea.h"
33#define GNOME_DESKTOP_USE_UNSTABLE_API33#include <libunity-settings-daemon/gsd-rr.h>
34#include <libgnome-desktop/gnome-rr.h>34#include <libunity-settings-daemon/gsd-rr-config.h>
35#include <libgnome-desktop/gnome-rr-config.h>
36#include <gdk/gdkx.h>35#include <gdk/gdkx.h>
37#include <X11/Xlib.h>36#include <X11/Xlib.h>
38#include <glib/gi18n.h>37#include <glib/gi18n.h>
@@ -86,10 +85,10 @@
8685
87struct _CcDisplayPanelPrivate86struct _CcDisplayPanelPrivate
88{87{
89 GnomeRRScreen *screen;88 GsdRRScreen *screen;
90 GnomeRRConfig *current_configuration;89 GsdRRConfig *current_configuration;
91 CcRRLabeler *labeler;90 CcRRLabeler *labeler;
92 GnomeRROutputInfo *current_output;91 GsdRROutputInfo *current_output;
9392
94 GSettings *clock_settings;93 GSettings *clock_settings;
95 GSettings *unity_settings;94 GSettings *unity_settings;
@@ -134,18 +133,18 @@
134133
135static void rebuild_gui (CcDisplayPanel *self);134static void rebuild_gui (CcDisplayPanel *self);
136static void on_clone_changed (GtkWidget *box, gpointer data);135static void on_clone_changed (GtkWidget *box, gpointer data);
137static gboolean output_overlaps (GnomeRROutputInfo *output, GnomeRRConfig *config);136static gboolean output_overlaps (GsdRROutputInfo *output, GsdRRConfig *config);
138static void select_current_output_from_dialog_position (CcDisplayPanel *self);137static void select_current_output_from_dialog_position (CcDisplayPanel *self);
139static void monitor_switch_active_cb (GObject *object, GParamSpec *pspec, gpointer data);138static void monitor_switch_active_cb (GObject *object, GParamSpec *pspec, gpointer data);
140static void get_geometry (GnomeRROutputInfo *output, int *w, int *h);139static void get_geometry (GsdRROutputInfo *output, int *w, int *h);
141static void apply_configuration_returned_cb (GObject *proxy, GAsyncResult *res, gpointer data);140static void apply_configuration_returned_cb (GObject *proxy, GAsyncResult *res, gpointer data);
142static gboolean get_clone_size (GnomeRRScreen *screen, int *width, int *height);141static gboolean get_clone_size (GsdRRScreen *screen, int *width, int *height);
143static gboolean output_info_supports_mode (CcDisplayPanel *self, GnomeRROutputInfo *info, int width, int height);142static gboolean output_info_supports_mode (CcDisplayPanel *self, GsdRROutputInfo *info, int width, int height);
144static char *make_resolution_string (int width, int height);143static char *make_resolution_string (int width, int height);
145static GObject *cc_display_panel_constructor (GType gtype,144static GObject *cc_display_panel_constructor (GType gtype,
146 guint n_properties,145 guint n_properties,
147 GObjectConstructParam *properties);146 GObjectConstructParam *properties);
148static void on_screen_changed (GnomeRRScreen *scr, gpointer data);147static void on_screen_changed (GsdRRScreen *scr, gpointer data);
149static void refresh_unity_launcher_placement (CcDisplayPanel *self);148static void refresh_unity_launcher_placement (CcDisplayPanel *self);
150static void refresh_unity_monitor_scale (CcDisplayPanel *self);149static void refresh_unity_monitor_scale (CcDisplayPanel *self);
151static gboolean unity_launcher_on_all_monitors (GSettings *settings);150static gboolean unity_launcher_on_all_monitors (GSettings *settings);
@@ -295,14 +294,14 @@
295}294}
296295
297static void296static void
298on_screen_changed (GnomeRRScreen *scr,297on_screen_changed (GsdRRScreen *scr,
299 gpointer data)298 gpointer data)
300{299{
301 GnomeRRConfig *current;300 GsdRRConfig *current;
302 CcDisplayPanel *self = data;301 CcDisplayPanel *self = data;
303302
304 current = gnome_rr_config_new_current (self->priv->screen, NULL);303 current = gsd_rr_config_new_current (self->priv->screen, NULL);
305 gnome_rr_config_ensure_primary (current);304 gsd_rr_config_ensure_primary (current);
306305
307 if (self->priv->current_configuration)306 if (self->priv->current_configuration)
308 g_object_unref (self->priv->current_configuration);307 g_object_unref (self->priv->current_configuration);
@@ -399,7 +398,7 @@
399 const char *text,398 const char *text,
400 gboolean preferred,399 gboolean preferred,
401 int width, int height, int rate,400 int width, int height, int rate,
402 GnomeRRRotation rotation)401 GsdRRRotation rotation)
403{402{
404 ForeachInfo info;403 ForeachInfo info;
405404
@@ -456,23 +455,23 @@
456455
457static void456static void
458add_mode (CcDisplayPanel *self,457add_mode (CcDisplayPanel *self,
459 GnomeRRMode *mode,458 GsdRRMode *mode,
460 gint output_width,459 gint output_width,
461 gint output_height,460 gint output_height,
462 guint preferred_id)461 guint preferred_id)
463{462{
464 int width, height, rate;463 int width, height, rate;
465464
466 width = gnome_rr_mode_get_width (mode);465 width = gsd_rr_mode_get_width (mode);
467 height = gnome_rr_mode_get_height (mode);466 height = gsd_rr_mode_get_height (mode);
468 rate = gnome_rr_mode_get_freq (mode);467 rate = gsd_rr_mode_get_freq (mode);
469468
470 if (should_show_resolution (output_width, output_height, width, height))469 if (should_show_resolution (output_width, output_height, width, height))
471 {470 {
472 char *text;471 char *text;
473 gboolean preferred;472 gboolean preferred;
474473
475 preferred = (gnome_rr_mode_get_id (mode) == preferred_id);474 preferred = (gsd_rr_mode_get_id (mode) == preferred_id);
476 text = make_resolution_string (width, height);475 text = make_resolution_string (width, height);
477 add_key (gtk_combo_box_get_model (GTK_COMBO_BOX (self->priv->resolution_combo)),476 add_key (gtk_combo_box_get_model (GTK_COMBO_BOX (self->priv->resolution_combo)),
478 text, preferred, width, height, rate, -1);477 text, preferred, width, height, rate, -1);
@@ -501,27 +500,27 @@
501 return TRUE;500 return TRUE;
502}501}
503502
504static GnomeRRMode **503static GsdRRMode **
505get_current_modes (CcDisplayPanel *self)504get_current_modes (CcDisplayPanel *self)
506{505{
507 GnomeRROutput *output;506 GsdRROutput *output;
508507
509 if (gnome_rr_config_get_clone (self->priv->current_configuration))508 if (gsd_rr_config_get_clone (self->priv->current_configuration))
510 {509 {
511 return gnome_rr_screen_list_clone_modes (self->priv->screen);510 return gsd_rr_screen_list_clone_modes (self->priv->screen);
512 }511 }
513 else512 else
514 {513 {
515 if (!self->priv->current_output)514 if (!self->priv->current_output)
516 return NULL;515 return NULL;
517516
518 output = gnome_rr_screen_get_output_by_name (self->priv->screen,517 output = gsd_rr_screen_get_output_by_name (self->priv->screen,
519 gnome_rr_output_info_get_name (self->priv->current_output));518 gsd_rr_output_info_get_name (self->priv->current_output));
520519
521 if (!output)520 if (!output)
522 return NULL;521 return NULL;
523522
524 return gnome_rr_output_list_modes (output);523 return gsd_rr_output_list_modes (output);
525 }524 }
526}525}
527526
@@ -530,38 +529,38 @@
530{529{
531 typedef struct530 typedef struct
532 {531 {
533 GnomeRRRotation rotation;532 GsdRRRotation rotation;
534 const char * name;533 const char * name;
535 } RotationInfo;534 } RotationInfo;
536 static const RotationInfo rotations[] = {535 static const RotationInfo rotations[] = {
537 { GNOME_RR_ROTATION_0, NC_("display panel, rotation", "Normal") },536 { GSD_RR_ROTATION_0, NC_("display panel, rotation", "Normal") },
538 { GNOME_RR_ROTATION_90, NC_("display panel, rotation", "Counterclockwise") },537 { GSD_RR_ROTATION_90, NC_("display panel, rotation", "Counterclockwise") },
539 { GNOME_RR_ROTATION_270, NC_("display panel, rotation", "Clockwise") },538 { GSD_RR_ROTATION_270, NC_("display panel, rotation", "Clockwise") },
540 { GNOME_RR_ROTATION_180, NC_("display panel, rotation", "180 Degrees") },539 { GSD_RR_ROTATION_180, NC_("display panel, rotation", "180 Degrees") },
541 };540 };
542 const char *selection;541 const char *selection;
543 GnomeRRRotation current;542 GsdRRRotation current;
544 int i;543 int i;
545544
546 clear_combo (self->priv->rotation_combo);545 clear_combo (self->priv->rotation_combo);
547546
548 gtk_widget_set_sensitive (self->priv->rotation_combo,547 gtk_widget_set_sensitive (self->priv->rotation_combo,
549 self->priv->current_output && gnome_rr_output_info_is_active (self->priv->current_output));548 self->priv->current_output && gsd_rr_output_info_is_active (self->priv->current_output));
550549
551 if (!self->priv->current_output)550 if (!self->priv->current_output)
552 return;551 return;
553552
554 current = gnome_rr_output_info_get_rotation (self->priv->current_output);553 current = gsd_rr_output_info_get_rotation (self->priv->current_output);
555554
556 selection = NULL;555 selection = NULL;
557 for (i = 0; i < G_N_ELEMENTS (rotations); ++i)556 for (i = 0; i < G_N_ELEMENTS (rotations); ++i)
558 {557 {
559 const RotationInfo *info = &(rotations[i]);558 const RotationInfo *info = &(rotations[i]);
560559
561 gnome_rr_output_info_set_rotation (self->priv->current_output, info->rotation);560 gsd_rr_output_info_set_rotation (self->priv->current_output, info->rotation);
562561
563 /* NULL-GError --- FIXME: we should say why this rotation is not available! */562 /* NULL-GError --- FIXME: we should say why this rotation is not available! */
564 if (gnome_rr_config_applicable (self->priv->current_configuration, self->priv->screen, NULL))563 if (gsd_rr_config_applicable (self->priv->current_configuration, self->priv->screen, NULL))
565 {564 {
566 add_key (gtk_combo_box_get_model (GTK_COMBO_BOX (self->priv->rotation_combo)), g_dpgettext2 (NULL, "display panel, rotation", info->name), FALSE, 0, 0, 0, info->rotation);565 add_key (gtk_combo_box_get_model (GTK_COMBO_BOX (self->priv->rotation_combo)), g_dpgettext2 (NULL, "display panel, rotation", info->name), FALSE, 0, 0, 0, info->rotation);
567566
@@ -570,7 +569,7 @@
570 }569 }
571 }570 }
572571
573 gnome_rr_output_info_set_rotation (self->priv->current_output, current);572 gsd_rr_output_info_set_rotation (self->priv->current_output, current);
574573
575 if (!(selection && combo_select (self->priv->rotation_combo, selection)))574 if (!(selection && combo_select (self->priv->rotation_combo, selection)))
576 gtk_combo_box_set_active (GTK_COMBO_BOX (self->priv->rotation_combo), 0);575 gtk_combo_box_set_active (GTK_COMBO_BOX (self->priv->rotation_combo), 0);
@@ -618,8 +617,8 @@
618 int output_width, output_height;617 int output_width, output_height;
619 float max_scale;618 float max_scale;
620619
621 GnomeRROutputInfo *output = self->priv->current_output;620 GsdRROutputInfo *output = self->priv->current_output;
622 const char *monitor_name = gnome_rr_output_info_get_name (output);621 const char *monitor_name = gsd_rr_output_info_get_name (output);
623 int current_ui_scale = get_ui_scale_from_monitor (self, monitor_name);622 int current_ui_scale = get_ui_scale_from_monitor (self, monitor_name);
624 float current_scale_factor = (float)current_ui_scale / 8.0;623 float current_scale_factor = (float)current_ui_scale / 8.0;
625 float win_scale_factor = current_scale_factor > 1 ? floor (current_scale_factor) : 1;624 float win_scale_factor = current_scale_factor > 1 ? floor (current_scale_factor) : 1;
@@ -644,7 +643,7 @@
644 GVariant *new_dict;643 GVariant *new_dict;
645644
646 GtkAdjustment *adj = gtk_range_get_adjustment (GTK_RANGE(self->priv->ui_scale));645 GtkAdjustment *adj = gtk_range_get_adjustment (GTK_RANGE(self->priv->ui_scale));
647 const char *monitor_name = gnome_rr_output_info_get_name (self->priv->current_output);646 const char *monitor_name = gsd_rr_output_info_get_name (self->priv->current_output);
648 if (!monitor_name)647 if (!monitor_name)
649 {648 {
650 g_warning("Failed to get monitor name.");649 g_warning("Failed to get monitor name.");
@@ -673,11 +672,11 @@
673count_active_outputs (CcDisplayPanel *self)672count_active_outputs (CcDisplayPanel *self)
674{673{
675 int i, count = 0;674 int i, count = 0;
676 GnomeRROutputInfo **outputs = gnome_rr_config_get_outputs (self->priv->current_configuration);675 GsdRROutputInfo **outputs = gsd_rr_config_get_outputs (self->priv->current_configuration);
677676
678 for (i = 0; outputs[i] != NULL; ++i)677 for (i = 0; outputs[i] != NULL; ++i)
679 {678 {
680 if (gnome_rr_output_info_is_active (outputs[i]))679 if (gsd_rr_output_info_is_active (outputs[i]))
681 count++;680 count++;
682 }681 }
683682
@@ -686,10 +685,10 @@
686685
687#if 0686#if 0
688static int687static int
689count_all_outputs (GnomeRRConfig *config)688count_all_outputs (GsdRRConfig *config)
690{689{
691 int i;690 int i;
692 GnomeRROutputInfo **outputs = gnome_rr_config_get_outputs (config);691 GsdRROutputInfo **outputs = gsd_rr_config_get_outputs (config);
693692
694 for (i = 0; outputs[i] != NULL; i++)693 for (i = 0; outputs[i] != NULL; i++)
695 ;694 ;
@@ -718,7 +717,7 @@
718 if (have_clone_size) {717 if (have_clone_size) {
719 int i;718 int i;
720 int num_outputs_with_clone_size;719 int num_outputs_with_clone_size;
721 GnomeRROutputInfo **outputs = gnome_rr_config_get_outputs (self->priv->current_configuration);720 GsdRROutputInfo **outputs = gsd_rr_config_get_outputs (self->priv->current_configuration);
722721
723 num_outputs_with_clone_size = 0;722 num_outputs_with_clone_size = 0;
724723
@@ -728,7 +727,7 @@
728 * doesn't matter if those outputs aren't actually On currently; we727 * doesn't matter if those outputs aren't actually On currently; we
729 * will turn them on in on_clone_changed().728 * will turn them on in on_clone_changed().
730 */729 */
731 if (gnome_rr_output_info_is_connected (outputs[i]) && output_info_supports_mode (self, outputs[i], clone_width, clone_height))730 if (gsd_rr_output_info_is_connected (outputs[i]) && output_info_supports_mode (self, outputs[i], clone_width, clone_height))
732 num_outputs_with_clone_size++;731 num_outputs_with_clone_size++;
733 }732 }
734733
@@ -747,7 +746,7 @@
747746
748 g_signal_handlers_block_by_func (self->priv->clone_checkbox, G_CALLBACK (on_clone_changed), self);747 g_signal_handlers_block_by_func (self->priv->clone_checkbox, G_CALLBACK (on_clone_changed), self);
749748
750 mirror_is_active = self->priv->current_configuration && gnome_rr_config_get_clone (self->priv->current_configuration);749 mirror_is_active = self->priv->current_configuration && gsd_rr_config_get_clone (self->priv->current_configuration);
751750
752 /* If mirror_is_active, then it *must* be possible to turn mirroring off */751 /* If mirror_is_active, then it *must* be possible to turn mirroring off */
753 mirror_is_supported = mirror_is_active || mirror_screens_is_supported (self);752 mirror_is_supported = mirror_is_active || mirror_screens_is_supported (self);
@@ -786,7 +785,7 @@
786785
787 if (self->priv->current_output)786 if (self->priv->current_output)
788 {787 {
789 if (gnome_rr_config_get_clone (self->priv->current_configuration))788 if (gsd_rr_config_get_clone (self->priv->current_configuration))
790 {789 {
791 gchar *str = mirror_monitor_name ();790 gchar *str = mirror_monitor_name ();
792 gtk_label_set_text (GTK_LABEL (self->priv->current_monitor_label), str);791 gtk_label_set_text (GTK_LABEL (self->priv->current_monitor_label), str);
@@ -794,7 +793,7 @@
794 }793 }
795 else794 else
796 {795 {
797 str = gnome_rr_output_info_get_display_name (self->priv->current_output);796 str = gsd_rr_output_info_get_display_name (self->priv->current_output);
798 gtk_label_set_text (GTK_LABEL (self->priv->current_monitor_label), str);797 gtk_label_set_text (GTK_LABEL (self->priv->current_monitor_label), str);
799 }798 }
800799
@@ -845,14 +844,14 @@
845 sensitive = FALSE;844 sensitive = FALSE;
846 on_active = FALSE;845 on_active = FALSE;
847846
848 if (!gnome_rr_config_get_clone (self->priv->current_configuration) && self->priv->current_output)847 if (!gsd_rr_config_get_clone (self->priv->current_configuration) && self->priv->current_output)
849 {848 {
850 if (count_active_outputs (self) > 1 || !gnome_rr_output_info_is_active (self->priv->current_output))849 if (count_active_outputs (self) > 1 || !gsd_rr_output_info_is_active (self->priv->current_output))
851 sensitive = TRUE;850 sensitive = TRUE;
852 else851 else
853 sensitive = FALSE;852 sensitive = FALSE;
854853
855 on_active = gnome_rr_output_info_is_active (self->priv->current_output);854 on_active = gsd_rr_output_info_is_active (self->priv->current_output);
856 }855 }
857856
858 gtk_widget_set_sensitive (self->priv->monitor_switch, sensitive);857 gtk_widget_set_sensitive (self->priv->monitor_switch, sensitive);
@@ -910,7 +909,7 @@
910}909}
911910
912static void911static void
913find_best_mode (GnomeRRMode **modes, int *out_width, int *out_height)912find_best_mode (GsdRRMode **modes, int *out_width, int *out_height)
914{913{
915 int i;914 int i;
916915
@@ -921,8 +920,8 @@
921 {920 {
922 int w, h;921 int w, h;
923922
924 w = gnome_rr_mode_get_width (modes[i]);923 w = gsd_rr_mode_get_width (modes[i]);
925 h = gnome_rr_mode_get_height (modes[i]);924 h = gsd_rr_mode_get_height (modes[i]);
926925
927 if (w * h > *out_width * *out_height)926 if (w * h > *out_width * *out_height)
928 {927 {
@@ -936,18 +935,18 @@
936rebuild_resolution_combo (CcDisplayPanel *self)935rebuild_resolution_combo (CcDisplayPanel *self)
937{936{
938 int i;937 int i;
939 GnomeRRMode **modes;938 GsdRRMode **modes;
940 GnomeRRMode *mode;939 GsdRRMode *mode;
941 char *current;940 char *current;
942 int output_width, output_height;941 int output_width, output_height;
943 guint32 preferred_id;942 guint32 preferred_id;
944 GnomeRROutput *output;943 GsdRROutput *output;
945944
946 clear_combo (self->priv->resolution_combo);945 clear_combo (self->priv->resolution_combo);
947946
948 if (!(modes = get_current_modes (self))947 if (!(modes = get_current_modes (self))
949 || !self->priv->current_output948 || !self->priv->current_output
950 || !gnome_rr_output_info_is_active (self->priv->current_output))949 || !gsd_rr_output_info_is_active (self->priv->current_output))
951 {950 {
952 gtk_widget_set_sensitive (self->priv->resolution_combo, FALSE);951 gtk_widget_set_sensitive (self->priv->resolution_combo, FALSE);
953 return;952 return;
@@ -955,22 +954,22 @@
955954
956 g_assert (self->priv->current_output != NULL);955 g_assert (self->priv->current_output != NULL);
957956
958 gnome_rr_output_info_get_geometry (self->priv->current_output, NULL, NULL, &output_width, &output_height);957 gsd_rr_output_info_get_geometry (self->priv->current_output, NULL, NULL, &output_width, &output_height);
959 g_assert (output_width != 0 && output_height != 0);958 g_assert (output_width != 0 && output_height != 0);
960959
961 gtk_widget_set_sensitive (self->priv->resolution_combo, TRUE);960 gtk_widget_set_sensitive (self->priv->resolution_combo, TRUE);
962961
963 output = gnome_rr_screen_get_output_by_name (self->priv->screen,962 output = gsd_rr_screen_get_output_by_name (self->priv->screen,
964 gnome_rr_output_info_get_name (self->priv->current_output));963 gsd_rr_output_info_get_name (self->priv->current_output));
965 mode = gnome_rr_output_get_preferred_mode (output);964 mode = gsd_rr_output_get_preferred_mode (output);
966 preferred_id = gnome_rr_mode_get_id (mode);965 preferred_id = gsd_rr_mode_get_id (mode);
967966
968 for (i = 0; modes[i] != NULL; ++i)967 for (i = 0; modes[i] != NULL; ++i)
969 add_mode (self, modes[i], output_width, output_height, preferred_id);968 add_mode (self, modes[i], output_width, output_height, preferred_id);
970969
971 /* And force the preferred mode in the drop-down (when not in clone mode)970 /* And force the preferred mode in the drop-down (when not in clone mode)
972 * https://bugzilla.gnome.org/show_bug.cgi?id=680969 */971 * https://bugzilla.gnome.org/show_bug.cgi?id=680969 */
973 if (!gnome_rr_config_get_clone (self->priv->current_configuration))972 if (!gsd_rr_config_get_clone (self->priv->current_configuration))
974 add_mode (self, mode, output_width, output_height, preferred_id);973 add_mode (self, mode, output_width, output_height, preferred_id);
975974
976 current = make_resolution_string (output_width, output_height);975 current = make_resolution_string (output_width, output_height);
@@ -1012,7 +1011,7 @@
1012}1011}
10131012
1014static gboolean1013static gboolean
1015get_mode (GtkWidget *widget, int *width, int *height, int *rate, GnomeRRRotation *rot)1014get_mode (GtkWidget *widget, int *width, int *height, int *rate, GsdRRRotation *rot)
1016{1015{
1017 GtkTreeIter iter;1016 GtkTreeIter iter;
1018 GtkTreeModel *model;1017 GtkTreeModel *model;
@@ -1032,7 +1031,7 @@
1032 rate = &dummy;1031 rate = &dummy;
10331032
1034 if (!rot)1033 if (!rot)
1035 rot = (GnomeRRRotation *)&dummy;1034 rot = (GsdRRRotation *)&dummy;
10361035
1037 model = gtk_combo_box_get_model (box);1036 model = gtk_combo_box_get_model (box);
1038 gtk_tree_model_get (model, &iter,1037 gtk_tree_model_get (model, &iter,
@@ -1050,13 +1049,13 @@
1050on_rotation_changed (GtkComboBox *box, gpointer data)1049on_rotation_changed (GtkComboBox *box, gpointer data)
1051{1050{
1052 CcDisplayPanel *self = data;1051 CcDisplayPanel *self = data;
1053 GnomeRRRotation rotation;1052 GsdRRRotation rotation;
10541053
1055 if (!self->priv->current_output)1054 if (!self->priv->current_output)
1056 return;1055 return;
10571056
1058 if (get_mode (self->priv->rotation_combo, NULL, NULL, NULL, &rotation))1057 if (get_mode (self->priv->rotation_combo, NULL, NULL, NULL, &rotation))
1059 gnome_rr_output_info_set_rotation (self->priv->current_output, rotation);1058 gsd_rr_output_info_set_rotation (self->priv->current_output, rotation);
10601059
1061 foo_scroll_area_invalidate (FOO_SCROLL_AREA (self->priv->area));1060 foo_scroll_area_invalidate (FOO_SCROLL_AREA (self->priv->area));
1062}1061}
@@ -1082,7 +1081,7 @@
1082 GVariant *dict;1081 GVariant *dict;
1083 GVariant *new_dict;1082 GVariant *new_dict;
10841083
1085 monitor_name = gnome_rr_output_info_get_name (self->priv->current_output);1084 monitor_name = gsd_rr_output_info_get_name (self->priv->current_output);
1086 if (!monitor_name)1085 if (!monitor_name)
1087 {1086 {
1088 g_warning("Failed to get monitor name.");1087 g_warning("Failed to get monitor name.");
@@ -1107,17 +1106,17 @@
1107static void1106static void
1108select_resolution_for_current_output (CcDisplayPanel *self)1107select_resolution_for_current_output (CcDisplayPanel *self)
1109{1108{
1110 GnomeRRMode **modes;1109 GsdRRMode **modes;
1111 int width, height;1110 int width, height;
1112 int x,y;1111 int x,y;
1113 gnome_rr_output_info_get_geometry (self->priv->current_output, &x, &y, NULL, NULL);1112 gsd_rr_output_info_get_geometry (self->priv->current_output, &x, &y, NULL, NULL);
11141113
1115 width = gnome_rr_output_info_get_preferred_width (self->priv->current_output);1114 width = gsd_rr_output_info_get_preferred_width (self->priv->current_output);
1116 height = gnome_rr_output_info_get_preferred_height (self->priv->current_output);1115 height = gsd_rr_output_info_get_preferred_height (self->priv->current_output);
11171116
1118 if (width != 0 && height != 0)1117 if (width != 0 && height != 0)
1119 {1118 {
1120 gnome_rr_output_info_set_geometry (self->priv->current_output, x, y, width, height);1119 gsd_rr_output_info_set_geometry (self->priv->current_output, x, y, width, height);
1121 return;1120 return;
1122 }1121 }
11231122
@@ -1127,7 +1126,7 @@
11271126
1128 find_best_mode (modes, &width, &height);1127 find_best_mode (modes, &width, &height);
11291128
1130 gnome_rr_output_info_set_geometry (self->priv->current_output, x, y, width, height);1129 gsd_rr_output_info_set_geometry (self->priv->current_output, x, y, width, height);
1131}1130}
11321131
1133static void1132static void
@@ -1145,13 +1144,13 @@
11451144
1146 if (value)1145 if (value)
1147 {1146 {
1148 gnome_rr_output_info_set_active (self->priv->current_output, TRUE);1147 gsd_rr_output_info_set_active (self->priv->current_output, TRUE);
1149 select_resolution_for_current_output (self);1148 select_resolution_for_current_output (self);
1150 }1149 }
1151 else1150 else
1152 {1151 {
1153 gnome_rr_output_info_set_active (self->priv->current_output, FALSE);1152 gsd_rr_output_info_set_active (self->priv->current_output, FALSE);
1154 gnome_rr_config_ensure_primary (self->priv->current_configuration);1153 gsd_rr_config_ensure_primary (self->priv->current_configuration);
1155 }1154 }
11561155
1157 rebuild_gui (self);1156 rebuild_gui (self);
@@ -1159,7 +1158,7 @@
1159}1158}
11601159
1161static void1160static void
1162realign_outputs_after_resolution_change (CcDisplayPanel *self, GnomeRROutputInfo *output_that_changed, int old_width, int old_height)1161realign_outputs_after_resolution_change (CcDisplayPanel *self, GsdRROutputInfo *output_that_changed, int old_width, int old_height)
1163{1162{
1164 /* We find the outputs that were below or to the right of the output that1163 /* We find the outputs that were below or to the right of the output that
1165 * changed, and realign them; we also do that for outputs that shared the1164 * changed, and realign them; we also do that for outputs that shared the
@@ -1171,11 +1170,11 @@
1171 int old_right_edge, old_bottom_edge;1170 int old_right_edge, old_bottom_edge;
1172 int dx, dy;1171 int dx, dy;
1173 int x, y, width, height;1172 int x, y, width, height;
1174 GnomeRROutputInfo **outputs;1173 GsdRROutputInfo **outputs;
11751174
1176 g_assert (self->priv->current_configuration != NULL);1175 g_assert (self->priv->current_configuration != NULL);
11771176
1178 gnome_rr_output_info_get_geometry (output_that_changed, &x, &y, &width, &height); 1177 gsd_rr_output_info_get_geometry (output_that_changed, &x, &y, &width, &height);
11791178
1180 if (width == old_width && height == old_height)1179 if (width == old_width && height == old_height)
1181 return;1180 return;
@@ -1186,17 +1185,17 @@
1186 dx = width - old_width;1185 dx = width - old_width;
1187 dy = height - old_height;1186 dy = height - old_height;
11881187
1189 outputs = gnome_rr_config_get_outputs (self->priv->current_configuration);1188 outputs = gsd_rr_config_get_outputs (self->priv->current_configuration);
11901189
1191 for (i = 0; outputs[i] != NULL; i++)1190 for (i = 0; outputs[i] != NULL; i++)
1192 {1191 {
1193 int output_x, output_y;1192 int output_x, output_y;
1194 int output_width, output_height;1193 int output_width, output_height;
11951194
1196 if (outputs[i] == output_that_changed || !gnome_rr_output_info_is_connected (outputs[i]))1195 if (outputs[i] == output_that_changed || !gsd_rr_output_info_is_connected (outputs[i]))
1197 continue;1196 continue;
11981197
1199 gnome_rr_output_info_get_geometry (outputs[i], &output_x, &output_y, &output_width, &output_height);1198 gsd_rr_output_info_get_geometry (outputs[i], &output_x, &output_y, &output_width, &output_height);
12001199
1201 if (output_x >= old_right_edge)1200 if (output_x >= old_right_edge)
1202 output_x += dx;1201 output_x += dx;
@@ -1208,7 +1207,7 @@
1208 else if (output_y + output_height == old_bottom_edge)1207 else if (output_y + output_height == old_bottom_edge)
1209 output_y = y + height - output_height;1208 output_y = y + height - output_height;
12101209
1211 gnome_rr_output_info_set_geometry (outputs[i], output_x, output_y, output_width, output_height);1210 gsd_rr_output_info_set_geometry (outputs[i], output_x, output_y, output_width, output_height);
1212 }1211 }
1213}1212}
12141213
@@ -1224,16 +1223,16 @@
1224 if (!self->priv->current_output)1223 if (!self->priv->current_output)
1225 return;1224 return;
12261225
1227 gnome_rr_output_info_get_geometry (self->priv->current_output, &x, &y, &old_width, &old_height);1226 gsd_rr_output_info_get_geometry (self->priv->current_output, &x, &y, &old_width, &old_height);
12281227
1229 if (get_mode (self->priv->resolution_combo, &width, &height, NULL, NULL))1228 if (get_mode (self->priv->resolution_combo, &width, &height, NULL, NULL))
1230 {1229 {
1231 gnome_rr_output_info_set_geometry (self->priv->current_output, x, y, width, height);1230 gsd_rr_output_info_set_geometry (self->priv->current_output, x, y, width, height);
12321231
1233 if (width == 0 || height == 0)1232 if (width == 0 || height == 0)
1234 gnome_rr_output_info_set_active (self->priv->current_output, FALSE);1233 gsd_rr_output_info_set_active (self->priv->current_output, FALSE);
1235 else1234 else
1236 gnome_rr_output_info_set_active (self->priv->current_output, TRUE);1235 gsd_rr_output_info_set_active (self->priv->current_output, TRUE);
1237 }1236 }
12381237
1239 realign_outputs_after_resolution_change (self, self->priv->current_output, old_width, old_height);1238 realign_outputs_after_resolution_change (self, self->priv->current_output, old_width, old_height);
@@ -1248,7 +1247,7 @@
1248{1247{
1249 int i;1248 int i;
1250 int x;1249 int x;
1251 GnomeRROutputInfo **outputs;1250 GsdRROutputInfo **outputs;
12521251
1253 /* Lay out all the monitors horizontally when "mirror screens" is turned1252 /* Lay out all the monitors horizontally when "mirror screens" is turned
1254 * off, to avoid having all of them overlapped initially. We put the1253 * off, to avoid having all of them overlapped initially. We put the
@@ -1258,15 +1257,15 @@
1258 x = 0;1257 x = 0;
12591258
1260 /* First pass, all "on" outputs */1259 /* First pass, all "on" outputs */
1261 outputs = gnome_rr_config_get_outputs (self->priv->current_configuration);1260 outputs = gsd_rr_config_get_outputs (self->priv->current_configuration);
12621261
1263 for (i = 0; outputs[i]; ++i)1262 for (i = 0; outputs[i]; ++i)
1264 {1263 {
1265 int width, height;1264 int width, height;
1266 if (gnome_rr_output_info_is_connected (outputs[i]) && gnome_rr_output_info_is_active (outputs[i]))1265 if (gsd_rr_output_info_is_connected (outputs[i]) && gsd_rr_output_info_is_active (outputs[i]))
1267 {1266 {
1268 gnome_rr_output_info_get_geometry (outputs[i], NULL, NULL, &width, &height);1267 gsd_rr_output_info_get_geometry (outputs[i], NULL, NULL, &width, &height);
1269 gnome_rr_output_info_set_geometry (outputs[i], x, 0, width, height);1268 gsd_rr_output_info_set_geometry (outputs[i], x, 0, width, height);
1270 x += width;1269 x += width;
1271 }1270 }
1272 }1271 }
@@ -1276,10 +1275,10 @@
1276 for (i = 0; outputs[i]; ++i)1275 for (i = 0; outputs[i]; ++i)
1277 {1276 {
1278 int width, height;1277 int width, height;
1279 if (!(gnome_rr_output_info_is_connected (outputs[i]) && gnome_rr_output_info_is_active (outputs[i])))1278 if (!(gsd_rr_output_info_is_connected (outputs[i]) && gsd_rr_output_info_is_active (outputs[i])))
1280 {1279 {
1281 gnome_rr_output_info_get_geometry (outputs[i], NULL, NULL, &width, &height);1280 gsd_rr_output_info_get_geometry (outputs[i], NULL, NULL, &width, &height);
1282 gnome_rr_output_info_set_geometry (outputs[i], x, 0, width, height);1281 gsd_rr_output_info_set_geometry (outputs[i], x, 0, width, height);
1283 x += width;1282 x += width;
1284 }1283 }
1285 }1284 }
@@ -1290,9 +1289,9 @@
1290 * Do we need to put this function in gnome-desktop for public use?1289 * Do we need to put this function in gnome-desktop for public use?
1291 */1290 */
1292static gboolean1291static gboolean
1293get_clone_size (GnomeRRScreen *screen, int *width, int *height)1292get_clone_size (GsdRRScreen *screen, int *width, int *height)
1294{1293{
1295 GnomeRRMode **modes = gnome_rr_screen_list_clone_modes (screen);1294 GsdRRMode **modes = gsd_rr_screen_list_clone_modes (screen);
1296 int best_w, best_h;1295 int best_w, best_h;
1297 int i;1296 int i;
12981297
@@ -1300,11 +1299,11 @@
1300 best_h = 0;1299 best_h = 0;
13011300
1302 for (i = 0; modes[i] != NULL; ++i) {1301 for (i = 0; modes[i] != NULL; ++i) {
1303 GnomeRRMode *mode = modes[i];1302 GsdRRMode *mode = modes[i];
1304 int w, h;1303 int w, h;
13051304
1306 w = gnome_rr_mode_get_width (mode);1305 w = gsd_rr_mode_get_width (mode);
1307 h = gnome_rr_mode_get_height (mode);1306 h = gsd_rr_mode_get_height (mode);
13081307
1309 if (w * h > best_w * best_h) {1308 if (w * h > best_w * best_h) {
1310 best_w = w;1309 best_w = w;
@@ -1325,24 +1324,24 @@
1325}1324}
13261325
1327static gboolean1326static gboolean
1328output_info_supports_mode (CcDisplayPanel *self, GnomeRROutputInfo *info, int width, int height)1327output_info_supports_mode (CcDisplayPanel *self, GsdRROutputInfo *info, int width, int height)
1329{1328{
1330 GnomeRROutput *output;1329 GsdRROutput *output;
1331 GnomeRRMode **modes;1330 GsdRRMode **modes;
1332 int i;1331 int i;
13331332
1334 if (!gnome_rr_output_info_is_connected (info))1333 if (!gsd_rr_output_info_is_connected (info))
1335 return FALSE;1334 return FALSE;
13361335
1337 output = gnome_rr_screen_get_output_by_name (self->priv->screen, gnome_rr_output_info_get_name (info));1336 output = gsd_rr_screen_get_output_by_name (self->priv->screen, gsd_rr_output_info_get_name (info));
1338 if (!output)1337 if (!output)
1339 return FALSE;1338 return FALSE;
13401339
1341 modes = gnome_rr_output_list_modes (output);1340 modes = gsd_rr_output_list_modes (output);
13421341
1343 for (i = 0; modes[i]; i++) {1342 for (i = 0; modes[i]; i++) {
1344 if (gnome_rr_mode_get_width (modes[i]) == width1343 if (gsd_rr_mode_get_width (modes[i]) == width
1345 && gnome_rr_mode_get_height (modes[i]) == height)1344 && gsd_rr_mode_get_height (modes[i]) == height)
1346 return TRUE;1345 return TRUE;
1347 }1346 }
13481347
@@ -1354,17 +1353,17 @@
1354{1353{
1355 CcDisplayPanel *self = data;1354 CcDisplayPanel *self = data;
13561355
1357 gnome_rr_config_set_clone (self->priv->current_configuration, gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (self->priv->clone_checkbox)));1356 gsd_rr_config_set_clone (self->priv->current_configuration, gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (self->priv->clone_checkbox)));
13581357
1359 if (gnome_rr_config_get_clone (self->priv->current_configuration))1358 if (gsd_rr_config_get_clone (self->priv->current_configuration))
1360 {1359 {
1361 int i;1360 int i;
1362 int width, height;1361 int width, height;
1363 GnomeRROutputInfo **outputs = gnome_rr_config_get_outputs (self->priv->current_configuration);1362 GsdRROutputInfo **outputs = gsd_rr_config_get_outputs (self->priv->current_configuration);
13641363
1365 for (i = 0; outputs[i]; ++i)1364 for (i = 0; outputs[i]; ++i)
1366 {1365 {
1367 if (gnome_rr_output_info_is_connected (outputs[i]))1366 if (gsd_rr_output_info_is_connected (outputs[i]))
1368 {1367 {
1369 self->priv->current_output = outputs[i];1368 self->priv->current_output = outputs[i];
1370 break;1369 break;
@@ -1381,9 +1380,9 @@
1381 for (i = 0; outputs[i]; i++) {1380 for (i = 0; outputs[i]; i++) {
1382 int x, y;1381 int x, y;
1383 if (output_info_supports_mode (self, outputs[i], width, height)) {1382 if (output_info_supports_mode (self, outputs[i], width, height)) {
1384 gnome_rr_output_info_set_active (outputs[i], TRUE);1383 gsd_rr_output_info_set_active (outputs[i], TRUE);
1385 gnome_rr_output_info_get_geometry (outputs[i], &x, &y, NULL, NULL);1384 gsd_rr_output_info_get_geometry (outputs[i], &x, &y, NULL, NULL);
1386 gnome_rr_output_info_set_geometry (outputs[i], x, y, width, height);1385 gsd_rr_output_info_set_geometry (outputs[i], x, y, width, height);
1387 }1386 }
1388 }1387 }
1389 }1388 }
@@ -1397,12 +1396,12 @@
1397}1396}
13981397
1399static void1398static void
1400apply_rotation_to_geometry (GnomeRROutputInfo *output, int *w, int *h)1399apply_rotation_to_geometry (GsdRROutputInfo *output, int *w, int *h)
1401{1400{
1402 GnomeRRRotation rotation;1401 GsdRRRotation rotation;
14031402
1404 rotation = gnome_rr_output_info_get_rotation (output);1403 rotation = gsd_rr_output_info_get_rotation (output);
1405 if ((rotation & GNOME_RR_ROTATION_90) || (rotation & GNOME_RR_ROTATION_270))1404 if ((rotation & GSD_RR_ROTATION_90) || (rotation & GSD_RR_ROTATION_270))
1406 {1405 {
1407 int tmp;1406 int tmp;
1408 tmp = *h;1407 tmp = *h;
@@ -1412,16 +1411,16 @@
1412}1411}
14131412
1414static void1413static void
1415get_geometry (GnomeRROutputInfo *output, int *w, int *h)1414get_geometry (GsdRROutputInfo *output, int *w, int *h)
1416{1415{
1417 if (gnome_rr_output_info_is_active (output))1416 if (gsd_rr_output_info_is_active (output))
1418 {1417 {
1419 gnome_rr_output_info_get_geometry (output, NULL, NULL, w, h);1418 gsd_rr_output_info_get_geometry (output, NULL, NULL, w, h);
1420 }1419 }
1421 else1420 else
1422 {1421 {
1423 *h = gnome_rr_output_info_get_preferred_height (output);1422 *h = gsd_rr_output_info_get_preferred_height (output);
1424 *w = gnome_rr_output_info_get_preferred_width (output);1423 *w = gsd_rr_output_info_get_preferred_width (output);
1425 }1424 }
14261425
1427 apply_rotation_to_geometry (output, w, h);1426 apply_rotation_to_geometry (output, w, h);
@@ -1435,7 +1434,7 @@
1435{1434{
1436 int i, dummy;1435 int i, dummy;
1437 GList *result = NULL;1436 GList *result = NULL;
1438 GnomeRROutputInfo **outputs;1437 GsdRROutputInfo **outputs;
14391438
1440 if (!total_w)1439 if (!total_w)
1441 total_w = &dummy;1440 total_w = &dummy;
@@ -1445,10 +1444,10 @@
1445 *total_w = 0;1444 *total_w = 0;
1446 *total_h = 0;1445 *total_h = 0;
14471446
1448 outputs = gnome_rr_config_get_outputs (self->priv->current_configuration);1447 outputs = gsd_rr_config_get_outputs (self->priv->current_configuration);
1449 for (i = 0; outputs[i] != NULL; ++i)1448 for (i = 0; outputs[i] != NULL; ++i)
1450 {1449 {
1451 if (gnome_rr_output_info_is_connected (outputs[i]))1450 if (gsd_rr_output_info_is_connected (outputs[i]))
1452 {1451 {
1453 int w, h;1452 int w, h;
14541453
@@ -1500,7 +1499,7 @@
15001499
1501typedef struct Edge1500typedef struct Edge
1502{1501{
1503 GnomeRROutputInfo *output;1502 GsdRROutputInfo *output;
1504 int x1, y1;1503 int x1, y1;
1505 int x2, y2;1504 int x2, y2;
1506} Edge;1505} Edge;
@@ -1513,7 +1512,7 @@
1513} Snap;1512} Snap;
15141513
1515static void1514static void
1516add_edge (GnomeRROutputInfo *output, int x1, int y1, int x2, int y2, GArray *edges)1515add_edge (GsdRROutputInfo *output, int x1, int y1, int x2, int y2, GArray *edges)
1517{1516{
1518 Edge e;1517 Edge e;
15191518
@@ -1527,11 +1526,11 @@
1527}1526}
15281527
1529static void1528static void
1530list_edges_for_output (GnomeRROutputInfo *output, GArray *edges)1529list_edges_for_output (GsdRROutputInfo *output, GArray *edges)
1531{1530{
1532 int x, y, w, h;1531 int x, y, w, h;
15331532
1534 gnome_rr_output_info_get_geometry (output, &x, &y, &w, &h);1533 gsd_rr_output_info_get_geometry (output, &x, &y, &w, &h);
15351534
1536 apply_rotation_to_geometry (output, &w, &h);1535 apply_rotation_to_geometry (output, &w, &h);
15371536
@@ -1543,14 +1542,14 @@
1543}1542}
15441543
1545static void1544static void
1546list_edges (GnomeRRConfig *config, GArray *edges)1545list_edges (GsdRRConfig *config, GArray *edges)
1547{1546{
1548 int i;1547 int i;
1549 GnomeRROutputInfo **outputs = gnome_rr_config_get_outputs (config);1548 GsdRROutputInfo **outputs = gsd_rr_config_get_outputs (config);
15501549
1551 for (i = 0; outputs[i]; ++i)1550 for (i = 0; outputs[i]; ++i)
1552 {1551 {
1553 if (gnome_rr_output_info_is_connected (outputs[i]))1552 if (gsd_rr_output_info_is_connected (outputs[i]))
1554 list_edges_for_output (outputs[i], edges);1553 list_edges_for_output (outputs[i], edges);
1555 }1554 }
1556}1555}
@@ -1636,7 +1635,7 @@
1636}1635}
16371636
1638static void1637static void
1639list_snaps (GnomeRROutputInfo *output, GArray *edges, GArray *snaps)1638list_snaps (GsdRROutputInfo *output, GArray *edges, GArray *snaps)
1640{1639{
1641 int i;1640 int i;
16421641
@@ -1692,7 +1691,7 @@
1692}1691}
16931692
1694static gboolean1693static gboolean
1695output_is_aligned (GnomeRROutputInfo *output, GArray *edges)1694output_is_aligned (GsdRROutputInfo *output, GArray *edges)
1696{1695{
1697 gboolean result = FALSE;1696 gboolean result = FALSE;
1698 int i;1697 int i;
@@ -1729,28 +1728,28 @@
1729}1728}
17301729
1731static void1730static void
1732get_output_rect (GnomeRROutputInfo *output, GdkRectangle *rect)1731get_output_rect (GsdRROutputInfo *output, GdkRectangle *rect)
1733{1732{
1734 gnome_rr_output_info_get_geometry (output, &rect->x, &rect->y, &rect->width, &rect->height);1733 gsd_rr_output_info_get_geometry (output, &rect->x, &rect->y, &rect->width, &rect->height);
17351734
1736 apply_rotation_to_geometry (output, &rect->width, &rect->height);1735 apply_rotation_to_geometry (output, &rect->width, &rect->height);
1737}1736}
17381737
1739static gboolean1738static gboolean
1740output_overlaps (GnomeRROutputInfo *output, GnomeRRConfig *config)1739output_overlaps (GsdRROutputInfo *output, GsdRRConfig *config)
1741{1740{
1742 int i;1741 int i;
1743 GdkRectangle output_rect;1742 GdkRectangle output_rect;
1744 GnomeRROutputInfo **outputs;1743 GsdRROutputInfo **outputs;
17451744
1746 g_assert (output != NULL);1745 g_assert (output != NULL);
17471746
1748 get_output_rect (output, &output_rect);1747 get_output_rect (output, &output_rect);
17491748
1750 outputs = gnome_rr_config_get_outputs (config);1749 outputs = gsd_rr_config_get_outputs (config);
1751 for (i = 0; outputs[i]; ++i)1750 for (i = 0; outputs[i]; ++i)
1752 {1751 {
1753 if (outputs[i] != output && gnome_rr_output_info_is_connected (outputs[i]))1752 if (outputs[i] != output && gsd_rr_output_info_is_connected (outputs[i]))
1754 {1753 {
1755 GdkRectangle other_rect;1754 GdkRectangle other_rect;
17561755
@@ -1764,16 +1763,16 @@
1764}1763}
17651764
1766static gboolean1765static gboolean
1767gnome_rr_config_is_aligned (GnomeRRConfig *config, GArray *edges)1766gsd_rr_config_is_aligned (GsdRRConfig *config, GArray *edges)
1768{1767{
1769 int i;1768 int i;
1770 gboolean result = TRUE;1769 gboolean result = TRUE;
1771 GnomeRROutputInfo **outputs;1770 GsdRROutputInfo **outputs;
17721771
1773 outputs = gnome_rr_config_get_outputs (config);1772 outputs = gsd_rr_config_get_outputs (config);
1774 for (i = 0; outputs[i]; ++i)1773 for (i = 0; outputs[i]; ++i)
1775 {1774 {
1776 if (gnome_rr_output_info_is_connected (outputs[i]))1775 if (gsd_rr_output_info_is_connected (outputs[i]))
1777 {1776 {
1778 if (!output_is_aligned (outputs[i], edges))1777 if (!output_is_aligned (outputs[i], edges))
1779 return FALSE;1778 return FALSE;
@@ -1879,7 +1878,7 @@
1879 * on_canvas_event() for where we reset the cursor to the default if it1878 * on_canvas_event() for where we reset the cursor to the default if it
1880 * exits the outputs' area.1879 * exits the outputs' area.
1881 */1880 */
1882 if (!gnome_rr_config_get_clone (self->priv->current_configuration) && get_n_connected (self) > 1)1881 if (!gsd_rr_config_get_clone (self->priv->current_configuration) && get_n_connected (self) > 1)
1883 set_cursor (GTK_WIDGET (area), GDK_HAND1);1882 set_cursor (GTK_WIDGET (area), GDK_HAND1);
18841883
1885 if (event->type == FOO_BUTTON_PRESS)1884 if (event->type == FOO_BUTTON_PRESS)
@@ -1887,7 +1886,7 @@
1887 rebuild_gui (self);1886 rebuild_gui (self);
1888 set_top_bar_tooltip (self, TRUE);1887 set_top_bar_tooltip (self, TRUE);
18891888
1890 if (!gnome_rr_config_get_clone (self->priv->current_configuration) && get_n_connected (self) > 1)1889 if (!gsd_rr_config_get_clone (self->priv->current_configuration) && get_n_connected (self) > 1)
1891 {1890 {
1892 self->priv->dragging_top_bar = TRUE;1891 self->priv->dragging_top_bar = TRUE;
1893 foo_scroll_area_begin_grab (area, (FooScrollAreaEventFunc) on_top_bar_event, self);1892 foo_scroll_area_begin_grab (area, (FooScrollAreaEventFunc) on_top_bar_event, self);
@@ -1926,14 +1925,14 @@
19261925
1927static void1926static void
1928set_primary_output (CcDisplayPanel *self,1927set_primary_output (CcDisplayPanel *self,
1929 GnomeRROutputInfo *output)1928 GsdRROutputInfo *output)
1930{1929{
1931 int i;1930 int i;
1932 GnomeRROutputInfo **outputs;1931 GsdRROutputInfo **outputs;
19331932
1934 outputs = gnome_rr_config_get_outputs (self->priv->current_configuration);1933 outputs = gsd_rr_config_get_outputs (self->priv->current_configuration);
1935 for (i = 0; outputs[i] != NULL; ++i)1934 for (i = 0; outputs[i] != NULL; ++i)
1936 gnome_rr_output_info_set_primary (outputs[i], outputs[i] == output);1935 gsd_rr_output_info_set_primary (outputs[i], outputs[i] == output);
19371936
1938 gtk_widget_queue_draw (WID ("self->priv->area"));1937 gtk_widget_queue_draw (WID ("self->priv->area"));
1939 /* refresh the combobox */1938 /* refresh the combobox */
@@ -1945,12 +1944,12 @@
1945 FooScrollAreaEvent *event,1944 FooScrollAreaEvent *event,
1946 gpointer data)1945 gpointer data)
1947{1946{
1948 GnomeRROutputInfo *output = data;1947 GsdRROutputInfo *output = data;
1949 CcDisplayPanel *self = g_object_get_data (G_OBJECT (area), "panel");1948 CcDisplayPanel *self = g_object_get_data (G_OBJECT (area), "panel");
19501949
1951 if (event->type == FOO_DRAG_HOVER)1950 if (event->type == FOO_DRAG_HOVER)
1952 {1951 {
1953 if (gnome_rr_output_info_is_active (output) && self->priv->dragging_top_bar)1952 if (gsd_rr_output_info_is_active (output) && self->priv->dragging_top_bar)
1954 set_primary_output (self, output);1953 set_primary_output (self, output);
1955 return;1954 return;
1956 }1955 }
@@ -1964,7 +1963,7 @@
1964 * on_canvas_event() for where we reset the cursor to the default if it1963 * on_canvas_event() for where we reset the cursor to the default if it
1965 * exits the outputs' area.1964 * exits the outputs' area.
1966 */1965 */
1967 if (!gnome_rr_config_get_clone (self->priv->current_configuration) && get_n_connected (self) > 1)1966 if (!gsd_rr_config_get_clone (self->priv->current_configuration) && get_n_connected (self) > 1)
1968 set_cursor (GTK_WIDGET (area), GDK_FLEUR);1967 set_cursor (GTK_WIDGET (area), GDK_FLEUR);
19691968
1970 if (event->type == FOO_BUTTON_PRESS)1969 if (event->type == FOO_BUTTON_PRESS)
@@ -1976,10 +1975,10 @@
1976 rebuild_gui (self);1975 rebuild_gui (self);
1977 set_monitors_tooltip (self, TRUE);1976 set_monitors_tooltip (self, TRUE);
19781977
1979 if (!gnome_rr_config_get_clone (self->priv->current_configuration) && get_n_connected (self) > 1)1978 if (!gsd_rr_config_get_clone (self->priv->current_configuration) && get_n_connected (self) > 1)
1980 {1979 {
1981 int output_x, output_y;1980 int output_x, output_y;
1982 gnome_rr_output_info_get_geometry (output, &output_x, &output_y, NULL, NULL);1981 gsd_rr_output_info_get_geometry (output, &output_x, &output_y, NULL, NULL);
19831982
1984 foo_scroll_area_begin_grab (area, on_output_event, data);1983 foo_scroll_area_begin_grab (area, on_output_event, data);
19851984
@@ -2005,11 +2004,11 @@
2005 int i;2004 int i;
2006 GArray *edges, *snaps, *new_edges;2005 GArray *edges, *snaps, *new_edges;
20072006
2008 gnome_rr_output_info_get_geometry (output, &old_x, &old_y, &width, &height);2007 gsd_rr_output_info_get_geometry (output, &old_x, &old_y, &width, &height);
2009 new_x = info->output_x + (event->x - info->grab_x) / scale;2008 new_x = info->output_x + (event->x - info->grab_x) / scale;
2010 new_y = info->output_y + (event->y - info->grab_y) / scale;2009 new_y = info->output_y + (event->y - info->grab_y) / scale;
20112010
2012 gnome_rr_output_info_set_geometry (output, new_x, new_y, width, height);2011 gsd_rr_output_info_set_geometry (output, new_x, new_y, width, height);
20132012
2014 edges = g_array_new (TRUE, TRUE, sizeof (Edge));2013 edges = g_array_new (TRUE, TRUE, sizeof (Edge));
2015 snaps = g_array_new (TRUE, TRUE, sizeof (Snap));2014 snaps = g_array_new (TRUE, TRUE, sizeof (Snap));
@@ -2020,26 +2019,26 @@
20202019
2021 g_array_sort (snaps, compare_snaps);2020 g_array_sort (snaps, compare_snaps);
20222021
2023 gnome_rr_output_info_set_geometry (output, new_x, new_y, width, height);2022 gsd_rr_output_info_set_geometry (output, new_x, new_y, width, height);
20242023
2025 for (i = 0; i < snaps->len; ++i)2024 for (i = 0; i < snaps->len; ++i)
2026 {2025 {
2027 Snap *snap = &(g_array_index (snaps, Snap, i));2026 Snap *snap = &(g_array_index (snaps, Snap, i));
2028 GArray *new_edges = g_array_new (TRUE, TRUE, sizeof (Edge));2027 GArray *new_edges = g_array_new (TRUE, TRUE, sizeof (Edge));
20292028
2030 gnome_rr_output_info_set_geometry (output, new_x + snap->dx, new_y + snap->dy, width, height);2029 gsd_rr_output_info_set_geometry (output, new_x + snap->dx, new_y + snap->dy, width, height);
20312030
2032 g_array_set_size (new_edges, 0);2031 g_array_set_size (new_edges, 0);
2033 list_edges (self->priv->current_configuration, new_edges);2032 list_edges (self->priv->current_configuration, new_edges);
20342033
2035 if (gnome_rr_config_is_aligned (self->priv->current_configuration, new_edges))2034 if (gsd_rr_config_is_aligned (self->priv->current_configuration, new_edges))
2036 {2035 {
2037 g_array_free (new_edges, TRUE);2036 g_array_free (new_edges, TRUE);
2038 break;2037 break;
2039 }2038 }
2040 else2039 else
2041 {2040 {
2042 gnome_rr_output_info_set_geometry (output, info->output_x, info->output_y, width, height);2041 gsd_rr_output_info_set_geometry (output, info->output_x, info->output_y, width, height);
2043 }2042 }
2044 }2043 }
20452044
@@ -2079,15 +2078,15 @@
20792078
2080static PangoLayout *2079static PangoLayout *
2081get_display_name (CcDisplayPanel *self,2080get_display_name (CcDisplayPanel *self,
2082 GnomeRROutputInfo *output)2081 GsdRROutputInfo *output)
2083{2082{
2084 PangoLayout *layout;2083 PangoLayout *layout;
2085 char *text;2084 char *text;
20862085
2087 if (gnome_rr_config_get_clone (self->priv->current_configuration))2086 if (gsd_rr_config_get_clone (self->priv->current_configuration))
2088 text = mirror_monitor_name ();2087 text = mirror_monitor_name ();
2089 else2088 else
2090 text = g_strdup (gnome_rr_output_info_get_display_name (output));2089 text = g_strdup (gsd_rr_output_info_get_display_name (output));
20912090
2092 layout = gtk_widget_create_pango_layout (GTK_WIDGET (self->priv->area), text);2091 layout = gtk_widget_create_pango_layout (GTK_WIDGET (self->priv->area), text);
2093 g_free (text);2092 g_free (text);
@@ -2167,10 +2166,10 @@
2167 double scale = compute_scale (self);2166 double scale = compute_scale (self);
2168 double x, y;2167 double x, y;
2169 int output_x, output_y;2168 int output_x, output_y;
2170 GnomeRRRotation rotation;2169 GsdRRRotation rotation;
2171 int total_w, total_h;2170 int total_w, total_h;
2172 GList *connected_outputs = list_connected_outputs (self, &total_w, &total_h);2171 GList *connected_outputs = list_connected_outputs (self, &total_w, &total_h);
2173 GnomeRROutputInfo *output = g_list_nth (connected_outputs, i)->data;2172 GsdRROutputInfo *output = g_list_nth (connected_outputs, i)->data;
2174 PangoLayout *layout = get_display_name (self, output);2173 PangoLayout *layout = get_display_name (self, output);
2175 PangoRectangle ink_extent, log_extent;2174 PangoRectangle ink_extent, log_extent;
2176 GdkRectangle viewport;2175 GdkRectangle viewport;
@@ -2192,7 +2191,7 @@
2192 viewport.height -= 2 * MARGIN;2191 viewport.height -= 2 * MARGIN;
2193 viewport.width -= 2 * MARGIN;2192 viewport.width -= 2 * MARGIN;
21942193
2195 gnome_rr_output_info_get_geometry (output, &output_x, &output_y, NULL, NULL);2194 gsd_rr_output_info_get_geometry (output, &output_x, &output_y, NULL, NULL);
2196 x = output_x * scale + MARGIN + (viewport.width - total_w * scale) / 2.0;2195 x = output_x * scale + MARGIN + (viewport.width - total_w * scale) / 2.0;
2197 y = output_y * scale + MARGIN + (viewport.height - total_h * scale) / 2.0;2196 y = output_y * scale + MARGIN + (viewport.height - total_h * scale) / 2.0;
21982197
@@ -2210,11 +2209,11 @@
22102209
2211 /* rotation is already applied in get_geometry */2210 /* rotation is already applied in get_geometry */
22122211
2213 rotation = gnome_rr_output_info_get_rotation (output);2212 rotation = gsd_rr_output_info_get_rotation (output);
2214 if (rotation & GNOME_RR_REFLECT_X)2213 if (rotation & GSD_RR_REFLECT_X)
2215 cairo_scale (cr, -1, 1);2214 cairo_scale (cr, -1, 1);
22162215
2217 if (rotation & GNOME_RR_REFLECT_Y)2216 if (rotation & GSD_RR_REFLECT_Y)
2218 cairo_scale (cr, 1, -1);2217 cairo_scale (cr, 1, -1);
22192218
2220 cairo_translate (cr,2219 cairo_translate (cr,
@@ -2244,7 +2243,7 @@
2244 g = output_color.green;2243 g = output_color.green;
2245 b = output_color.blue;2244 b = output_color.blue;
22462245
2247 if (!gnome_rr_output_info_is_active (output))2246 if (!gsd_rr_output_info_is_active (output))
2248 {2247 {
2249 /* If the output is turned off, just darken the selected color */2248 /* If the output is turned off, just darken the selected color */
2250 color_shade (&r, &g, &b, 0.4);2249 color_shade (&r, &g, &b, 0.4);
@@ -2280,7 +2279,7 @@
2280 y + ((h * scale + 0.5) - factor * log_extent.height) / 2);2279 y + ((h * scale + 0.5) - factor * log_extent.height) / 2);
22812280
2282 cairo_scale (cr, factor, factor);2281 cairo_scale (cr, factor, factor);
2283 if (gnome_rr_output_info_is_active (output))2282 if (gsd_rr_output_info_is_active (output))
2284 cairo_set_source_rgb (cr, 0.0, 0.0, 0.0);2283 cairo_set_source_rgb (cr, 0.0, 0.0, 0.0);
2285 else2284 else
2286 cairo_set_source_rgb (cr, 1.0, 1.0, 1.0);2285 cairo_set_source_rgb (cr, 1.0, 1.0, 1.0);
@@ -2292,7 +2291,7 @@
2292 /* Only display a launcher on all or primary monitor */2291 /* Only display a launcher on all or primary monitor */
2293 if (is_unity_session ())2292 if (is_unity_session ())
2294 {2293 {
2295 if (gnome_rr_output_info_is_active (output) && (unity_launcher_on_all_monitors (self->priv->unity_settings) || gnome_rr_output_info_get_primary (output)))2294 if (gsd_rr_output_info_is_active (output) && (unity_launcher_on_all_monitors (self->priv->unity_settings) || gsd_rr_output_info_get_primary (output)))
2296 {2295 {
2297 cairo_rectangle (cr, x, y, 10, h * scale + 0.5);2296 cairo_rectangle (cr, x, y, 10, h * scale + 0.5);
2298 cairo_set_source_rgb (cr, 0, 0, 0);2297 cairo_set_source_rgb (cr, 0, 0, 0);
@@ -2312,7 +2311,7 @@
2312 }2311 }
2313 }2312 }
23142313
2315 if (gnome_rr_output_info_get_primary (output) && !is_unity_session ())2314 if (gsd_rr_output_info_get_primary (output) && !is_unity_session ())
2316 {2315 {
2317 const char *clock_format;2316 const char *clock_format;
2318 char *text;2317 char *text;
@@ -2389,7 +2388,7 @@
2389 {2388 {
2390 paint_output (self, cr, g_list_position (connected_outputs, list));2389 paint_output (self, cr, g_list_position (connected_outputs, list));
23912390
2392 if (gnome_rr_config_get_clone (self->priv->current_configuration))2391 if (gsd_rr_config_get_clone (self->priv->current_configuration))
2393 break;2392 break;
2394 }2393 }
2395}2394}
@@ -2428,21 +2427,21 @@
2428}2427}
24292428
2430static void2429static void
2431compute_virtual_size_for_configuration (GnomeRRConfig *config, int *ret_width, int *ret_height)2430compute_virtual_size_for_configuration (GsdRRConfig *config, int *ret_width, int *ret_height)
2432{2431{
2433 int i;2432 int i;
2434 int width, height;2433 int width, height;
2435 int output_x, output_y, output_width, output_height;2434 int output_x, output_y, output_width, output_height;
2436 GnomeRROutputInfo **outputs;2435 GsdRROutputInfo **outputs;
24372436
2438 width = height = 0;2437 width = height = 0;
24392438
2440 outputs = gnome_rr_config_get_outputs (config);2439 outputs = gsd_rr_config_get_outputs (config);
2441 for (i = 0; outputs[i] != NULL; i++)2440 for (i = 0; outputs[i] != NULL; i++)
2442 {2441 {
2443 if (gnome_rr_output_info_is_active (outputs[i]))2442 if (gsd_rr_output_info_is_active (outputs[i]))
2444 {2443 {
2445 gnome_rr_output_info_get_geometry (outputs[i], &output_x, &output_y, &output_width, &output_height);2444 gsd_rr_output_info_get_geometry (outputs[i], &output_x, &output_y, &output_width, &output_height);
2446 width = MAX (width, output_x + output_width);2445 width = MAX (width, output_x + output_width);
2447 height = MAX (height, output_y + output_height);2446 height = MAX (height, output_y + output_height);
2448 }2447 }
@@ -2461,7 +2460,7 @@
24612460
2462 compute_virtual_size_for_configuration (self->priv->current_configuration, &req_width, &req_height);2461 compute_virtual_size_for_configuration (self->priv->current_configuration, &req_width, &req_height);
24632462
2464 gnome_rr_screen_get_ranges (self->priv->screen, &min_width, &max_width, &min_height, &max_height);2463 gsd_rr_screen_get_ranges (self->priv->screen, &min_width, &max_width, &min_height, &max_height);
24652464
2466#if 02465#if 0
2467 g_debug ("X Server supports:");2466 g_debug ("X Server supports:");
@@ -2516,24 +2515,24 @@
2516static void2515static void
2517ensure_current_configuration_is_saved (void)2516ensure_current_configuration_is_saved (void)
2518{2517{
2519 GnomeRRScreen *rr_screen;2518 GsdRRScreen *rr_screen;
2520 GnomeRRConfig *rr_config;2519 GsdRRConfig *rr_config;
25212520
2522 /* Normally, gnome_rr_config_save() creates a backup file based on the2521 /* Normally, gsd_rr_config_save() creates a backup file based on the
2523 * old monitors.xml. However, if *that* file didn't exist, there is2522 * old monitors.xml. However, if *that* file didn't exist, there is
2524 * nothing from which to create a backup. So, here we'll save the2523 * nothing from which to create a backup. So, here we'll save the
2525 * current/unchanged configuration and then let our caller call2524 * current/unchanged configuration and then let our caller call
2526 * gnome_rr_config_save() again with the new/changed configuration, so2525 * gsd_rr_config_save() again with the new/changed configuration, so
2527 * that there *will* be a backup file in the end.2526 * that there *will* be a backup file in the end.
2528 */2527 */
25292528
2530 rr_screen = gnome_rr_screen_new (gdk_screen_get_default (), NULL); /* NULL-GError */2529 rr_screen = gsd_rr_screen_new (gdk_screen_get_default (), NULL); /* NULL-GError */
2531 if (!rr_screen)2530 if (!rr_screen)
2532 return;2531 return;
25332532
2534 rr_config = gnome_rr_config_new_current (rr_screen, NULL);2533 rr_config = gsd_rr_config_new_current (rr_screen, NULL);
2535 gnome_rr_config_ensure_primary (rr_config);2534 gsd_rr_config_ensure_primary (rr_config);
2536 gnome_rr_config_save (rr_config, NULL); /* NULL-GError */2535 gsd_rr_config_save (rr_config, NULL); /* NULL-GError */
25372536
2538 g_object_unref (rr_config);2537 g_object_unref (rr_config);
2539 g_object_unref (rr_screen);2538 g_object_unref (rr_screen);
@@ -2566,8 +2565,8 @@
2566{2565{
2567 GError *error;2566 GError *error;
25682567
2569 gnome_rr_config_sanitize (self->priv->current_configuration);2568 gsd_rr_config_sanitize (self->priv->current_configuration);
2570 gnome_rr_config_ensure_primary (self->priv->current_configuration);2569 gsd_rr_config_ensure_primary (self->priv->current_configuration);
25712570
2572 check_required_virtual_size (self);2571 check_required_virtual_size (self);
25732572
@@ -2576,7 +2575,7 @@
2576 ensure_current_configuration_is_saved ();2575 ensure_current_configuration_is_saved ();
25772576
2578 error = NULL;2577 error = NULL;
2579 if (!gnome_rr_config_save (self->priv->current_configuration, &error))2578 if (!gsd_rr_config_save (self->priv->current_configuration, &error))
2580 {2579 {
2581 error_message (self, _("Could not save the monitor configuration"), error->message);2580 error_message (self, _("Could not save the monitor configuration"), error->message);
2582 g_error_free (error);2581 g_error_free (error);
@@ -2609,7 +2608,7 @@
2609#if 02608#if 0
2610/* Returns whether the graphics driver doesn't advertise RANDR 1.2 features, and just 1.0 */2609/* Returns whether the graphics driver doesn't advertise RANDR 1.2 features, and just 1.0 */
2611static gboolean2610static gboolean
2612driver_is_randr_10 (GnomeRRConfig *config)2611driver_is_randr_10 (GsdRRConfig *config)
2613{2612{
2614 /* In the Xorg code, see xserver/randr/rrinfo.c:RRScanOldConfig(). It gets2613 /* In the Xorg code, see xserver/randr/rrinfo.c:RRScanOldConfig(). It gets
2615 * called when the graphics driver doesn't support RANDR 1.2 yet, just 1.0.2614 * called when the graphics driver doesn't support RANDR 1.2 yet, just 1.0.
@@ -2622,10 +2621,10 @@
2622 *2621 *
2623 * FIXME: however, we don't even check for XRRQueryVersion() returning 1.2, neither2622 * FIXME: however, we don't even check for XRRQueryVersion() returning 1.2, neither
2624 * here nor in gnome-desktop/libgnomedesktop*.c. Do we need to check for that,2623 * here nor in gnome-desktop/libgnomedesktop*.c. Do we need to check for that,
2625 * or is gnome_rr_screen_new()'s return value sufficient?2624 * or is gsd_rr_screen_new()'s return value sufficient?
2626 */2625 */
26272626
2628 return (count_all_outputs (config) == 1 && strcmp (gnome_rr_output_info_get_name (gnome_rr_config_get_outputs (config)[0]), "default") == 0);2627 return (count_all_outputs (config) == 1 && strcmp (gsd_rr_output_info_get_name (gsd_rr_config_get_outputs (config)[0]), "default") == 0);
2629}2628}
2630#endif2629#endif
26312630
@@ -2636,7 +2635,7 @@
2636 GError *error;2635 GError *error;
26372636
2638 error = NULL;2637 error = NULL;
2639 if (!gnome_rr_screen_refresh (self->priv->screen, &error)) {2638 if (!gsd_rr_screen_refresh (self->priv->screen, &error)) {
2640 if (error) {2639 if (error) {
2641 error_message (self, _("Could not detect displays"), error->message);2640 error_message (self, _("Could not detect displays"), error->message);
2642 g_error_free (error);2641 g_error_free (error);
@@ -2644,27 +2643,27 @@
2644 }2643 }
2645}2644}
26462645
2647static GnomeRROutputInfo *2646static GsdRROutputInfo *
2648get_nearest_output (GnomeRRConfig *configuration, int x, int y)2647get_nearest_output (GsdRRConfig *configuration, int x, int y)
2649{2648{
2650 int i;2649 int i;
2651 int nearest_index;2650 int nearest_index;
2652 int nearest_dist;2651 int nearest_dist;
2653 GnomeRROutputInfo **outputs;2652 GsdRROutputInfo **outputs;
26542653
2655 nearest_index = -1;2654 nearest_index = -1;
2656 nearest_dist = G_MAXINT;2655 nearest_dist = G_MAXINT;
26572656
2658 outputs = gnome_rr_config_get_outputs (configuration);2657 outputs = gsd_rr_config_get_outputs (configuration);
2659 for (i = 0; outputs[i] != NULL; i++)2658 for (i = 0; outputs[i] != NULL; i++)
2660 {2659 {
2661 int dist_x, dist_y;2660 int dist_x, dist_y;
2662 int output_x, output_y, output_width, output_height;2661 int output_x, output_y, output_width, output_height;
26632662
2664 if (!(gnome_rr_output_info_is_connected (outputs[i]) && gnome_rr_output_info_is_active (outputs[i])))2663 if (!(gsd_rr_output_info_is_connected (outputs[i]) && gsd_rr_output_info_is_active (outputs[i])))
2665 continue;2664 continue;
26662665
2667 gnome_rr_output_info_get_geometry (outputs[i], &output_x, &output_y, &output_width, &output_height);2666 gsd_rr_output_info_get_geometry (outputs[i], &output_x, &output_y, &output_width, &output_height);
26682667
2669 if (x < output_x)2668 if (x < output_x)
2670 dist_x = output_x - x;2669 dist_x = output_x - x;
@@ -2696,14 +2695,14 @@
2696/* Gets the output that contains the largest intersection with the window.2695/* Gets the output that contains the largest intersection with the window.
2697 * Logic stolen from gdk_screen_get_monitor_at_window().2696 * Logic stolen from gdk_screen_get_monitor_at_window().
2698 */2697 */
2699static GnomeRROutputInfo *2698static GsdRROutputInfo *
2700get_output_for_window (GnomeRRConfig *configuration, GdkWindow *window)2699get_output_for_window (GsdRRConfig *configuration, GdkWindow *window)
2701{2700{
2702 GdkRectangle win_rect;2701 GdkRectangle win_rect;
2703 int i;2702 int i;
2704 int largest_area;2703 int largest_area;
2705 int largest_index;2704 int largest_index;
2706 GnomeRROutputInfo **outputs;2705 GsdRROutputInfo **outputs;
27072706
2708 gdk_window_get_geometry (window, &win_rect.x, &win_rect.y, &win_rect.width, &win_rect.height);2707 gdk_window_get_geometry (window, &win_rect.x, &win_rect.y, &win_rect.width, &win_rect.height);
2709 gdk_window_get_origin (window, &win_rect.x, &win_rect.y);2708 gdk_window_get_origin (window, &win_rect.x, &win_rect.y);
@@ -2711,14 +2710,14 @@
2711 largest_area = 0;2710 largest_area = 0;
2712 largest_index = -1;2711 largest_index = -1;
27132712
2714 outputs = gnome_rr_config_get_outputs (configuration);2713 outputs = gsd_rr_config_get_outputs (configuration);
2715 for (i = 0; outputs[i] != NULL; i++)2714 for (i = 0; outputs[i] != NULL; i++)
2716 {2715 {
2717 GdkRectangle output_rect, intersection;2716 GdkRectangle output_rect, intersection;
27182717
2719 gnome_rr_output_info_get_geometry (outputs[i], &output_rect.x, &output_rect.y, &output_rect.width, &output_rect.height);2718 gsd_rr_output_info_get_geometry (outputs[i], &output_rect.x, &output_rect.y, &output_rect.width, &output_rect.height);
27202719
2721 if (gnome_rr_output_info_is_connected (outputs[i]) && gdk_rectangle_intersect (&win_rect, &output_rect, &intersection))2720 if (gsd_rr_output_info_is_connected (outputs[i]) && gdk_rectangle_intersect (&win_rect, &output_rect, &intersection))
2722 {2721 {
2723 int area;2722 int area;
27242723
@@ -2831,7 +2830,7 @@
2831}2830}
28322831
2833static GdkPixbuf*2832static GdkPixbuf*
2834get_monitor_pixbuf (CcDisplayPanel *self, GnomeRROutputInfo *output)2833get_monitor_pixbuf (CcDisplayPanel *self, GsdRROutputInfo *output)
2835{2834{
2836 GdkRGBA color;2835 GdkRGBA color;
2837 cairo_surface_t *cairo_surface;2836 cairo_surface_t *cairo_surface;
@@ -2880,19 +2879,19 @@
2880 {2879 {
2881 char *monitor_name;2880 char *monitor_name;
2882 GdkPixbuf *monitor_pixbuf;2881 GdkPixbuf *monitor_pixbuf;
2883 GnomeRROutputInfo *output = list->data;2882 GsdRROutputInfo *output = list->data;
28842883
2885 if (!gnome_rr_output_info_is_active (output))2884 if (!gsd_rr_output_info_is_active (output))
2886 continue;2885 continue;
28872886
2888 gtk_list_store_append (liststore, &iter);2887 gtk_list_store_append (liststore, &iter);
2889 monitor_name = g_strdup (gnome_rr_output_info_get_display_name (output));2888 monitor_name = g_strdup (gsd_rr_output_info_get_display_name (output));
2890 monitor_pixbuf = get_monitor_pixbuf (self, output);2889 monitor_pixbuf = get_monitor_pixbuf (self, output);
28912890
2892 gtk_list_store_set (liststore, &iter, 0, monitor_pixbuf, 1, monitor_name, -1);2891 gtk_list_store_set (liststore, &iter, 0, monitor_pixbuf, 1, monitor_name, -1);
28932892
2894 /* select it if primary and only one launcher */2893 /* select it if primary and only one launcher */
2895 if (gnome_rr_output_info_get_primary (output) && (!launcher_on_all_monitors))2894 if (gsd_rr_output_info_get_primary (output) && (!launcher_on_all_monitors))
2896 index_of_primary_screen = i;2895 index_of_primary_screen = i;
2897 i++;2896 i++;
28982897
@@ -2930,19 +2929,19 @@
2930 {2929 {
2931 gchar *monitor_name;2930 gchar *monitor_name;
2932 GdkPixbuf *monitor_pixbuf;2931 GdkPixbuf *monitor_pixbuf;
2933 GnomeRROutputInfo *output = list->data;2932 GsdRROutputInfo *output = list->data;
29342933
2935 if (!gnome_rr_output_info_is_active (output))2934 if (!gsd_rr_output_info_is_active (output))
2936 continue;2935 continue;
29372936
2938 gtk_list_store_append (liststore, &iter);2937 gtk_list_store_append (liststore, &iter);
2939 monitor_name = g_strdup (gnome_rr_output_info_get_display_name (output));2938 monitor_name = g_strdup (gsd_rr_output_info_get_display_name (output));
2940 monitor_pixbuf = get_monitor_pixbuf (self, output);2939 monitor_pixbuf = get_monitor_pixbuf (self, output);
29412940
2942 gtk_list_store_set (liststore, &iter, 0, monitor_pixbuf, 1, monitor_name, -1);2941 gtk_list_store_set (liststore, &iter, 0, monitor_pixbuf, 1, monitor_name, -1);
29432942
2944 /* select it if primary and only one launcher */2943 /* select it if primary and only one launcher */
2945 if (g_strcmp0 (gnome_rr_output_info_get_name (output), target_monitor) == 0)2944 if (g_strcmp0 (gsd_rr_output_info_get_name (output), target_monitor) == 0)
2946 target_monitor_idx = i;2945 target_monitor_idx = i;
2947 i++;2946 i++;
29482947
@@ -3011,15 +3010,15 @@
3011 if (!on_all_monitors) {3010 if (!on_all_monitors) {
3012 value = 1;3011 value = 1;
3013 // set the primary output if needed3012 // set the primary output if needed
3014 GnomeRROutputInfo **outputs = gnome_rr_config_get_outputs (self->priv->current_configuration);3013 GsdRROutputInfo **outputs = gsd_rr_config_get_outputs (self->priv->current_configuration);
30153014
3016 for (i = 0; outputs[i] != NULL; ++i)3015 for (i = 0; outputs[i] != NULL; ++i)
3017 {3016 {
3018 GnomeRROutputInfo *output = outputs[i];3017 GsdRROutputInfo *output = outputs[i];
3019 if (!gnome_rr_output_info_is_active (output))3018 if (!gsd_rr_output_info_is_active (output))
3020 continue;3019 continue;
30213020
3022 if ((active == index_on_combo) && !gnome_rr_output_info_get_primary (output))3021 if ((active == index_on_combo) && !gsd_rr_output_info_get_primary (output))
3023 {3022 {
3024 set_primary_output (self, output);3023 set_primary_output (self, output);
3025 break;3024 break;
@@ -3055,17 +3054,17 @@
3055 if (active < 0)3054 if (active < 0)
3056 return;3055 return;
30573056
3058 GnomeRROutputInfo **outputs = gnome_rr_config_get_outputs (self->priv->current_configuration);3057 GsdRROutputInfo **outputs = gsd_rr_config_get_outputs (self->priv->current_configuration);
30593058
3060 for (i = 0; outputs[i] != NULL; ++i)3059 for (i = 0; outputs[i] != NULL; ++i)
3061 {3060 {
3062 GnomeRROutputInfo *output = outputs[i];3061 GsdRROutputInfo *output = outputs[i];
3063 if (!gnome_rr_output_info_is_active (output))3062 if (!gsd_rr_output_info_is_active (output))
3064 continue;3063 continue;
30653064
3066 if (active == index_on_combo)3065 if (active == index_on_combo)
3067 {3066 {
3068 scale_monitor = g_strdup (gnome_rr_output_info_get_name (output));3067 scale_monitor = g_strdup (gsd_rr_output_info_get_name (output));
3069 break;3068 break;
3070 }3069 }
3071 index_on_combo++;3070 index_on_combo++;
@@ -3179,7 +3178,7 @@
3179 return obj;3178 return obj;
3180 }3179 }
31813180
3182 self->priv->screen = gnome_rr_screen_new (gdk_screen_get_default (), &error);3181 self->priv->screen = gsd_rr_screen_new (gdk_screen_get_default (), &error);
3183 g_signal_connect (self->priv->screen, "changed", G_CALLBACK (on_screen_changed), self);3182 g_signal_connect (self->priv->screen, "changed", G_CALLBACK (on_screen_changed), self);
3184 if (!self->priv->screen)3183 if (!self->priv->screen)
3185 {3184 {
31863185
=== modified file 'panels/display/cc-rr-labeler.c'
--- panels/display/cc-rr-labeler.c 2013-11-28 05:57:59 +0000
+++ panels/display/cc-rr-labeler.c 2014-08-29 10:31:11 +0000
@@ -38,7 +38,7 @@
38#include "cc-rr-labeler.h"38#include "cc-rr-labeler.h"
3939
40struct _CcRRLabelerPrivate {40struct _CcRRLabelerPrivate {
41 GnomeRRConfig *config;41 GsdRRConfig *config;
4242
43 int num_outputs;43 int num_outputs;
4444
@@ -106,7 +106,7 @@
106106
107 switch (property_id) {107 switch (property_id) {
108 case PROP_CONFIG:108 case PROP_CONFIG:
109 self->priv->config = GNOME_RR_CONFIG (g_value_dup_object (value));109 self->priv->config = GSD_RR_CONFIG (g_value_dup_object (value));
110 return;110 return;
111 default:111 default:
112 G_OBJECT_WARN_INVALID_PROPERTY_ID (gobject, property_id, param_spec);112 G_OBJECT_WARN_INVALID_PROPERTY_ID (gobject, property_id, param_spec);
@@ -139,7 +139,7 @@
139 g_object_class_install_property (object_class, PROP_CONFIG, g_param_spec_object ("config",139 g_object_class_install_property (object_class, PROP_CONFIG, g_param_spec_object ("config",
140 "Configuration",140 "Configuration",
141 "RandR configuration to label",141 "RandR configuration to label",
142 GNOME_TYPE_RR_CONFIG,142 GSD_TYPE_RR_CONFIG,
143 G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY |143 G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY |
144 G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB));144 G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB));
145}145}
@@ -170,10 +170,10 @@
170}170}
171171
172static int172static int
173count_outputs (GnomeRRConfig *config)173count_outputs (GsdRRConfig *config)
174{174{
175 int i;175 int i;
176 GnomeRROutputInfo **outputs = gnome_rr_config_get_outputs (config);176 GsdRROutputInfo **outputs = gsd_rr_config_get_outputs (config);
177177
178 for (i = 0; outputs[i] != NULL; i++)178 for (i = 0; outputs[i] != NULL; i++)
179 ;179 ;
@@ -402,7 +402,7 @@
402}402}
403403
404static GtkWidget *404static GtkWidget *
405create_label_window (CcRRLabeler *labeler, GnomeRROutputInfo *output, GdkRGBA *rgba)405create_label_window (CcRRLabeler *labeler, GsdRROutputInfo *output, GdkRGBA *rgba)
406{406{
407 GtkWidget *window;407 GtkWidget *window;
408 GtkWidget *widget;408 GtkWidget *widget;
@@ -438,7 +438,7 @@
438 g_signal_connect (window, "composited-changed",438 g_signal_connect (window, "composited-changed",
439 G_CALLBACK (label_window_composited_changed_cb), labeler);439 G_CALLBACK (label_window_composited_changed_cb), labeler);
440440
441 if (gnome_rr_config_get_clone (labeler->priv->config)) {441 if (gsd_rr_config_get_clone (labeler->priv->config)) {
442 /* Keep this string in sync with gnome-control-center/capplets/display/xrandr-capplet.c:get_display_name() */442 /* Keep this string in sync with gnome-control-center/capplets/display/xrandr-capplet.c:get_display_name() */
443443
444 /* Translators: this is the feature where what you see on your444 /* Translators: this is the feature where what you see on your
@@ -448,7 +448,7 @@
448 */448 */
449 display_name = _("Mirrored Displays");449 display_name = _("Mirrored Displays");
450 } else450 } else
451 display_name = gnome_rr_output_info_get_display_name (output);451 display_name = gsd_rr_output_info_get_display_name (output);
452452
453 str = g_strdup_printf ("<b>%s</b>", display_name);453 str = g_strdup_printf ("<b>%s</b>", display_name);
454 widget = gtk_label_new (NULL);454 widget = gtk_label_new (NULL);
@@ -466,7 +466,7 @@
466 gtk_container_add (GTK_CONTAINER (window), widget);466 gtk_container_add (GTK_CONTAINER (window), widget);
467467
468 /* Should we center this at the top edge of the monitor, instead of using the upper-left corner? */468 /* Should we center this at the top edge of the monitor, instead of using the upper-left corner? */
469 gnome_rr_output_info_get_geometry (output, &x, &y, NULL, NULL);469 gsd_rr_output_info_get_geometry (output, &x, &y, NULL, NULL);
470 position_window (labeler, window, x, y);470 position_window (labeler, window, x, y);
471471
472 gtk_widget_show_all (window);472 gtk_widget_show_all (window);
@@ -496,9 +496,9 @@
496 * Returns: A new #CcRRLabeler496 * Returns: A new #CcRRLabeler
497 */497 */
498CcRRLabeler *498CcRRLabeler *
499cc_rr_labeler_new (GnomeRRConfig *config)499cc_rr_labeler_new (GsdRRConfig *config)
500{500{
501 g_return_val_if_fail (GNOME_IS_RR_CONFIG (config), NULL);501 g_return_val_if_fail (GSD_IS_RR_CONFIG (config), NULL);
502502
503 return g_object_new (GNOME_TYPE_RR_LABELER, "config", config, NULL);503 return g_object_new (GNOME_TYPE_RR_LABELER, "config", config, NULL);
504}504}
@@ -514,7 +514,7 @@
514{514{
515 int i;515 int i;
516 gboolean created_window_for_clone;516 gboolean created_window_for_clone;
517 GnomeRROutputInfo **outputs;517 GsdRROutputInfo **outputs;
518518
519 g_return_if_fail (GNOME_IS_RR_LABELER (labeler));519 g_return_if_fail (GNOME_IS_RR_LABELER (labeler));
520520
@@ -525,13 +525,13 @@
525525
526 created_window_for_clone = FALSE;526 created_window_for_clone = FALSE;
527527
528 outputs = gnome_rr_config_get_outputs (labeler->priv->config);528 outputs = gsd_rr_config_get_outputs (labeler->priv->config);
529529
530 for (i = 0; i < labeler->priv->num_outputs; i++) {530 for (i = 0; i < labeler->priv->num_outputs; i++) {
531 if (!created_window_for_clone && gnome_rr_output_info_is_active (outputs[i])) {531 if (!created_window_for_clone && gsd_rr_output_info_is_active (outputs[i])) {
532 labeler->priv->windows[i] = create_label_window (labeler, outputs[i], labeler->priv->palette + i);532 labeler->priv->windows[i] = create_label_window (labeler, outputs[i], labeler->priv->palette + i);
533533
534 if (gnome_rr_config_get_clone (labeler->priv->config))534 if (gsd_rr_config_get_clone (labeler->priv->config))
535 created_window_for_clone = TRUE;535 created_window_for_clone = TRUE;
536 } else536 } else
537 labeler->priv->windows[i] = NULL;537 labeler->priv->windows[i] = NULL;
@@ -575,16 +575,16 @@
575 * Get the color used for the label on a given output (monitor).575 * Get the color used for the label on a given output (monitor).
576 */576 */
577void577void
578cc_rr_labeler_get_rgba_for_output (CcRRLabeler *labeler, GnomeRROutputInfo *output, GdkRGBA *rgba_out)578cc_rr_labeler_get_rgba_for_output (CcRRLabeler *labeler, GsdRROutputInfo *output, GdkRGBA *rgba_out)
579{579{
580 int i;580 int i;
581 GnomeRROutputInfo **outputs;581 GsdRROutputInfo **outputs;
582582
583 g_return_if_fail (GNOME_IS_RR_LABELER (labeler));583 g_return_if_fail (GNOME_IS_RR_LABELER (labeler));
584 g_return_if_fail (GNOME_IS_RR_OUTPUT_INFO (output));584 g_return_if_fail (GSD_IS_RR_OUTPUT_INFO (output));
585 g_return_if_fail (rgba_out != NULL);585 g_return_if_fail (rgba_out != NULL);
586586
587 outputs = gnome_rr_config_get_outputs (labeler->priv->config);587 outputs = gsd_rr_config_get_outputs (labeler->priv->config);
588588
589 for (i = 0; i < labeler->priv->num_outputs; i++)589 for (i = 0; i < labeler->priv->num_outputs; i++)
590 if (outputs[i] == output) {590 if (outputs[i] == output) {
591591
=== modified file 'panels/display/cc-rr-labeler.h'
--- panels/display/cc-rr-labeler.h 2013-11-28 05:57:59 +0000
+++ panels/display/cc-rr-labeler.h 2014-08-29 10:31:11 +0000
@@ -26,8 +26,7 @@
26#ifndef CC_RR_LABELER_H26#ifndef CC_RR_LABELER_H
27#define CC_RR_LABELER_H27#define CC_RR_LABELER_H
2828
29#define GNOME_DESKTOP_USE_UNSTABLE_API29#include <libunity-settings-daemon/gsd-rr-config.h>
30#include <libgnome-desktop/gnome-rr-config.h>
3130
32#define GNOME_TYPE_RR_LABELER (cc_rr_labeler_get_type ())31#define GNOME_TYPE_RR_LABELER (cc_rr_labeler_get_type ())
33#define CC_RR_LABELER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GNOME_TYPE_RR_LABELER, CcRRLabeler))32#define CC_RR_LABELER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GNOME_TYPE_RR_LABELER, CcRRLabeler))
@@ -53,12 +52,12 @@
5352
54GType cc_rr_labeler_get_type (void);53GType cc_rr_labeler_get_type (void);
5554
56CcRRLabeler *cc_rr_labeler_new (GnomeRRConfig *config);55CcRRLabeler *cc_rr_labeler_new (GsdRRConfig *config);
5756
58void cc_rr_labeler_show (CcRRLabeler *labeler);57void cc_rr_labeler_show (CcRRLabeler *labeler);
5958
60void cc_rr_labeler_hide (CcRRLabeler *labeler);59void cc_rr_labeler_hide (CcRRLabeler *labeler);
6160
62void cc_rr_labeler_get_rgba_for_output (CcRRLabeler *labeler, GnomeRROutputInfo *output, GdkRGBA *rgba_out);61void cc_rr_labeler_get_rgba_for_output (CcRRLabeler *labeler, GsdRROutputInfo *output, GdkRGBA *rgba_out);
6362
64#endif63#endif
6564
=== modified file 'panels/wacom/cc-wacom-mapping-panel.c'
--- panels/wacom/cc-wacom-mapping-panel.c 2012-08-21 16:00:22 +0000
+++ panels/wacom/cc-wacom-mapping-panel.c 2014-08-29 10:31:11 +0000
@@ -23,9 +23,8 @@
2323
24#include <gtk/gtk.h>24#include <gtk/gtk.h>
25#include <glib/gi18n.h>25#include <glib/gi18n.h>
26#define GNOME_DESKTOP_USE_UNSTABLE_API26#include <libunity-settings-daemon/gsd-rr.h>
27#include <libgnome-desktop/gnome-rr.h>27#include <libunity-settings-daemon/gsd-rr-config.h>
28#include <libgnome-desktop/gnome-rr-config.h>
2928
30#include <string.h>29#include <string.h>
3130
@@ -57,17 +56,17 @@
57static void checkbutton_toggled_cb (GtkWidget *widget, CcWacomMappingPanel *self);56static void checkbutton_toggled_cb (GtkWidget *widget, CcWacomMappingPanel *self);
58static void aspectswitch_toggled_cb (GtkWidget *widget, GParamSpec *pspec, CcWacomMappingPanel *self);57static void aspectswitch_toggled_cb (GtkWidget *widget, GParamSpec *pspec, CcWacomMappingPanel *self);
5958
60static GnomeRROutputInfo**59static GsdRROutputInfo**
61get_rr_outputs (void)60get_rr_outputs (void)
62{61{
63 GError *error = NULL;62 GError *error = NULL;
64 GnomeRRScreen *rr_screen;63 GsdRRScreen *rr_screen;
65 GnomeRRConfig *rr_config;64 GsdRRConfig *rr_config;
6665
67 /* TODO: Check the value of 'error' */66 /* TODO: Check the value of 'error' */
68 rr_screen = gnome_rr_screen_new (gdk_screen_get_default (), &error);67 rr_screen = gsd_rr_screen_new (gdk_screen_get_default (), &error);
69 rr_config = gnome_rr_config_new_current (rr_screen, &error);68 rr_config = gsd_rr_config_new_current (rr_screen, &error);
70 return gnome_rr_config_get_outputs (rr_config);69 return gsd_rr_config_get_outputs (rr_config);
71}70}
7271
73static void72static void
@@ -91,7 +90,7 @@
91update_monitor_chooser (CcWacomMappingPanel *self)90update_monitor_chooser (CcWacomMappingPanel *self)
92{91{
93 GtkListStore *store;92 GtkListStore *store;
94 GnomeRROutputInfo **outputs;93 GsdRROutputInfo **outputs;
95 GdkRectangle geom;94 GdkRectangle geom;
96 GSettings *settings;95 GSettings *settings;
97 gint monitor;96 gint monitor;
@@ -130,19 +129,19 @@
130 goto bail;129 goto bail;
131130
132 for (i = 0; outputs[i] != NULL; i++) {131 for (i = 0; outputs[i] != NULL; i++) {
133 GnomeRROutputInfo *output = outputs[i];132 GsdRROutputInfo *output = outputs[i];
134133
135 if (gnome_rr_output_info_is_active (output)) {134 if (gsd_rr_output_info_is_active (output)) {
136 GtkTreeIter iter;135 GtkTreeIter iter;
137 gchar *name, *disp_name, *text;136 gchar *name, *disp_name, *text;
138 int x, y, w, h;137 int x, y, w, h;
139 int mon_at_point;138 int mon_at_point;
140139
141 name = gnome_rr_output_info_get_name (output);140 name = gsd_rr_output_info_get_name (output);
142 disp_name = gnome_rr_output_info_get_display_name (output);141 disp_name = gsd_rr_output_info_get_display_name (output);
143 text = g_strdup_printf ("%s (%s)", name, disp_name);142 text = g_strdup_printf ("%s (%s)", name, disp_name);
144143
145 gnome_rr_output_info_get_geometry (output, &x, &y, &w, &h);144 gsd_rr_output_info_get_geometry (output, &x, &y, &w, &h);
146 mon_at_point = gdk_screen_get_monitor_at_point (gdk_screen_get_default (), x, y);145 mon_at_point = gdk_screen_get_monitor_at_point (gdk_screen_get_default (), x, y);
147 gtk_list_store_append (store, &iter);146 gtk_list_store_append (store, &iter);
148 gtk_list_store_set (store, &iter, MONITOR_NAME_COLUMN, text, MONITOR_NUM_COLUMN, mon_at_point, -1);147 gtk_list_store_set (store, &iter, MONITOR_NAME_COLUMN, text, MONITOR_NUM_COLUMN, mon_at_point, -1);
149148
=== modified file 'panels/wacom/gsd-wacom-device.c'
--- panels/wacom/gsd-wacom-device.c 2014-02-19 02:24:52 +0000
+++ panels/wacom/gsd-wacom-device.c 2014-08-29 10:31:11 +0000
@@ -27,8 +27,7 @@
27#include <gdk/gdk.h>27#include <gdk/gdk.h>
28#include <gdk/gdkx.h>28#include <gdk/gdkx.h>
29#include <X11/Xatom.h>29#include <X11/Xatom.h>
30#define GNOME_DESKTOP_USE_UNSTABLE_API30#include <libunity-settings-daemon/gsd-rr.h>
31#include <libgnome-desktop/gnome-rr.h>
3231
33#include <libwacom/libwacom.h>32#include <libwacom/libwacom.h>
34#include <X11/extensions/XInput.h>33#include <X11/extensions/XInput.h>
@@ -48,14 +47,14 @@
48#define WACOM_BUTTON_SCHEMA "org.gnome.settings-daemon.peripherals.wacom.tablet-button"47#define WACOM_BUTTON_SCHEMA "org.gnome.settings-daemon.peripherals.wacom.tablet-button"
4948
50static struct {49static struct {
51 GnomeRRRotation rotation;50 GsdRRRotation rotation;
52 GsdWacomRotation rotation_wacom;51 GsdWacomRotation rotation_wacom;
53 const gchar *rotation_string;52 const gchar *rotation_string;
54} rotation_table[] = {53} rotation_table[] = {
55 { GNOME_RR_ROTATION_0, GSD_WACOM_ROTATION_NONE, "none" },54 { GSD_RR_ROTATION_0, GSD_WACOM_ROTATION_NONE, "none" },
56 { GNOME_RR_ROTATION_90, GSD_WACOM_ROTATION_CCW, "ccw" },55 { GSD_RR_ROTATION_90, GSD_WACOM_ROTATION_CCW, "ccw" },
57 { GNOME_RR_ROTATION_180, GSD_WACOM_ROTATION_HALF, "half" },56 { GSD_RR_ROTATION_180, GSD_WACOM_ROTATION_HALF, "half" },
58 { GNOME_RR_ROTATION_270, GSD_WACOM_ROTATION_CW, "cw" }57 { GSD_RR_ROTATION_270, GSD_WACOM_ROTATION_CW, "cw" }
59};58};
6059
61static WacomDeviceDatabase *db = NULL;60static WacomDeviceDatabase *db = NULL;
@@ -511,14 +510,14 @@
511510
512/* Finds an output which matches the given EDID information. Any NULL511/* Finds an output which matches the given EDID information. Any NULL
513 * parameter will be interpreted to match any value. */512 * parameter will be interpreted to match any value. */
514static GnomeRROutput *513static GsdRROutput *
515find_output_by_edid (GnomeRRScreen *rr_screen, const gchar *vendor, const gchar *product, const gchar *serial)514find_output_by_edid (GsdRRScreen *rr_screen, const gchar *vendor, const gchar *product, const gchar *serial)
516{515{
517 GnomeRROutput **rr_outputs;516 GsdRROutput **rr_outputs;
518 GnomeRROutput *retval = NULL;517 GsdRROutput *retval = NULL;
519 guint i;518 guint i;
520519
521 rr_outputs = gnome_rr_screen_list_outputs (rr_screen);520 rr_outputs = gsd_rr_screen_list_outputs (rr_screen);
522521
523 for (i = 0; rr_outputs[i] != NULL; i++) {522 for (i = 0; rr_outputs[i] != NULL; i++) {
524 gchar *o_vendor_s;523 gchar *o_vendor_s;
@@ -528,10 +527,10 @@
528 int o_serial;527 int o_serial;
529 gboolean match;528 gboolean match;
530529
531 if (!gnome_rr_output_is_connected (rr_outputs[i]))530 if (!gsd_rr_output_is_connected (rr_outputs[i]))
532 continue;531 continue;
533532
534 if (!gnome_rr_output_get_ids_from_edid (rr_outputs[i],533 if (!gsd_rr_output_get_ids_from_edid (rr_outputs[i],
535 &o_vendor_s,534 &o_vendor_s,
536 &o_product,535 &o_product,
537 &o_serial))536 &o_serial))
@@ -564,19 +563,19 @@
564 return retval;563 return retval;
565}564}
566565
567static GnomeRROutput*566static GsdRROutput*
568find_builtin_output (GnomeRRScreen *rr_screen)567find_builtin_output (GsdRRScreen *rr_screen)
569{568{
570 GnomeRROutput **rr_outputs;569 GsdRROutput **rr_outputs;
571 GnomeRROutput *retval = NULL;570 GsdRROutput *retval = NULL;
572 guint i;571 guint i;
573572
574 rr_outputs = gnome_rr_screen_list_outputs (rr_screen);573 rr_outputs = gsd_rr_screen_list_outputs (rr_screen);
575 for (i = 0; rr_outputs[i] != NULL; i++) {574 for (i = 0; rr_outputs[i] != NULL; i++) {
576 if (!gnome_rr_output_is_connected (rr_outputs[i]))575 if (!gsd_rr_output_is_connected (rr_outputs[i]))
577 continue;576 continue;
578577
579 if (gnome_rr_output_is_laptop(rr_outputs[i])) {578 if (gsd_rr_output_is_laptop(rr_outputs[i])) {
580 retval = rr_outputs[i];579 retval = rr_outputs[i];
581 break;580 break;
582 }581 }
@@ -588,10 +587,10 @@
588 return retval;587 return retval;
589}588}
590589
591static GnomeRROutput *590static GsdRROutput *
592find_output_by_heuristic (GnomeRRScreen *rr_screen, GsdWacomDevice *device)591find_output_by_heuristic (GsdRRScreen *rr_screen, GsdWacomDevice *device)
593{592{
594 GnomeRROutput *rr_output;593 GsdRROutput *rr_output;
595594
596 /* TODO: This heuristic will fail for non-Wacom display595 /* TODO: This heuristic will fail for non-Wacom display
597 * tablets and may give the wrong result if multiple Wacom596 * tablets and may give the wrong result if multiple Wacom
@@ -605,14 +604,14 @@
605 return rr_output;604 return rr_output;
606}605}
607606
608static GnomeRROutput *607static GsdRROutput *
609find_output_by_display (GnomeRRScreen *rr_screen, GsdWacomDevice *device)608find_output_by_display (GsdRRScreen *rr_screen, GsdWacomDevice *device)
610{609{
611 gsize n;610 gsize n;
612 GSettings *tablet;611 GSettings *tablet;
613 GVariant *display;612 GVariant *display;
614 const gchar **edid;613 const gchar **edid;
615 GnomeRROutput *ret;614 GsdRROutput *ret;
616615
617 if (device == NULL)616 if (device == NULL)
618 return NULL;617 return NULL;
@@ -640,32 +639,32 @@
640}639}
641640
642static gboolean641static gboolean
643is_on (GnomeRROutput *output)642is_on (GsdRROutput *output)
644{643{
645 GnomeRRCrtc *crtc;644 GsdRRCrtc *crtc;
646645
647 crtc = gnome_rr_output_get_crtc (output);646 crtc = gsd_rr_output_get_crtc (output);
648 if (!crtc)647 if (!crtc)
649 return FALSE;648 return FALSE;
650 return gnome_rr_crtc_get_current_mode (crtc) != NULL;649 return gsd_rr_crtc_get_current_mode (crtc) != NULL;
651}650}
652651
653static GnomeRROutput *652static GsdRROutput *
654find_output_by_monitor (GnomeRRScreen *rr_screen,653find_output_by_monitor (GsdRRScreen *rr_screen,
655 GdkScreen *screen,654 GdkScreen *screen,
656 int monitor)655 int monitor)
657{656{
658 GnomeRROutput **rr_outputs;657 GsdRROutput **rr_outputs;
659 GnomeRROutput *ret;658 GsdRROutput *ret;
660 guint i;659 guint i;
661660
662 ret = NULL;661 ret = NULL;
663662
664 rr_outputs = gnome_rr_screen_list_outputs (rr_screen);663 rr_outputs = gsd_rr_screen_list_outputs (rr_screen);
665664
666 for (i = 0; rr_outputs[i] != NULL; i++) {665 for (i = 0; rr_outputs[i] != NULL; i++) {
667 GnomeRROutput *rr_output;666 GsdRROutput *rr_output;
668 GnomeRRCrtc *crtc;667 GsdRRCrtc *crtc;
669 int x, y;668 int x, y;
670669
671 rr_output = rr_outputs[i];670 rr_output = rr_outputs[i];
@@ -673,11 +672,11 @@
673 if (!is_on (rr_output))672 if (!is_on (rr_output))
674 continue;673 continue;
675674
676 crtc = gnome_rr_output_get_crtc (rr_output);675 crtc = gsd_rr_output_get_crtc (rr_output);
677 if (!crtc)676 if (!crtc)
678 continue;677 continue;
679678
680 gnome_rr_crtc_get_position (crtc, &x, &y);679 gsd_rr_crtc_get_position (crtc, &x, &y);
681680
682 if (monitor == gdk_screen_get_monitor_at_point (screen, x, y)) {681 if (monitor == gdk_screen_get_monitor_at_point (screen, x, y)) {
683 ret = rr_output;682 ret = rr_output;
@@ -693,7 +692,7 @@
693692
694static void693static void
695set_display_by_output (GsdWacomDevice *device,694set_display_by_output (GsdWacomDevice *device,
696 GnomeRROutput *rr_output)695 GsdRROutput *rr_output)
697{696{
698 GSettings *tablet;697 GSettings *tablet;
699 GVariant *c_array;698 GVariant *c_array;
@@ -712,7 +711,7 @@
712 }711 }
713712
714 if (rr_output == NULL ||713 if (rr_output == NULL ||
715 !gnome_rr_output_get_ids_from_edid (rr_output,714 !gsd_rr_output_get_ids_from_edid (rr_output,
716 &o_vendor_s,715 &o_vendor_s,
717 &o_product,716 &o_product,
718 &o_serial)) {717 &o_serial)) {
@@ -736,7 +735,7 @@
736}735}
737736
738static GsdWacomRotation737static GsdWacomRotation
739get_rotation_wacom (GnomeRRRotation rotation)738get_rotation_wacom (GsdRRRotation rotation)
740{739{
741 guint i;740 guint i;
742741
@@ -752,14 +751,14 @@
752 int monitor)751 int monitor)
753{752{
754 GError *error = NULL;753 GError *error = NULL;
755 GnomeRRScreen *rr_screen;754 GsdRRScreen *rr_screen;
756 GnomeRROutput *output = NULL;755 GsdRROutput *output = NULL;
757756
758 g_return_if_fail (GSD_IS_WACOM_DEVICE (device));757 g_return_if_fail (GSD_IS_WACOM_DEVICE (device));
759758
760 rr_screen = gnome_rr_screen_new (gdk_screen_get_default (), &error);759 rr_screen = gsd_rr_screen_new (gdk_screen_get_default (), &error);
761 if (rr_screen == NULL) {760 if (rr_screen == NULL) {
762 g_warning ("Failed to create GnomeRRScreen: %s", error->message);761 g_warning ("Failed to create GsdRRScreen: %s", error->message);
763 g_error_free (error);762 g_error_free (error);
764 return;763 return;
765 }764 }
@@ -771,11 +770,11 @@
771 g_object_unref (rr_screen);770 g_object_unref (rr_screen);
772}771}
773772
774static GnomeRROutput *773static GsdRROutput *
775find_output (GnomeRRScreen *rr_screen,774find_output (GsdRRScreen *rr_screen,
776 GsdWacomDevice *device)775 GsdWacomDevice *device)
777{776{
778 GnomeRROutput *rr_output;777 GsdRROutput *rr_output;
779 rr_output = find_output_by_display (rr_screen, device);778 rr_output = find_output_by_display (rr_screen, device);
780779
781 if (rr_output == NULL) {780 if (rr_output == NULL) {
@@ -823,17 +822,17 @@
823gsd_wacom_device_get_display_monitor (GsdWacomDevice *device)822gsd_wacom_device_get_display_monitor (GsdWacomDevice *device)
824{823{
825 GError *error = NULL;824 GError *error = NULL;
826 GnomeRRScreen *rr_screen;825 GsdRRScreen *rr_screen;
827 GnomeRROutput *rr_output;826 GsdRROutput *rr_output;
828 GnomeRRMode *mode;827 GsdRRMode *mode;
829 GnomeRRCrtc *crtc;828 GsdRRCrtc *crtc;
830 gint area[4];829 gint area[4];
831830
832 g_return_val_if_fail (GSD_IS_WACOM_DEVICE (device), GSD_WACOM_SET_ALL_MONITORS);831 g_return_val_if_fail (GSD_IS_WACOM_DEVICE (device), GSD_WACOM_SET_ALL_MONITORS);
833832
834 rr_screen = gnome_rr_screen_new (gdk_screen_get_default (), &error);833 rr_screen = gsd_rr_screen_new (gdk_screen_get_default (), &error);
835 if (rr_screen == NULL) {834 if (rr_screen == NULL) {
836 g_warning ("Failed to create GnomeRRScreen: %s", error->message);835 g_warning ("Failed to create GsdRRScreen: %s", error->message);
837 g_error_free (error);836 g_error_free (error);
838 return GSD_WACOM_SET_ALL_MONITORS;837 return GSD_WACOM_SET_ALL_MONITORS;
839 }838 }
@@ -850,12 +849,12 @@
850 return GSD_WACOM_SET_ALL_MONITORS;849 return GSD_WACOM_SET_ALL_MONITORS;
851 }850 }
852851
853 crtc = gnome_rr_output_get_crtc (rr_output);852 crtc = gsd_rr_output_get_crtc (rr_output);
854 gnome_rr_crtc_get_position (crtc, &area[0], &area[1]);853 gsd_rr_crtc_get_position (crtc, &area[0], &area[1]);
855854
856 mode = gnome_rr_crtc_get_current_mode (crtc);855 mode = gsd_rr_crtc_get_current_mode (crtc);
857 area[2] = gnome_rr_mode_get_width (mode);856 area[2] = gsd_rr_mode_get_width (mode);
858 area[3] = gnome_rr_mode_get_height (mode);857 area[3] = gsd_rr_mode_get_height (mode);
859858
860 g_object_unref (rr_screen);859 g_object_unref (rr_screen);
861860
@@ -904,22 +903,22 @@
904gsd_wacom_device_get_display_rotation (GsdWacomDevice *device)903gsd_wacom_device_get_display_rotation (GsdWacomDevice *device)
905{904{
906 GError *error = NULL;905 GError *error = NULL;
907 GnomeRRScreen *rr_screen;906 GsdRRScreen *rr_screen;
908 GnomeRROutput *rr_output;907 GsdRROutput *rr_output;
909 GnomeRRRotation rotation = GNOME_RR_ROTATION_0;908 GsdRRRotation rotation = GSD_RR_ROTATION_0;
910909
911 rr_screen = gnome_rr_screen_new (gdk_screen_get_default (), &error);910 rr_screen = gsd_rr_screen_new (gdk_screen_get_default (), &error);
912 if (rr_screen == NULL) {911 if (rr_screen == NULL) {
913 g_warning ("Failed to create GnomeRRScreen: %s", error->message);912 g_warning ("Failed to create GsdRRScreen: %s", error->message);
914 g_error_free (error);913 g_error_free (error);
915 return GSD_WACOM_ROTATION_NONE;914 return GSD_WACOM_ROTATION_NONE;
916 }915 }
917916
918 rr_output = find_output (rr_screen, device);917 rr_output = find_output (rr_screen, device);
919 if (rr_output) {918 if (rr_output) {
920 GnomeRRCrtc *crtc = gnome_rr_output_get_crtc (rr_output);919 GsdRRCrtc *crtc = gsd_rr_output_get_crtc (rr_output);
921 if (crtc)920 if (crtc)
922 rotation = gnome_rr_crtc_get_current_rotation (crtc);921 rotation = gsd_rr_crtc_get_current_rotation (crtc);
923 }922 }
924 g_object_unref (rr_screen);923 g_object_unref (rr_screen);
925924

Subscribers

People subscribed via source and target branches