From: Holger Schemel Date: Sat, 29 Sep 2018 08:20:41 +0000 (+0200) Subject: changed setting cursor when automatically activating text input gadgets X-Git-Tag: 4.1.1.0~24 X-Git-Url: https://git.artsoft.org/?a=commitdiff_plain;h=f7b47bbe40b05bc4d815f94dd1bcdc21596d4ff5;p=rocksndiamonds.git changed setting cursor when automatically activating text input gadgets When activating text input gadgets using function "ClickOnGadget()", do not set the cursor position at the start, but at the end of the text in the gadget. --- diff --git a/src/libgame/gadgets.c b/src/libgame/gadgets.c index 4cf008fc..64f0e0a9 100644 --- a/src/libgame/gadgets.c +++ b/src/libgame/gadgets.c @@ -1494,11 +1494,18 @@ void ClickOnGadget(struct GadgetInfo *gi, int button) if (button_status) HandleGadgets(-1, -1, 0); + int x = gi->x; + int y = gi->y; + + /* set cursor position to the end of the text for text input gadgets */ + if (gi->type & GD_TYPE_TEXT_INPUT) + x = gi->x + gi->width - 1; + /* simulate pressing mouse button over specified gadget */ - HandleGadgets(gi->x, gi->y, button); + HandleGadgets(x, y, button); /* simulate releasing mouse button over specified gadget */ - HandleGadgets(gi->x, gi->y, 0); + HandleGadgets(x, y, 0); } boolean HandleGadgets(int mx, int my, int button)