[gtk+/wip/baedert/drawing: 57/186] range: Remove gadget usage
- From: Timm Bäder <baedert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+/wip/baedert/drawing: 57/186] range: Remove gadget usage
- Date: Tue, 16 May 2017 06:09:33 +0000 (UTC)
commit c491e82f5731826ac171dcd027983a64e25298b8
Author: Timm Bäder <mail baedert org>
Date: Thu May 4 08:05:11 2017 +0200
range: Remove gadget usage
gtk/gtkrange.c | 130 ++++++++++++-------------------------------------------
1 files changed, 29 insertions(+), 101 deletions(-)
---
diff --git a/gtk/gtkrange.c b/gtk/gtkrange.c
index 77f6b52..be37558 100644
--- a/gtk/gtkrange.c
+++ b/gtk/gtkrange.c
@@ -177,7 +177,7 @@ static void gtk_range_get_property (GObject *object,
GParamSpec *pspec);
static void gtk_range_finalize (GObject *object);
static void gtk_range_destroy (GtkWidget *widget);
-static void gtk_range_measure_ (GtkWidget *widget,
+static void gtk_range_measure (GtkWidget *widget,
GtkOrientation orientation,
int for_size,
int *minimum,
@@ -279,26 +279,6 @@ static gboolean gtk_range_render_trough (GtkCssGadget *gadget,
int width,
int height,
gpointer user_data);
-static void gtk_range_measure (GtkCssGadget *gadget,
- GtkOrientation orientation,
- gint for_size,
- gint *minimum,
- gint *natural,
- gint *minimum_baseline,
- gint *natural_baseline,
- gpointer user_data);
-static void gtk_range_allocate (GtkCssGadget *gadget,
- const GtkAllocation *allocation,
- int baseline,
- GtkAllocation *out_clip,
- gpointer data);
-static gboolean gtk_range_render (GtkCssGadget *gadget,
- GtkSnapshot *snapshot,
- int x,
- int y,
- int width,
- int height,
- gpointer user_data);
G_DEFINE_ABSTRACT_TYPE_WITH_CODE (GtkRange, gtk_range, GTK_TYPE_WIDGET,
G_ADD_PRIVATE (GtkRange)
@@ -322,7 +302,7 @@ gtk_range_class_init (GtkRangeClass *class)
gobject_class->finalize = gtk_range_finalize;
widget_class->destroy = gtk_range_destroy;
- widget_class->measure = gtk_range_measure_;
+ widget_class->measure = gtk_range_measure;
widget_class->size_allocate = gtk_range_size_allocate;
widget_class->realize = gtk_range_realize;
widget_class->unrealize = gtk_range_unrealize;
@@ -662,9 +642,9 @@ gtk_range_init (GtkRange *range)
widget_node = gtk_widget_get_css_node (GTK_WIDGET (range));
priv->gadget = gtk_css_custom_gadget_new_for_node (widget_node,
GTK_WIDGET (range),
- gtk_range_measure,
- gtk_range_allocate,
- gtk_range_render,
+ NULL,
+ NULL,
+ NULL,
NULL, NULL);
priv->contents_gadget = gtk_box_gadget_new ("contents",
GTK_WIDGET (range),
@@ -1634,17 +1614,14 @@ gtk_range_measure_trough (GtkCssGadget *gadget,
}
}
-static void
-gtk_range_measure (GtkCssGadget *gadget,
- GtkOrientation orientation,
- gint for_size,
- gint *minimum,
- gint *natural,
- gint *minimum_baseline,
- gint *natural_baseline,
- gpointer user_data)
+static void gtk_range_measure (GtkWidget *widget,
+ GtkOrientation orientation,
+ int for_size,
+ int *minimum,
+ int *natural,
+ int *minimum_baseline,
+ int *natural_baseline)
{
- GtkWidget *widget = gtk_css_gadget_get_owner (gadget);
GtkRange *range = GTK_RANGE (widget);
GtkRangePrivate *priv = range->priv;
GtkBorder border = { 0 };
@@ -1670,22 +1647,6 @@ gtk_range_measure (GtkCssGadget *gadget,
*minimum += border.top + border.bottom;
*natural += border.top + border.bottom;
}
-}
-
-static void gtk_range_measure_ (GtkWidget *widget,
- GtkOrientation orientation,
- int for_size,
- int *minimum,
- int *natural,
- int *minimum_baseline,
- int *natural_baseline)
-{
- GtkRange *range = GTK_RANGE (widget);
- GtkRangePrivate *priv = range->priv;
-
- gtk_css_gadget_get_preferred_size (priv->gadget, orientation, -1,
- minimum, natural,
- NULL, NULL);
if (GTK_RANGE_GET_CLASS (range)->get_range_size_request)
{
@@ -1907,19 +1868,24 @@ clamp_dimensions (const GtkAllocation *allocation,
}
static void
-gtk_range_allocate (GtkCssGadget *gadget,
- const GtkAllocation *allocation,
- int baseline,
- GtkAllocation *out_clip,
- gpointer data)
+gtk_range_size_allocate (GtkWidget *widget,
+ GtkAllocation *allocation)
{
- GtkWidget *widget = gtk_css_gadget_get_owner (gadget);
GtkRange *range = GTK_RANGE (widget);
GtkRangePrivate *priv = range->priv;
+ GtkAllocation clip = *allocation;
+ GtkAllocation child_clip;
GtkBorder border = { 0 };
GtkAllocation box_alloc;
int box_min_width, box_min_height;
+
+ if (gtk_widget_get_realized (widget))
+ gdk_window_move_resize (priv->event_window,
+ allocation->x, allocation->y,
+ allocation->width, allocation->height);
+
+
if (GTK_RANGE_GET_CLASS (range)->get_range_border)
GTK_RANGE_GET_CLASS (range)->get_range_border (range, &border);
@@ -1937,34 +1903,14 @@ gtk_range_allocate (GtkCssGadget *gadget,
gtk_css_gadget_allocate (priv->contents_gadget,
&box_alloc,
- baseline,
- out_clip);
+ gtk_widget_get_allocated_baseline (widget),
+ &child_clip);
/* TODO: we should compute a proper clip from get_range_border(),
* but this will at least give us outset shadows.
*/
- gdk_rectangle_union (out_clip, allocation, out_clip);
-}
+ gdk_rectangle_union (&child_clip, &clip, &clip);
-static void
-gtk_range_size_allocate (GtkWidget *widget,
- GtkAllocation *allocation)
-{
- GtkRange *range = GTK_RANGE (widget);
- GtkRangePrivate *priv = range->priv;
- GtkAllocation clip;
-
- gtk_widget_set_allocation (widget, allocation);
-
- if (gtk_widget_get_realized (widget))
- gdk_window_move_resize (priv->event_window,
- allocation->x, allocation->y,
- allocation->width, allocation->height);
-
- gtk_css_gadget_allocate (priv->gadget,
- allocation,
- gtk_widget_get_allocated_baseline (widget),
- &clip);
gtk_widget_set_clip (widget, &clip);
}
@@ -2132,16 +2078,10 @@ gtk_range_render_trough (GtkCssGadget *gadget,
return gtk_widget_has_visible_focus (widget);
}
-static gboolean
-gtk_range_render (GtkCssGadget *gadget,
- GtkSnapshot *snapshot,
- int x,
- int y,
- int width,
- int height,
- gpointer user_data)
+static void
+gtk_range_snapshot (GtkWidget *widget,
+ GtkSnapshot *snapshot)
{
- GtkWidget *widget = gtk_css_gadget_get_owner (gadget);
GtkRange *range = GTK_RANGE (widget);
GtkRangePrivate *priv = range->priv;
@@ -2149,18 +2089,6 @@ gtk_range_render (GtkCssGadget *gadget,
/* Draw the slider last, so that e.g. the focus ring stays below it */
gtk_css_gadget_snapshot (priv->slider_gadget, snapshot);
-
- return FALSE;
-}
-
-static void
-gtk_range_snapshot (GtkWidget *widget,
- GtkSnapshot *snapshot)
-{
- GtkRange *range = GTK_RANGE (widget);
- GtkRangePrivate *priv = range->priv;
-
- gtk_css_gadget_snapshot (priv->gadget, snapshot);
}
static void
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]