[gtk+/wip/baedert/drawing: 39/355] headerbar: Remove gadget
- From: Timm Bäder <baedert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+/wip/baedert/drawing: 39/355] headerbar: Remove gadget
- Date: Tue, 11 Jul 2017 16:31:36 +0000 (UTC)
commit a41649e73aa6e78ae719a819d6925292102cf7fa
Author: Timm Bäder <mail baedert org>
Date: Wed May 3 19:44:52 2017 +0200
headerbar: Remove gadget
both drawing and sizing are done through GtkWidget now.
gtk/gtkheaderbar.c | 74 ++++++++-------------------------------------------
1 files changed, 12 insertions(+), 62 deletions(-)
---
diff --git a/gtk/gtkheaderbar.c b/gtk/gtkheaderbar.c
index 19d28ed..60766a4 100644
--- a/gtk/gtkheaderbar.c
+++ b/gtk/gtkheaderbar.c
@@ -26,7 +26,6 @@
#include "gtktypebuiltins.h"
#include "gtkwidgetprivate.h"
#include "gtkcssnodeprivate.h"
-#include "gtkcsscustomgadgetprivate.h"
#include "gtkwindowprivate.h"
#include "gtkwidgetprivate.h"
#include "gtkcontainerprivate.h"
@@ -83,7 +82,6 @@ struct _GtkHeaderBarPrivate
GtkWidget *titlebar_icon;
- GtkCssGadget *gadget;
guint shows_app_menu : 1;
};
@@ -878,26 +876,6 @@ gtk_header_bar_compute_size_for_opposing_orientation (GtkWidget *widget,
}
static void
-gtk_header_bar_get_content_size (GtkCssGadget *gadget,
- GtkOrientation orientation,
- gint for_size,
- gint *minimum,
- gint *natural,
- gint *minimum_baseline,
- gint *natural_baseline,
- gpointer unused)
-{
- GtkWidget *widget = gtk_css_gadget_get_owner (gadget);
-
- if (for_size < 0)
- gtk_header_bar_get_size (widget, orientation, minimum, natural);
- else if (orientation == GTK_ORIENTATION_HORIZONTAL)
- gtk_header_bar_compute_size_for_orientation (widget, for_size, minimum, natural);
- else
- gtk_header_bar_compute_size_for_opposing_orientation (widget, for_size, minimum, natural);
-}
-
-static void
gtk_header_bar_measure (GtkWidget *widget,
GtkOrientation orientation,
int for_size,
@@ -906,13 +884,12 @@ gtk_header_bar_measure (GtkWidget *widget,
int *minimum_baseline,
int *natural_baseline)
{
- GtkHeaderBarPrivate *priv = gtk_header_bar_get_instance_private (GTK_HEADER_BAR (widget));
-
- gtk_css_gadget_get_preferred_size (priv->gadget,
- orientation,
- for_size,
- minimum, natural,
- minimum_baseline, natural_baseline);
+ if (for_size < 0)
+ gtk_header_bar_get_size (widget, orientation, minimum, natural);
+ else if (orientation == GTK_ORIENTATION_HORIZONTAL)
+ gtk_header_bar_compute_size_for_orientation (widget, for_size, minimum, natural);
+ else
+ gtk_header_bar_compute_size_for_opposing_orientation (widget, for_size, minimum, natural);
}
static void
@@ -921,25 +898,8 @@ gtk_header_bar_size_allocate (GtkWidget *widget,
{
GtkHeaderBarPrivate *priv = gtk_header_bar_get_instance_private (GTK_HEADER_BAR (widget));
GtkAllocation clip;
-
- gtk_widget_set_allocation (widget, allocation);
-
- gtk_css_gadget_allocate (priv->gadget, allocation, gtk_widget_get_allocated_baseline (widget), &clip);
-
- gtk_widget_set_clip (widget, &clip);
-}
-
-static void
-gtk_header_bar_allocate_contents (GtkCssGadget *gadget,
- const GtkAllocation *allocation,
- int baseline,
- GtkAllocation *out_clip,
- gpointer unused)
-{
- GtkWidget *widget = gtk_css_gadget_get_owner (gadget);
GtkWidget *title_widget;
GtkHeaderBar *bar = GTK_HEADER_BAR (widget);
- GtkHeaderBarPrivate *priv = gtk_header_bar_get_instance_private (bar);
GtkRequestedSize *sizes;
gint width, height;
gint nvis_children;
@@ -1138,7 +1098,7 @@ gtk_header_bar_allocate_contents (GtkCssGadget *gadget,
gtk_widget_size_allocate (child->widget, &child_allocation);
gtk_widget_get_clip (child->widget, &child_clip);
- gdk_rectangle_union (&child_clip, out_clip, out_clip);
+ gdk_rectangle_union (&child_clip, &clip, &clip);
next:
i++;
@@ -1177,7 +1137,7 @@ gtk_header_bar_allocate_contents (GtkCssGadget *gadget,
{
gtk_widget_size_allocate (title_widget, &child_allocation);
gtk_widget_get_clip (title_widget, &child_clip);
- gdk_rectangle_union (&child_clip, out_clip, out_clip);
+ gdk_rectangle_union (&child_clip, &clip, &clip);
}
child_allocation.y = allocation->y;
@@ -1193,7 +1153,7 @@ gtk_header_bar_allocate_contents (GtkCssGadget *gadget,
child_allocation.width = start_width - priv->spacing;
gtk_widget_size_allocate (priv->titlebar_start_box, &child_allocation);
gtk_widget_get_clip (priv->titlebar_start_box, &child_clip);
- gdk_rectangle_union (&child_clip, out_clip, out_clip);
+ gdk_rectangle_union (&child_clip, &clip, &clip);
}
if (priv->titlebar_end_box)
@@ -1206,8 +1166,10 @@ gtk_header_bar_allocate_contents (GtkCssGadget *gadget,
child_allocation.width = end_width - priv->spacing;
gtk_widget_size_allocate (priv->titlebar_end_box, &child_allocation);
gtk_widget_get_clip (priv->titlebar_end_box, &child_clip);
- gdk_rectangle_union (&child_clip, out_clip, out_clip);
+ gdk_rectangle_union (&child_clip, &clip, &clip);
}
+
+ gtk_widget_set_clip (widget, &clip);
}
/**
@@ -1467,8 +1429,6 @@ gtk_header_bar_finalize (GObject *object)
g_free (priv->subtitle);
g_free (priv->decoration_layout);
- g_clear_object (&priv->gadget);
-
G_OBJECT_CLASS (gtk_header_bar_parent_class)->finalize (object);
}
@@ -2019,7 +1979,6 @@ static void
gtk_header_bar_init (GtkHeaderBar *bar)
{
GtkHeaderBarPrivate *priv;
- GtkCssNode *widget_node;
priv = gtk_header_bar_get_instance_private (bar);
@@ -2038,15 +1997,6 @@ gtk_header_bar_init (GtkHeaderBar *bar)
init_sizing_box (bar);
construct_label_box (bar);
-
- widget_node = gtk_widget_get_css_node (GTK_WIDGET (bar));
- priv->gadget = gtk_css_custom_gadget_new_for_node (widget_node,
- GTK_WIDGET (bar),
- gtk_header_bar_get_content_size,
- gtk_header_bar_allocate_contents,
- NULL,
- NULL,
- NULL);
}
static void
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]