Fix small regressions in GtkNotebook tab detaching. Bug #378852.

2006-12-26  Carlos Garnacho  <carlosg@gnome.org>

        Fix small regressions in GtkNotebook tab detaching. Bug #378852.

        * gtk/gtknotebook.c (gtk_notebook_do_arrow): grab focus to allow tabs
        scrolling when hovering with a detached tab.
        (gtk_notebook_stop_reorder): Do not deparent the wrong tab if the
        focus tab has changed during a tab DND operation.
        (gtk_notebook_drag_end): ensure that the dropped tab gets focused.
        (gtk_notebook_paint): do not take cur_page as a reference to paint the
        box if it's detached.
        (gtk_notebook_calculate_tabs_allocation): focus_tab may be different
        to the detached tab if we hover the arrows during a tabs detaching
        operation, do not allocate it unconditionally in 0,0.
This commit is contained in:
Carlos Garnacho 2006-12-26 11:02:15 +00:00 committed by Carlos Garnacho
parent c1077874a0
commit 43e3082a43
2 changed files with 34 additions and 13 deletions

View File

@ -1,3 +1,18 @@
2006-12-26 Carlos Garnacho <carlosg@gnome.org>
Fix small regressions in GtkNotebook tab detaching. Bug #378852.
* gtk/gtknotebook.c (gtk_notebook_do_arrow): grab focus to allow tabs
scrolling when hovering with a detached tab.
(gtk_notebook_stop_reorder): Do not deparent the wrong tab if the
focus tab has changed during a tab DND operation.
(gtk_notebook_drag_end): ensure that the dropped tab gets focused.
(gtk_notebook_paint): do not take cur_page as a reference to paint the
box if it's detached.
(gtk_notebook_calculate_tabs_allocation): focus_tab may be different
to the detached tab if we hover the arrows during a tabs detaching
operation, do not allocate it unconditionally in 0,0.
2006-12-26 Carlos Garnacho <carlosg@gnome.org>
Expose improvements for GtkNotebook. Bug #383435

View File

@ -2203,6 +2203,8 @@ gtk_notebook_do_arrow (GtkNotebook *notebook,
dir = ARROW_IS_LEFT (arrow) ? GTK_DIR_UP : GTK_DIR_DOWN;
else
dir = ARROW_IS_LEFT (arrow) ? GTK_DIR_LEFT : GTK_DIR_RIGHT;
gtk_widget_grab_focus (widget);
gtk_widget_child_focus (widget, dir);
}
}
@ -2619,7 +2621,11 @@ gtk_notebook_stop_reorder (GtkNotebook *notebook)
GtkNotebookPage *page;
priv = GTK_NOTEBOOK_GET_PRIVATE (notebook);
page = notebook->cur_page;
if (priv->operation == DRAG_OPERATION_DETACH)
page = priv->detached_tab;
else
page = notebook->cur_page;
if (!page)
return;
@ -3090,6 +3096,9 @@ gtk_notebook_drag_end (GtkWidget *widget,
gtk_notebook_stop_reorder (GTK_NOTEBOOK (widget));
if (priv->detached_tab)
gtk_notebook_switch_page (GTK_NOTEBOOK (widget), priv->detached_tab, -1);
GTK_BIN (priv->dnd_window)->child = NULL;
gtk_widget_destroy (priv->dnd_window);
priv->dnd_window = NULL;
@ -4437,8 +4446,7 @@ gtk_notebook_paint (GtkWidget *widget,
if (!notebook->first_tab)
notebook->first_tab = notebook->children;
if (!NOTEBOOK_IS_TAB_LABEL_PARENT (notebook, notebook->cur_page) ||
!GTK_WIDGET_MAPPED (notebook->cur_page->tab_label))
if (!GTK_WIDGET_MAPPED (notebook->cur_page->tab_label))
page = GTK_NOTEBOOK_PAGE (notebook->first_tab);
else
page = notebook->cur_page;
@ -5234,18 +5242,16 @@ gtk_notebook_calculate_tabs_allocation (GtkNotebook *notebook,
page->allocation = child_allocation;
if (page == notebook->cur_page)
if ((page == priv->detached_tab && priv->operation == DRAG_OPERATION_DETACH) ||
(page == notebook->cur_page && priv->operation == DRAG_OPERATION_REORDER))
{
if (priv->operation == DRAG_OPERATION_REORDER ||
priv->operation == DRAG_OPERATION_DETACH)
{
/* needs to be allocated at 0,0
* to be shown in the drag window */
page->allocation.x = 0;
page->allocation.y = 0;
}
/* needs to be allocated at 0,0
* to be shown in the drag window */
page->allocation.x = 0;
page->allocation.y = 0;
}
else
if (page != notebook->cur_page)
{
switch (tab_pos)
{