summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorHavoc Pennington <hp@pobox.com>2001-10-30 02:00:53 +0000
committerHavoc Pennington <hp@src.gnome.org>2001-10-30 02:00:53 +0000
commitff5315d5514e41ffb33c348656f2c806838a6bbc (patch)
tree472f34f751bac3ea6ee75a00083af44f4e6daab3 /src
parent4395fd581ab49f7fc61df0aaf44b53a23cd0bf7d (diff)
downloadmetacity-ff5315d5514e41ffb33c348656f2c806838a6bbc.tar.gz
metacity-ff5315d5514e41ffb33c348656f2c806838a6bbc.tar.bz2
handle queue/unqueue of calc showings as we are iterating over the pending
2001-10-29 Havoc Pennington <hp@pobox.com> * src/window.c (idle_calc_showing): handle queue/unqueue of calc showings as we are iterating over the pending list (meta_window_show): focus placed transients in here instead of in meta_window_place - now it should actually work, yay * src/place.c (meta_window_place): remove focusing of transient child from here; this was really broken
Diffstat (limited to 'src')
-rw-r--r--src/place.c10
-rw-r--r--src/window.c47
2 files changed, 42 insertions, 15 deletions
diff --git a/src/place.c b/src/place.c
index 23026c8..b67af69 100644
--- a/src/place.c
+++ b/src/place.c
@@ -216,7 +216,9 @@ meta_window_place (MetaWindow *window,
/* frame member variables should NEVER be used in here, only
* MetaFrameGeometry. But remember fgeom == NULL
- * for undecorated windows.
+ * for undecorated windows. Also, this function should
+ * NEVER have side effects other than computing the
+ * placement coordinates.
*/
meta_verbose ("Placing window %s\n", window->desc);
@@ -252,12 +254,6 @@ meta_window_place (MetaWindow *window,
meta_verbose ("Centered window %s over transient parent\n",
window->desc);
-
- if (parent->has_focus)
- {
- meta_verbose ("Focusing transient window since parent had focus\n");
- meta_window_focus (window, CurrentTime); /* FIXME CurrentTime */
- }
goto done;
}
diff --git a/src/window.c b/src/window.c
index 42e8c66..ec12ca2 100644
--- a/src/window.c
+++ b/src/window.c
@@ -907,17 +907,26 @@ static gboolean
idle_calc_showing (gpointer data)
{
GSList *tmp;
+ GSList *copy;
meta_verbose ("Clearing the calc_showing queue\n");
+
+ /* Work with a copy, for reentrancy. The allowed reentrancy isn't
+ * complete; destroying a window while we're in here would result in
+ * badness. But it's OK to queue/unqueue calc_showings.
+ */
+ copy = g_slist_copy (calc_showing_pending);
+ g_slist_free (calc_showing_pending);
+ calc_showing_pending = NULL;
+ calc_showing_idle = 0;
/* sort them from bottom to top, so we map the
* bottom windows first, so that placement (e.g. cascading)
* works properly
*/
- calc_showing_pending = g_slist_sort (calc_showing_pending,
- stackcmp);
+ copy = g_slist_sort (copy, stackcmp);
- tmp = calc_showing_pending;
+ tmp = copy;
while (tmp != NULL)
{
MetaWindow *window;
@@ -930,10 +939,8 @@ idle_calc_showing (gpointer data)
tmp = tmp->next;
}
- g_slist_free (calc_showing_pending);
- calc_showing_pending = NULL;
+ g_slist_free (copy);
- calc_showing_idle = 0;
return FALSE;
}
@@ -945,7 +952,7 @@ meta_window_unqueue_calc_showing (MetaWindow *window)
meta_verbose ("Removing %s from the calc_showing queue\n",
window->desc);
-
+
calc_showing_pending = g_slist_remove (calc_showing_pending, window);
window->calc_showing_queued = FALSE;
@@ -990,9 +997,12 @@ meta_window_queue_calc_showing (MetaWindow *window)
void
meta_window_show (MetaWindow *window)
{
+ gboolean did_placement;
+
meta_verbose ("Showing window %s, shaded: %d iconic: %d placed: %d\n",
window->desc, window->shaded, window->iconic, window->placed);
+ did_placement = FALSE;
if (!window->placed)
{
/* We have to recalc the placement here since other windows may
@@ -1011,7 +1021,8 @@ meta_window_show (MetaWindow *window)
* This is toggled here so that initially-iconified windows
* still get placed when they are ultimately shown.
*/
- window->placed = TRUE;
+ window->placed = TRUE;
+ did_placement = TRUE;
}
/* Shaded means the frame is mapped but the window is not */
@@ -1058,6 +1069,26 @@ meta_window_show (MetaWindow *window)
set_wm_state (window, NormalState);
}
}
+
+
+ if (did_placement)
+ {
+ if (window->xtransient_for != None)
+ {
+ MetaWindow *parent;
+
+ parent =
+ meta_display_lookup_x_window (window->display,
+ window->xtransient_for);
+
+ if (parent && parent->has_focus)
+ {
+ meta_verbose ("Focusing transient window '%s' since parent had focus\n",
+ window->desc);
+ meta_window_focus (window, CurrentTime); /* FIXME CurrentTime */
+ }
+ }
+ }
}
void