X-Git-Url: https://vcs.maemo.org/git/?a=blobdiff_plain;f=hildon%2Fhildon-window-stack.c;h=681265d0f3a8b9e916c76a7ad4dadd6093efee74;hb=a0bb5e181c480bb0c8c64dcc3c54f6814816c2ad;hp=f72081834ee20a05d27462de21b62e73d2bbd832;hpb=30145d2600fdb0a434350f631064cbfbbf9f03eb;p=hildon diff --git a/hildon/hildon-window-stack.c b/hildon/hildon-window-stack.c index f720818..681265d 100644 --- a/hildon/hildon-window-stack.c +++ b/hildon/hildon-window-stack.c @@ -285,9 +285,14 @@ _hildon_window_stack_do_push (HildonWindowStack *stack, if (current_stack == NULL) { GtkWidget *parent = hildon_window_stack_peek (stack); + gint pos = 0; + + if (parent) { + pos = HILDON_STACKABLE_WINDOW_GET_PRIVATE (parent)->stack_position + 1; + } /* Push the window */ - hildon_stackable_window_set_stack (win, stack, g_list_length (stack->priv->list)); + hildon_stackable_window_set_stack (win, stack, pos); stack->priv->list = g_list_prepend (stack->priv->list, win); /* Make the window part of the same group as its parent */ @@ -506,15 +511,20 @@ hildon_window_stack_pop_and_push_list (HildonWindowStack *stack, GList **popped_windows, GList *list) { - gint i; + gint i, topmost_index; GList *l; GList *popped = NULL; GList *pushed = NULL; + HildonStackableWindowPrivate *priv; g_return_if_fail (HILDON_IS_WINDOW_STACK (stack)); g_return_if_fail (nwindows > 0); g_return_if_fail (g_list_length (stack->priv->list) >= nwindows); + /* Store the index of the topmost window */ + priv = HILDON_STACKABLE_WINDOW_GET_PRIVATE (hildon_window_stack_peek (stack)); + topmost_index = priv->stack_position; + /* Pop windows */ for (i = 0; i < nwindows; i++) { GtkWidget *win = _hildon_window_stack_do_pop (stack); @@ -532,6 +542,15 @@ hildon_window_stack_pop_and_push_list (HildonWindowStack *stack, } } + if (pushed != NULL) { + /* The WM will be confused if the old topmost window and the new + * one have the same index, so make sure that they're different */ + priv = HILDON_STACKABLE_WINDOW_GET_PRIVATE (hildon_window_stack_peek (stack)); + if (priv->stack_position == topmost_index) { + priv->stack_position++; + } + } + /* Show windows in reverse order (topmost first) */ g_list_foreach (pushed, (GFunc) gtk_widget_show, NULL);