From: Holger Schemel Date: Fri, 17 Jun 2016 18:34:34 +0000 (+0200) Subject: added scrolling any scrollbars under the mouse pointer with mouse wheel X-Git-Tag: 4.0.0.0-rc3~1 X-Git-Url: https://git.artsoft.org/?a=commitdiff_plain;h=791c71ebdff49bada6e1becaca5482af8804d645;p=rocksndiamonds.git added scrolling any scrollbars under the mouse pointer with mouse wheel --- 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) {