From 5355bb542f5c2f4268025b3573cbbbb9f24471c4 Mon Sep 17 00:00:00 2001
From: Eric Harney <eharney@redhat.com>
Date: Mon, 20 May 2013 13:41:15 -0400
Subject: [PATCH] Re-add patch for multi monitor position settings. (#773780)

---
 xfce4-settings-4.8.3-monitor-position.patch | 282 ++++++++++++++++++++++++++++
 xfce4-settings.spec                         |   9 +-
 2 files changed, 289 insertions(+), 2 deletions(-)
 create mode 100644 xfce4-settings-4.8.3-monitor-position.patch

diff --git a/xfce4-settings-4.8.3-monitor-position.patch b/xfce4-settings-4.8.3-monitor-position.patch
new file mode 100644
index 0000000..8a17729
--- /dev/null
+++ b/xfce4-settings-4.8.3-monitor-position.patch
@@ -0,0 +1,282 @@
+diff -Nur xfce4-settings-4.8.3.orig/dialogs/display-settings/display-dialog.glade xfce4-settings-4.8.3/dialogs/display-settings/display-dialog.glade
+--- xfce4-settings-4.8.3.orig/dialogs/display-settings/display-dialog.glade	2011-09-22 13:30:15.000000000 -0600
++++ xfce4-settings-4.8.3/dialogs/display-settings/display-dialog.glade	2012-01-21 12:23:13.056574990 -0700
+@@ -10,7 +10,6 @@
+     <property name="default_height">350</property>
+     <property name="icon_name">video-display</property>
+     <property name="type_hint">dialog</property>
+-    <property name="has_separator">False</property>
+     <property name="subtitle" translatable="yes">Configure screen settings and layout</property>
+     <child internal-child="vbox">
+       <object class="GtkVBox" id="dialog-vbox1">
+@@ -40,6 +39,9 @@
+                   </object>
+                 </child>
+               </object>
++              <packing>
++                <property name="position">0</property>
++              </packing>
+             </child>
+             <child>
+               <object class="GtkVBox" id="vbox1">
+@@ -49,7 +51,10 @@
+                 <child>
+                   <object class="GtkCheckButton" id="output-on">
+                     <property name="label" translatable="yes">_Use this output</property>
++                    <property name="can_focus">False</property>
++                    <property name="receives_default">False</property>
+                     <property name="use_underline">True</property>
++                    <property name="draw_indicator">True</property>
+                   </object>
+                   <packing>
+                     <property name="position">0</property>
+@@ -58,7 +63,7 @@
+                 <child>
+                   <object class="GtkTable" id="table1">
+                     <property name="visible">True</property>
+-                    <property name="n_rows">4</property>
++                    <property name="n_rows">5</property>
+                     <property name="n_columns">2</property>
+                     <property name="column_spacing">12</property>
+                     <property name="row_spacing">6</property>
+@@ -163,7 +168,77 @@
+                         <property name="y_options">GTK_FILL</property>
+                       </packing>
+                     </child>
++                    <child>
++                      <object class="GtkTable" id="table2">
++                        <property name="visible">True</property>
++                        <property name="n_columns">4</property>
++                        <child>
++                          <object class="GtkLabel" id="label2">
++                            <property name="visible">True</property>
++                            <property name="label" translatable="yes">X:</property>
++                          </object>
++                        </child>
++                        <child>
++                          <object class="GtkLabel" id="label6">
++                            <property name="visible">True</property>
++                            <property name="label" translatable="yes">Y:</property>
++                          </object>
++                          <packing>
++                            <property name="left_attach">2</property>
++                            <property name="right_attach">3</property>
++                          </packing>
++                        </child>
++                        <child>
++                          <object class="GtkSpinButton" id="randr-xpos">
++                            <property name="visible">True</property>
++                            <property name="can_focus">True</property>
++                            <property name="max_length">5</property>
++                            <property name="invisible_char">&#x2022;</property>
++                            <property name="snap_to_ticks">True</property>
++                            <property name="numeric">True</property>
++                          </object>
++                          <packing>
++                            <property name="left_attach">1</property>
++                            <property name="right_attach">2</property>
++                          </packing>
++                        </child>
++                        <child>
++                          <object class="GtkSpinButton" id="randr-ypos">
++                            <property name="visible">True</property>
++                            <property name="can_focus">True</property>
++                            <property name="max_length">5</property>
++                            <property name="invisible_char">&#x2022;</property>
++                            <property name="snap_to_ticks">True</property>
++                            <property name="numeric">True</property>
++                          </object>
++                          <packing>
++                            <property name="left_attach">3</property>
++                            <property name="right_attach">4</property>
++                          </packing>
++                        </child>
++                      </object>
++                      <packing>
++                        <property name="left_attach">1</property>
++                        <property name="right_attach">2</property>
++                        <property name="top_attach">4</property>
++                        <property name="bottom_attach">5</property>
++                      </packing>
++                    </child>
++                    <child>
++                      <object class="GtkLabel" id="label1">
++                        <property name="visible">True</property>
++                        <property name="xalign">0</property>
++                        <property name="label" translatable="yes">Position:</property>
++                      </object>
++                      <packing>
++                        <property name="top_attach">4</property>
++                        <property name="bottom_attach">5</property>
++                      </packing>
++                    </child>
+                   </object>
++                  <packing>
++                    <property name="position">1</property>
++                  </packing>
+                 </child>
+               </object>
+               <packing>
+diff -Nur xfce4-settings-4.8.3.orig/dialogs/display-settings/main.c xfce4-settings-4.8.3/dialogs/display-settings/main.c
+--- xfce4-settings-4.8.3.orig/dialogs/display-settings/main.c	2011-09-22 13:30:15.000000000 -0600
++++ xfce4-settings-4.8.3/dialogs/display-settings/main.c	2012-01-21 12:23:13.057574995 -0700
+@@ -699,6 +699,98 @@
+ 
+ 
+ static void
++display_setting_xpos_changed (GtkSpinButton *spinbutton,
++                                GtkBuilder      *builder)
++{
++    gint value;
++
++    value = gtk_spin_button_get_value_as_int  (spinbutton);
++
++    XFCE_RANDR_POS_X (xfce_randr) = value;
++
++    display_setting_refresh_rates_populate (builder);
++
++    /* Apply the changes */
++    xfce_randr_save_output (xfce_randr, "Default", display_channel,
++                            xfce_randr->active_output);
++    xfce_randr_apply (xfce_randr, "Default", display_channel);
++}
++
++
++
++static void
++display_setting_xpos_status_populate (GtkBuilder *builder)
++{
++    GObject *xpos;
++    gchar    property[512];
++
++    if (!xfce_randr)
++        return;
++
++    if (xfce_randr->noutput <= 1)
++        return;
++
++    xpos = gtk_builder_get_object (builder, "randr-xpos");
++
++    /* Disconnect the "toggled" signal to avoid writing the config again */
++    g_object_disconnect (xpos, "any_signal::value-changed",
++                         display_setting_xpos_changed,
++                         builder, NULL);
++    gtk_spin_button_set_value (GTK_SPIN_BUTTON (xpos),
++                                  XFCE_RANDR_POS_X (xfce_randr));
++    /* Reconnect the signal */
++    g_signal_connect (G_OBJECT (xpos), "value-changed", G_CALLBACK (display_setting_xpos_changed),
++                      builder);
++}
++
++
++
++static void
++display_setting_ypos_changed (GtkSpinButton *spinbutton,
++                                GtkBuilder      *builder)
++{
++    gint value;
++
++    value = gtk_spin_button_get_value_as_int  (spinbutton);
++
++    XFCE_RANDR_POS_Y (xfce_randr) = value;
++
++    display_setting_refresh_rates_populate (builder);
++
++    /* Apply the changes */
++    xfce_randr_save_output (xfce_randr, "Default", display_channel,
++                            xfce_randr->active_output);
++    xfce_randr_apply (xfce_randr, "Default", display_channel);
++}
++
++
++
++static void
++display_setting_ypos_status_populate (GtkBuilder *builder)
++{
++    GObject *ypos;
++
++    if (!xfce_randr)
++        return;
++
++    if (xfce_randr->noutput <= 1)
++        return;
++
++    ypos = gtk_builder_get_object (builder, "randr-ypos");
++    /* Disconnect the "value-changed" signal to avoid writing the config again */
++    g_object_disconnect (ypos, "any_signal::value-changed",
++                         display_setting_ypos_changed,
++                         builder, NULL);
++    gtk_spin_button_set_value (GTK_SPIN_BUTTON (ypos),
++                                  XFCE_RANDR_POS_Y (xfce_randr));
++    /* Reconnect the signal */
++    g_signal_connect (G_OBJECT (ypos), "value-changed", G_CALLBACK (display_setting_ypos_changed),
++                      builder);
++}
++
++
++
++static void
+ display_settings_treeview_selection_changed (GtkTreeSelection *selection,
+                                              GtkBuilder       *builder)
+ {
+@@ -723,6 +815,8 @@
+         display_setting_refresh_rates_populate (builder);
+         display_setting_rotations_populate (builder);
+         display_setting_reflections_populate (builder);
++        display_setting_xpos_status_populate (builder);
++        display_setting_ypos_status_populate (builder);
+     }
+ }
+ 
+@@ -827,6 +921,15 @@
+ 
+ 
+ static void
++display_settings_spin_button_create (GtkSpinButton *spinbutton)
++{
++	gtk_spin_button_set_increments(spinbutton, 1,0);
++	gtk_spin_button_set_range(spinbutton,0,4096);
++}
++
++
++
++static void
+ display_settings_dialog_response (GtkDialog  *dialog,
+                                   gint        response_id,
+                                   GtkBuilder *builder)
+@@ -843,7 +946,7 @@
+     GtkCellRenderer  *renderer;
+     GtkTreeSelection *selection;
+     GObject          *combobox;
+-    GObject          *label, *check;
++    GObject          *label, *check, *spin;
+ 
+     /* Get the treeview */
+     treeview = gtk_builder_get_object (builder, "randr-outputs");
+@@ -874,6 +977,26 @@
+     else
+         gtk_widget_hide (GTK_WIDGET (check));
+ 
++    spin = gtk_builder_get_object (builder, "randr-xpos");
++    display_settings_spin_button_create(GTK_SPIN_BUTTON (spin));
++    if (xfce_randr->noutput > 1)
++    {
++        gtk_widget_show (GTK_WIDGET (spin));
++        g_signal_connect (G_OBJECT (spin), "value-changed", G_CALLBACK (display_setting_xpos_changed), builder);
++    }
++    else
++        gtk_widget_hide (GTK_WIDGET (spin));
++
++    spin = gtk_builder_get_object (builder, "randr-ypos");
++    display_settings_spin_button_create(GTK_SPIN_BUTTON (spin));
++    if (xfce_randr->noutput > 1)
++    {
++        gtk_widget_show (GTK_WIDGET (spin));
++        g_signal_connect (G_OBJECT (spin), "value-changed", G_CALLBACK (display_setting_ypos_changed), builder);
++    }
++    else
++        gtk_widget_hide (GTK_WIDGET (spin));
++
+     label = gtk_builder_get_object (builder, "label-reflection");
+     gtk_widget_show (GTK_WIDGET (label));
+ 
diff --git a/xfce4-settings.spec b/xfce4-settings.spec
index 164faa6..1dfdd5a 100644
--- a/xfce4-settings.spec
+++ b/xfce4-settings.spec
@@ -2,7 +2,7 @@
 
 Name:           xfce4-settings
 Version:        4.10.1
-Release:        1%{?dist}
+Release:        2%{?dist}
 Summary:        Settings Manager for Xfce
 
 Group:          User Interface/Desktops
@@ -11,6 +11,7 @@ URL:            http://www.xfce.org/
 #VCS git:git://git.xfce.org/xfce/xfce4-settings
 Source0:        http://archive.xfce.org/src/xfce/%{name}/%{xfceversion}/%{name}-%{version}.tar.bz2
 ## Downstream patches
+Patch1:          xfce4-settings-4.8.3-monitor-position.patch
 # Use Fedora theme and font settings
 Patch10:         xfce4-settings-4.9.4-fedora.patch
 
@@ -46,11 +47,12 @@ This package includes the settings manager applications for the Xfce desktop.
 
 %prep
 %setup -q
+%patch1 -p1
 %patch10 -p1 -b .fedora
 
 
 %build
-%configure --enable-sound-settings --enable-pluggable-dialogs
+%configure --enable-sound-settings --enable-pluggable-dialogs --enable-maintainer-mode
 make %{?_smp_mflags} V=1
 
 
@@ -87,6 +89,9 @@ rm -rf %{buildroot}
 %{_libdir}/xfce4/settings
 
 %changelog
+* Mon May 20 2013 Eric Harney <eharney@redhat.com> 4.10.1-2
+- Re-add patch for multi monitor position settings. (#773780)
+
 * Sun May 05 2013 Kevin Fenzi <kevin@scrye.com> 4.10.1-1
 - Update to 4.10.1
 
-- 
1.8.1.4

