[gnome-panel] [panel] Check if the current monitor of a toplevel can be still used
- From: Vincent Untz <vuntz src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [gnome-panel] [panel] Check if the current monitor of a toplevel can be still used
- Date: Thu, 20 Aug 2009 12:49:19 +0000 (UTC)
commit e5d41e1cf56445c451f78b83ec0f4bf92fdef604
Author: Vincent Untz <vuntz gnome org>
Date: Wed Aug 19 15:45:10 2009 +0200
[panel] Check if the current monitor of a toplevel can be still used
On a randr update, we were checking if we can move a toplevel to its
configured monitor. But we were not checking if its current monitor was
still valid (the opposite case, when a monitor disappears).
gnome-panel/panel-toplevel.c | 29 +++++++++++++++++------------
1 files changed, 17 insertions(+), 12 deletions(-)
---
diff --git a/gnome-panel/panel-toplevel.c b/gnome-panel/panel-toplevel.c
index cb75e4d..64d24bf 100644
--- a/gnome-panel/panel-toplevel.c
+++ b/gnome-panel/panel-toplevel.c
@@ -5025,9 +5025,9 @@ panel_toplevel_set_monitor_internal (PanelToplevel *toplevel,
/**
* panel_toplevel_update_monitor:
*
- * Moves the toplevel to its configured monitor if needed. This generally
- * happens when the configured monitor was non-existing before, and it appeared
- * at runtime.
+ * Moves the toplevel to its configured monitor or the first one, if needed.
+ * This generally happens when the configured monitor was non-existing before,
+ * and it appeared at runtime, or if it was existing and disappeared.
*
* This must only be called at the beginning of the size request of the
* toplevel because it doesn't queue a size request.
@@ -5037,17 +5037,22 @@ panel_toplevel_update_monitor (PanelToplevel *toplevel)
{
GdkScreen *screen;
- if (toplevel->priv->configured_monitor == -1 ||
- toplevel->priv->configured_monitor == toplevel->priv->monitor)
- return;
-
screen = gtk_window_get_screen (GTK_WINDOW (toplevel));
- if (toplevel->priv->configured_monitor >= panel_multiscreen_monitors (screen))
- return;
- panel_toplevel_set_monitor_internal (toplevel,
- toplevel->priv->configured_monitor,
- FALSE);
+ /* If we were not using the configured monitor, can we use it now? */
+ if ((toplevel->priv->configured_monitor != -1) &&
+ (toplevel->priv->configured_monitor != toplevel->priv->monitor) &&
+ toplevel->priv->configured_monitor < panel_multiscreen_monitors (screen)) {
+ panel_toplevel_set_monitor_internal (toplevel,
+ toplevel->priv->configured_monitor,
+ FALSE);
+
+ /* else, can we still use the monitor we were using? */
+ } else if (toplevel->priv->monitor >= panel_multiscreen_monitors (screen)) {
+ panel_toplevel_set_monitor_internal (toplevel,
+ 0,
+ FALSE);
+ }
}
void
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]