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
This commit is contained in:
Havoc Pennington 2001-10-30 02:00:53 +00:00 committed by Havoc Pennington
parent 4395fd581a
commit ff5315d551
3 changed files with 52 additions and 15 deletions

View File

@ -1,3 +1,13 @@
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
2001-10-29 Yuriy Syrota <rasta@renome.rovno.ua> 2001-10-29 Yuriy Syrota <rasta@renome.rovno.ua>
* configure.in: Added "uk" to ALL_LINGUAS. * configure.in: Added "uk" to ALL_LINGUAS.

View File

@ -216,7 +216,9 @@ meta_window_place (MetaWindow *window,
/* frame member variables should NEVER be used in here, only /* frame member variables should NEVER be used in here, only
* MetaFrameGeometry. But remember fgeom == NULL * 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); 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", meta_verbose ("Centered window %s over transient parent\n",
window->desc); 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; goto done;
} }

View File

@ -907,17 +907,26 @@ static gboolean
idle_calc_showing (gpointer data) idle_calc_showing (gpointer data)
{ {
GSList *tmp; GSList *tmp;
GSList *copy;
meta_verbose ("Clearing the calc_showing queue\n"); 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 /* sort them from bottom to top, so we map the
* bottom windows first, so that placement (e.g. cascading) * bottom windows first, so that placement (e.g. cascading)
* works properly * works properly
*/ */
calc_showing_pending = g_slist_sort (calc_showing_pending, copy = g_slist_sort (copy, stackcmp);
stackcmp);
tmp = calc_showing_pending; tmp = copy;
while (tmp != NULL) while (tmp != NULL)
{ {
MetaWindow *window; MetaWindow *window;
@ -930,10 +939,8 @@ idle_calc_showing (gpointer data)
tmp = tmp->next; tmp = tmp->next;
} }
g_slist_free (calc_showing_pending); g_slist_free (copy);
calc_showing_pending = NULL;
calc_showing_idle = 0;
return FALSE; return FALSE;
} }
@ -945,7 +952,7 @@ meta_window_unqueue_calc_showing (MetaWindow *window)
meta_verbose ("Removing %s from the calc_showing queue\n", meta_verbose ("Removing %s from the calc_showing queue\n",
window->desc); window->desc);
calc_showing_pending = g_slist_remove (calc_showing_pending, window); calc_showing_pending = g_slist_remove (calc_showing_pending, window);
window->calc_showing_queued = FALSE; window->calc_showing_queued = FALSE;
@ -990,9 +997,12 @@ meta_window_queue_calc_showing (MetaWindow *window)
void void
meta_window_show (MetaWindow *window) meta_window_show (MetaWindow *window)
{ {
gboolean did_placement;
meta_verbose ("Showing window %s, shaded: %d iconic: %d placed: %d\n", meta_verbose ("Showing window %s, shaded: %d iconic: %d placed: %d\n",
window->desc, window->shaded, window->iconic, window->placed); window->desc, window->shaded, window->iconic, window->placed);
did_placement = FALSE;
if (!window->placed) if (!window->placed)
{ {
/* We have to recalc the placement here since other windows may /* 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 * This is toggled here so that initially-iconified windows
* still get placed when they are ultimately shown. * 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 */ /* 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); 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 void