File gnome-control-center-bnc381139-handle-hotplug-and-unsuspend.diff of Package gnome-control-center

From 4eee3746006311a87624944819dce89b8644c86c Mon Sep 17 00:00:00 2001
From: Federico Mena Quintero <federico@novell.com>
Date: Sat, 30 May 2009 20:47:42 -0500
Subject: [PATCH 1/2] Use the timestamp of the Apply button to change the RANDR configuration

There is no timestamp available when the dialog returns from gtk_dialog_run().
So, we save the timestamp at the time the Apply button is clicked.

Signed-off-by: Federico Mena Quintero <federico@novell.com>
---
 capplets/display/display-capplet.glade |    2 +-
 capplets/display/xrandr-capplet.c      |   23 ++++++++++++++++++++++-
 2 files changed, 23 insertions(+), 2 deletions(-)

diff --git a/capplets/display/display-capplet.glade b/capplets/display/display-capplet.glade
index 5e5bd85..79bd62d 100644
--- a/capplets/display/display-capplet.glade
+++ b/capplets/display/display-capplet.glade
@@ -45,7 +45,7 @@
 	  </child>
 
 	  <child>
-	    <widget class="GtkButton" id="button1">
+	    <widget class="GtkButton" id="apply_button">
 	      <property name="visible">True</property>
 	      <property name="can_default">True</property>
 	      <property name="can_focus">True</property>
diff --git a/capplets/display/xrandr-capplet.c b/capplets/display/xrandr-capplet.c
index 3ed8f87..557bdd4 100644
--- a/capplets/display/xrandr-capplet.c
+++ b/capplets/display/xrandr-capplet.c
@@ -61,6 +61,10 @@ struct App
     GtkWidget      *rotate_tablet_box;
     GtkWidget      *rotate_tablet_checkbox;
 
+    /* We store the event timestamp when the Apply button is clicked */
+    GtkWidget      *apply_button;
+    guint32         apply_button_clicked_timestamp;
+
     GtkWidget      *area;
     gboolean	    ignore_gui_changes;
     GConfClient	   *client;
@@ -1870,7 +1874,7 @@ apply (App *app)
 
     gtk_widget_set_sensitive (app->dialog, FALSE);
 
-    begin_version2_apply_configuration (app, gtk_widget_get_window (app->dialog), gtk_get_current_event_time ());
+    begin_version2_apply_configuration (app, gtk_widget_get_window (app->dialog), app->apply_button_clicked_timestamp);
 }
 
 #if 0
@@ -2112,6 +2116,19 @@ set_rotate_tablet_widgets (App *app)
 }
 
 static void
+apply_button_clicked_cb (GtkButton *button, gpointer data)
+{
+    App *app = data;
+
+    /* We simply store the timestamp at which the Apply button was clicked.
+     * We'll just wait for the dialog to return from gtk_dialog_run(), and
+     * *then* use the timestamp when applying the RANDR configuration.
+     */
+
+    app->apply_button_clicked_timestamp = gtk_get_current_event_time ();
+}
+
+static void
 run_application (App *app)
 {
 #ifndef GLADEDIR
@@ -2219,6 +2236,10 @@ run_application (App *app)
     /* Until we have help to show, we'll just hide the Help button */
     hide_help_button (app);
 
+    app->apply_button = glade_xml_get_widget (xml, "apply_button");
+    g_signal_connect (app->apply_button, "clicked",
+		      G_CALLBACK (apply_button_clicked_cb), app);
+
     on_screen_changed (app->screen, app);
 
     g_object_unref (xml);
-- 
1.6.0.2


From a5a30cfe5424bc3da00d1e190b3ab0556e7b93fc Mon Sep 17 00:00:00 2001
From: Federico Mena Quintero <federico@novell.com>
Date: Sun, 31 May 2009 13:52:26 -0500
Subject: [PATCH 2/2] Fix the layout-outputs-horizontally helper

The horizontal coordinate was not always being updated.
Also, ensure that outputs are at y=0.

Signed-off-by: Federico Mena Quintero <federico@novell.com>
---
 capplets/display/xrandr-capplet.c |   14 ++++++++------
 1 files changed, 8 insertions(+), 6 deletions(-)

diff --git a/capplets/display/xrandr-capplet.c b/capplets/display/xrandr-capplet.c
index 557bdd4..b899df5 100644
--- a/capplets/display/xrandr-capplet.c
+++ b/capplets/display/xrandr-capplet.c
@@ -808,10 +808,11 @@ lay_out_outputs_horizontally (App *app)
 	GnomeOutputInfo *output;
 
 	output = app->current_configuration->outputs[i];
-	if (output->connected && output->on)
+	if (output->connected && output->on) {
 	    output->x = x;
-
-	x += output->width;
+	    output->y = 0;
+	    x += output->width;
+	}
     }
 
     /* Second pass, all the black screens */
@@ -821,10 +822,11 @@ lay_out_outputs_horizontally (App *app)
 	GnomeOutputInfo *output;
 
 	output = app->current_configuration->outputs[i];
-	if (!(output->connected && output->on))
+	if (!(output->connected && output->on)) {
 	    output->x = x;
-
-	x += output->width;
+	    output->y = 0;
+	    x += output->width;
+	}
     }
 
 }
-- 
1.6.0.2

openSUSE Build Service is sponsored by