while (offset != 0)
{
- current = gtk_notebook_search_page (notebook, current, offset < 0 ? STEP_PREV : STEP_NEXT, TRUE);
+ current = gtk_notebook_search_page (notebook, current,
+ offset < 0 ? STEP_PREV : STEP_NEXT,
+ TRUE);
+
+ if (!current)
+ {
+ gboolean wrap_around;
+
+ g_object_get (gtk_widget_get_settings (GTK_WIDGET (notebook)),
+ "gtk-keynav-wrap-around", &wrap_around,
+ NULL);
+
+ if (wrap_around)
+ current = gtk_notebook_search_page (notebook, NULL,
+ offset < 0 ? STEP_PREV : STEP_NEXT,
+ TRUE);
+ else
+ break;
+ }
+
offset += offset < 0 ? 1 : -1;
}
if (current)
gtk_notebook_switch_page (notebook, current->data, -1);
else
- gdk_display_beep (gtk_widget_get_display (GTK_WIDGET (notebook)));
+ gtk_widget_error_bell (GTK_WIDGET (notebook));
}
static GtkDirectionType
GtkNotebookPointerPosition pointer_position;
GList *element, *first_tab;
- GDK_THREADS_ENTER ();
-
priv = GTK_NOTEBOOK_GET_PRIVATE (notebook);
pointer_position = get_pointer_position (notebook);
gdk_window_raise (priv->drag_window);
}
- GDK_THREADS_LEAVE ();
-
return TRUE;
}
settings = gtk_widget_get_settings (GTK_WIDGET (notebook));
g_object_get (settings, "gtk-timeout-repeat", &timeout, NULL);
- priv->dnd_timer = g_timeout_add (timeout * SCROLL_DELAY_FACTOR,
- (GSourceFunc) scroll_notebook_timer,
+ priv->dnd_timer = gdk_threads_add_timeout (timeout * SCROLL_DELAY_FACTOR,
+ scroll_notebook_timer,
(gpointer) notebook);
}
}
GList *tab;
gint x, y;
- GDK_THREADS_ENTER ();
-
notebook = GTK_NOTEBOOK (data);
priv = GTK_NOTEBOOK_GET_PRIVATE (notebook);
gtk_notebook_switch_focus_tab (notebook, tab);
}
- GDK_THREADS_LEAVE ();
-
return FALSE;
}
settings = gtk_widget_get_settings (widget);
g_object_get (settings, "gtk-timeout-expand", &timeout, NULL);
- priv->switch_tab_timer = g_timeout_add (timeout,
- (GSourceFunc) gtk_notebook_switch_tab_timeout,
+ priv->switch_tab_timer = gdk_threads_add_timeout (timeout,
+ gtk_notebook_switch_tab_timeout,
widget);
}
}
new_page = gtk_notebook_search_page (notebook, notebook->focus_tab,
search_direction, TRUE);
+ if (!new_page)
+ {
+ gboolean wrap_around;
+
+ g_object_get (gtk_widget_get_settings (GTK_WIDGET (notebook)),
+ "gtk-keynav-wrap-around", &wrap_around,
+ NULL);
+
+ if (wrap_around)
+ new_page = gtk_notebook_search_page (notebook, NULL,
+ search_direction, TRUE);
+ }
+
if (new_page)
gtk_notebook_switch_focus_tab (notebook, new_page);
else
- gdk_display_beep (gtk_widget_get_display (GTK_WIDGET (notebook)));
-
+ gtk_widget_error_bell (GTK_WIDGET (notebook));
+
return TRUE;
}
}
}
-static gint
+static gboolean
gtk_notebook_timer (GtkNotebook *notebook)
{
gboolean retval = FALSE;
- GDK_THREADS_ENTER ();
-
if (notebook->timer)
{
gtk_notebook_do_arrow (notebook, notebook->click_child);
g_object_get (settings, "gtk-timeout-repeat", &timeout, NULL);
notebook->need_timer = FALSE;
- notebook->timer = g_timeout_add (timeout * SCROLL_DELAY_FACTOR,
+ notebook->timer = gdk_threads_add_timeout (timeout * SCROLL_DELAY_FACTOR,
(GSourceFunc) gtk_notebook_timer,
(gpointer) notebook);
}
retval = TRUE;
}
- GDK_THREADS_LEAVE ();
-
return retval;
}
g_object_get (settings, "gtk-timeout-initial", &timeout, NULL);
- notebook->timer = g_timeout_add (timeout,
+ notebook->timer = gdk_threads_add_timeout (timeout,
(GSourceFunc) gtk_notebook_timer,
(gpointer) notebook);
notebook->need_timer = TRUE;
gboolean allocate_at_bottom;
gint tab_overlap, tab_pos, tab_extra_space;
gint left_x, right_x, top_y, bottom_y, anchor;
+ gint xthickness, ythickness;
gboolean gap_left, packing_changed;
GtkAllocation child_allocation = { 0, };
gboolean allocation_changed = FALSE;
child_allocation.x = widget->allocation.x + container->border_width;
child_allocation.y = widget->allocation.y + container->border_width;
+ xthickness = widget->style->xthickness;
+ ythickness = widget->style->ythickness;
+
switch (tab_pos)
{
case GTK_POS_BOTTOM:
page->allocation = child_allocation;
- if (page == notebook->cur_page &&
- (priv->operation == DRAG_OPERATION_REORDER ||
- priv->operation == DRAG_OPERATION_DETACH))
+ if (page == notebook->cur_page)
+ {
+ 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;
+ }
+ }
+ else
{
- /* needs to be allocated at 0,0
- * to be shown in the drag window */
- page->allocation.x = 0;
- page->allocation.y = 0;
+ switch (tab_pos)
+ {
+ case GTK_POS_TOP:
+ page->allocation.y += ythickness;
+ /* fall through */
+ case GTK_POS_BOTTOM:
+ page->allocation.height = MAX (1, page->allocation.height - ythickness);
+ break;
+ case GTK_POS_LEFT:
+ page->allocation.x += xthickness;
+ /* fall through */
+ case GTK_POS_RIGHT:
+ page->allocation.width = MAX (1, page->allocation.width - xthickness);
+ break;
+ }
}
/* calculate whether to leave a gap based on reorder operation or not */