Commit 8589cfa1 authored by Tim Janik's avatar Tim Janik Committed by Tim Janik

add GDK_THREADS_ENTER/GDK_THREADS_LEAVE. (gtk_range_calc_layout): compute

Sat Jul 14 12:47:35 2001  Tim Janik  <timj@gtk.org>

        * gtk/gtkrange.c:
        (second_timeout):
        (initial_timeout):
        (update_timeout): add GDK_THREADS_ENTER/GDK_THREADS_LEAVE.
        (gtk_range_calc_layout): compute the new layout based on an
        adjustment->value being passed in as argument.
        (gtk_range_button_press): for button2 slider warps, first recalc
        the layout, then adjust the value. also, use update_slider_position()
        for adjusting the value, so we keep pixel quantisation at which we
        usually operate (upon motion or button releases). the reason for this
        is that, we can't change the adjustment upon button2 presses to a non
        quantised value and upon button2 release re-quantise the value since
        that'd alter the value even if we didn't get any motion events (causing
        unexpected scroll area warps upon release and/or slider pixel-jitter).
        (gtk_range_motion_notify): update the slider position from queried
        coordinates, not event coordinates.

Fri Jul 13 09:47:52 2001  Tim Janik  <timj@gtk.org>

        * gtk/gtkstyle.c (gtk_default_draw_focus): fix line style resetting,
        the default gc values are: width=0, CapBut, JoinMiter.
parent 2afa5510
Sat Jul 14 12:47:35 2001 Tim Janik <timj@gtk.org>
* gtk/gtkrange.c:
(second_timeout):
(initial_timeout):
(update_timeout): add GDK_THREADS_ENTER/GDK_THREADS_LEAVE.
(gtk_range_calc_layout): compute the new layout based on an
adjustment->value being passed in as argument.
(gtk_range_button_press): for button2 slider warps, first recalc
the layout, then adjust the value. also, use update_slider_position()
for adjusting the value, so we keep pixel quantisation at which we
usually operate (upon motion or button releases). the reason for this
is that, we can't change the adjustment upon button2 presses to a non
quantised value and upon button2 release re-quantise the value since
that'd alter the value even if we didn't get any motion events (causing
unexpected scroll area warps upon release and/or slider pixel-jitter).
(gtk_range_motion_notify): update the slider position from queried
coordinates, not event coordinates.
Fri Jul 13 09:47:52 2001 Tim Janik <timj@gtk.org>
* gtk/gtkstyle.c (gtk_default_draw_focus): fix line style resetting,
the default gc values are: width=0, CapBut, JoinMiter.
2001-07-13 Anders Carlsson <andersca@codefactory.se>
* gtk/gtkcellrendererpixbuf.c (gtk_cell_renderer_pixbuf_render): Take
......
Sat Jul 14 12:47:35 2001 Tim Janik <timj@gtk.org>
* gtk/gtkrange.c:
(second_timeout):
(initial_timeout):
(update_timeout): add GDK_THREADS_ENTER/GDK_THREADS_LEAVE.
(gtk_range_calc_layout): compute the new layout based on an
adjustment->value being passed in as argument.
(gtk_range_button_press): for button2 slider warps, first recalc
the layout, then adjust the value. also, use update_slider_position()
for adjusting the value, so we keep pixel quantisation at which we
usually operate (upon motion or button releases). the reason for this
is that, we can't change the adjustment upon button2 presses to a non
quantised value and upon button2 release re-quantise the value since
that'd alter the value even if we didn't get any motion events (causing
unexpected scroll area warps upon release and/or slider pixel-jitter).
(gtk_range_motion_notify): update the slider position from queried
coordinates, not event coordinates.
Fri Jul 13 09:47:52 2001 Tim Janik <timj@gtk.org>
* gtk/gtkstyle.c (gtk_default_draw_focus): fix line style resetting,
the default gc values are: width=0, CapBut, JoinMiter.
2001-07-13 Anders Carlsson <andersca@codefactory.se>
* gtk/gtkcellrendererpixbuf.c (gtk_cell_renderer_pixbuf_render): Take
......
Sat Jul 14 12:47:35 2001 Tim Janik <timj@gtk.org>
* gtk/gtkrange.c:
(second_timeout):
(initial_timeout):
(update_timeout): add GDK_THREADS_ENTER/GDK_THREADS_LEAVE.
(gtk_range_calc_layout): compute the new layout based on an
adjustment->value being passed in as argument.
(gtk_range_button_press): for button2 slider warps, first recalc
the layout, then adjust the value. also, use update_slider_position()
for adjusting the value, so we keep pixel quantisation at which we
usually operate (upon motion or button releases). the reason for this
is that, we can't change the adjustment upon button2 presses to a non
quantised value and upon button2 release re-quantise the value since
that'd alter the value even if we didn't get any motion events (causing
unexpected scroll area warps upon release and/or slider pixel-jitter).
(gtk_range_motion_notify): update the slider position from queried
coordinates, not event coordinates.
Fri Jul 13 09:47:52 2001 Tim Janik <timj@gtk.org>
* gtk/gtkstyle.c (gtk_default_draw_focus): fix line style resetting,
the default gc values are: width=0, CapBut, JoinMiter.
2001-07-13 Anders Carlsson <andersca@codefactory.se>
* gtk/gtkcellrendererpixbuf.c (gtk_cell_renderer_pixbuf_render): Take
......
Sat Jul 14 12:47:35 2001 Tim Janik <timj@gtk.org>
* gtk/gtkrange.c:
(second_timeout):
(initial_timeout):
(update_timeout): add GDK_THREADS_ENTER/GDK_THREADS_LEAVE.
(gtk_range_calc_layout): compute the new layout based on an
adjustment->value being passed in as argument.
(gtk_range_button_press): for button2 slider warps, first recalc
the layout, then adjust the value. also, use update_slider_position()
for adjusting the value, so we keep pixel quantisation at which we
usually operate (upon motion or button releases). the reason for this
is that, we can't change the adjustment upon button2 presses to a non
quantised value and upon button2 release re-quantise the value since
that'd alter the value even if we didn't get any motion events (causing
unexpected scroll area warps upon release and/or slider pixel-jitter).
(gtk_range_motion_notify): update the slider position from queried
coordinates, not event coordinates.
Fri Jul 13 09:47:52 2001 Tim Janik <timj@gtk.org>
* gtk/gtkstyle.c (gtk_default_draw_focus): fix line style resetting,
the default gc values are: width=0, CapBut, JoinMiter.
2001-07-13 Anders Carlsson <andersca@codefactory.se>
* gtk/gtkcellrendererpixbuf.c (gtk_cell_renderer_pixbuf_render): Take
......
Sat Jul 14 12:47:35 2001 Tim Janik <timj@gtk.org>
* gtk/gtkrange.c:
(second_timeout):
(initial_timeout):
(update_timeout): add GDK_THREADS_ENTER/GDK_THREADS_LEAVE.
(gtk_range_calc_layout): compute the new layout based on an
adjustment->value being passed in as argument.
(gtk_range_button_press): for button2 slider warps, first recalc
the layout, then adjust the value. also, use update_slider_position()
for adjusting the value, so we keep pixel quantisation at which we
usually operate (upon motion or button releases). the reason for this
is that, we can't change the adjustment upon button2 presses to a non
quantised value and upon button2 release re-quantise the value since
that'd alter the value even if we didn't get any motion events (causing
unexpected scroll area warps upon release and/or slider pixel-jitter).
(gtk_range_motion_notify): update the slider position from queried
coordinates, not event coordinates.
Fri Jul 13 09:47:52 2001 Tim Janik <timj@gtk.org>
* gtk/gtkstyle.c (gtk_default_draw_focus): fix line style resetting,
the default gc values are: width=0, CapBut, JoinMiter.
2001-07-13 Anders Carlsson <andersca@codefactory.se>
* gtk/gtkcellrendererpixbuf.c (gtk_cell_renderer_pixbuf_render): Take
......
Sat Jul 14 12:47:35 2001 Tim Janik <timj@gtk.org>
* gtk/gtkrange.c:
(second_timeout):
(initial_timeout):
(update_timeout): add GDK_THREADS_ENTER/GDK_THREADS_LEAVE.
(gtk_range_calc_layout): compute the new layout based on an
adjustment->value being passed in as argument.
(gtk_range_button_press): for button2 slider warps, first recalc
the layout, then adjust the value. also, use update_slider_position()
for adjusting the value, so we keep pixel quantisation at which we
usually operate (upon motion or button releases). the reason for this
is that, we can't change the adjustment upon button2 presses to a non
quantised value and upon button2 release re-quantise the value since
that'd alter the value even if we didn't get any motion events (causing
unexpected scroll area warps upon release and/or slider pixel-jitter).
(gtk_range_motion_notify): update the slider position from queried
coordinates, not event coordinates.
Fri Jul 13 09:47:52 2001 Tim Janik <timj@gtk.org>
* gtk/gtkstyle.c (gtk_default_draw_focus): fix line style resetting,
the default gc values are: width=0, CapBut, JoinMiter.
2001-07-13 Anders Carlsson <andersca@codefactory.se>
* gtk/gtkcellrendererpixbuf.c (gtk_cell_renderer_pixbuf_render): Take
......
Sat Jul 14 12:47:35 2001 Tim Janik <timj@gtk.org>
* gtk/gtkrange.c:
(second_timeout):
(initial_timeout):
(update_timeout): add GDK_THREADS_ENTER/GDK_THREADS_LEAVE.
(gtk_range_calc_layout): compute the new layout based on an
adjustment->value being passed in as argument.
(gtk_range_button_press): for button2 slider warps, first recalc
the layout, then adjust the value. also, use update_slider_position()
for adjusting the value, so we keep pixel quantisation at which we
usually operate (upon motion or button releases). the reason for this
is that, we can't change the adjustment upon button2 presses to a non
quantised value and upon button2 release re-quantise the value since
that'd alter the value even if we didn't get any motion events (causing
unexpected scroll area warps upon release and/or slider pixel-jitter).
(gtk_range_motion_notify): update the slider position from queried
coordinates, not event coordinates.
Fri Jul 13 09:47:52 2001 Tim Janik <timj@gtk.org>
* gtk/gtkstyle.c (gtk_default_draw_focus): fix line style resetting,
the default gc values are: width=0, CapBut, JoinMiter.
2001-07-13 Anders Carlsson <andersca@codefactory.se>
* gtk/gtkcellrendererpixbuf.c (gtk_cell_renderer_pixbuf_render): Take
......
......@@ -495,6 +495,7 @@ This can later be composited together with other
#GtkRcStyle structures to form a #GtkStyle.
</para>
@parent_instance:
@name:
@bg_pixmap_name:
@font_desc:
......
......@@ -84,6 +84,7 @@ struct _GtkRangeLayout
gint grab_button; /* 0 if none */
};
static void gtk_range_class_init (GtkRangeClass *klass);
static void gtk_range_init (GtkRange *range);
static void gtk_range_set_property (GObject *object,
......@@ -118,6 +119,9 @@ static gint gtk_range_scroll_event (GtkWidget *widget,
GdkEventScroll *event);
static void gtk_range_style_set (GtkWidget *widget,
GtkStyle *previous_style);
static void update_slider_position (GtkRange *range,
gint mouse_x,
gint mouse_y);
/* Range methods */
......@@ -129,7 +133,8 @@ static void gtk_range_move_slider (GtkRange *range,
static void gtk_range_scroll (GtkRange *range,
GtkScrollType scroll);
static gboolean gtk_range_update_mouse_location (GtkRange *range);
static void gtk_range_calc_layout (GtkRange *range);
static void gtk_range_calc_layout (GtkRange *range,
gdouble adjustment_value);
static void gtk_range_get_props (GtkRange *range,
gint *slider_width,
gint *stepper_size,
......@@ -718,7 +723,7 @@ gtk_range_size_allocate (GtkWidget *widget,
range = GTK_RANGE (widget);
range->need_recalc = TRUE;
gtk_range_calc_layout (range);
gtk_range_calc_layout (range, range->adjustment->value);
(* GTK_WIDGET_CLASS (parent_class)->size_allocate) (widget, allocation);
}
......@@ -732,7 +737,7 @@ gtk_range_realize (GtkWidget *widget)
range = GTK_RANGE (widget);
gtk_range_calc_layout (range);
gtk_range_calc_layout (range, range->adjustment->value);
GTK_WIDGET_SET_FLAGS (widget, GTK_REALIZED);
......@@ -833,7 +838,7 @@ gtk_range_expose (GtkWidget *widget,
range = GTK_RANGE (widget);
gtk_range_calc_layout (range);
gtk_range_calc_layout (range, range->adjustment->value);
sensitive = GTK_WIDGET_IS_SENSITIVE (widget);
......@@ -1115,6 +1120,8 @@ gtk_range_button_press (GtkWidget *widget,
event->button == 2) ||
range->layout->mouse_location == MOUSE_SLIDER)
{
gboolean need_value_update = FALSE;
/* Any button can be used to drag the slider, but you can start
* dragging the slider with a trough click using button 2;
* On button 2 press, we warp the slider to mouse position,
......@@ -1122,7 +1129,7 @@ gtk_range_button_press (GtkWidget *widget,
*/
if (event->button == 2)
{
gdouble slider_low_value, slider_high_value;
gdouble slider_low_value, slider_high_value, new_value;
slider_high_value =
coord_to_value (range,
......@@ -1134,14 +1141,19 @@ gtk_range_button_press (GtkWidget *widget,
event->y - range->layout->slider.height :
event->x - range->layout->slider.width);
/* middle button jumps to point */
gtk_range_internal_set_value (range,
slider_low_value + (slider_high_value - slider_low_value) / 2);
/* compute new value for warped slider */
new_value = slider_low_value + (slider_high_value - slider_low_value) / 2;
/* Calc layout so we can set slide_initial_slider_position
/* recalc slider, so we can set slide_initial_slider_position
* properly
*/
gtk_range_calc_layout (range);
range->need_recalc = TRUE;
gtk_range_calc_layout (range, new_value);
/* defer adjustment updates to update_slider_position() in order
* to keep pixel quantisation
*/
need_value_update = TRUE;
}
if (range->orientation == GTK_ORIENTATION_VERTICAL)
......@@ -1155,6 +1167,9 @@ gtk_range_button_press (GtkWidget *widget,
range->slide_initial_coordinate = event->x;
}
if (need_value_update)
update_slider_position (range, event->x, event->y);
range_grab_add (range, MOUSE_SLIDER, event->button);
return TRUE;
......@@ -1290,7 +1305,7 @@ gtk_range_motion_notify (GtkWidget *widget,
gtk_widget_queue_draw (widget);
if (range->layout->grab_location == MOUSE_SLIDER)
update_slider_position (range, event->x, event->y);
update_slider_position (range, x, y);
/* We handled the event if the mouse was in the range_rect */
return range->layout->mouse_location != MOUSE_OUTSIDE;
......@@ -1781,7 +1796,8 @@ gtk_range_calc_request (GtkRange *range,
}
static void
gtk_range_calc_layout (GtkRange *range)
gtk_range_calc_layout (GtkRange *range,
gdouble adjustment_value)
{
gint slider_width, stepper_size, trough_border, stepper_spacing;
gint slider_length;
......@@ -1948,7 +1964,7 @@ gtk_range_calc_layout (GtkRange *range)
y = top;
y += (bottom - top - height) * ((range->adjustment->value - range->adjustment->lower) /
y += (bottom - top - height) * ((adjustment_value - range->adjustment->lower) /
(range->adjustment->upper - range->adjustment->lower - range->adjustment->page_size));
y = CLAMP (y, top, bottom);
......@@ -2083,7 +2099,7 @@ gtk_range_calc_layout (GtkRange *range)
x = left;
x += (right - left - width) * ((range->adjustment->value - range->adjustment->lower) /
x += (right - left - width) * ((adjustment_value - range->adjustment->lower) /
(range->adjustment->upper - range->adjustment->lower - range->adjustment->page_size));
x = CLAMP (x, left, right);
......@@ -2198,9 +2214,10 @@ second_timeout (gpointer data)
{
GtkRange *range;
GDK_THREADS_ENTER ();
range = GTK_RANGE (data);
gtk_range_scroll (range, range->timer->step);
GDK_THREADS_LEAVE ();
return TRUE;
}
......@@ -2210,12 +2227,13 @@ initial_timeout (gpointer data)
{
GtkRange *range;
GDK_THREADS_ENTER ();
range = GTK_RANGE (data);
range->timer->timeout_id =
g_timeout_add (SCROLL_LATER_DELAY,
second_timeout,
range);
GDK_THREADS_LEAVE ();
/* remove self */
return FALSE;
......@@ -2256,11 +2274,11 @@ update_timeout (gpointer data)
{
GtkRange *range;
GDK_THREADS_ENTER ();
range = GTK_RANGE (data);
gtk_range_update_value (range);
range->update_timeout_id = 0;
GDK_THREADS_LEAVE ();
/* self-remove */
return FALSE;
......
......@@ -3826,7 +3826,7 @@ gtk_default_draw_focus (GtkStyle *style,
points[4] = points[0];
gdk_draw_polygon (window, style->black_gc, FALSE, points, 4);
gdk_gc_set_line_attributes (style->black_gc, 1, GDK_LINE_SOLID, 0, 0);
gdk_gc_set_line_attributes (style->black_gc, 0, GDK_LINE_SOLID, GDK_CAP_BUTT, GDK_JOIN_MITER);
if (area)
gdk_gc_set_clip_rectangle (style->black_gc, NULL);
......
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