From 114d0b6b25d64d70d68997d64d46b561ecfe4e46 Mon Sep 17 00:00:00 2001 From: Owen Taylor Date: Sun, 12 Nov 2000 18:42:30 +0000 Subject: [PATCH] Add some missing casts. Support 2 and 3 button clicks on the arrows to Sun Nov 12 13:33:01 2000 Owen Taylor * gtk/gtkrange.c: Add some missing casts. Support 2 and 3 button clicks on the arrows to mean "move by pages" and "jump to end". (Like gtkspinbutton) --- ChangeLog | 6 ++++++ ChangeLog.pre-2-0 | 6 ++++++ ChangeLog.pre-2-10 | 6 ++++++ ChangeLog.pre-2-2 | 6 ++++++ ChangeLog.pre-2-4 | 6 ++++++ ChangeLog.pre-2-6 | 6 ++++++ ChangeLog.pre-2-8 | 6 ++++++ gtk/gtkrange.c | 50 ++++++++++++++++++++++++++++------------------ 8 files changed, 73 insertions(+), 19 deletions(-) diff --git a/ChangeLog b/ChangeLog index e8c8c804a6..0a64e7631b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +Sun Nov 12 13:33:01 2000 Owen Taylor + + * gtk/gtkrange.c: Add some missing casts. Support + 2 and 3 button clicks on the arrows to mean + "move by pages" and "jump to end". (Like gtkspinbutton) + 2000-11-12 Hans Breuer * gdk/win32/makefile.msc : reflect build module changes diff --git a/ChangeLog.pre-2-0 b/ChangeLog.pre-2-0 index e8c8c804a6..0a64e7631b 100644 --- a/ChangeLog.pre-2-0 +++ b/ChangeLog.pre-2-0 @@ -1,3 +1,9 @@ +Sun Nov 12 13:33:01 2000 Owen Taylor + + * gtk/gtkrange.c: Add some missing casts. Support + 2 and 3 button clicks on the arrows to mean + "move by pages" and "jump to end". (Like gtkspinbutton) + 2000-11-12 Hans Breuer * gdk/win32/makefile.msc : reflect build module changes diff --git a/ChangeLog.pre-2-10 b/ChangeLog.pre-2-10 index e8c8c804a6..0a64e7631b 100644 --- a/ChangeLog.pre-2-10 +++ b/ChangeLog.pre-2-10 @@ -1,3 +1,9 @@ +Sun Nov 12 13:33:01 2000 Owen Taylor + + * gtk/gtkrange.c: Add some missing casts. Support + 2 and 3 button clicks on the arrows to mean + "move by pages" and "jump to end". (Like gtkspinbutton) + 2000-11-12 Hans Breuer * gdk/win32/makefile.msc : reflect build module changes diff --git a/ChangeLog.pre-2-2 b/ChangeLog.pre-2-2 index e8c8c804a6..0a64e7631b 100644 --- a/ChangeLog.pre-2-2 +++ b/ChangeLog.pre-2-2 @@ -1,3 +1,9 @@ +Sun Nov 12 13:33:01 2000 Owen Taylor + + * gtk/gtkrange.c: Add some missing casts. Support + 2 and 3 button clicks on the arrows to mean + "move by pages" and "jump to end". (Like gtkspinbutton) + 2000-11-12 Hans Breuer * gdk/win32/makefile.msc : reflect build module changes diff --git a/ChangeLog.pre-2-4 b/ChangeLog.pre-2-4 index e8c8c804a6..0a64e7631b 100644 --- a/ChangeLog.pre-2-4 +++ b/ChangeLog.pre-2-4 @@ -1,3 +1,9 @@ +Sun Nov 12 13:33:01 2000 Owen Taylor + + * gtk/gtkrange.c: Add some missing casts. Support + 2 and 3 button clicks on the arrows to mean + "move by pages" and "jump to end". (Like gtkspinbutton) + 2000-11-12 Hans Breuer * gdk/win32/makefile.msc : reflect build module changes diff --git a/ChangeLog.pre-2-6 b/ChangeLog.pre-2-6 index e8c8c804a6..0a64e7631b 100644 --- a/ChangeLog.pre-2-6 +++ b/ChangeLog.pre-2-6 @@ -1,3 +1,9 @@ +Sun Nov 12 13:33:01 2000 Owen Taylor + + * gtk/gtkrange.c: Add some missing casts. Support + 2 and 3 button clicks on the arrows to mean + "move by pages" and "jump to end". (Like gtkspinbutton) + 2000-11-12 Hans Breuer * gdk/win32/makefile.msc : reflect build module changes diff --git a/ChangeLog.pre-2-8 b/ChangeLog.pre-2-8 index e8c8c804a6..0a64e7631b 100644 --- a/ChangeLog.pre-2-8 +++ b/ChangeLog.pre-2-8 @@ -1,3 +1,9 @@ +Sun Nov 12 13:33:01 2000 Owen Taylor + + * gtk/gtkrange.c: Add some missing casts. Support + 2 and 3 button clicks on the arrows to mean + "move by pages" and "jump to end". (Like gtkspinbutton) + 2000-11-12 Hans Breuer * gdk/win32/makefile.msc : reflect build module changes diff --git a/gtk/gtkrange.c b/gtk/gtkrange.c index 595a8a9bdc..d32e2c35be 100644 --- a/gtk/gtkrange.c +++ b/gtk/gtkrange.c @@ -458,7 +458,7 @@ gtk_range_default_hslider_update (GtkRange *range) else if (x > right) x = right; - if (range->flippable && gtk_widget_get_direction (range) == GTK_TEXT_DIR_RTL) + if (range->flippable && gtk_widget_get_direction (GTK_WIDGET (range)) == GTK_TEXT_DIR_RTL) x = right - (x - left); move_and_update_window (range->slider, x, GTK_WIDGET (range)->style->ythickness); @@ -526,7 +526,7 @@ gtk_range_default_htrough_click (GtkRange *range, gdk_window_get_size (range->slider, &slider_length, NULL); right += slider_length; - if (range->flippable && gtk_widget_get_direction (range) == GTK_TEXT_DIR_RTL) + if (range->flippable && gtk_widget_get_direction (GTK_WIDGET (range)) == GTK_TEXT_DIR_RTL) x = (right - x) + left; if ((x > left) && (y > ythickness)) @@ -613,8 +613,6 @@ gtk_range_default_hmotion (GtkRange *range, g_return_if_fail (GTK_IS_RANGE (range)); g_return_if_fail (GTK_WIDGET_REALIZED (range)); - range = GTK_RANGE (range); - gdk_window_get_position (range->slider, &slider_x, &slider_y); gtk_range_trough_hdims (range, &left, &right); @@ -623,7 +621,7 @@ gtk_range_default_hmotion (GtkRange *range, new_pos = slider_x + xdelta; - if (range->flippable && gtk_widget_get_direction (range) == GTK_TEXT_DIR_RTL) + if (range->flippable && gtk_widget_get_direction (GTK_WIDGET (range)) == GTK_TEXT_DIR_RTL) new_pos = (right - new_pos) + left; if (new_pos < left) @@ -919,23 +917,37 @@ gtk_range_button_press (GtkWidget *widget, range->click_child = RANGE_CLASS (range)->slider; range->scroll_type = GTK_SCROLL_NONE; } - else if (event->window == range->step_forw) + else if (event->window == range->step_forw || + event->window == range->step_back) { - range->click_child = RANGE_CLASS (range)->step_forw; - range->scroll_type = GTK_SCROLL_STEP_FORWARD; + gboolean back = (event->window == range->step_back); + + if (range->button == 3) + { + range->scroll_type = GTK_SCROLL_JUMP; + gtk_range_scroll (range, back ? 0.0 : 1.0); + } + else + { + range->click_child = + back ? RANGE_CLASS (range)->step_back + : RANGE_CLASS (range)->step_forw; - gtk_range_scroll (range, -1); - gtk_range_add_timer (range); - gtk_range_draw_step_forw (range); - } - else if (event->window == range->step_back) - { - range->click_child = RANGE_CLASS (range)->step_back; - range->scroll_type = GTK_SCROLL_STEP_BACKWARD; + if (range->button == 2) + range->scroll_type = + back ? GTK_SCROLL_PAGE_BACKWARD : GTK_SCROLL_PAGE_FORWARD; + else + range->scroll_type = + back ? GTK_SCROLL_STEP_BACKWARD : GTK_SCROLL_STEP_FORWARD; - gtk_range_scroll (range, -1); - gtk_range_add_timer (range); - gtk_range_draw_step_back (range); + gtk_range_scroll (range, -1); + gtk_range_add_timer (range); + + if (back) + gtk_range_draw_step_back (range); + else + gtk_range_draw_step_forw (range); + } } }