From 8cb728ab7f7dfd4160b13c6846feefa9d547a9fb Mon Sep 17 00:00:00 2001 From: Michael Jennings Date: Fri, 21 Jan 2000 20:53:49 +0000 Subject: [PATCH] Fri Jan 21 12:52:26 PST 2000 Michael Jennings Fixed an off-by-one error in the scrollbar click-handling pointed out by Malcolm Tredinnick . SVN revision: 1958 --- ChangeLog | 6 ++++++ src/scrollbar.c | 3 +-- src/scrollbar.h | 4 ++-- 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/ChangeLog b/ChangeLog index e835838..768a785 100644 --- a/ChangeLog +++ b/ChangeLog @@ -3072,3 +3072,9 @@ Tue Jan 18 21:17:24 PST 2000 Michael Jennings menus. Also added arrows for submenus. ------------------------------------------------------------------------------- +Fri Jan 21 12:52:26 PST 2000 Michael Jennings + + Fixed an off-by-one error in the scrollbar click-handling pointed out + by Malcolm Tredinnick . + +------------------------------------------------------------------------------- diff --git a/src/scrollbar.c b/src/scrollbar.c index 1cab3de..fb40849 100644 --- a/src/scrollbar.c +++ b/src/scrollbar.c @@ -252,10 +252,9 @@ sb_handle_button_press(event_t * ev) break; case Button1: - button_state.mouse_offset = MAX(ev->xbutton.y, 1); + button_state.mouse_offset = ((scrollbar_win_is_anchor(ev->xany.window)) ? (MAX(ev->xbutton.y, 1)) : (1)); /* drop */ case Button3: - D_SCROLLBAR((" -> Scrollbar type is %u\n", scrollbar_get_type())); #if defined(MOTIF_SCROLLBAR) || defined(NEXT_SCROLLBAR) if (scrollbar.type == SCROLLBAR_MOTIF || scrollbar.type == SCROLLBAR_NEXT) { if (scrollbar_is_above_anchor(ev->xany.window, ev->xbutton.y)) { diff --git a/src/scrollbar.h b/src/scrollbar.h index 6475e02..78aaa11 100644 --- a/src/scrollbar.h +++ b/src/scrollbar.h @@ -76,8 +76,8 @@ #define scrollbar_arrow_height() (scrollbar.width) /* Scrollbar positions */ -#define scrollbar_is_above_anchor(w, y) (!scrollbar_win_is_anchor(w) && ((y) < scrollbar.anchor_top)) -#define scrollbar_is_below_anchor(w, y) (!scrollbar_win_is_anchor(w) && ((y) > scrollbar.anchor_bottom)) +#define scrollbar_is_above_anchor(w, y) (!scrollbar_win_is_anchor(w) && ((y) <= scrollbar.anchor_top)) +#define scrollbar_is_below_anchor(w, y) (!scrollbar_win_is_anchor(w) && ((y) >= scrollbar.anchor_bottom)) #define scrollbar_position(y) ((y) - scrollbar.scrollarea_start) #define scrollbar_up_loc() (scrollbar.up_arrow_loc) #define scrollbar_dn_loc() (scrollbar.down_arrow_loc)