[gnome-panel] [panel] Do not use non-existing monitors for toplevels



commit 787d8ab2f472f31084dfca28b48902e9d8fee822
Author: Vincent Untz <vuntz gnome org>
Date:   Wed Aug 12 13:12:49 2009 +0200

    [panel] Do not use non-existing monitors for toplevels
    
    We just use the previous monitor instead, without changing the
    configuration.

 gnome-panel/panel-toplevel.c |   10 ++++++++++
 1 files changed, 10 insertions(+), 0 deletions(-)
---
diff --git a/gnome-panel/panel-toplevel.c b/gnome-panel/panel-toplevel.c
index 8c39b77..ca1a2e5 100644
--- a/gnome-panel/panel-toplevel.c
+++ b/gnome-panel/panel-toplevel.c
@@ -4987,11 +4987,21 @@ void
 panel_toplevel_set_monitor (PanelToplevel *toplevel,
 			    int            monitor)
 {
+	GdkScreen *screen;
+
 	g_return_if_fail (PANEL_IS_TOPLEVEL (toplevel));
 
 	if (toplevel->priv->monitor == monitor)
 		return;
 
+	/* Ignore non-existing monitors, and keep the old one. The main use
+	 * case is when logging in after having used a multiscreen environment.
+	 * We will put the panel on the monitor 0 for this session, and it will
+	 * move back to the right monitor next time. */
+	screen = gtk_window_get_screen (GTK_WINDOW (toplevel));
+	if (monitor >= panel_multiscreen_monitors (screen))
+		return;
+
 	toplevel->priv->monitor = monitor;
 
 	gtk_widget_queue_resize (GTK_WIDGET (toplevel));



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]