[Xfce4-commits] <xfce4-settings:bluesabre/display-settings> Added detection of relative display position.
Sean Davis
noreply at xfce.org
Thu Sep 27 16:24:01 CEST 2012
Updating branch refs/heads/bluesabre/display-settings
to dc10e401b2a5889a53ec1df459043deed0ffcc81 (commit)
from 207fe4d903bc9ba09b742627f04e0bc99c888ff9 (commit)
commit dc10e401b2a5889a53ec1df459043deed0ffcc81
Author: Sean Davis <smd.seandavis at gmail.com>
Date: Thu Sep 27 10:23:48 2012 -0400
Added detection of relative display position.
dialogs/display-settings/main.c | 81 +++++++++++++++++++++++++++++++++++++++
1 files changed, 81 insertions(+), 0 deletions(-)
diff --git a/dialogs/display-settings/main.c b/dialogs/display-settings/main.c
index 79a948a..af39b61 100644
--- a/dialogs/display-settings/main.c
+++ b/dialogs/display-settings/main.c
@@ -498,6 +498,86 @@ display_setting_active_displays_populate (GtkBuilder *builder)
}
static void
+display_setting_guess_positioning (GtkBuilder *builder)
+{
+ GObject *position_combo, *display_combo;
+ gint current_x, current_y, index;
+ guint n, current_display;
+
+ current_display = xfce_randr->active_output;
+ current_x = XFCE_RANDR_POS_X (xfce_randr);
+ current_y = XFCE_RANDR_POS_Y (xfce_randr);
+
+ position_combo = gtk_builder_get_object(builder, "randr-position");
+ display_combo = gtk_builder_get_object(builder, "randr-active-displays");
+
+ g_object_disconnect (position_combo, "any_signal::changed",
+ display_setting_positions_changed,
+ builder, NULL);
+
+ g_object_disconnect (display_combo, "any_signal::changed",
+ display_setting_active_displays_changed,
+ builder, NULL);
+
+ index = 0;
+
+ for (n = 0; n < display_settings_get_n_active_outputs (); n++)
+ {
+ if (n != current_display)
+ {
+ xfce_randr->active_output = n;
+
+ /* Check for mirror */
+ if ( (XFCE_RANDR_POS_X (xfce_randr) == current_x) &&
+ (XFCE_RANDR_POS_Y (xfce_randr) == current_y) ) {
+ gtk_combo_box_set_active( GTK_COMBO_BOX(position_combo), 0 );
+ gtk_combo_box_set_active( GTK_COMBO_BOX(display_combo), index );
+ break;
+ }
+
+ /* Check for Left Of */
+ if ( (XFCE_RANDR_POS_Y (xfce_randr) == current_y) &&
+ (XFCE_RANDR_POS_X (xfce_randr) > current_x) ) {
+ gtk_combo_box_set_active( GTK_COMBO_BOX(position_combo), 1 );
+ gtk_combo_box_set_active( GTK_COMBO_BOX(display_combo), index );
+ break;
+ }
+
+ /* Check for Right Of */
+ if ( (XFCE_RANDR_POS_Y (xfce_randr) == current_y) &&
+ (XFCE_RANDR_POS_X (xfce_randr) < current_x) ) {
+ gtk_combo_box_set_active( GTK_COMBO_BOX(position_combo), 2 );
+ gtk_combo_box_set_active( GTK_COMBO_BOX(display_combo), index );
+ break;
+ }
+
+ /* Check for Above */
+ if ( (XFCE_RANDR_POS_X (xfce_randr) == current_x) &&
+ (XFCE_RANDR_POS_Y (xfce_randr) > current_y) ) {
+ gtk_combo_box_set_active( GTK_COMBO_BOX(position_combo), 3 );
+ gtk_combo_box_set_active( GTK_COMBO_BOX(display_combo), index );
+ break;
+ }
+
+ /* Check for Below */
+ if ( (XFCE_RANDR_POS_X (xfce_randr) == current_x) &&
+ (XFCE_RANDR_POS_Y (xfce_randr) < current_y) ) {
+ gtk_combo_box_set_active( GTK_COMBO_BOX(position_combo), 4 );
+ gtk_combo_box_set_active( GTK_COMBO_BOX(display_combo), index );
+ break;
+ }
+
+ index++;
+ }
+ }
+
+ xfce_randr->active_output = current_display;
+
+ g_signal_connect (G_OBJECT (position_combo), "changed", G_CALLBACK (display_setting_positions_changed), builder);
+ g_signal_connect (G_OBJECT (display_combo), "changed", G_CALLBACK (display_setting_active_displays_changed), builder);
+}
+
+static void
display_setting_reflections_changed (GtkComboBox *combobox,
GtkBuilder *builder)
{
@@ -1061,6 +1141,7 @@ display_settings_treeview_selection_changed (GtkTreeSelection *selection,
/* Update the combo boxes */
display_setting_positions_populate (builder);
display_setting_active_displays_populate (builder);
+ display_setting_guess_positioning (builder);
display_setting_output_status_populate (builder);
display_setting_mirror_displays_populate (builder);
display_setting_resolutions_populate (builder);
More information about the Xfce4-commits
mailing list