]> Pileus Git - ~andy/gtk/blobdiff - gtk/gtknotebook.c
Remove GtkObject completely
[~andy/gtk] / gtk / gtknotebook.c
index 1282081d3b83600eb3d43ca273e2ec6f62bc12ca..c5b880c0f16cc7062d72d99f56c6918a5bbdadd1 100644 (file)
@@ -38,7 +38,6 @@
 #include "gtkmenu.h"
 #include "gtkmenuitem.h"
 #include "gtklabel.h"
-#include "gtksizerequest.h"
 #include "gtkintl.h"
 #include "gtkmarshalers.h"
 #include "gtkbindings.h"
@@ -263,8 +262,7 @@ static void     gtk_notebook_query_tab_label_packing (GtkNotebook  *notebook,
                                                       gboolean     *fill,
                                                       GtkPackType  *pack_type);
 
-/*** GtkObject Methods ***/
-static void gtk_notebook_destroy             (GtkObject        *object);
+/*** GObject Methods ***/
 static void gtk_notebook_set_property       (GObject         *object,
                                              guint            prop_id,
                                              const GValue    *value,
@@ -275,6 +273,7 @@ static void gtk_notebook_get_property            (GObject         *object,
                                              GParamSpec      *pspec);
 
 /*** GtkWidget Methods ***/
+static void gtk_notebook_destroy             (GtkWidget        *widget);
 static void gtk_notebook_map                 (GtkWidget        *widget);
 static void gtk_notebook_unmap               (GtkWidget        *widget);
 static void gtk_notebook_realize             (GtkWidget        *widget);
@@ -283,8 +282,8 @@ static void gtk_notebook_size_request        (GtkWidget        *widget,
                                              GtkRequisition   *requisition);
 static void gtk_notebook_size_allocate       (GtkWidget        *widget,
                                              GtkAllocation    *allocation);
-static gint gtk_notebook_expose              (GtkWidget        *widget,
-                                             GdkEventExpose   *event);
+static gint gtk_notebook_draw                (GtkWidget        *widget,
+                                              cairo_t          *cr);
 static gint gtk_notebook_button_press        (GtkWidget        *widget,
                                              GdkEventButton   *event);
 static gint gtk_notebook_button_release      (GtkWidget        *widget,
@@ -401,11 +400,12 @@ static void  gtk_notebook_child_reordered    (GtkNotebook      *notebook,
 
 /*** GtkNotebook Drawing Functions ***/
 static void gtk_notebook_paint               (GtkWidget        *widget,
-                                             GdkRectangle     *area);
+                                             cairo_t          *cr);
 static void gtk_notebook_draw_tab            (GtkNotebook      *notebook,
                                              GtkNotebookPage  *page,
-                                             GdkRectangle     *area);
+                                             cairo_t          *cr);
 static void gtk_notebook_draw_arrow          (GtkNotebook      *notebook,
+                                              cairo_t          *cr,
                                              GtkNotebookArrow  arrow);
 
 /*** GtkNotebook Size Allocate Functions ***/
@@ -537,22 +537,21 @@ static void
 gtk_notebook_class_init (GtkNotebookClass *class)
 {
   GObjectClass   *gobject_class = G_OBJECT_CLASS (class);
-  GtkObjectClass *object_class = GTK_OBJECT_CLASS (class);
   GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (class);
   GtkContainerClass *container_class = GTK_CONTAINER_CLASS (class);
   GtkBindingSet *binding_set;
   
   gobject_class->set_property = gtk_notebook_set_property;
   gobject_class->get_property = gtk_notebook_get_property;
-  object_class->destroy = gtk_notebook_destroy;
 
+  widget_class->destroy = gtk_notebook_destroy;
   widget_class->map = gtk_notebook_map;
   widget_class->unmap = gtk_notebook_unmap;
   widget_class->realize = gtk_notebook_realize;
   widget_class->unrealize = gtk_notebook_unrealize;
   widget_class->size_request = gtk_notebook_size_request;
   widget_class->size_allocate = gtk_notebook_size_allocate;
-  widget_class->expose_event = gtk_notebook_expose;
+  widget_class->draw = gtk_notebook_draw;
   widget_class->button_press_event = gtk_notebook_button_press;
   widget_class->button_release_event = gtk_notebook_button_release;
   widget_class->popup_menu = gtk_notebook_popup_menu;
@@ -1453,36 +1452,11 @@ gtk_notebook_new (void)
   return g_object_new (GTK_TYPE_NOTEBOOK, NULL);
 }
 
-/* Private GtkObject Methods :
- * 
- * gtk_notebook_destroy
- * gtk_notebook_set_arg
- * gtk_notebook_get_arg
+/* Private GObject Methods :
+ *
+ * gtk_notebook_set_property
+ * gtk_notebook_get_property
  */
-static void
-gtk_notebook_destroy (GtkObject *object)
-{
-  GtkNotebook *notebook = GTK_NOTEBOOK (object);
-  GtkNotebookPrivate *priv = notebook->priv;
-
-  if (priv->menu)
-    gtk_notebook_popup_disable (notebook);
-
-  if (priv->source_targets)
-    {
-      gtk_target_list_unref (priv->source_targets);
-      priv->source_targets = NULL;
-    }
-
-  if (priv->switch_tab_timer)
-    {
-      g_source_remove (priv->switch_tab_timer);
-      priv->switch_tab_timer = 0;
-    }
-
-  GTK_OBJECT_CLASS (gtk_notebook_parent_class)->destroy (object);
-}
-
 static void
 gtk_notebook_set_property (GObject         *object,
                           guint            prop_id,
@@ -1564,13 +1538,14 @@ gtk_notebook_get_property (GObject         *object,
 }
 
 /* Private GtkWidget Methods :
- * 
+ *
+ * gtk_notebook_destroy
  * gtk_notebook_map
  * gtk_notebook_unmap
  * gtk_notebook_realize
  * gtk_notebook_size_request
  * gtk_notebook_size_allocate
- * gtk_notebook_expose
+ * gtk_notebook_draw
  * gtk_notebook_scroll
  * gtk_notebook_button_press
  * gtk_notebook_button_release
@@ -1588,6 +1563,30 @@ gtk_notebook_get_property (GObject         *object,
  * gtk_notebook_drag_data_get
  * gtk_notebook_drag_data_received
  */
+static void
+gtk_notebook_destroy (GtkWidget *widget)
+{
+  GtkNotebook *notebook = GTK_NOTEBOOK (widget);
+  GtkNotebookPrivate *priv = notebook->priv;
+
+  if (priv->menu)
+    gtk_notebook_popup_disable (notebook);
+
+  if (priv->source_targets)
+    {
+      gtk_target_list_unref (priv->source_targets);
+      priv->source_targets = NULL;
+    }
+
+  if (priv->switch_tab_timer)
+    {
+      g_source_remove (priv->switch_tab_timer);
+      priv->switch_tab_timer = 0;
+    }
+
+  GTK_WIDGET_CLASS (gtk_notebook_parent_class)->destroy (widget);
+}
+
 static gboolean
 gtk_notebook_get_event_window_position (GtkNotebook  *notebook,
                                        GdkRectangle *rectangle)
@@ -1703,7 +1702,7 @@ gtk_notebook_map (GtkWidget *widget)
     {
       if (priv->action_widget[i] &&
           gtk_widget_get_visible (priv->action_widget[i]) &&
-          GTK_WIDGET_CHILD_VISIBLE (priv->action_widget[i]) &&
+          gtk_widget_get_child_visible (priv->action_widget[i]) &&
           !gtk_widget_get_mapped (priv->action_widget[i]))
         gtk_widget_map (priv->action_widget[i]);
     }
@@ -1843,8 +1842,8 @@ gtk_notebook_size_request (GtkWidget      *widget,
       if (gtk_widget_get_visible (page->child))
        {
          vis_pages++;
-          gtk_size_request_get_size (GTK_SIZE_REQUEST (page->child),
-                                     &child_requisition, NULL);
+          gtk_widget_get_preferred_size (page->child,
+                                         &child_requisition, NULL);
 
          requisition->width = MAX (requisition->width,
                                           child_requisition.width);
@@ -1901,8 +1900,8 @@ gtk_notebook_size_request (GtkWidget      *widget,
                  if (!gtk_widget_get_visible (page->tab_label))
                    gtk_widget_show (page->tab_label);
 
-                  gtk_size_request_get_size (GTK_SIZE_REQUEST (page->tab_label),
-                                             &child_requisition, NULL);
+                  gtk_widget_get_preferred_size (page->tab_label,
+                                                 &child_requisition, NULL);
 
                   page->requisition.width = child_requisition.width + 2 * style->xthickness;
                  page->requisition.height = child_requisition.height + 2 * style->ythickness;
@@ -1937,8 +1936,8 @@ gtk_notebook_size_request (GtkWidget      *widget,
                 {
                   if (priv->action_widget[i])
                     {
-                      gtk_size_request_get_size (GTK_SIZE_REQUEST (priv->action_widget[i]),
-                                                 &action_widget_requisition[i], NULL);
+                      gtk_widget_get_preferred_size (priv->action_widget[i],
+                                                     &action_widget_requisition[i], NULL);
                       action_widget_requisition[i].width += style->xthickness;
                       action_widget_requisition[i].height += style->ythickness;
                     }
@@ -2190,8 +2189,8 @@ gtk_notebook_size_allocate (GtkWidget     *widget,
                  widget_allocation.y = allocation->y + border_width;
                  is_rtl = gtk_widget_get_direction (widget) == GTK_TEXT_DIR_RTL;
 
-                  gtk_size_request_get_size (GTK_SIZE_REQUEST (priv->action_widget[i]),
-                                             &requisition, NULL);
+                  gtk_widget_get_preferred_size (priv->action_widget[i],
+                                                 &requisition, NULL);
 
                  switch (tab_pos)
                    {
@@ -2242,41 +2241,27 @@ gtk_notebook_size_allocate (GtkWidget     *widget,
 }
 
 static gint
-gtk_notebook_expose (GtkWidget      *widget,
-                    GdkEventExpose *event)
+gtk_notebook_draw (GtkWidget *widget,
+                   cairo_t   *cr)
 {
   GtkNotebook *notebook = GTK_NOTEBOOK (widget);
   GtkNotebookPrivate *priv = notebook->priv;
+  GtkAllocation allocation;
+  GdkWindow *window;
   gint i;
 
-  if (event->window == priv->drag_window)
+  gtk_widget_get_allocation (widget, &allocation);
+
+  window = gtk_widget_get_window (widget);
+  if (gtk_cairo_should_draw_window (cr, window))
     {
-      GdkRectangle area = { 0, };
-      cairo_t *cr;
+      cairo_save (cr);
 
-      /* FIXME: This is a workaround to make tabs reordering work better
-       * with engines with rounded tabs. If the drag window background
-       * isn't set, the rounded corners would be black.
-       *
-       * Ideally, these corners should be made transparent, Either by using
-       * ARGB visuals or shape windows.
-       */
-      cr = gdk_cairo_create (priv->drag_window);
-      gdk_cairo_set_source_color (cr, &gtk_widget_get_style(widget)->bg [GTK_STATE_NORMAL]);
-      cairo_paint (cr);
-      cairo_destroy (cr);
+      cairo_translate (cr, -allocation.x, -allocation.y);
+      gtk_notebook_paint (widget, cr);
+
+      cairo_restore (cr);
 
-      gdk_drawable_get_size (priv->drag_window,
-                            &area.width, &area.height);
-      gtk_notebook_draw_tab (notebook,
-                            priv->cur_page,
-                            &area);
-      gtk_container_propagate_expose (GTK_CONTAINER (notebook),
-                                     priv->cur_page->tab_label, event);
-    }
-  else if (gtk_widget_is_drawable (widget))
-    {
-      gtk_notebook_paint (widget, &event->area);
       if (priv->show_tabs)
        {
          GtkNotebookPage *page;
@@ -2286,29 +2271,53 @@ gtk_notebook_expose (GtkWidget      *widget,
             {
              page = GTK_NOTEBOOK_PAGE (pages);
 
-             if (gtk_widget_get_window (page->tab_label) == event->window &&
-                 gtk_widget_is_drawable (page->tab_label))
-               gtk_container_propagate_expose (GTK_CONTAINER (notebook),
-                                               page->tab_label, event);
+              if (gtk_widget_get_parent (page->tab_label) == widget)
+                gtk_container_propagate_draw (GTK_CONTAINER (notebook),
+                                              page->tab_label, cr);
            }
        }
 
-      if (priv->cur_page)
-       gtk_container_propagate_expose (GTK_CONTAINER (notebook),
-                                       priv->cur_page->child,
-                                       event);
+      if (priv->cur_page && priv->operation != DRAG_OPERATION_REORDER)
+       gtk_container_propagate_draw (GTK_CONTAINER (notebook),
+                                      priv->cur_page->child,
+                                      cr);
       if (priv->show_tabs)
       {
         for (i = 0; i < N_ACTION_WIDGETS; i++)
         {
-          if (priv->action_widget[i] &&
-              gtk_widget_is_drawable (priv->action_widget[i]))
-            gtk_container_propagate_expose (GTK_CONTAINER (notebook),
-                                            priv->action_widget[i], event);
+          if (priv->action_widget[i])
+            gtk_container_propagate_draw (GTK_CONTAINER (notebook),
+                                          priv->action_widget[i], cr);
         }
       }
     }
 
+  if (priv->operation == DRAG_OPERATION_REORDER &&
+      gtk_cairo_should_draw_window (cr, priv->drag_window))
+    {
+      cairo_save (cr);
+      gtk_cairo_transform_to_window (cr, widget, priv->drag_window);
+
+      /* FIXME: This is a workaround to make tabs reordering work better
+       * with engines with rounded tabs. If the drag window background
+       * isn't set, the rounded corners would be black.
+       *
+       * Ideally, these corners should be made transparent, Either by using
+       * ARGB visuals or shape windows.
+       */
+      gdk_cairo_set_source_color (cr, &gtk_widget_get_style (widget)->bg [GTK_STATE_NORMAL]);
+      cairo_paint (cr);
+
+      gtk_notebook_draw_tab (notebook,
+                            priv->cur_page,
+                            cr);
+
+      cairo_restore (cr);
+
+      gtk_container_propagate_draw (GTK_CONTAINER (notebook),
+                                   priv->cur_page->tab_label, cr);
+    }
+  
   return FALSE;
 }
 
@@ -2652,8 +2661,8 @@ popup_position_func (GtkMenu  *menu,
   gdk_window_get_origin (gtk_widget_get_window (w), x, y);
 
   gtk_widget_get_allocation (w, &allocation);
-  gtk_size_request_get_size (GTK_SIZE_REQUEST (menu),
-                             &requisition, NULL);
+  gtk_widget_get_preferred_size (GTK_WIDGET (menu),
+                                 &requisition, NULL);
 
   if (gtk_widget_get_direction (w) == GTK_TEXT_DIR_RTL)
     *x += allocation.x + allocation.width - requisition.width;
@@ -2951,7 +2960,8 @@ get_pointer_position (GtkNotebook *notebook)
     return POINTER_BETWEEN;
 
   gdk_window_get_position (priv->event_window, &wx, &wy);
-  gdk_drawable_get_size (GDK_DRAWABLE (priv->event_window), &width, &height);
+  width = gdk_window_get_width (priv->event_window);
+  height = gdk_window_get_height (priv->event_window);
 
   if (priv->tab_pos == GTK_POS_TOP ||
       priv->tab_pos == GTK_POS_BOTTOM)
@@ -3032,7 +3042,8 @@ check_threshold (GtkNotebook *notebook,
   dnd_threshold *= DND_THRESHOLD_MULTIPLIER;
 
   gdk_window_get_position (priv->event_window, &rectangle.x, &rectangle.y);
-  gdk_drawable_get_size (GDK_DRAWABLE (priv->event_window), &rectangle.width, &rectangle.height);
+  rectangle.width = gdk_window_get_width (priv->event_window);
+  rectangle.height = gdk_window_get_height (priv->event_window);
 
   rectangle.x -= dnd_threshold;
   rectangle.width += 2 * dnd_threshold;
@@ -3225,9 +3236,9 @@ gtk_notebook_style_set  (GtkWidget *widget,
 }
 
 static gboolean
-on_drag_icon_expose (GtkWidget      *widget,
-                    GdkEventExpose *event,
-                    gpointer        data)
+on_drag_icon_draw (GtkWidget *widget,
+                  cairo_t   *cr,
+                  gpointer   data)
 {
   GtkWidget *notebook, *child;
   GtkRequisition requisition;
@@ -3236,19 +3247,19 @@ on_drag_icon_expose (GtkWidget      *widget,
   notebook = GTK_WIDGET (data);
   child = gtk_bin_get_child (GTK_BIN (widget));
 
-  gtk_size_request_get_size (GTK_SIZE_REQUEST (widget),
-                             &requisition, NULL);
+  gtk_widget_get_preferred_size (widget,
+                                 &requisition, NULL);
   gap_pos = get_tab_gap_pos (GTK_NOTEBOOK (notebook));
 
   gtk_paint_extension (gtk_widget_get_style (notebook),
-                       gtk_widget_get_window (widget),
+                       cr,
                       GTK_STATE_NORMAL, GTK_SHADOW_OUT,
-                      NULL, widget, "tab",
+                      widget, "tab",
                       0, 0,
                       requisition.width, requisition.height,
                       gap_pos);
   if (child)
-    gtk_container_propagate_expose (GTK_CONTAINER (widget), child, event);
+    gtk_container_propagate_draw (GTK_CONTAINER (widget), child, cr);
 
   return TRUE;
 }
@@ -3285,8 +3296,8 @@ gtk_notebook_drag_begin (GtkWidget        *widget,
                               priv->detached_tab->allocation.height);
   g_object_unref (tab_label);
 
-  g_signal_connect (G_OBJECT (priv->dnd_window), "expose-event",
-                   G_CALLBACK (on_drag_icon_expose), notebook);
+  g_signal_connect (G_OBJECT (priv->dnd_window), "draw",
+                   G_CALLBACK (on_drag_icon_draw), notebook);
 
   gtk_drag_set_icon_widget (context, priv->dnd_window, -2, -2);
 }
@@ -4516,10 +4527,9 @@ gtk_notebook_real_remove (GtkNotebook *notebook,
   GList * next_list;
   gint need_resize = FALSE;
   GtkWidget *tab_label;
-
   gboolean destroying;
 
-  destroying = GTK_OBJECT_FLAGS (notebook) & GTK_IN_DESTRUCTION;
+  destroying = gtk_widget_in_destruction (notebook);
 
   next_list = gtk_notebook_search_page (notebook, list, STEP_NEXT, TRUE);
   if (!next_list)
@@ -4736,7 +4746,7 @@ gtk_notebook_search_page (GtkNotebook *notebook,
  */
 static void
 gtk_notebook_paint (GtkWidget    *widget,
-                   GdkRectangle *area)
+                   cairo_t      *cr)
 {
   GtkNotebook *notebook;
   GtkNotebookPrivate *priv;
@@ -4751,9 +4761,6 @@ gtk_notebook_paint (GtkWidget    *widget,
   gboolean is_rtl;
   gint tab_pos;
    
-  if (!gtk_widget_is_drawable (widget))
-    return;
-
   notebook = GTK_NOTEBOOK (widget);
   priv = notebook->priv;
   is_rtl = gtk_widget_get_direction (widget) == GTK_TEXT_DIR_RTL;
@@ -4772,10 +4779,9 @@ gtk_notebook_paint (GtkWidget    *widget,
 
   if (priv->show_border && (!priv->show_tabs || !priv->children))
     {
-      gtk_paint_box (gtk_widget_get_style (widget),
-                     gtk_widget_get_window (widget),
+      gtk_paint_box (gtk_widget_get_style (widget), cr,
                     GTK_STATE_NORMAL, GTK_SHADOW_OUT,
-                    area, widget, "notebook",
+                    widget, "notebook",
                     x, y, width, height);
       return;
     }
@@ -4836,10 +4842,9 @@ gtk_notebook_paint (GtkWidget    *widget,
          break;
        }
     }
-  gtk_paint_box_gap (gtk_widget_get_style (widget),
-                     gtk_widget_get_window (widget),
+  gtk_paint_box_gap (gtk_widget_get_style (widget), cr,
                     GTK_STATE_NORMAL, GTK_SHADOW_OUT,
-                    area, widget, "notebook",
+                    widget, "notebook",
                     x, y, width, height,
                     tab_pos, gap_x, gap_width);
 
@@ -4855,33 +4860,32 @@ gtk_notebook_paint (GtkWidget    *widget,
       if (!gtk_widget_get_mapped (page->tab_label))
        showarrow = TRUE;
       else if (page != priv->cur_page)
-       gtk_notebook_draw_tab (notebook, page, area);
+       gtk_notebook_draw_tab (notebook, page, cr);
     }
 
   if (showarrow && priv->scrollable)
     {
       if (priv->has_before_previous)
-       gtk_notebook_draw_arrow (notebook, ARROW_LEFT_BEFORE);
+       gtk_notebook_draw_arrow (notebook, cr, ARROW_LEFT_BEFORE);
       if (priv->has_before_next)
-       gtk_notebook_draw_arrow (notebook, ARROW_RIGHT_BEFORE);
+       gtk_notebook_draw_arrow (notebook, cr, ARROW_RIGHT_BEFORE);
       if (priv->has_after_previous)
-       gtk_notebook_draw_arrow (notebook, ARROW_LEFT_AFTER);
+       gtk_notebook_draw_arrow (notebook, cr, ARROW_LEFT_AFTER);
       if (priv->has_after_next)
-       gtk_notebook_draw_arrow (notebook, ARROW_RIGHT_AFTER);
+       gtk_notebook_draw_arrow (notebook, cr, ARROW_RIGHT_AFTER);
     }
-  gtk_notebook_draw_tab (notebook, priv->cur_page, area);
+
+  if (priv->operation != DRAG_OPERATION_REORDER)
+    gtk_notebook_draw_tab (notebook, priv->cur_page, cr);
 }
 
 static void
 gtk_notebook_draw_tab (GtkNotebook     *notebook,
                       GtkNotebookPage *page,
-                      GdkRectangle    *area)
+                      cairo_t         *cr)
 {
   GtkNotebookPrivate *priv;
-  GdkRectangle page_area;
   GtkStateType state_type;
-  GtkPositionType gap_side;
-  GdkWindow *window;
   GtkWidget *widget;
   
   if (!NOTEBOOK_IS_TAB_LABEL_PARENT (notebook, page) ||
@@ -4892,29 +4896,19 @@ gtk_notebook_draw_tab (GtkNotebook     *notebook,
   widget = GTK_WIDGET (notebook);
   priv = notebook->priv;
 
-  if (priv->operation == DRAG_OPERATION_REORDER && page == priv->cur_page)
-    window = priv->drag_window;
-  else
-    window = gtk_widget_get_window (widget);
-
-  page_area.x = page->allocation.x;
-  page_area.y = page->allocation.y;
-  page_area.width = page->allocation.width;
-  page_area.height = page->allocation.height;
-
-  gap_side = get_tab_gap_pos (notebook);
-
   if (priv->cur_page == page)
     state_type = GTK_STATE_NORMAL;
   else 
     state_type = GTK_STATE_ACTIVE;
 
-  gtk_paint_extension (gtk_widget_get_style (widget), window,
+  gtk_paint_extension (gtk_widget_get_style (widget), cr,
                        state_type, GTK_SHADOW_OUT,
-                       area, widget, "tab",
-                       page_area.x, page_area.y,
-                       page_area.width, page_area.height,
-                       gap_side);
+                       widget, "tab",
+                       page->allocation.x,
+                       page->allocation.y,
+                       page->allocation.width,
+                       page->allocation.height,
+                       get_tab_gap_pos (notebook));
 
   if (gtk_widget_has_focus (widget) &&
       priv->cur_page == page)
@@ -4925,8 +4919,8 @@ gtk_notebook_draw_tab (GtkNotebook     *notebook,
       gtk_widget_get_allocation (page->tab_label, &allocation);
       gtk_widget_style_get (widget, "focus-line-width", &focus_width, NULL);
 
-      gtk_paint_focus (gtk_widget_get_style (widget), window, 
-                       gtk_widget_get_state (widget), area, widget, "tab",
+      gtk_paint_focus (gtk_widget_get_style (widget), cr,
+                       gtk_widget_get_state (widget), widget, "tab",
                        allocation.x - focus_width,
                        allocation.y - focus_width,
                        allocation.width + 2 * focus_width,
@@ -4936,6 +4930,7 @@ gtk_notebook_draw_tab (GtkNotebook     *notebook,
 
 static void
 gtk_notebook_draw_arrow (GtkNotebook      *notebook,
+                         cairo_t          *cr,
                         GtkNotebookArrow  nbarrow)
 {
   GtkNotebookPrivate *priv = notebook->priv;
@@ -4945,67 +4940,63 @@ gtk_notebook_draw_arrow (GtkNotebook      *notebook,
   GdkRectangle arrow_rect;
   GtkArrowType arrow;
   gboolean is_rtl, left;
+  gint scroll_arrow_hlength;
+  gint scroll_arrow_vlength;
+  gint arrow_size;
 
   widget = GTK_WIDGET (notebook);
 
-  if (gtk_widget_is_drawable (widget))
-    {
-      gint scroll_arrow_hlength;
-      gint scroll_arrow_vlength;
-      gint arrow_size;
-
-      gtk_notebook_get_arrow_rect (notebook, &arrow_rect, nbarrow);
+  gtk_notebook_get_arrow_rect (notebook, &arrow_rect, nbarrow);
 
-      is_rtl = gtk_widget_get_direction (widget) == GTK_TEXT_DIR_RTL;
-      left = (ARROW_IS_LEFT (nbarrow) && !is_rtl) ||
-             (!ARROW_IS_LEFT (nbarrow) && is_rtl); 
-
-      gtk_widget_style_get (widget,
-                            "scroll-arrow-hlength", &scroll_arrow_hlength,
-                            "scroll-arrow-vlength", &scroll_arrow_vlength,
-                            NULL);
+  is_rtl = gtk_widget_get_direction (widget) == GTK_TEXT_DIR_RTL;
+  left = (ARROW_IS_LEFT (nbarrow) && !is_rtl) ||
+         (!ARROW_IS_LEFT (nbarrow) && is_rtl); 
 
-      if (priv->in_child == nbarrow)
-        {
-          if (priv->click_child == nbarrow)
-            state_type = GTK_STATE_ACTIVE;
-          else
-            state_type = GTK_STATE_PRELIGHT;
-        }
-      else
-        state_type = gtk_widget_get_state (widget);
+  gtk_widget_style_get (widget,
+                        "scroll-arrow-hlength", &scroll_arrow_hlength,
+                        "scroll-arrow-vlength", &scroll_arrow_vlength,
+                        NULL);
 
+  if (priv->in_child == nbarrow)
+    {
       if (priv->click_child == nbarrow)
-        shadow_type = GTK_SHADOW_IN;
+        state_type = GTK_STATE_ACTIVE;
       else
-        shadow_type = GTK_SHADOW_OUT;
+        state_type = GTK_STATE_PRELIGHT;
+    }
+  else
+    state_type = gtk_widget_get_state (widget);
 
-      if (priv->focus_tab &&
-         !gtk_notebook_search_page (notebook, priv->focus_tab,
-                                    left ? STEP_PREV : STEP_NEXT, TRUE))
-       {
-         shadow_type = GTK_SHADOW_ETCHED_IN;
-         state_type = GTK_STATE_INSENSITIVE;
-       }
-      
-      if (priv->tab_pos == GTK_POS_LEFT ||
-         priv->tab_pos == GTK_POS_RIGHT)
-        {
-          arrow = (ARROW_IS_LEFT (nbarrow) ? GTK_ARROW_UP : GTK_ARROW_DOWN);
-          arrow_size = scroll_arrow_vlength;
-        }
-      else
-        {
-          arrow = (ARROW_IS_LEFT (nbarrow) ? GTK_ARROW_LEFT : GTK_ARROW_RIGHT);
-          arrow_size = scroll_arrow_hlength;
-        }
+  if (priv->click_child == nbarrow)
+    shadow_type = GTK_SHADOW_IN;
+  else
+    shadow_type = GTK_SHADOW_OUT;
 
-      gtk_paint_arrow (gtk_widget_get_style (widget),
-                       gtk_widget_get_window (widget), state_type,
-                      shadow_type, NULL, widget, "notebook",
-                      arrow, TRUE, arrow_rect.x, arrow_rect.y, 
-                      arrow_size, arrow_size);
+  if (priv->focus_tab &&
+      !gtk_notebook_search_page (notebook, priv->focus_tab,
+                                 left ? STEP_PREV : STEP_NEXT, TRUE))
+    {
+      shadow_type = GTK_SHADOW_ETCHED_IN;
+      state_type = GTK_STATE_INSENSITIVE;
+    }
+  
+  if (priv->tab_pos == GTK_POS_LEFT ||
+      priv->tab_pos == GTK_POS_RIGHT)
+    {
+      arrow = (ARROW_IS_LEFT (nbarrow) ? GTK_ARROW_UP : GTK_ARROW_DOWN);
+      arrow_size = scroll_arrow_vlength;
     }
+  else
+    {
+      arrow = (ARROW_IS_LEFT (nbarrow) ? GTK_ARROW_LEFT : GTK_ARROW_RIGHT);
+      arrow_size = scroll_arrow_hlength;
+    }
+  gtk_paint_arrow (gtk_widget_get_style (widget),
+                   cr, state_type, 
+                   shadow_type, widget, "notebook",
+                   arrow, TRUE, arrow_rect.x, arrow_rect.y, 
+                   arrow_size, arrow_size);
 }
 
 /* Private GtkNotebook Size Allocate Functions:
@@ -5831,8 +5822,7 @@ gtk_notebook_page_allocate (GtkNotebook     *notebook,
   xthickness = style->xthickness;
   ythickness = style->ythickness;
 
-  gtk_size_request_get_size (GTK_SIZE_REQUEST (page->tab_label),
-                             &tab_requisition, NULL);
+  gtk_widget_get_preferred_size (page->tab_label, &tab_requisition, NULL);
   gtk_widget_style_get (widget,
                        "focus-line-width", &focus_width,
                        "tab-curvature", &tab_curvature,