[gtk+/wip/cosimoc/range-gadget: 76/84] range: deprecate trough-under-steppers
- From: Cosimo Cecchi <cosimoc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+/wip/cosimoc/range-gadget: 76/84] range: deprecate trough-under-steppers
- Date: Tue, 19 Jan 2016 09:23:22 +0000 (UTC)
commit b9d22ecfca46ba54747b8f3d6a06d003478a2418
Author: Cosimo Cecchi <cosimoc gnome org>
Date: Wed Jan 13 15:01:47 2016 -0800
range: deprecate trough-under-steppers
It's not clear what this would do in a CSS world, and all the themes set
it to TRUE anyway...
gtk/gtkrange.c | 112 ++++------------------
gtk/theme/Adwaita/_common.scss | 1 -
gtk/theme/Adwaita/gtk-contained-dark.css | 3 +-
gtk/theme/Adwaita/gtk-contained.css | 3 +-
gtk/theme/HighContrast/_common.scss | 1 -
gtk/theme/HighContrast/gtk-contained-inverse.css | 3 +-
gtk/theme/HighContrast/gtk-contained.css | 3 +-
7 files changed, 22 insertions(+), 104 deletions(-)
---
diff --git a/gtk/gtkrange.c b/gtk/gtkrange.c
index c6eb8aa..0e36460 100644
--- a/gtk/gtkrange.c
+++ b/gtk/gtkrange.c
@@ -275,8 +275,7 @@ static void gtk_range_get_props (GtkRange *range,
gint *slider_width,
gint *stepper_size,
gint *trough_border,
- gint *stepper_spacing,
- gboolean *trough_under_steppers);
+ gint *stepper_spacing);
static void gtk_range_calc_request (GtkRange *range,
gint slider_width,
gint stepper_size,
@@ -613,13 +612,16 @@ gtk_range_class_init (GtkRangeClass *class)
* to exclude the steppers and their spacing.
*
* Since: 2.10
+ *
+ * Deprecated: 3.20: The value of this style property is ignored, and the
+ * widget will behave as if it was set to %TRUE.
*/
gtk_widget_class_install_style_property (widget_class,
g_param_spec_boolean ("trough-under-steppers",
P_("Trough Under Steppers"),
P_("Whether to draw trough for full length
of range or exclude the steppers and spacing"),
TRUE,
- GTK_PARAM_READABLE));
+ GTK_PARAM_READABLE|G_PARAM_DEPRECATED));
/**
* GtkRange:arrow-scaling:
@@ -1784,12 +1786,10 @@ gtk_range_allocate_trough (GtkRange *range,
GtkWidget *widget = GTK_WIDGET (range);
GtkAllocation widget_alloc;
GtkAllocation trough_alloc = priv->range_rect;
- gboolean trough_under_steppers;
gint stepper_size;
gint stepper_spacing;
gtk_widget_style_get (widget,
- "trough-under-steppers", &trough_under_steppers,
"stepper-size", &stepper_size,
"stepper-spacing", &stepper_spacing,
NULL);
@@ -1798,48 +1798,6 @@ gtk_range_allocate_trough (GtkRange *range,
trough_alloc.x += widget_alloc.x;
trough_alloc.y += widget_alloc.y;
- if (!trough_under_steppers)
- {
- gint offset = 0;
- gint shorter = 0;
-
- if (priv->stepper_a_gadget)
- offset += stepper_size;
-
- if (priv->stepper_b_gadget)
- offset += stepper_size;
-
- shorter += offset;
-
- if (priv->stepper_c_gadget)
- shorter += stepper_size;
-
- if (priv->stepper_d_gadget)
- shorter += stepper_size;
-
- if (priv->stepper_a_gadget || priv->stepper_b_gadget)
- {
- offset += stepper_spacing;
- shorter += stepper_spacing;
- }
-
- if (priv->stepper_c_gadget || priv->stepper_d_gadget)
- {
- shorter += stepper_spacing;
- }
-
- if (priv->orientation == GTK_ORIENTATION_HORIZONTAL)
- {
- trough_alloc.x += offset;
- trough_alloc.width -= shorter;
- }
- else
- {
- trough_alloc.y += offset;
- trough_alloc.height -= shorter;
- }
- }
-
gtk_css_gadget_allocate (priv->trough_gadget,
&trough_alloc,
gtk_widget_get_allocated_baseline (widget),
@@ -2355,7 +2313,6 @@ coord_to_value (GtkRange *range,
gint trough_start;
gint slider_length;
gint trough_border;
- gint trough_under_steppers;
if (priv->orientation == GTK_ORIENTATION_VERTICAL)
{
@@ -2370,14 +2327,7 @@ coord_to_value (GtkRange *range,
slider_length = priv->slider.width;
}
- gtk_range_get_props (range, NULL, NULL, &trough_border, NULL,
- &trough_under_steppers);
-
- if (! trough_under_steppers)
- {
- trough_start += trough_border;
- trough_length -= 2 * trough_border;
- }
+ gtk_range_get_props (range, NULL, NULL, &trough_border, NULL);
if (trough_length == slider_length)
frac = 1.0;
@@ -3270,19 +3220,17 @@ gtk_range_get_props (GtkRange *range,
gint *slider_width,
gint *stepper_size,
gint *trough_border,
- gint *stepper_spacing,
- gboolean *trough_under_steppers)
+ gint *stepper_spacing)
{
GtkWidget *widget = GTK_WIDGET (range);
gint tmp_slider_width, tmp_stepper_size, tmp_trough_border;
- gint tmp_stepper_spacing, tmp_trough_under_steppers;
+ 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,
- "trough-under-steppers", &tmp_trough_under_steppers,
NULL);
if (slider_width)
@@ -3296,9 +3244,6 @@ gtk_range_get_props (GtkRange *range,
if (stepper_spacing)
*stepper_spacing = tmp_stepper_spacing;
-
- if (trough_under_steppers)
- *trough_under_steppers = tmp_trough_under_steppers;
}
#define POINT_IN_RECT(xcoord, ycoord, rect) \
@@ -3539,10 +3484,8 @@ gtk_range_compute_slider_position (GtkRange *range,
{
GtkRangePrivate *priv = range->priv;
gint trough_border;
- gboolean trough_under_steppers;
- gtk_range_get_props (range, NULL, NULL, &trough_border, NULL,
- &trough_under_steppers);
+ gtk_range_get_props (range, NULL, NULL, &trough_border, NULL);
if (priv->orientation == GTK_ORIENTATION_VERTICAL)
{
@@ -3558,12 +3501,6 @@ gtk_range_compute_slider_position (GtkRange *range,
top = priv->trough.y;
bottom = priv->trough.y + priv->trough.height;
- if (! trough_under_steppers)
- {
- top += trough_border;
- bottom -= trough_border;
- }
-
/* slider height is the fraction (page_size /
* total_adjustment_range) times the trough height in pixels
*/
@@ -3608,12 +3545,6 @@ gtk_range_compute_slider_position (GtkRange *range,
left = priv->trough.x;
right = priv->trough.x + priv->trough.width;
- if (! trough_under_steppers)
- {
- left += trough_border;
- right -= trough_border;
- }
-
/* slider width is the fraction (page_size /
* total_adjustment_range) times the trough width in pixels
*/
@@ -3746,7 +3677,6 @@ gtk_range_calc_layout (GtkRange *range)
gint n_steppers;
gboolean has_steppers_ab;
gboolean has_steppers_cd;
- gboolean trough_under_steppers;
GdkRectangle range_rect;
GtkWidget *widget;
@@ -3765,7 +3695,7 @@ gtk_range_calc_layout (GtkRange *range)
gtk_range_get_props (range,
&slider_width, &stepper_size,
&trough_border,
- &stepper_spacing, &trough_under_steppers);
+ &stepper_spacing);
gtk_range_calc_request (range,
slider_width, stepper_size,
@@ -3798,10 +3728,7 @@ gtk_range_calc_layout (GtkRange *range)
* height, or if we don't have enough height, divided equally
* among available space.
*/
- stepper_width = range_rect.width;
-
- if (trough_under_steppers)
- stepper_width -= trough_border * 2;
+ stepper_width = range_rect.width - trough_border * 2;
if (stepper_width < 1)
stepper_width = range_rect.width; /* screw the trough border */
@@ -3813,8 +3740,8 @@ gtk_range_calc_layout (GtkRange *range)
/* Stepper A */
- priv->stepper_a.x = range_rect.x + trough_border * trough_under_steppers;
- priv->stepper_a.y = range_rect.y + trough_border * trough_under_steppers;
+ priv->stepper_a.x = range_rect.x + trough_border;
+ priv->stepper_a.y = range_rect.y + trough_border;
if (priv->stepper_a_gadget)
{
@@ -3857,7 +3784,7 @@ gtk_range_calc_layout (GtkRange *range)
}
priv->stepper_d.x = priv->stepper_a.x;
- priv->stepper_d.y = range_rect.y + range_rect.height - priv->stepper_d.height - trough_border *
trough_under_steppers;
+ priv->stepper_d.y = range_rect.y + range_rect.height - priv->stepper_d.height - trough_border;
/* Stepper C */
@@ -3891,10 +3818,7 @@ gtk_range_calc_layout (GtkRange *range)
* width, or if we don't have enough width, divided equally
* among available space.
*/
- stepper_height = range_rect.height;
-
- if (trough_under_steppers)
- stepper_height -= trough_border * 2;
+ stepper_height = range_rect.height - trough_border * 2;
if (stepper_height < 1)
stepper_height = range_rect.height; /* screw the trough border */
@@ -3906,8 +3830,8 @@ gtk_range_calc_layout (GtkRange *range)
/* Stepper A */
- priv->stepper_a.x = range_rect.x + trough_border * trough_under_steppers;
- priv->stepper_a.y = range_rect.y + trough_border * trough_under_steppers;
+ priv->stepper_a.x = range_rect.x + trough_border;
+ priv->stepper_a.y = range_rect.y + trough_border;
if (priv->stepper_a_gadget)
{
@@ -3949,7 +3873,7 @@ gtk_range_calc_layout (GtkRange *range)
priv->stepper_d.height = 0;
}
- priv->stepper_d.x = range_rect.x + range_rect.width - priv->stepper_d.width - trough_border *
trough_under_steppers;
+ priv->stepper_d.x = range_rect.x + range_rect.width - priv->stepper_d.width - trough_border;
priv->stepper_d.y = priv->stepper_a.y;
diff --git a/gtk/theme/Adwaita/_common.scss b/gtk/theme/Adwaita/_common.scss
index 5061344..d6dfc29 100644
--- a/gtk/theme/Adwaita/_common.scss
+++ b/gtk/theme/Adwaita/_common.scss
@@ -1973,7 +1973,6 @@ scrollbar {
// sadly can't be in '.slider'
// where it belongs
-GtkRange-stepper-spacing: 0;
- -GtkRange-trough-under-steppers: 1;
}
$_slider_margin: 3px;
diff --git a/gtk/theme/Adwaita/gtk-contained-dark.css b/gtk/theme/Adwaita/gtk-contained-dark.css
index 2216b4d..e97a5c9 100644
--- a/gtk/theme/Adwaita/gtk-contained-dark.css
+++ b/gtk/theme/Adwaita/gtk-contained-dark.css
@@ -2461,8 +2461,7 @@ notebook {
-GtkScrollbar-has-backward-stepper: false;
-GtkScrollbar-has-forward-stepper: false;
-GtkScrollbar-min-slider-length: 42;
- -GtkRange-stepper-spacing: 0;
- -GtkRange-trough-under-steppers: 1; }
+ -GtkRange-stepper-spacing: 0; }
scrollbar button, scrollbar headerbar button.titlebutton, headerbar scrollbar button.titlebutton,
scrollbar .titlebar button.titlebutton,
.titlebar scrollbar button.titlebutton {
diff --git a/gtk/theme/Adwaita/gtk-contained.css b/gtk/theme/Adwaita/gtk-contained.css
index a7daca4..6dd2197 100644
--- a/gtk/theme/Adwaita/gtk-contained.css
+++ b/gtk/theme/Adwaita/gtk-contained.css
@@ -2471,8 +2471,7 @@ notebook {
-GtkScrollbar-has-backward-stepper: false;
-GtkScrollbar-has-forward-stepper: false;
-GtkScrollbar-min-slider-length: 42;
- -GtkRange-stepper-spacing: 0;
- -GtkRange-trough-under-steppers: 1; }
+ -GtkRange-stepper-spacing: 0; }
scrollbar button, scrollbar headerbar button.titlebutton, headerbar scrollbar button.titlebutton,
scrollbar .titlebar button.titlebutton,
.titlebar scrollbar button.titlebutton {
diff --git a/gtk/theme/HighContrast/_common.scss b/gtk/theme/HighContrast/_common.scss
index 5a0350b..523577a 100644
--- a/gtk/theme/HighContrast/_common.scss
+++ b/gtk/theme/HighContrast/_common.scss
@@ -1467,7 +1467,6 @@ scrollbar {
// where it belongs
-GtkRange-stepper-spacing: 0;
- -GtkRange-trough-under-steppers: 1;
trough { @extend junction; }
diff --git a/gtk/theme/HighContrast/gtk-contained-inverse.css
b/gtk/theme/HighContrast/gtk-contained-inverse.css
index d485cfa..e010605 100644
--- a/gtk/theme/HighContrast/gtk-contained-inverse.css
+++ b/gtk/theme/HighContrast/gtk-contained-inverse.css
@@ -1619,8 +1619,7 @@ scrollbar {
-GtkScrollbar-has-forward-stepper: false;
-GtkRange-slider-width: 20;
-GtkScrollbar-min-slider-length: 42;
- -GtkRange-stepper-spacing: 0;
- -GtkRange-trough-under-steppers: 1; }
+ -GtkRange-stepper-spacing: 0; }
scrollbar button {
border: none; }
scrollbar slider {
diff --git a/gtk/theme/HighContrast/gtk-contained.css b/gtk/theme/HighContrast/gtk-contained.css
index 590f31d..4d77114 100644
--- a/gtk/theme/HighContrast/gtk-contained.css
+++ b/gtk/theme/HighContrast/gtk-contained.css
@@ -1619,8 +1619,7 @@ scrollbar {
-GtkScrollbar-has-forward-stepper: false;
-GtkRange-slider-width: 20;
-GtkScrollbar-min-slider-length: 42;
- -GtkRange-stepper-spacing: 0;
- -GtkRange-trough-under-steppers: 1; }
+ -GtkRange-stepper-spacing: 0; }
scrollbar button {
border: none; }
scrollbar slider {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]