[gtk+/wip/baedert/drawing] set clip of more widgets



commit 46721166bcd429b66f5ac9e4e56c93ff32246452
Author: Timm Bäder <mail baedert org>
Date:   Thu May 4 11:27:45 2017 +0200

    set clip of more widgets

 gtk/gtkapplicationwindow.c |    2 ++
 gtk/gtkbin.c               |    7 +++++--
 gtk/gtkcalendar.c          |    2 ++
 gtk/gtkcolorbutton.c       |    6 ++++--
 gtk/gtkcolorplane.c        |    3 +--
 gtk/gtkfilechooserbutton.c |    6 ++++--
 gtk/gtkfontbutton.c        |    6 ++++--
 gtk/gtkheaderbar.c         |    2 +-
 gtk/gtkiconview.c          |    4 ++--
 gtk/gtkimage.c             |    2 +-
 gtk/gtkprogressbar.c       |    5 ++++-
 gtk/gtkrevealer.c          |    9 +++++++--
 gtk/gtktextview.c          |    2 ++
 gtk/gtktreeview.c          |    2 ++
 gtk/gtkwindow.c            |    2 ++
 15 files changed, 43 insertions(+), 17 deletions(-)
---
diff --git a/gtk/gtkapplicationwindow.c b/gtk/gtkapplicationwindow.c
index 42ce7c6..c0094c3 100644
--- a/gtk/gtkapplicationwindow.c
+++ b/gtk/gtkapplicationwindow.c
@@ -625,6 +625,8 @@ gtk_application_window_real_size_allocate (GtkWidget     *widget,
   else
     GTK_WIDGET_CLASS (gtk_application_window_parent_class)
       ->size_allocate (widget, allocation);
+
+  gtk_widget_set_clip (widget, allocation);
 }
 
 static void
diff --git a/gtk/gtkbin.c b/gtk/gtkbin.c
index 7d928ca..031f5c0 100644
--- a/gtk/gtkbin.c
+++ b/gtk/gtkbin.c
@@ -192,11 +192,14 @@ gtk_bin_size_allocate (GtkWidget     *widget,
   GtkBin *bin = GTK_BIN (widget);
   GtkBinPrivate *priv = bin->priv;
 
-  gtk_widget_set_allocation (widget, allocation);
-
   if (priv->child && gtk_widget_get_visible (priv->child))
     {
+      GtkAllocation clip = *allocation;
+
       gtk_widget_size_allocate (priv->child, allocation);
+      gtk_widget_get_clip (priv->child, &clip);
+
+      gtk_widget_set_clip (widget, &clip);
     }
 }
 
diff --git a/gtk/gtkcalendar.c b/gtk/gtkcalendar.c
index dd2d78f..b2d1f84 100644
--- a/gtk/gtkcalendar.c
+++ b/gtk/gtkcalendar.c
@@ -2126,6 +2126,8 @@ gtk_calendar_size_allocate (GtkWidget     *widget,
             }
         }
     }
+
+  gtk_widget_set_clip (widget, allocation);
 }
 
 
diff --git a/gtk/gtkcolorbutton.c b/gtk/gtkcolorbutton.c
index 7f289b5..2d63e8d 100644
--- a/gtk/gtkcolorbutton.c
+++ b/gtk/gtkcolorbutton.c
@@ -173,10 +173,12 @@ gtk_color_button_size_allocate (GtkWidget     *widget,
 {
   GtkColorButton *button = GTK_COLOR_BUTTON (widget);
   GtkColorButtonPrivate *priv = gtk_color_button_get_instance_private (button);
-
-  GTK_WIDGET_CLASS (gtk_color_button_parent_class)->size_allocate (widget, allocation);
+  GtkAllocation clip = *allocation;
 
   gtk_widget_size_allocate (priv->button, allocation);
+  gtk_widget_get_clip (priv->button, &clip);
+
+  gtk_widget_set_clip (widget, &clip);
 }
 
 static void
diff --git a/gtk/gtkcolorplane.c b/gtk/gtkcolorplane.c
index 8b9c1f9..e2cd1ec 100644
--- a/gtk/gtkcolorplane.c
+++ b/gtk/gtkcolorplane.c
@@ -185,14 +185,13 @@ plane_size_allocate (GtkWidget     *widget,
 {
   GtkColorPlane *plane = GTK_COLOR_PLANE (widget);
 
-  GTK_WIDGET_CLASS (gtk_color_plane_parent_class)->size_allocate (widget, allocation);
-
   if (gtk_widget_get_realized (widget))
     gdk_window_move_resize (plane->priv->input_window,
                             allocation->x, allocation->y,
                             allocation->width, allocation->height);
 
   create_surface (plane);
+  gtk_widget_set_clip (widget, allocation);
 }
 
 static void
diff --git a/gtk/gtkfilechooserbutton.c b/gtk/gtkfilechooserbutton.c
index 179cc22..18fdde9 100644
--- a/gtk/gtkfilechooserbutton.c
+++ b/gtk/gtkfilechooserbutton.c
@@ -386,10 +386,12 @@ gtk_file_chooser_button_size_allocate (GtkWidget     *widget,
 {
   GtkFileChooserButton *button = GTK_FILE_CHOOSER_BUTTON (widget);
   GtkFileChooserButtonPrivate *priv = gtk_file_chooser_button_get_instance_private (button);
-
-  GTK_WIDGET_CLASS (gtk_file_chooser_button_parent_class)->size_allocate (widget, allocation);
+  GtkAllocation clip = *allocation;
 
   gtk_widget_size_allocate (priv->child, allocation);
+  gtk_widget_get_clip (priv->child, &clip);
+
+  gtk_widget_set_clip (widget, &clip);
 }
 
 static void
diff --git a/gtk/gtkfontbutton.c b/gtk/gtkfontbutton.c
index 10c73d7..4f06b92 100644
--- a/gtk/gtkfontbutton.c
+++ b/gtk/gtkfontbutton.c
@@ -468,10 +468,12 @@ gtk_font_button_size_allocate (GtkWidget     *widget,
 {
   GtkFontButton *button = GTK_FONT_BUTTON (widget);
   GtkFontButtonPrivate *priv = gtk_font_button_get_instance_private (button);
-
-  GTK_WIDGET_CLASS (gtk_font_button_parent_class)->size_allocate (widget, allocation);
+  GtkAllocation clip = *allocation;
 
   gtk_widget_size_allocate (priv->button, allocation);
+  gtk_widget_get_clip (priv->button, &clip);
+
+  gtk_widget_set_clip (widget, &clip);
 }
 
 static void
diff --git a/gtk/gtkheaderbar.c b/gtk/gtkheaderbar.c
index af8f8a0..d85d6d7 100644
--- a/gtk/gtkheaderbar.c
+++ b/gtk/gtkheaderbar.c
@@ -899,7 +899,7 @@ gtk_header_bar_size_allocate (GtkWidget     *widget,
                               GtkAllocation *allocation)
 {
   GtkHeaderBarPrivate *priv = gtk_header_bar_get_instance_private (GTK_HEADER_BAR (widget));
-  GtkAllocation clip;
+  GtkAllocation clip = *allocation;
   GtkWidget *title_widget;
   GtkHeaderBar *bar = GTK_HEADER_BAR (widget);
   GtkRequestedSize *sizes;
diff --git a/gtk/gtkiconview.c b/gtk/gtkiconview.c
index e96b13a..a21f424 100644
--- a/gtk/gtkiconview.c
+++ b/gtk/gtkiconview.c
@@ -1694,8 +1694,6 @@ gtk_icon_view_size_allocate (GtkWidget      *widget,
 {
   GtkIconView *icon_view = GTK_ICON_VIEW (widget);
 
-  gtk_widget_set_allocation (widget, allocation);
-
   gtk_icon_view_layout (icon_view);
 
   if (gtk_widget_get_realized (widget))
@@ -1735,6 +1733,8 @@ gtk_icon_view_size_allocate (GtkWidget      *widget,
   /* Emit any pending signals now */
   g_object_thaw_notify (G_OBJECT (icon_view->priv->hadjustment));
   g_object_thaw_notify (G_OBJECT (icon_view->priv->vadjustment));
+
+  gtk_widget_set_clip (widget, allocation);
 }
 
 static void
diff --git a/gtk/gtkimage.c b/gtk/gtkimage.c
index 7632354..7f0e7c4 100644
--- a/gtk/gtkimage.c
+++ b/gtk/gtkimage.c
@@ -1237,7 +1237,7 @@ static void
 gtk_image_size_allocate (GtkWidget     *widget,
                          GtkAllocation *allocation)
 {
-  GtkAllocation clip;
+  GtkAllocation clip = *allocation;
   GdkRectangle extents;
 
   _gtk_style_context_get_icon_extents (gtk_widget_get_style_context (widget),
diff --git a/gtk/gtkprogressbar.c b/gtk/gtkprogressbar.c
index 5d40165..b1449c0 100644
--- a/gtk/gtkprogressbar.c
+++ b/gtk/gtkprogressbar.c
@@ -662,7 +662,10 @@ gtk_progress_bar_size_allocate (GtkWidget     *widget,
   gdk_rectangle_union (&clip, &child_clip, &clip);
 
   if (!priv->show_text)
-    return;
+    {
+      gtk_widget_set_clip (widget, &clip);
+      return;
+    }
 
   gtk_widget_measure (priv->label, GTK_ORIENTATION_HORIZONTAL, -1,
                       &text_min, &text_nat,
diff --git a/gtk/gtkrevealer.c b/gtk/gtkrevealer.c
index 9e9a6c8..b7140b5 100644
--- a/gtk/gtkrevealer.c
+++ b/gtk/gtkrevealer.c
@@ -435,15 +435,18 @@ gtk_revealer_real_size_allocate (GtkWidget     *widget,
   int bin_x, bin_y;
   GtkRevealerTransitionType transition;
   GtkBorder padding;
+  GtkAllocation clip = *allocation;
 
   g_return_if_fail (allocation != NULL);
 
-  gtk_widget_set_allocation (widget, allocation);
   gtk_revealer_get_child_allocation (revealer, allocation, &child_allocation);
 
   child = gtk_bin_get_child (GTK_BIN (revealer));
   if (child != NULL && gtk_widget_get_visible (child))
-    gtk_widget_size_allocate (child, &child_allocation);
+    {
+      gtk_widget_size_allocate (child, &child_allocation);
+      gtk_widget_get_clip (child, &clip);
+    }
 
   if (gtk_widget_get_realized (widget))
     {
@@ -511,6 +514,8 @@ gtk_revealer_real_size_allocate (GtkWidget     *widget,
                               bin_x, bin_y,
                               child_allocation.width, child_allocation.height);
     }
+
+  gtk_widget_set_clip (widget, &clip);
 }
 
 static void
diff --git a/gtk/gtktextview.c b/gtk/gtktextview.c
index 300e68d..7a3b653 100644
--- a/gtk/gtktextview.c
+++ b/gtk/gtktextview.c
@@ -4312,6 +4312,8 @@ gtk_text_view_size_allocate (GtkWidget *widget,
    */
   if (size_changed)
     gtk_widget_queue_draw (widget);
+
+  gtk_widget_set_clip (widget, allocation);
 }
 
 static void
diff --git a/gtk/gtktreeview.c b/gtk/gtktreeview.c
index b13e6f9..bdf28fa 100644
--- a/gtk/gtktreeview.c
+++ b/gtk/gtktreeview.c
@@ -2836,6 +2836,8 @@ gtk_tree_view_size_allocate (GtkWidget     *widget,
       gtk_tree_path_free (path);
       gtk_widget_size_allocate (child->widget, &child_rect);
     }
+
+  gtk_widget_set_clip (widget, allocation);
 }
 
 /* Grabs the focus and unsets the GTK_TREE_VIEW_DRAW_KEYFOCUS flag */
diff --git a/gtk/gtkwindow.c b/gtk/gtkwindow.c
index 6efc3cc..19dd247 100644
--- a/gtk/gtkwindow.c
+++ b/gtk/gtkwindow.c
@@ -7288,6 +7288,8 @@ gtk_window_size_allocate (GtkWidget     *widget,
     gtk_widget_size_allocate (child, &child_allocation);
 
   gtk_window_restack_popovers (window);
+
+  gtk_widget_set_clip (widget, allocation);
 }
 
 static gint


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