From 791c71ebdff49bada6e1becaca5482af8804d645 Mon Sep 17 00:00:00 2001 From: Holger Schemel Date: Fri, 17 Jun 2016 20:34:34 +0200 Subject: [PATCH] added scrolling any scrollbars under the mouse pointer with mouse wheel --- src/libgame/gadgets.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/libgame/gadgets.c b/src/libgame/gadgets.c index 1a0da4b4..75d0a855 100644 --- a/src/libgame/gadgets.c +++ b/src/libgame/gadgets.c @@ -96,6 +96,16 @@ static struct GadgetInfo *getGadgetInfoFromMousePosition(int mx, int my, boolean check_horizontal = (IS_WHEEL_BUTTON_HORIZONTAL(button) || GetKeyModState() & KMOD_Shift); + /* check for the first active scrollbar directly under the mouse pointer */ + for (gi = gadget_list_first_entry; gi != NULL; gi = gi->next) + { + if (gi->mapped && gi->active && + (gi->type & GD_TYPE_SCROLLBAR) && + mx >= gi->x && mx < gi->x + gi->width && + my >= gi->y && my < gi->y + gi->height) + return gi; + } + /* check for the first active scrollbar with matching mouse wheel area */ for (gi = gadget_list_first_entry; gi != NULL; gi = gi->next) { -- 2.34.1