X-Git-Url: https://git.artsoft.org/?p=rocksndiamonds.git;a=blobdiff_plain;f=src%2Flibgame%2Fgadgets.c;h=e939f865a5ace5063ea78374a2b0b69c657c5758;hp=c7c9ff182dd5b877711fa580683cf462e69ef698;hb=d109a83b1b41088e536efa0788d5cb33382bbe18;hpb=00e3ab259639fb01724dfc0f0bb96e06f54494e8 diff --git a/src/libgame/gadgets.c b/src/libgame/gadgets.c index c7c9ff18..e939f865 100644 --- a/src/libgame/gadgets.c +++ b/src/libgame/gadgets.c @@ -73,18 +73,17 @@ static struct GadgetInfo *getGadgetInfoFromMousePosition(int mx, int my, /* first check for scrollbars in case of mouse scroll wheel button events */ if (button == 4 || button == 5) { -#if 0 - printf("WHOA! SCROLL WHEEL DETECTED [%d]\n", button); -#endif - + /* check for the first active scrollbar with matching mouse wheel area */ for (gi = gadget_list_first_entry; gi != NULL; gi = gi->next) { if (gi->mapped && gi->active && - gi->type & GD_TYPE_SCROLLBAR) + gi->type & GD_TYPE_SCROLLBAR && + mx >= gi->wheelarea.x && mx < gi->wheelarea.x + gi->wheelarea.width && + my >= gi->wheelarea.y && my < gi->wheelarea.y + gi->wheelarea.height) return gi; } - /* no active scrollbar found -- ignore this button event */ + /* no active scrollbar found -- ignore this scroll wheel button event */ return NULL; } @@ -995,6 +994,22 @@ static void HandleGadgetTags(struct GadgetInfo *gi, int first_tag, va_list ap) gi->scrollbar.item_position = va_arg(ap, int); break; + case GDI_WHEEL_AREA_X: + gi->wheelarea.x = va_arg(ap, int); + break; + + case GDI_WHEEL_AREA_Y: + gi->wheelarea.y = va_arg(ap, int); + break; + + case GDI_WHEEL_AREA_WIDTH: + gi->wheelarea.width = va_arg(ap, int); + break; + + case GDI_WHEEL_AREA_HEIGHT: + gi->wheelarea.height = va_arg(ap, int); + break; + case GDI_CALLBACK_INFO: gi->callback_info = va_arg(ap, gadget_function); break;