X-Git-Url: https://git.artsoft.org/?p=rocksndiamonds.git;a=blobdiff_plain;f=src%2Flibgame%2Fgadgets.c;h=b21ecdca09607e9afb25eb4dec7f1fb8ad302e19;hp=6200c9dc3da22291d19e086f1c5acdf99685e4d4;hb=1477a6b1b3a60b5a3b5ef82eb1e61b7df0984249;hpb=2176d1de29652bc9e8db1baa283fdc1c4e99e674 diff --git a/src/libgame/gadgets.c b/src/libgame/gadgets.c index 6200c9dc..b21ecdca 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) { @@ -221,15 +231,24 @@ static void DrawGadget(struct GadgetInfo *gi, boolean pressed, boolean direct) case GD_TYPE_NORMAL_BUTTON: case GD_TYPE_CHECK_BUTTON: case GD_TYPE_RADIO_BUTTON: + BlitBitmapOnBackground(gd->bitmap, drawto, gd->x, gd->y, gi->width, gi->height, gi->x, gi->y); + if (gi->deco.design.bitmap) + { + // make sure that decoration does not overlap gadget border + int deco_x = gi->deco.x + (pressed ? gi->deco.xshift : 0); + int deco_y = gi->deco.y + (pressed ? gi->deco.yshift : 0); + int deco_width = MIN(gi->deco.width, gi->width - deco_x); + int deco_height = MIN(gi->deco.height, gi->height - deco_y); + BlitBitmap(gi->deco.design.bitmap, drawto, gi->deco.design.x, gi->deco.design.y, - gi->deco.width, gi->deco.height, - gi->x + gi->deco.x + (pressed ? gi->deco.xshift : 0), - gi->y + gi->deco.y + (pressed ? gi->deco.yshift : 0)); + deco_width, deco_height, gi->x + deco_x, gi->y + deco_y); + } + break; case GD_TYPE_TEXT_BUTTON: @@ -1779,7 +1798,7 @@ boolean HandleGadgets(int mx, int my, int button) { boolean scroll_single_step = ((GetKeyModState() & KMOD_Alt) != 0); - item_steps = (scroll_single_step ? 1 : DEFAULT_WHEEL_STEPS); + item_steps = (scroll_single_step ? 1 : wheel_steps); item_direction = (button == MB_WHEEL_UP || button == MB_WHEEL_LEFT ? -1 : +1); }