[gtk+/wip/cosimoc/scrolledwin-gadget: 4/4] scrolledwindow: avoid forward declarations



commit 864bffc35c83f001dd5316921ede93c04013beea
Author: Cosimo Cecchi <cosimoc gnome org>
Date:   Wed Dec 23 12:05:25 2015 -0800

    scrolledwindow: avoid forward declarations
    
    No code change.

 gtk/gtkscrolledwindow.c |  348 +++++++++++++++++++++++------------------------
 1 files changed, 169 insertions(+), 179 deletions(-)
---
diff --git a/gtk/gtkscrolledwindow.c b/gtk/gtkscrolledwindow.c
index 4a5f94c..faa7358 100644
--- a/gtk/gtkscrolledwindow.c
+++ b/gtk/gtkscrolledwindow.c
@@ -328,16 +328,6 @@ static gboolean gtk_scrolled_window_scroll_child       (GtkScrolledWindow *scrol
                                                         gboolean           horizontal);
 static void     gtk_scrolled_window_move_focus_out     (GtkScrolledWindow *scrolled_window,
                                                         GtkDirectionType   direction_type);
-
-static void     gtk_scrolled_window_relative_allocation(GtkWidget         *widget,
-                                                        GtkAllocation     *allocation);
-static void     gtk_scrolled_window_inner_allocation   (GtkWidget         *widget,
-                                                        GtkAllocation     *rect);
-static void     gtk_scrolled_window_allocate_scrollbar (GtkScrolledWindow *scrolled_window,
-                                                        GtkWidget         *scrollbar,
-                                                        GtkAllocation     *allocation);
-static void     gtk_scrolled_window_allocate_child     (GtkScrolledWindow *swindow,
-                                                        GtkAllocation     *relative_allocation);
 static void     gtk_scrolled_window_adjustment_changed (GtkAdjustment     *adjustment,
                                                         gpointer           data);
 static void     gtk_scrolled_window_adjustment_value_changed (GtkAdjustment     *adjustment,
@@ -867,6 +857,66 @@ scrolled_window_drag_begin_cb (GtkScrolledWindow *scrolled_window,
 }
 
 static void
+gtk_scrolled_window_relative_allocation (GtkWidget     *widget,
+                                        GtkAllocation *allocation)
+{
+  GtkAllocation content_allocation, widget_allocation;
+  GtkScrolledWindow *scrolled_window;
+  GtkScrolledWindowPrivate *priv;
+  gint sb_spacing;
+  gint sb_width;
+  gint sb_height;
+
+  g_return_if_fail (widget != NULL);
+  g_return_if_fail (allocation != NULL);
+
+  scrolled_window = GTK_SCROLLED_WINDOW (widget);
+  priv = scrolled_window->priv;
+
+  /* Get possible scrollbar dimensions */
+  sb_spacing = _gtk_scrolled_window_get_scrollbar_spacing (scrolled_window);
+  gtk_widget_get_preferred_height (priv->hscrollbar, &sb_height, NULL);
+  gtk_widget_get_preferred_width (priv->vscrollbar, &sb_width, NULL);
+
+  gtk_widget_get_allocation (widget, &widget_allocation);
+  gtk_css_gadget_get_content_allocation (priv->gadget, &content_allocation,
+                                         NULL);
+
+  allocation->x = content_allocation.x - widget_allocation.x;
+  allocation->y = content_allocation.y - widget_allocation.y;
+  allocation->width = content_allocation.width;
+  allocation->height = content_allocation.height;
+
+  /* Subtract some things from our available allocation size */
+  if (priv->vscrollbar_visible && !priv->use_indicators)
+    {
+      gboolean is_rtl;
+
+      is_rtl = gtk_widget_get_direction (widget) == GTK_TEXT_DIR_RTL;
+
+      if ((!is_rtl &&
+          (priv->window_placement == GTK_CORNER_TOP_RIGHT ||
+           priv->window_placement == GTK_CORNER_BOTTOM_RIGHT)) ||
+         (is_rtl &&
+          (priv->window_placement == GTK_CORNER_TOP_LEFT ||
+           priv->window_placement == GTK_CORNER_BOTTOM_LEFT)))
+       allocation->x += (sb_width +  sb_spacing);
+
+      allocation->width = MAX (1, allocation->width - (sb_width + sb_spacing));
+    }
+
+  if (priv->hscrollbar_visible && !priv->use_indicators)
+    {
+
+      if (priv->window_placement == GTK_CORNER_BOTTOM_LEFT ||
+         priv->window_placement == GTK_CORNER_BOTTOM_RIGHT)
+       allocation->y += (sb_height + sb_spacing);
+
+      allocation->height = MAX (1, allocation->height - (sb_height + sb_spacing));
+    }
+}
+
+static void
 gtk_scrolled_window_invalidate_overshoot (GtkScrolledWindow *scrolled_window)
 {
   GtkAllocation child_allocation;
@@ -1418,6 +1468,115 @@ _gtk_scrolled_window_get_scrollbar_spacing (GtkScrolledWindow *scrolled_window)
 }
 
 static void
+gtk_scrolled_window_inner_allocation (GtkWidget     *widget,
+                                      GtkAllocation *rect)
+{
+  GtkWidget *child;
+  GtkBorder border = { 0 };
+
+  gtk_scrolled_window_relative_allocation (widget, rect);
+
+  child = gtk_bin_get_child (GTK_BIN (widget));
+  if (GTK_IS_SCROLLABLE (child) &&
+      gtk_scrollable_get_border (GTK_SCROLLABLE (child), &border))
+    {
+      rect->x += border.left;
+      rect->y += border.top;
+      rect->width -= border.left + border.right;
+      rect->height -= border.top + border.bottom;
+    }
+}
+
+static void
+gtk_scrolled_window_allocate_child (GtkScrolledWindow *swindow,
+                                   GtkAllocation     *relative_allocation)
+{
+  GtkWidget     *widget = GTK_WIDGET (swindow), *child;
+  GtkAllocation  child_allocation;
+
+  child = gtk_bin_get_child (GTK_BIN (widget));
+
+  gtk_scrolled_window_relative_allocation (widget, relative_allocation);
+
+  child_allocation.x = relative_allocation->x;
+  child_allocation.y = relative_allocation->y;
+  child_allocation.width = relative_allocation->width;
+  child_allocation.height = relative_allocation->height;
+
+  gtk_widget_size_allocate (child, &child_allocation);
+}
+
+static void
+gtk_scrolled_window_allocate_scrollbar (GtkScrolledWindow *scrolled_window,
+                                        GtkWidget         *scrollbar,
+                                        GtkAllocation     *allocation)
+{
+  GtkAllocation child_allocation, content_allocation;
+  GtkWidget *widget = GTK_WIDGET (scrolled_window);
+  gint sb_spacing, sb_height, sb_width;
+  GtkScrolledWindowPrivate *priv;
+
+  priv = scrolled_window->priv;
+
+  gtk_scrolled_window_inner_allocation (widget, &content_allocation);
+  sb_spacing = _gtk_scrolled_window_get_scrollbar_spacing (scrolled_window);
+  gtk_widget_get_preferred_height (priv->hscrollbar, &sb_height, NULL);
+  gtk_widget_get_preferred_width (priv->vscrollbar, &sb_width, NULL);
+
+  if (scrollbar == priv->hscrollbar)
+    {
+      child_allocation.x = content_allocation.x;
+
+      if (priv->window_placement == GTK_CORNER_TOP_LEFT ||
+         priv->window_placement == GTK_CORNER_TOP_RIGHT)
+        {
+          if (priv->use_indicators)
+           child_allocation.y = content_allocation.y + content_allocation.height - sb_height;
+          else
+           child_allocation.y = content_allocation.y + content_allocation.height + sb_spacing;
+        }
+      else
+        {
+          if (priv->use_indicators)
+           child_allocation.y = content_allocation.y;
+          else
+           child_allocation.y = content_allocation.y - sb_spacing - sb_height;
+        }
+
+      child_allocation.width = content_allocation.width;
+      child_allocation.height = sb_height;
+    }
+  else if (scrollbar == priv->vscrollbar)
+    {
+      if ((gtk_widget_get_direction (widget) == GTK_TEXT_DIR_RTL &&
+          (priv->window_placement == GTK_CORNER_TOP_RIGHT ||
+           priv->window_placement == GTK_CORNER_BOTTOM_RIGHT)) ||
+         (gtk_widget_get_direction (widget) == GTK_TEXT_DIR_LTR &&
+          (priv->window_placement == GTK_CORNER_TOP_LEFT ||
+           priv->window_placement == GTK_CORNER_BOTTOM_LEFT)))
+        {
+          if (priv->use_indicators)
+           child_allocation.x = content_allocation.x + content_allocation.width - sb_width;
+          else
+           child_allocation.x = content_allocation.x + content_allocation.width + sb_spacing;
+        }
+      else
+        {
+          if (priv->use_indicators)
+           child_allocation.x = content_allocation.x;
+          else
+           child_allocation.x = content_allocation.x - sb_spacing - sb_width;
+        }
+
+      child_allocation.y = content_allocation.y;
+      child_allocation.width = sb_width;
+      child_allocation.height = content_allocation.height;
+    }
+
+  *allocation = child_allocation;
+}
+
+static void
 gtk_scrolled_window_allocate (GtkCssGadget        *gadget,
                               const GtkAllocation *allocation,
                               int                  baseline,
@@ -2822,26 +2981,6 @@ gtk_scrolled_window_get_property (GObject    *object,
     }
 }
 
-static void
-gtk_scrolled_window_inner_allocation (GtkWidget     *widget,
-                                      GtkAllocation *rect)
-{
-  GtkWidget *child;
-  GtkBorder border = { 0 };
-
-  gtk_scrolled_window_relative_allocation (widget, rect);
-
-  child = gtk_bin_get_child (GTK_BIN (widget));
-  if (GTK_IS_SCROLLABLE (child) &&
-      gtk_scrollable_get_border (GTK_SCROLLABLE (child), &border))
-    {
-      rect->x += border.left;
-      rect->y += border.top;
-      rect->width -= border.left + border.right;
-      rect->height -= border.top + border.bottom;
-    }
-}
-
 static gboolean
 gtk_scrolled_window_draw (GtkWidget *widget,
                           cairo_t   *cr)
@@ -3008,66 +3147,6 @@ gtk_scrolled_window_move_focus_out (GtkScrolledWindow *scrolled_window,
   g_object_unref (scrolled_window);
 }
 
-static void
-gtk_scrolled_window_relative_allocation (GtkWidget     *widget,
-                                        GtkAllocation *allocation)
-{
-  GtkAllocation content_allocation, widget_allocation;
-  GtkScrolledWindow *scrolled_window;
-  GtkScrolledWindowPrivate *priv;
-  gint sb_spacing;
-  gint sb_width;
-  gint sb_height;
-
-  g_return_if_fail (widget != NULL);
-  g_return_if_fail (allocation != NULL);
-
-  scrolled_window = GTK_SCROLLED_WINDOW (widget);
-  priv = scrolled_window->priv;
-
-  /* Get possible scrollbar dimensions */
-  sb_spacing = _gtk_scrolled_window_get_scrollbar_spacing (scrolled_window);
-  gtk_widget_get_preferred_height (priv->hscrollbar, &sb_height, NULL);
-  gtk_widget_get_preferred_width (priv->vscrollbar, &sb_width, NULL);
-
-  gtk_widget_get_allocation (widget, &widget_allocation);
-  gtk_css_gadget_get_content_allocation (priv->gadget, &content_allocation,
-                                         NULL);
-
-  allocation->x = content_allocation.x - widget_allocation.x;
-  allocation->y = content_allocation.y - widget_allocation.y;
-  allocation->width = content_allocation.width;
-  allocation->height = content_allocation.height;
-
-  /* Subtract some things from our available allocation size */
-  if (priv->vscrollbar_visible && !priv->use_indicators)
-    {
-      gboolean is_rtl;
-
-      is_rtl = gtk_widget_get_direction (widget) == GTK_TEXT_DIR_RTL;
-
-      if ((!is_rtl &&
-          (priv->window_placement == GTK_CORNER_TOP_RIGHT ||
-           priv->window_placement == GTK_CORNER_BOTTOM_RIGHT)) ||
-         (is_rtl &&
-          (priv->window_placement == GTK_CORNER_TOP_LEFT ||
-           priv->window_placement == GTK_CORNER_BOTTOM_LEFT)))
-       allocation->x += (sb_width +  sb_spacing);
-
-      allocation->width = MAX (1, allocation->width - (sb_width + sb_spacing));
-    }
-
-  if (priv->hscrollbar_visible && !priv->use_indicators)
-    {
-
-      if (priv->window_placement == GTK_CORNER_BOTTOM_LEFT ||
-         priv->window_placement == GTK_CORNER_BOTTOM_RIGHT)
-       allocation->y += (sb_height + sb_spacing);
-
-      allocation->height = MAX (1, allocation->height - (sb_height + sb_spacing));
-    }
-}
-
 static gboolean
 _gtk_scrolled_window_get_overshoot (GtkScrolledWindow *scrolled_window,
                                     gint              *overshoot_x,
@@ -3113,95 +3192,6 @@ _gtk_scrolled_window_get_overshoot (GtkScrolledWindow *scrolled_window,
 }
 
 static void
-gtk_scrolled_window_allocate_child (GtkScrolledWindow *swindow,
-                                   GtkAllocation     *relative_allocation)
-{
-  GtkWidget     *widget = GTK_WIDGET (swindow), *child;
-  GtkAllocation  child_allocation;
-
-  child = gtk_bin_get_child (GTK_BIN (widget));
-
-  gtk_scrolled_window_relative_allocation (widget, relative_allocation);
-
-  child_allocation.x = relative_allocation->x;
-  child_allocation.y = relative_allocation->y;
-  child_allocation.width = relative_allocation->width;
-  child_allocation.height = relative_allocation->height;
-
-  gtk_widget_size_allocate (child, &child_allocation);
-}
-
-static void
-gtk_scrolled_window_allocate_scrollbar (GtkScrolledWindow *scrolled_window,
-                                        GtkWidget         *scrollbar,
-                                        GtkAllocation     *allocation)
-{
-  GtkAllocation child_allocation, content_allocation;
-  GtkWidget *widget = GTK_WIDGET (scrolled_window);
-  gint sb_spacing, sb_height, sb_width;
-  GtkScrolledWindowPrivate *priv;
-
-  priv = scrolled_window->priv;
-
-  gtk_scrolled_window_inner_allocation (widget, &content_allocation);
-  sb_spacing = _gtk_scrolled_window_get_scrollbar_spacing (scrolled_window);
-  gtk_widget_get_preferred_height (priv->hscrollbar, &sb_height, NULL);
-  gtk_widget_get_preferred_width (priv->vscrollbar, &sb_width, NULL);
-
-  if (scrollbar == priv->hscrollbar)
-    {
-      child_allocation.x = content_allocation.x;
-
-      if (priv->window_placement == GTK_CORNER_TOP_LEFT ||
-         priv->window_placement == GTK_CORNER_TOP_RIGHT)
-        {
-          if (priv->use_indicators)
-           child_allocation.y = content_allocation.y + content_allocation.height - sb_height;
-          else
-           child_allocation.y = content_allocation.y + content_allocation.height + sb_spacing;
-        }
-      else
-        {
-          if (priv->use_indicators)
-           child_allocation.y = content_allocation.y;
-          else
-           child_allocation.y = content_allocation.y - sb_spacing - sb_height;
-        }
-
-      child_allocation.width = content_allocation.width;
-      child_allocation.height = sb_height;
-    }
-  else if (scrollbar == priv->vscrollbar)
-    {
-      if ((gtk_widget_get_direction (widget) == GTK_TEXT_DIR_RTL &&
-          (priv->window_placement == GTK_CORNER_TOP_RIGHT ||
-           priv->window_placement == GTK_CORNER_BOTTOM_RIGHT)) ||
-         (gtk_widget_get_direction (widget) == GTK_TEXT_DIR_LTR &&
-          (priv->window_placement == GTK_CORNER_TOP_LEFT ||
-           priv->window_placement == GTK_CORNER_BOTTOM_LEFT)))
-        {
-          if (priv->use_indicators)
-           child_allocation.x = content_allocation.x + content_allocation.width - sb_width;
-          else
-           child_allocation.x = content_allocation.x + content_allocation.width + sb_spacing;
-        }
-      else
-        {
-          if (priv->use_indicators)
-           child_allocation.x = content_allocation.x;
-          else
-           child_allocation.x = content_allocation.x - sb_spacing - sb_width;
-        }
-
-      child_allocation.y = content_allocation.y;
-      child_allocation.width = sb_width;
-      child_allocation.height = content_allocation.height;
-    }
-
-  *allocation = child_allocation;
-}
-
-static void
 gtk_scrolled_window_size_allocate (GtkWidget     *widget,
                                   GtkAllocation *allocation)
 {


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]