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



commit e302e1eee4da726efc53866d3afab0b9066829c5
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/gtkwindow.c            |    2 ++
 14 files changed, 41 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 9618323..d9baabd 100644
--- a/gtk/gtkcalendar.c
+++ b/gtk/gtkcalendar.c
@@ -2119,6 +2119,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 9c4e68a..addc155 100644
--- a/gtk/gtkcolorplane.c
+++ b/gtk/gtkcolorplane.c
@@ -184,9 +184,8 @@ plane_size_allocate (GtkWidget     *widget,
 {
   GtkColorPlane *plane = GTK_COLOR_PLANE (widget);
 
-  GTK_WIDGET_CLASS (gtk_color_plane_parent_class)->size_allocate (widget, allocation);
-
   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 c7fe92a..0bd58a9 100644
--- a/gtk/gtkheaderbar.c
+++ b/gtk/gtkheaderbar.c
@@ -897,7 +897,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 dfed670..fcb25b5 100644
--- a/gtk/gtkiconview.c
+++ b/gtk/gtkiconview.c
@@ -1675,8 +1675,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))
@@ -1714,6 +1712,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 0e4608c..96f8952 100644
--- a/gtk/gtkrevealer.c
+++ b/gtk/gtkrevealer.c
@@ -441,15 +441,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))
     {
@@ -501,6 +504,8 @@ gtk_revealer_real_size_allocate (GtkWidget     *widget,
                               bin_y + allocation->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 1011388..82a70a3 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/gtkwindow.c b/gtk/gtkwindow.c
index 8e71100..7cba37a 100644
--- a/gtk/gtkwindow.c
+++ b/gtk/gtkwindow.c
@@ -7219,6 +7219,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]