Commit 230aa999 authored by Benjamin Otte's avatar Benjamin Otte

range: Query slider position instead of updating it

We're updating it later in the function, there's no need to do it here.
parent 7193043f
...@@ -252,6 +252,9 @@ static void gtk_range_move_slider (GtkRange *range, ...@@ -252,6 +252,9 @@ static void gtk_range_move_slider (GtkRange *range,
GtkScrollType scroll); GtkScrollType scroll);
/* Internals */ /* Internals */
static void gtk_range_compute_slider_position (GtkRange *range,
gdouble adjustment_value,
GdkRectangle *slider_rect);
static gboolean gtk_range_scroll (GtkRange *range, static gboolean gtk_range_scroll (GtkRange *range,
GtkScrollType scroll); GtkScrollType scroll);
static gboolean gtk_range_update_mouse_location (GtkRange *range); static gboolean gtk_range_update_mouse_location (GtkRange *range);
...@@ -2569,6 +2572,7 @@ gtk_range_multipress_gesture_pressed (GtkGestureMultiPress *gesture, ...@@ -2569,6 +2572,7 @@ gtk_range_multipress_gesture_pressed (GtkGestureMultiPress *gesture,
priv->mouse_location == MOUSE_SLIDER) priv->mouse_location == MOUSE_SLIDER)
{ {
gboolean need_value_update = FALSE; gboolean need_value_update = FALSE;
GdkRectangle slider;
/* Any button can be used to drag the slider, but you can start /* Any button can be used to drag the slider, but you can start
* dragging the slider with a trough click using button 1; * dragging the slider with a trough click using button 1;
...@@ -2591,11 +2595,7 @@ gtk_range_multipress_gesture_pressed (GtkGestureMultiPress *gesture, ...@@ -2591,11 +2595,7 @@ gtk_range_multipress_gesture_pressed (GtkGestureMultiPress *gesture,
/* compute new value for warped slider */ /* compute new value for warped slider */
new_value = slider_low_value + (slider_high_value - slider_low_value) / 2; new_value = slider_low_value + (slider_high_value - slider_low_value) / 2;
/* recalc slider, so we can set slide_initial_slider_position gtk_range_compute_slider_position (range, new_value, &slider);
* properly
*/
priv->need_recalc = TRUE;
gtk_range_calc_layout (range, new_value);
/* defer adjustment updates to update_slider_position() in order /* defer adjustment updates to update_slider_position() in order
* to keep pixel quantisation * to keep pixel quantisation
...@@ -2613,17 +2613,19 @@ gtk_range_multipress_gesture_pressed (GtkGestureMultiPress *gesture, ...@@ -2613,17 +2613,19 @@ gtk_range_multipress_gesture_pressed (GtkGestureMultiPress *gesture,
{ {
update_zoom_state (range, TRUE); update_zoom_state (range, TRUE);
} }
slider = priv->slider;
} }
if (priv->orientation == GTK_ORIENTATION_VERTICAL) if (priv->orientation == GTK_ORIENTATION_VERTICAL)
{ {
priv->slide_initial_slider_position = priv->slider.y; priv->slide_initial_slider_position = slider.y;
priv->slide_initial_coordinate_delta = y - priv->slider.y; priv->slide_initial_coordinate_delta = y - slider.y;
} }
else else
{ {
priv->slide_initial_slider_position = priv->slider.x; priv->slide_initial_slider_position = slider.x;
priv->slide_initial_coordinate_delta = x - priv->slider.x; priv->slide_initial_coordinate_delta = x - slider.x;
} }
range_grab_add (range, MOUSE_SLIDER); range_grab_add (range, MOUSE_SLIDER);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment