X-Git-Url: https://git.artsoft.org/?a=blobdiff_plain;f=src%2Flibgame%2Fgadgets.c;h=a797c75475a1a9b41bf9f6cb2e25a79a67f5f406;hb=e9b47ffa7a91cd2a2317b3d5db85165b64e2f74c;hp=6b7d2592f435849b3bd8fb0f8798227278a18ca7;hpb=1f8b87db45242885f00440d4ca5a06f00afdb3ef;p=rocksndiamonds.git diff --git a/src/libgame/gadgets.c b/src/libgame/gadgets.c index 6b7d2592..a797c754 100644 --- a/src/libgame/gadgets.c +++ b/src/libgame/gadgets.c @@ -1481,7 +1481,7 @@ static boolean insideSelectboxArea(struct GadgetInfo *gi, int mx, int my) void ClickOnGadget(struct GadgetInfo *gi, int button) { - if (!gi->mapped) + if (gi == NULL || gi->deactivated || !gi->mapped) return; /* simulate releasing mouse button over last gadget, if still pressed */ @@ -1681,16 +1681,20 @@ boolean HandleGadgets(int mx, int my, int button) { int last_x = gi->event.x; int last_y = gi->event.y; + int last_mx = gi->event.mx; + int last_my = gi->event.my; - gi->event.x = mx - gi->x; - gi->event.y = my - gi->y; + gi->event.x = gi->event.mx = mx - gi->x; + gi->event.y = gi->event.my = my - gi->y; if (gi->type == GD_TYPE_DRAWING_AREA) { gi->event.x /= gi->drawing.item_xsize; gi->event.y /= gi->drawing.item_ysize; - if (last_x != gi->event.x || last_y != gi->event.y) + if (last_x != gi->event.x || last_y != gi->event.y || + ((last_mx != gi->event.mx || last_my != gi->event.my) && + gi->event_mask & GD_EVENT_PIXEL_PRECISE)) changed_position = TRUE; } else if (gi->type & GD_TYPE_TEXT_INPUT && button != 0 && !motion_status)