[gtk+/wip/cosimoc/range-gadget: 526/526] range: continue porting to GtkGadgets
- From: Cosimo Cecchi <cosimoc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+/wip/cosimoc/range-gadget: 526/526] range: continue porting to GtkGadgets
- Date: Sun, 21 Feb 2016 08:30:16 +0000 (UTC)
commit 4f2cfdd9d7f179dfdecf0a0fdfbfd884eaf793f5
Author: Cosimo Cecchi <cosimoc gnome org>
Date: Tue Jan 19 07:22:33 2016 -0200
range: continue porting to GtkGadgets
This commit rewrites a lot of the GtkRange internals to make full use
of the gadget structure.
gtk/gtkrange.c | 1142 +++++++++++++++++++++-----------------------------------
1 files changed, 428 insertions(+), 714 deletions(-)
---
diff --git a/gtk/gtkrange.c b/gtk/gtkrange.c
index 320fdca..ffd2fee 100644
--- a/gtk/gtkrange.c
+++ b/gtk/gtkrange.c
@@ -96,13 +96,7 @@ struct _GtkRangePrivate
GtkSensitivityType lower_sensitivity;
GtkSensitivityType upper_sensitivity;
- GdkRectangle range_rect; /* Area of entire stepper + trough assembly in widget->window coords */
/* These are in widget->window coordinates */
- GdkRectangle stepper_a;
- GdkRectangle stepper_b;
- GdkRectangle stepper_c;
- GdkRectangle stepper_d;
- GdkRectangle trough; /* The trough rectangle is the area the thumb can slide in, not the
entire range_rect */
GdkRectangle slider;
GdkWindow *event_window;
@@ -265,23 +259,7 @@ static gboolean gtk_range_scroll (GtkRange *range,
static void gtk_range_update_mouse_location (GtkRange *range);
static void gtk_range_calc_slider (GtkRange *range);
static void gtk_range_calc_stepper_sensitivity (GtkRange *range);
-static void gtk_range_calc_layout (GtkRange *range);
static void gtk_range_calc_marks (GtkRange *range);
-static void gtk_range_get_props (GtkRange *range,
- gint *slider_width,
- gint *stepper_size,
- gint *trough_border,
- gint *stepper_spacing);
-static void gtk_range_calc_request (GtkRange *range,
- gint slider_width,
- gint stepper_size,
- gint trough_border,
- gint stepper_spacing,
- GdkRectangle *range_rect,
- GtkBorder *border,
- gint *n_steppers_p,
- gboolean *has_steppers_ab,
- gboolean *has_steppers_cd);
static void gtk_range_adjustment_value_changed (GtkAdjustment *adjustment,
gpointer data);
static void gtk_range_adjustment_changed (GtkAdjustment *adjustment,
@@ -300,12 +278,25 @@ static void gtk_range_state_flags_changed (GtkWidget *widget,
GtkStateFlags previous_state);
static void gtk_range_measure_trough (GtkCssGadget *gadget,
GtkOrientation orientation,
- int for_size,
- int *minimum,
- int *natural,
- int *minimum_baseline,
- int *natural_baseline,
- gpointer data);
+ gint for_size,
+ gint *minimum,
+ gint *natural,
+ gint *minimum_baseline,
+ gint *natural_baseline,
+ gpointer user_data);
+static void gtk_range_allocate_trough (GtkCssGadget *gadget,
+ const GtkAllocation *allocation,
+ int baseline,
+ GtkAllocation *out_clip,
+ gpointer data);
+static gboolean gtk_range_render_trough (GtkCssGadget *gadget,
+ cairo_t *cr,
+ 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)
@@ -772,8 +763,8 @@ gtk_range_init (GtkRange *range)
GTK_WIDGET (range),
NULL, NULL,
gtk_range_measure_trough,
- NULL,
- NULL,
+ gtk_range_allocate_trough,
+ gtk_range_render_trough,
NULL, NULL);
gtk_css_gadget_set_state (priv->trough_gadget,
gtk_css_node_get_state (widget_node));
@@ -1163,15 +1154,57 @@ gtk_range_get_range_rect (GtkRange *range,
GdkRectangle *range_rect)
{
GtkRangePrivate *priv;
+ GtkBorder border = { 0 };
+ GtkAllocation allocation;
g_return_if_fail (GTK_IS_RANGE (range));
g_return_if_fail (range_rect != NULL);
priv = range->priv;
- gtk_range_calc_layout (range);
+ if (GTK_RANGE_GET_CLASS (range)->get_range_border)
+ GTK_RANGE_GET_CLASS (range)->get_range_border (range, &border);
+
+ range_rect->x = border.left;
+ range_rect->y = border.top;
+ range_rect->width = 0;
+ range_rect->height = 0;
+
+ gtk_css_gadget_get_margin_allocation (priv->trough_gadget,
+ &allocation, NULL);
+ gdk_rectangle_union (range_rect, &allocation, range_rect);
+
+ gtk_css_gadget_get_margin_allocation (priv->slider_gadget,
+ &allocation, NULL);
+ gdk_rectangle_union (range_rect, &allocation, range_rect);
+
+ if (priv->stepper_a_gadget)
+ {
+ gtk_css_gadget_get_margin_allocation (priv->stepper_a_gadget,
+ &allocation, NULL);
+ gdk_rectangle_union (range_rect, &allocation, range_rect);
+ }
+
+ if (priv->stepper_b_gadget)
+ {
+ gtk_css_gadget_get_margin_allocation (priv->stepper_b_gadget,
+ &allocation, NULL);
+ gdk_rectangle_union (range_rect, &allocation, range_rect);
+ }
+
+ if (priv->stepper_c_gadget)
+ {
+ gtk_css_gadget_get_margin_allocation (priv->stepper_c_gadget,
+ &allocation, NULL);
+ gdk_rectangle_union (range_rect, &allocation, range_rect);
+ }
- *range_rect = priv->range_rect;
+ if (priv->stepper_d_gadget)
+ {
+ gtk_css_gadget_get_margin_allocation (priv->stepper_d_gadget,
+ &allocation, NULL);
+ gdk_rectangle_union (range_rect, &allocation, range_rect);
+ }
}
/**
@@ -1200,7 +1233,7 @@ gtk_range_get_slider_range (GtkRange *range,
priv = range->priv;
- gtk_range_calc_layout (range);
+ gtk_range_calc_slider (range);
if (priv->orientation == GTK_ORIENTATION_VERTICAL)
{
@@ -1672,84 +1705,132 @@ gtk_range_destroy (GtkWidget *widget)
static void
gtk_range_measure_trough (GtkCssGadget *gadget,
GtkOrientation orientation,
- int for_size,
- int *minimum,
- int *natural,
- int *minimum_baseline,
- int *natural_baseline,
- gpointer data)
+ gint for_size,
+ gint *minimum,
+ gint *natural,
+ gint *minimum_baseline,
+ gint *natural_baseline,
+ gpointer user_data)
{
GtkWidget *widget = gtk_css_gadget_get_owner (gadget);
GtkRange *range = GTK_RANGE (widget);
GtkRangePrivate *priv = range->priv;
- gint slider_width, stepper_size, trough_border;
- gint stepper_spacing;
- gint n_steppers, n_steppers_ab, n_steppers_cd;
- GtkBorder border;
- GdkRectangle range_rect;
-
- gtk_widget_style_get (widget,
- "slider-width", &slider_width,
- "trough-border", &trough_border,
- "stepper-size", &stepper_size,
- "stepper-spacing", &stepper_spacing,
- NULL);
-
- border.left = 0;
- border.right = 0;
- border.top = 0;
- border.bottom = 0;
+ gint min, nat;
- if (GTK_RANGE_GET_CLASS (range)->get_range_border)
- GTK_RANGE_GET_CLASS (range)->get_range_border (range, &border);
+ *minimum = *natural = 0;
+
+ if (priv->fill_gadget)
+ {
+ gtk_css_gadget_get_preferred_size (priv->fill_gadget,
+ orientation, for_size,
+ &min, &nat,
+ NULL, NULL);
+ *minimum = MAX (*minimum, min);
+ *natural = MAX (*natural, nat);
+ }
- n_steppers_ab = 0;
- n_steppers_cd = 0;
+ if (priv->highlight_gadget)
+ {
+ gtk_css_gadget_get_preferred_size (priv->highlight_gadget,
+ orientation, for_size,
+ &min, &nat,
+ NULL, NULL);
+ *minimum = MAX (*minimum, min);
+ *natural = MAX (*natural, nat);
+ }
+}
+static void
+gtk_range_size_request (GtkWidget *widget,
+ GtkOrientation orientation,
+ gint *minimum,
+ gint *natural)
+{
+ GtkRange *range = GTK_RANGE (widget);
+ GtkRangePrivate *priv = range->priv;
+ GtkBorder border = { 0 };
+ gint trough_min, trough_nat, slider_min, slider_nat;
+ gint stepper_a_min = 0, stepper_a_nat = 0;
+ gint stepper_b_min = 0, stepper_b_nat = 0;
+ gint stepper_c_min = 0, stepper_c_nat = 0;
+ gint stepper_d_min = 0, stepper_d_nat = 0;
+
+ /* First, measure everything */
+ gtk_css_gadget_get_preferred_size (priv->trough_gadget,
+ orientation,
+ -1,
+ &trough_min, &trough_nat,
+ NULL, NULL);
+ gtk_css_gadget_get_preferred_size (priv->slider_gadget,
+ orientation,
+ -1,
+ &slider_min, &slider_nat,
+ NULL, NULL);
if (priv->stepper_a_gadget)
- n_steppers_ab += 1;
+ gtk_css_gadget_get_preferred_size (priv->stepper_a_gadget,
+ orientation,
+ -1,
+ &stepper_a_min, &stepper_a_nat,
+ NULL, NULL);
if (priv->stepper_b_gadget)
- n_steppers_ab += 1;
+ gtk_css_gadget_get_preferred_size (priv->stepper_b_gadget,
+ orientation,
+ -1,
+ &stepper_b_min, &stepper_b_nat,
+ NULL, NULL);
if (priv->stepper_c_gadget)
- n_steppers_cd += 1;
+ gtk_css_gadget_get_preferred_size (priv->stepper_c_gadget,
+ orientation,
+ -1,
+ &stepper_c_min, &stepper_c_nat,
+ NULL, NULL);
if (priv->stepper_d_gadget)
- n_steppers_cd += 1;
-
- n_steppers = n_steppers_ab + n_steppers_cd;
+ gtk_css_gadget_get_preferred_size (priv->stepper_d_gadget,
+ orientation,
+ -1,
+ &stepper_d_min, &stepper_d_nat,
+ NULL, NULL);
- range_rect.x = 0;
- range_rect.y = 0;
+ if (GTK_RANGE_GET_CLASS (range)->get_range_border)
+ GTK_RANGE_GET_CLASS (range)->get_range_border (range, &border);
- /* We never expand to fill available space in the small dimension
- * (i.e. vertical scrollbars are always a fixed width)
- */
- if (priv->orientation == GTK_ORIENTATION_VERTICAL)
+ if (priv->orientation != orientation)
{
- range_rect.width = trough_border * 2 + slider_width;
- range_rect.height = stepper_size * n_steppers + trough_border * 2 + priv->min_slider_size;
-
- if (n_steppers_ab > 0)
- range_rect.height += stepper_spacing;
+ /* If we're measuring opposite orientation, return the maximum size */
+ *minimum = trough_min;
+ *minimum = MAX (*minimum, slider_min);
+ *minimum = MAX (*minimum, stepper_a_min);
+ *minimum = MAX (*minimum, stepper_b_min);
+ *minimum = MAX (*minimum, stepper_c_min);
+ *minimum = MAX (*minimum, stepper_d_min);
- if (n_steppers_cd > 0)
- range_rect.height += stepper_spacing;
+ *natural = trough_nat;
+ *natural = MAX (*natural, slider_nat);
+ *natural = MAX (*natural, stepper_a_nat);
+ *natural = MAX (*natural, stepper_b_nat);
+ *natural = MAX (*natural, stepper_c_nat);
+ *natural = MAX (*natural, stepper_d_nat);
}
else
{
- range_rect.width = stepper_size * n_steppers + trough_border * 2 + priv->min_slider_size;
- range_rect.height = trough_border * 2 + slider_width;
-
- if (n_steppers_ab > 0)
- range_rect.width += stepper_spacing;
-
- if (n_steppers_cd > 0)
- range_rect.width += stepper_spacing;
+ /* Otherwise, we add the trough and the steppers together */
+ *minimum = trough_min + stepper_a_min + stepper_b_min +
+ stepper_c_min + stepper_d_min;
+ *natural = trough_nat + stepper_a_nat + stepper_b_nat +
+ stepper_c_nat + stepper_d_nat;
}
+ /* Finally, add the border */
if (orientation == GTK_ORIENTATION_HORIZONTAL)
- *minimum = *natural = range_rect.width + border.left + border.right;
+ {
+ *minimum += border.left + border.right;
+ *natural += border.left + border.right;
+ }
else
- *minimum = *natural = range_rect.height + border.top + border.bottom;
+ {
+ *minimum += border.top + border.bottom;
+ *natural += border.top + border.bottom;
+ }
}
static void
@@ -1757,11 +1838,8 @@ gtk_range_get_preferred_width (GtkWidget *widget,
gint *minimum,
gint *natural)
{
- gtk_css_gadget_get_preferred_size (GTK_RANGE (widget)->priv->trough_gadget,
- GTK_ORIENTATION_HORIZONTAL,
- -1,
- minimum, natural,
- NULL, NULL);
+ gtk_range_size_request (widget, GTK_ORIENTATION_HORIZONTAL,
+ minimum, natural);
}
static void
@@ -1769,49 +1847,79 @@ gtk_range_get_preferred_height (GtkWidget *widget,
gint *minimum,
gint *natural)
{
- gtk_css_gadget_get_preferred_size (GTK_RANGE (widget)->priv->trough_gadget,
- GTK_ORIENTATION_VERTICAL,
- -1,
- minimum, natural,
- NULL, NULL);
+ gtk_range_size_request (widget, GTK_ORIENTATION_VERTICAL,
+ minimum, natural);
}
static void
-gtk_range_allocate_trough (GtkRange *range,
- GtkAllocation *out_clip)
+gtk_range_allocate_highlight (GtkRange *range,
+ GtkAllocation *out_clip)
{
GtkRangePrivate *priv = range->priv;
- GtkWidget *widget = GTK_WIDGET (range);
- GtkAllocation widget_alloc;
- GtkAllocation trough_alloc = priv->range_rect;
- gint stepper_size;
- gint stepper_spacing;
-
- gtk_widget_style_get (widget,
- "stepper-size", &stepper_size,
- "stepper-spacing", &stepper_spacing,
- NULL);
-
- gtk_widget_get_allocation (widget, &widget_alloc);
- trough_alloc.x += widget_alloc.x;
- trough_alloc.y += widget_alloc.y;
-
- gtk_css_gadget_allocate (priv->trough_gadget,
- &trough_alloc,
- gtk_widget_get_allocated_baseline (widget),
+ int baseline;
+ GtkAllocation allocation, highlight_alloc, slider_alloc;
+
+ g_assert (priv->has_origin);
+
+ gtk_css_gadget_get_content_allocation (priv->trough_gadget,
+ &allocation, &baseline);
+ gtk_css_gadget_get_content_allocation (priv->slider_gadget,
+ &slider_alloc, NULL);
+
+ highlight_alloc = allocation;
+
+ if (priv->orientation == GTK_ORIENTATION_HORIZONTAL)
+ {
+ if (!should_invert (range))
+ {
+ highlight_alloc.x = allocation.x;
+ highlight_alloc.width = slider_alloc.x + slider_alloc.width / 2 - allocation.x;
+ }
+ else
+ {
+ highlight_alloc.x = slider_alloc.x + slider_alloc.width / 2;
+ highlight_alloc.width = allocation.x + allocation.width - highlight_alloc.x;
+ }
+ }
+ else
+ {
+ if (!should_invert (range))
+ {
+ highlight_alloc.y = allocation.y;
+ highlight_alloc.height = slider_alloc.y + slider_alloc.height / 2 - allocation.y;
+ }
+ else
+ {
+ highlight_alloc.y = slider_alloc.y + slider_alloc.height / 2;
+ highlight_alloc.height = allocation.y + allocation.height - highlight_alloc.y;
+ }
+ }
+
+ gtk_css_gadget_allocate (priv->highlight_gadget,
+ &highlight_alloc,
+ baseline,
out_clip);
+}
+
+static void
+gtk_range_allocate_trough (GtkCssGadget *gadget,
+ const GtkAllocation *allocation,
+ int baseline,
+ GtkAllocation *out_clip,
+ gpointer data)
+{
+ GtkWidget *widget = gtk_css_gadget_get_owner (gadget);
+ GtkRange *range = GTK_RANGE (widget);
+ GtkRangePrivate *priv = range->priv;
if (priv->show_fill_level &&
gtk_adjustment_get_upper (priv->adjustment) - gtk_adjustment_get_page_size (priv->adjustment) -
gtk_adjustment_get_lower (priv->adjustment) != 0)
{
- gdouble level;
- gdouble fill = 0.0;
- GtkAllocation content_alloc, fill_alloc, fill_clip;
+ gdouble level, fill;
+ GtkAllocation fill_alloc, fill_clip;
- gtk_css_gadget_get_content_allocation (priv->trough_gadget,
- &content_alloc, NULL);
- fill_alloc = content_alloc;
+ fill_alloc = *allocation;
level = CLAMP (priv->fill_level,
gtk_adjustment_get_lower (priv->adjustment),
@@ -1828,66 +1936,50 @@ gtk_range_allocate_trough (GtkRange *range,
fill_alloc.width *= fill;
if (should_invert (range))
- fill_alloc.x += content_alloc.width - fill_alloc.width;
+ fill_alloc.x += allocation->width - fill_alloc.width;
}
else
{
fill_alloc.height *= fill;
if (should_invert (range))
- fill_alloc.y += content_alloc.height - (fill_alloc.height * fill);
+ fill_alloc.y += allocation->height - (fill_alloc.height * fill);
}
gtk_css_gadget_allocate (priv->fill_gadget,
&fill_alloc,
- gtk_widget_get_allocated_baseline (widget),
+ baseline,
&fill_clip);
gdk_rectangle_union (out_clip, &fill_clip, out_clip);
}
+}
- if (priv->has_origin)
- {
- GtkAllocation content_alloc, highlight_alloc, highlight_clip, slider_alloc;
-
- gtk_css_gadget_get_content_allocation (priv->trough_gadget,
- &content_alloc, NULL);
- gtk_css_gadget_get_content_allocation (priv->slider_gadget,
- &slider_alloc, NULL);
- highlight_alloc = content_alloc;
+static void
+gtk_range_allocate_one_stepper (GtkRange *range,
+ GtkCssGadget *gadget,
+ gint size,
+ GtkAllocation *allocation,
+ gint baseline,
+ GtkAllocation *out_clip)
+{
+ GtkRangePrivate *priv = range->priv;
+ GtkAllocation gadget_clip;
- if (priv->orientation == GTK_ORIENTATION_HORIZONTAL)
- {
- if (!should_invert (range))
- {
- highlight_alloc.x = content_alloc.x;
- highlight_alloc.width = slider_alloc.x + slider_alloc.width / 2 - content_alloc.x;
- }
- else
- {
- highlight_alloc.x = slider_alloc.x + slider_alloc.width / 2;
- highlight_alloc.width = content_alloc.x + content_alloc.width - highlight_alloc.x;
- }
- }
- else
- {
- if (!should_invert (range))
- {
- highlight_alloc.y = content_alloc.y;
- highlight_alloc.height = slider_alloc.y + slider_alloc.height / 2 - content_alloc.y;
- }
- else
- {
- highlight_alloc.y = slider_alloc.y + slider_alloc.height / 2;
- highlight_alloc.height = content_alloc.y + content_alloc.height - highlight_alloc.y;
- }
- }
+ if (priv->orientation == GTK_ORIENTATION_VERTICAL)
+ allocation->height = size;
+ else
+ allocation->width = size;
- gtk_css_gadget_allocate (priv->highlight_gadget,
- &highlight_alloc,
- gtk_widget_get_allocated_baseline (widget),
- &highlight_clip);
- gdk_rectangle_union (out_clip, &highlight_clip, out_clip);
+ if (gadget)
+ {
+ gtk_css_gadget_allocate (gadget, allocation, baseline, &gadget_clip);
+ gdk_rectangle_union (out_clip, &gadget_clip, out_clip);
}
+
+ if (priv->orientation == GTK_ORIENTATION_VERTICAL)
+ allocation->y += size;
+ else
+ allocation->x += size;
}
static void
@@ -1896,9 +1988,13 @@ gtk_range_size_allocate (GtkWidget *widget,
{
GtkRange *range = GTK_RANGE (widget);
GtkRangePrivate *priv = range->priv;
- GtkAllocation clip, trough_clip, slider_clip, stepper_clip;
- GtkAllocation slider_alloc, stepper_alloc;
gint baseline;
+ GtkAllocation clip = { 0 };
+ GtkAllocation gadget_alloc, gadget_clip;
+ GtkAllocation slider_clip, slider_alloc, highlight_clip;
+ GtkBorder border = { 0 };
+ gint stepper_a_size = 0, stepper_b_size = 0;
+ gint stepper_c_size = 0, stepper_d_size = 0;
gtk_widget_set_allocation (widget, allocation);
baseline = gtk_widget_get_allocated_baseline (widget);
@@ -1908,71 +2004,117 @@ gtk_range_size_allocate (GtkWidget *widget,
allocation->x, allocation->y,
allocation->width, allocation->height);
- gtk_range_calc_marks (range);
- gtk_range_calc_layout (range);
-
- slider_alloc = priv->slider;
- slider_alloc.x += allocation->x;
- slider_alloc.y += allocation->y;
-
- gtk_css_gadget_allocate (priv->slider_gadget,
- &slider_alloc,
- baseline,
- &slider_clip);
+ if (GTK_RANGE_GET_CLASS (range)->get_range_border)
+ GTK_RANGE_GET_CLASS (range)->get_range_border (range, &border);
- gtk_range_allocate_trough (range, &trough_clip);
- gdk_rectangle_union (&trough_clip, &slider_clip, &clip);
+ gadget_alloc.x = allocation->x + border.left;
+ gadget_alloc.y = allocation->y + border.top;
+ /* Determine the size of the steppers */
if (priv->stepper_a_gadget)
+ gtk_css_gadget_get_preferred_size (priv->stepper_a_gadget,
+ priv->orientation,
+ -1,
+ &stepper_a_size, NULL,
+ NULL, NULL);
+ if (priv->stepper_b_gadget)
+ gtk_css_gadget_get_preferred_size (priv->stepper_b_gadget,
+ priv->orientation,
+ -1,
+ &stepper_b_size, NULL,
+ NULL, NULL);
+ if (priv->stepper_c_gadget)
+ gtk_css_gadget_get_preferred_size (priv->stepper_c_gadget,
+ priv->orientation,
+ -1,
+ &stepper_c_size, NULL,
+ NULL, NULL);
+ if (priv->stepper_d_gadget)
+ gtk_css_gadget_get_preferred_size (priv->stepper_d_gadget,
+ priv->orientation,
+ -1,
+ &stepper_d_size, NULL,
+ NULL, NULL);
+
+ /* Gadgets are always allocated the full opposite orientation; walk down the
+ * available size along the orientation and allocate them in visible order.
+ */
+ if (priv->orientation == GTK_ORIENTATION_VERTICAL)
+ gadget_alloc.width = allocation->width;
+ else
+ gadget_alloc.height = allocation->height;
+
+ /* Steppers A+B */
+ gtk_range_allocate_one_stepper (range,
+ priv->stepper_a_gadget,
+ stepper_a_size,
+ &gadget_alloc,
+ baseline,
+ &clip);
+ gtk_range_allocate_one_stepper (range,
+ priv->stepper_b_gadget,
+ stepper_b_size,
+ &gadget_alloc,
+ baseline,
+ &clip);
+
+ /* Trough */
+ if (priv->orientation == GTK_ORIENTATION_VERTICAL)
{
- stepper_alloc = priv->stepper_a;
- stepper_alloc.x += allocation->x;
- stepper_alloc.y += allocation->y;
-
- gtk_css_gadget_allocate (priv->stepper_a_gadget,
- &stepper_alloc,
+ gadget_alloc.height = allocation->height - stepper_a_size -
+ stepper_b_size - stepper_c_size - stepper_d_size;
+ gtk_css_gadget_allocate (priv->trough_gadget,
+ &gadget_alloc,
baseline,
- &stepper_clip);
- gdk_rectangle_union (&clip, &stepper_clip, &clip);
+ &gadget_clip);
+ gdk_rectangle_union (&clip, &gadget_clip, &clip);
+ gadget_alloc.y += gadget_alloc.height;
}
-
- if (priv->stepper_b_gadget)
+ else
{
- stepper_alloc = priv->stepper_b;
- stepper_alloc.x += allocation->x;
- stepper_alloc.y += allocation->y;
-
- gtk_css_gadget_allocate (priv->stepper_b_gadget,
- &stepper_alloc,
+ gadget_alloc.width = allocation->width - stepper_a_size -
+ stepper_b_size - stepper_c_size - stepper_d_size;
+ gtk_css_gadget_allocate (priv->trough_gadget,
+ &gadget_alloc,
baseline,
- &stepper_clip);
- gdk_rectangle_union (&clip, &stepper_clip, &clip);
- }
+ &gadget_clip);
+ gdk_rectangle_union (&clip, &gadget_clip, &clip);
+ gadget_alloc.x += gadget_alloc.width;
+ }
+
+ /* Steppers C+D */
+ gtk_range_allocate_one_stepper (range,
+ priv->stepper_c_gadget,
+ stepper_c_size,
+ &gadget_alloc,
+ baseline,
+ &clip);
+ gtk_range_allocate_one_stepper (range,
+ priv->stepper_d_gadget,
+ stepper_d_size,
+ &gadget_alloc,
+ baseline,
+ &clip);
+
+ /* Slider and highlight */
+ gtk_range_calc_marks (range);
+ gtk_range_calc_slider (range);
+ gtk_range_calc_stepper_sensitivity (range);
- if (priv->stepper_c_gadget)
- {
- stepper_alloc = priv->stepper_c;
- stepper_alloc.x += allocation->x;
- stepper_alloc.y += allocation->y;
+ slider_alloc = priv->slider;
+ slider_alloc.x += allocation->x;
+ slider_alloc.y += allocation->y;
- gtk_css_gadget_allocate (priv->stepper_c_gadget,
- &stepper_alloc,
- baseline,
- &stepper_clip);
- gdk_rectangle_union (&clip, &stepper_clip, &clip);
- }
+ gtk_css_gadget_allocate (priv->slider_gadget,
+ &slider_alloc,
+ baseline,
+ &slider_clip);
+ gdk_rectangle_union (&clip, &slider_clip, &clip);
- if (priv->stepper_d_gadget)
+ if (priv->has_origin)
{
- stepper_alloc = priv->stepper_d;
- stepper_alloc.x += allocation->x;
- stepper_alloc.y += allocation->y;
-
- gtk_css_gadget_allocate (priv->stepper_d_gadget,
- &stepper_alloc,
- baseline,
- &stepper_clip);
- gdk_rectangle_union (&clip, &stepper_clip, &clip);
+ gtk_range_allocate_highlight (range, &highlight_clip);
+ gdk_rectangle_union (&clip, &highlight_clip, &clip);
}
gtk_widget_set_clip (widget, &clip);
@@ -2113,6 +2255,30 @@ gtk_range_state_flags_changed (GtkWidget *widget,
}
static gboolean
+gtk_range_render_trough (GtkCssGadget *gadget,
+ cairo_t *cr,
+ int x,
+ int y,
+ int width,
+ int height,
+ gpointer user_data)
+{
+ GtkWidget *widget = gtk_css_gadget_get_owner (gadget);
+ GtkRange *range = GTK_RANGE (widget);
+ GtkRangePrivate *priv = range->priv;
+
+ if (priv->show_fill_level &&
+ gtk_adjustment_get_upper (priv->adjustment) - gtk_adjustment_get_page_size (priv->adjustment) -
+ gtk_adjustment_get_lower (priv->adjustment) != 0)
+ gtk_css_gadget_draw (priv->fill_gadget, cr);
+
+ if (priv->has_origin)
+ gtk_css_gadget_draw (priv->highlight_gadget, cr);
+
+ return gtk_widget_has_visible_focus (widget);
+}
+
+static gboolean
gtk_range_draw (GtkWidget *widget,
cairo_t *cr)
{
@@ -2120,9 +2286,6 @@ gtk_range_draw (GtkWidget *widget,
GtkRangePrivate *priv = range->priv;
gboolean draw_trough = TRUE;
gboolean draw_slider = TRUE;
- GtkStyleContext *context;
-
- context = gtk_widget_get_style_context (widget);
if (GTK_IS_SCALE (widget) &&
gtk_adjustment_get_upper (priv->adjustment) == gtk_adjustment_get_lower (priv->adjustment))
@@ -2137,25 +2300,7 @@ gtk_range_draw (GtkWidget *widget,
}
if (draw_trough)
- {
- gtk_css_gadget_draw (priv->trough_gadget, cr);
-
- if (priv->show_fill_level &&
- gtk_adjustment_get_upper (priv->adjustment) - gtk_adjustment_get_page_size (priv->adjustment) -
- gtk_adjustment_get_lower (priv->adjustment) != 0)
- gtk_css_gadget_draw (priv->fill_gadget, cr);
-
- if (priv->has_origin)
- gtk_css_gadget_draw (priv->highlight_gadget, cr);
- }
-
- if (!(gtk_widget_get_state_flags (widget) & GTK_STATE_FLAG_INSENSITIVE) &&
- gtk_widget_has_visible_focus (widget))
- gtk_render_focus (context, cr,
- priv->range_rect.x,
- priv->range_rect.y,
- priv->range_rect.width,
- priv->range_rect.height);
+ gtk_css_gadget_draw (priv->trough_gadget, cr);
if (draw_slider)
gtk_css_gadget_draw (priv->slider_gadget, cr);
@@ -2310,17 +2455,22 @@ coord_to_value (GtkRange *range,
gint trough_length;
gint trough_start;
gint slider_length;
+ GtkAllocation trough_allocation, widget_allocation;
+
+ gtk_widget_get_allocation (GTK_WIDGET (range), &widget_allocation);
+ gtk_css_gadget_get_content_allocation (priv->trough_gadget,
+ &trough_allocation, NULL);
if (priv->orientation == GTK_ORIENTATION_VERTICAL)
{
- trough_length = priv->trough.height;
- trough_start = priv->trough.y;
+ trough_length = trough_allocation.height;
+ trough_start = trough_allocation.y - widget_allocation.y;
slider_length = priv->slider.height;
}
else
{
- trough_length = priv->trough.width;
- trough_start = priv->trough.x;
+ trough_length = trough_allocation.width;
+ trough_start = trough_allocation.x - widget_allocation.x;
slider_length = priv->slider.width;
}
@@ -2614,11 +2764,15 @@ update_slider_position (GtkRange *range,
gdouble zoom;
gint slider_start, slider_end;
gint i;
+ GtkAllocation trough_allocation;
+
+ gtk_css_gadget_get_content_allocation (priv->trough_gadget,
+ &trough_allocation, NULL);
if (priv->zoom)
{
zoom = MIN(1.0, (priv->orientation == GTK_ORIENTATION_VERTICAL ?
- priv->trough.height : priv->trough.width) /
+ trough_allocation.height : trough_allocation.width) /
(gtk_adjustment_get_upper (priv->adjustment) -
gtk_adjustment_get_lower (priv->adjustment) -
gtk_adjustment_get_page_size (priv->adjustment)));
@@ -3198,37 +3352,6 @@ gtk_range_move_slider (GtkRange *range,
gtk_widget_error_bell (GTK_WIDGET (range));
}
-static void
-gtk_range_get_props (GtkRange *range,
- gint *slider_width,
- gint *stepper_size,
- gint *trough_border,
- gint *stepper_spacing)
-{
- GtkWidget *widget = GTK_WIDGET (range);
- gint tmp_slider_width, tmp_stepper_size, tmp_trough_border;
- gint tmp_stepper_spacing;
-
- gtk_widget_style_get (widget,
- "slider-width", &tmp_slider_width,
- "trough-border", &tmp_trough_border,
- "stepper-size", &tmp_stepper_size,
- "stepper-spacing", &tmp_stepper_spacing,
- NULL);
-
- if (slider_width)
- *slider_width = tmp_slider_width;
-
- if (trough_border)
- *trough_border = tmp_trough_border;
-
- if (stepper_size)
- *stepper_size = tmp_stepper_size;
-
- if (stepper_spacing)
- *stepper_spacing = tmp_stepper_spacing;
-}
-
#define POINT_IN_RECT(xcoord, ycoord, rect) \
((xcoord) >= (rect).x && \
(xcoord) < ((rect).x + (rect).width) && \
@@ -3254,17 +3377,21 @@ gtk_range_update_mouse_location (GtkRange *range)
if (priv->grab_location != MOUSE_OUTSIDE)
priv->mouse_location = priv->grab_location;
- else if (POINT_IN_RECT (x, y, priv->stepper_a))
+ else if (priv->stepper_a_gadget &&
+ gtk_css_gadget_content_allocation_contains_point (priv->stepper_a_gadget, x, y))
priv->mouse_location = MOUSE_STEPPER_A;
- else if (POINT_IN_RECT (x, y, priv->stepper_b))
+ else if (priv->stepper_b_gadget &&
+ gtk_css_gadget_content_allocation_contains_point (priv->stepper_b_gadget, x, y))
priv->mouse_location = MOUSE_STEPPER_B;
- else if (POINT_IN_RECT (x, y, priv->stepper_c))
+ else if (priv->stepper_c_gadget &&
+ gtk_css_gadget_content_allocation_contains_point (priv->stepper_c_gadget, x, y))
priv->mouse_location = MOUSE_STEPPER_C;
- else if (POINT_IN_RECT (x, y, priv->stepper_d))
+ else if (priv->stepper_d_gadget &&
+ gtk_css_gadget_content_allocation_contains_point (priv->stepper_d_gadget, x, y))
priv->mouse_location = MOUSE_STEPPER_D;
- else if (POINT_IN_RECT (x, y, priv->slider))
+ else if (gtk_css_gadget_content_allocation_contains_point (priv->slider_gadget, x, y))
priv->mouse_location = MOUSE_SLIDER;
- else if (POINT_IN_RECT (x, y, priv->trough))
+ else if (gtk_css_gadget_content_allocation_contains_point (priv->trough_gadget, x, y))
priv->mouse_location = MOUSE_TROUGH;
else if (POINT_IN_RECT (x, y, allocation))
priv->mouse_location = MOUSE_WIDGET;
@@ -3286,189 +3413,17 @@ gtk_range_update_mouse_location (GtkRange *range)
}
}
-/* Clamp rect, border inside widget->allocation, such that we prefer
- * to take space from border not rect in all directions, and prefer to
- * give space to border over rect in one direction.
- */
-static void
-clamp_dimensions (GtkWidget *widget,
- GdkRectangle *rect,
- GtkBorder *border,
- gboolean border_expands_horizontally)
-{
- GtkAllocation allocation;
- gint extra, shortage;
-
- g_return_if_fail (rect->x == 0);
- g_return_if_fail (rect->y == 0);
- g_return_if_fail (rect->width >= 0);
- g_return_if_fail (rect->height >= 0);
-
- gtk_widget_get_allocation (widget, &allocation);
-
- /* Width */
-
- extra = allocation.width - border->left - border->right - rect->width;
- if (extra > 0)
- {
- if (border_expands_horizontally)
- {
- border->left += extra / 2;
- border->right += extra / 2 + extra % 2;
- }
- else
- {
- rect->width += extra;
- }
- }
-
- /* See if we can fit rect, if not kill the border */
- shortage = rect->width - allocation.width;
- if (shortage > 0)
- {
- rect->width = allocation.width;
- /* lose the border */
- border->left = 0;
- border->right = 0;
- }
- else
- {
- /* See if we can fit rect with borders */
- shortage = rect->width + border->left + border->right - allocation.width;
- if (shortage > 0)
- {
- /* Shrink borders */
- border->left -= shortage / 2;
- border->right -= shortage / 2 + shortage % 2;
- }
- }
-
- /* Height */
-
- extra = allocation.height - border->top - border->bottom - rect->height;
- if (extra > 0)
- {
- if (border_expands_horizontally)
- {
- /* don't expand border vertically */
- rect->height += extra;
- }
- else
- {
- border->top += extra / 2;
- border->bottom += extra / 2 + extra % 2;
- }
- }
-
- /* See if we can fit rect, if not kill the border */
- shortage = rect->height - allocation.height;
- if (shortage > 0)
- {
- rect->height = allocation.height;
- /* lose the border */
- border->top = 0;
- border->bottom = 0;
- }
- else
- {
- /* See if we can fit rect with borders */
- shortage = rect->height + border->top + border->bottom - allocation.height;
- if (shortage > 0)
- {
- /* Shrink borders */
- border->top -= shortage / 2;
- border->bottom -= shortage / 2 + shortage % 2;
- }
- }
-}
-
-static void
-gtk_range_calc_request (GtkRange *range,
- gint slider_width,
- gint stepper_size,
- gint trough_border,
- gint stepper_spacing,
- GdkRectangle *range_rect,
- GtkBorder *border,
- gint *n_steppers_p,
- gboolean *has_steppers_ab,
- gboolean *has_steppers_cd)
-{
- GtkRangePrivate *priv = range->priv;
- gint n_steppers;
- gint n_steppers_ab;
- gint n_steppers_cd;
-
- border->left = 0;
- border->right = 0;
- border->top = 0;
- border->bottom = 0;
-
- if (GTK_RANGE_GET_CLASS (range)->get_range_border)
- GTK_RANGE_GET_CLASS (range)->get_range_border (range, border);
-
- n_steppers_ab = 0;
- n_steppers_cd = 0;
-
- if (priv->stepper_a_gadget)
- n_steppers_ab += 1;
- if (priv->stepper_b_gadget)
- n_steppers_ab += 1;
- if (priv->stepper_c_gadget)
- n_steppers_cd += 1;
- if (priv->stepper_d_gadget)
- n_steppers_cd += 1;
-
- n_steppers = n_steppers_ab + n_steppers_cd;
-
- range_rect->x = 0;
- range_rect->y = 0;
-
- /* We never expand to fill available space in the small dimension
- * (i.e. vertical scrollbars are always a fixed width)
- */
- if (priv->orientation == GTK_ORIENTATION_VERTICAL)
- {
- range_rect->width = + trough_border * 2 + slider_width;
- range_rect->height = stepper_size * n_steppers + trough_border * 2 + priv->min_slider_size;
-
- if (n_steppers_ab > 0)
- range_rect->height += stepper_spacing;
-
- if (n_steppers_cd > 0)
- range_rect->height += stepper_spacing;
- }
- else
- {
- range_rect->width = stepper_size * n_steppers + trough_border * 2 + priv->min_slider_size;
- range_rect->height = trough_border * 2 + slider_width;
-
- if (n_steppers_ab > 0)
- range_rect->width += stepper_spacing;
-
- if (n_steppers_cd > 0)
- range_rect->width += stepper_spacing;
- }
-
- if (n_steppers_p)
- *n_steppers_p = n_steppers;
-
- if (has_steppers_ab)
- *has_steppers_ab = (n_steppers_ab > 0);
-
- if (has_steppers_cd)
- *has_steppers_cd = (n_steppers_cd > 0);
-}
-
static void
gtk_range_compute_slider_position (GtkRange *range,
gdouble adjustment_value,
GdkRectangle *slider_rect)
{
GtkRangePrivate *priv = range->priv;
- gint trough_border;
+ GtkAllocation trough_allocation, widget_allocation;
- gtk_range_get_props (range, NULL, NULL, &trough_border, NULL);
+ gtk_widget_get_allocation (GTK_WIDGET (range), &widget_allocation);
+ gtk_css_gadget_get_margin_allocation (priv->trough_gadget,
+ &trough_allocation, NULL);
if (priv->orientation == GTK_ORIENTATION_VERTICAL)
{
@@ -3477,12 +3432,12 @@ gtk_range_compute_slider_position (GtkRange *range,
/* Slider fits into the trough, with stepper_spacing on either side,
* and the size/position based on the adjustment or fixed, depending.
*/
- slider_rect->x = priv->trough.x + trough_border;
- slider_rect->width = priv->trough.width - trough_border * 2;
+ slider_rect->x = trough_allocation.x - widget_allocation.x;
+ slider_rect->width = trough_allocation.width;
/* Compute slider position/length */
- top = priv->trough.y;
- bottom = priv->trough.y + priv->trough.height;
+ top = trough_allocation.y - widget_allocation.y;
+ bottom = top + trough_allocation.height;
/* slider height is the fraction (page_size /
* total_adjustment_range) times the trough height in pixels
@@ -3498,7 +3453,7 @@ gtk_range_compute_slider_position (GtkRange *range,
priv->slider_size_fixed)
height = priv->min_slider_size;
- height = MIN (height, priv->trough.height);
+ height = MIN (height, trough_allocation.height);
y = top;
@@ -3521,12 +3476,12 @@ gtk_range_compute_slider_position (GtkRange *range,
/* Slider fits into the trough, with stepper_spacing on either side,
* and the size/position based on the adjustment or fixed, depending.
*/
- slider_rect->y = priv->trough.y + trough_border;
- slider_rect->height = priv->trough.height - trough_border * 2;
+ slider_rect->y = trough_allocation.y - widget_allocation.y;
+ slider_rect->height = trough_allocation.height;
/* Compute slider position/length */
- left = priv->trough.x;
- right = priv->trough.x + priv->trough.width;
+ left = trough_allocation.x - widget_allocation.x;
+ right = left + trough_allocation.width;
/* slider width is the fraction (page_size /
* total_adjustment_range) times the trough width in pixels
@@ -3542,7 +3497,7 @@ gtk_range_compute_slider_position (GtkRange *range,
priv->slider_size_fixed)
width = priv->min_slider_size;
- width = MIN (width, priv->trough.width);
+ width = MIN (width, trough_allocation.width);
x = left;
@@ -3582,9 +3537,6 @@ gtk_range_calc_slider (GtkRange *range)
return;
gtk_css_gadget_set_visible (priv->slider_gadget, visible);
-
- gtk_range_queue_draw_location (range, MOUSE_SLIDER);
-
priv->slider = new_slider;
gtk_range_queue_draw_location (range, MOUSE_SLIDER);
@@ -3652,244 +3604,6 @@ gtk_range_calc_stepper_sensitivity (GtkRange *range)
}
static void
-gtk_range_calc_layout (GtkRange *range)
-{
- GtkRangePrivate *priv = range->priv;
- gint slider_width, stepper_size, trough_border, stepper_spacing;
- GtkBorder border;
- gint n_steppers;
- gboolean has_steppers_ab;
- gboolean has_steppers_cd;
- GdkRectangle range_rect;
- GtkWidget *widget;
-
- /* If we have a too-small allocation, we prefer the steppers over
- * the trough/slider, probably the steppers are a more useful
- * feature in small spaces.
- *
- * Also, we prefer to draw the range itself rather than the border
- * areas if there's a conflict, since the borders will be decoration
- * not controls. Though this depends on subclasses cooperating by
- * not drawing on priv->range_rect.
- */
-
- widget = GTK_WIDGET (range);
-
- gtk_range_get_props (range,
- &slider_width, &stepper_size,
- &trough_border,
- &stepper_spacing);
-
- gtk_range_calc_request (range,
- slider_width, stepper_size,
- trough_border, stepper_spacing,
- &range_rect, &border, &n_steppers,
- &has_steppers_ab, &has_steppers_cd);
-
- /* We never expand to fill available space in the small dimension
- * (i.e. vertical scrollbars are always a fixed width)
- */
- if (priv->orientation == GTK_ORIENTATION_VERTICAL)
- {
- clamp_dimensions (widget, &range_rect, &border, TRUE);
- }
- else
- {
- clamp_dimensions (widget, &range_rect, &border, FALSE);
- }
-
- range_rect.x = border.left;
- range_rect.y = border.top;
-
- priv->range_rect = range_rect;
-
- if (priv->orientation == GTK_ORIENTATION_VERTICAL)
- {
- gint stepper_width, stepper_height;
-
- /* Steppers are the width of the range, and stepper_size in
- * height, or if we don't have enough height, divided equally
- * among available space.
- */
- stepper_width = range_rect.width - trough_border * 2;
-
- if (stepper_width < 1)
- stepper_width = range_rect.width; /* screw the trough border */
-
- if (n_steppers == 0)
- stepper_height = 0; /* avoid divide by n_steppers */
- else
- stepper_height = MIN (stepper_size, (range_rect.height / n_steppers));
-
- /* Stepper A */
-
- priv->stepper_a.x = range_rect.x + trough_border;
- priv->stepper_a.y = range_rect.y + trough_border;
-
- if (priv->stepper_a_gadget)
- {
- priv->stepper_a.width = stepper_width;
- priv->stepper_a.height = stepper_height;
- }
- else
- {
- priv->stepper_a.width = 0;
- priv->stepper_a.height = 0;
- }
-
- /* Stepper B */
-
- priv->stepper_b.x = priv->stepper_a.x;
- priv->stepper_b.y = priv->stepper_a.y + priv->stepper_a.height;
-
- if (priv->stepper_b_gadget)
- {
- priv->stepper_b.width = stepper_width;
- priv->stepper_b.height = stepper_height;
- }
- else
- {
- priv->stepper_b.width = 0;
- priv->stepper_b.height = 0;
- }
-
- /* Stepper D */
-
- if (priv->stepper_d_gadget)
- {
- priv->stepper_d.width = stepper_width;
- priv->stepper_d.height = stepper_height;
- }
- else
- {
- priv->stepper_d.width = 0;
- priv->stepper_d.height = 0;
- }
-
- priv->stepper_d.x = priv->stepper_a.x;
- priv->stepper_d.y = range_rect.y + range_rect.height - priv->stepper_d.height - trough_border;
-
- /* Stepper C */
-
- if (priv->stepper_c_gadget)
- {
- priv->stepper_c.width = stepper_width;
- priv->stepper_c.height = stepper_height;
- }
- else
- {
- priv->stepper_c.width = 0;
- priv->stepper_c.height = 0;
- }
-
- priv->stepper_c.x = priv->stepper_a.x;
- priv->stepper_c.y = priv->stepper_d.y - priv->stepper_c.height;
-
- /* Now the trough is the remaining space between steppers B and C,
- * if any, minus spacing
- */
- priv->trough.x = range_rect.x;
- priv->trough.y = priv->stepper_b.y + priv->stepper_b.height + stepper_spacing * has_steppers_ab;
- priv->trough.width = range_rect.width;
- priv->trough.height = priv->stepper_c.y - priv->trough.y - stepper_spacing * has_steppers_cd;
- }
- else
- {
- gint stepper_width, stepper_height;
-
- /* Steppers are the height of the range, and stepper_size in
- * width, or if we don't have enough width, divided equally
- * among available space.
- */
- stepper_height = range_rect.height - trough_border * 2;
-
- if (stepper_height < 1)
- stepper_height = range_rect.height; /* screw the trough border */
-
- if (n_steppers == 0)
- stepper_width = 0; /* avoid divide by n_steppers */
- else
- stepper_width = MIN (stepper_size, (range_rect.width / n_steppers));
-
- /* Stepper A */
-
- priv->stepper_a.x = range_rect.x + trough_border;
- priv->stepper_a.y = range_rect.y + trough_border;
-
- if (priv->stepper_a_gadget)
- {
- priv->stepper_a.width = stepper_width;
- priv->stepper_a.height = stepper_height;
- }
- else
- {
- priv->stepper_a.width = 0;
- priv->stepper_a.height = 0;
- }
-
- /* Stepper B */
-
- priv->stepper_b.x = priv->stepper_a.x + priv->stepper_a.width;
- priv->stepper_b.y = priv->stepper_a.y;
-
- if (priv->stepper_b_gadget)
- {
- priv->stepper_b.width = stepper_width;
- priv->stepper_b.height = stepper_height;
- }
- else
- {
- priv->stepper_b.width = 0;
- priv->stepper_b.height = 0;
- }
-
- /* Stepper D */
-
- if (priv->stepper_d_gadget)
- {
- priv->stepper_d.width = stepper_width;
- priv->stepper_d.height = stepper_height;
- }
- else
- {
- priv->stepper_d.width = 0;
- priv->stepper_d.height = 0;
- }
-
- priv->stepper_d.x = range_rect.x + range_rect.width - priv->stepper_d.width - trough_border;
- priv->stepper_d.y = priv->stepper_a.y;
-
-
- /* Stepper C */
-
- if (priv->stepper_c_gadget)
- {
- priv->stepper_c.width = stepper_width;
- priv->stepper_c.height = stepper_height;
- }
- else
- {
- priv->stepper_c.width = 0;
- priv->stepper_c.height = 0;
- }
-
- priv->stepper_c.x = priv->stepper_d.x - priv->stepper_c.width;
- priv->stepper_c.y = priv->stepper_a.y;
-
- /* Now the trough is the remaining space between steppers B and C,
- * if any
- */
- priv->trough.x = priv->stepper_b.x + priv->stepper_b.width + stepper_spacing * has_steppers_ab;
- priv->trough.y = range_rect.y;
- priv->trough.width = priv->stepper_c.x - priv->trough.x - stepper_spacing * has_steppers_cd;
- priv->trough.height = range_rect.height;
- }
-
- gtk_range_calc_slider (range);
- gtk_range_calc_stepper_sensitivity (range);
-}
-
-static void
gtk_range_queue_draw_location (GtkRange *range,
MouseLocation location)
{
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]