gnome-panel r11530 - trunk/gnome-panel
- From: vuntz svn gnome org
- To: svn-commits-list gnome org
- Subject: gnome-panel r11530 - trunk/gnome-panel
- Date: Tue, 24 Feb 2009 02:43:21 +0000 (UTC)
Author: vuntz
Date: Tue Feb 24 02:43:20 2009
New Revision: 11530
URL: http://svn.gnome.org/viewvc/gnome-panel?rev=11530&view=rev
Log:
2009-02-24 Vincent Untz <vuntz gnome org>
Fix some randr-interaction by connecting to the monitors-changed
signal.
Fix bug #572933.
Patch by Matthias Clasen <mclasen redhat com>
* panel-multiscreen.c: (panel_multiscreen_reinit_idle),
(panel_multiscreen_queue_reinit): use an idle loop as callback since we
can get two signals emitted at the same time.
(panel_multiscreen_init): connect to monitors-changed too
(panel_multiscreen_reinit): trivial update
Modified:
trunk/gnome-panel/ChangeLog
trunk/gnome-panel/panel-multiscreen.c
Modified: trunk/gnome-panel/panel-multiscreen.c
==============================================================================
--- trunk/gnome-panel/panel-multiscreen.c (original)
+++ trunk/gnome-panel/panel-multiscreen.c Tue Feb 24 02:43:20 2009
@@ -40,6 +40,25 @@
static int *monitors = NULL;
static GdkRectangle **geometries = NULL;
static gboolean initialized = FALSE;
+static guint reinit_id = 0;
+
+static gboolean
+panel_multiscreen_reinit_idle (gpointer data)
+{
+ panel_multiscreen_reinit ();
+ reinit_id = 0;
+
+ return FALSE;
+}
+
+static void
+panel_multiscreen_queue_reinit (void)
+{
+ if (reinit_id)
+ return;
+
+ reinit_id = g_idle_add (panel_multiscreen_reinit_idle, NULL);
+}
void
panel_multiscreen_init (void)
@@ -62,8 +81,14 @@
screen = gdk_display_get_screen (display, i);
+ /* We connect to both signals to be on the safe side, but in
+ * theory, it should be enough to only connect to
+ * monitors-changed. Since we'll likely get two signals, we do
+ * the real callback in the idle loop. */
g_signal_connect (screen, "size-changed",
- G_CALLBACK (panel_multiscreen_reinit), NULL);
+ G_CALLBACK (panel_multiscreen_queue_reinit), NULL);
+ g_signal_connect (screen, "monitors-changed",
+ G_CALLBACK (panel_multiscreen_queue_reinit), NULL);
monitors [i] = gdk_screen_get_n_monitors (screen);
geometries [i] = g_new0 (GdkRectangle, monitors [i]);
@@ -105,7 +130,7 @@
screen = gdk_display_get_screen (display, i);
g_signal_handlers_disconnect_by_func (screen,
- panel_multiscreen_reinit,
+ panel_multiscreen_queue_reinit,
NULL);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]