projects
/
rocksndiamonds.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
fixed bug with text input gadgets when pressing "Escape" key
[rocksndiamonds.git]
/
src
/
libgame
/
gadgets.c
diff --git
a/src/libgame/gadgets.c
b/src/libgame/gadgets.c
index 3ac1f9d55fdc5c100d29409e7fd244f367e66f94..f84815b0effb46f94ab5bc4f399e6a84f7864b73 100644
(file)
--- a/
src/libgame/gadgets.c
+++ b/
src/libgame/gadgets.c
@@
-78,7
+78,7
@@
static int getNewGadgetID(void)
}
if (next_free_gadget_id <= 0) // cannot get new gadget id
}
if (next_free_gadget_id <= 0) // cannot get new gadget id
-
Error(ERR_EXIT,
"too much gadgets -- this should not happen");
+
Fail(
"too much gadgets -- this should not happen");
return id;
}
return id;
}
@@
-1207,7
+1207,7
@@
static void HandleGadgetTags(struct GadgetInfo *gi, int first_tag, va_list ap)
break;
default:
break;
default:
-
Error(ERR_EXIT,
"HandleGadgetTags(): unknown tag %d", tag);
+
Fail(
"HandleGadgetTags(): unknown tag %d", tag);
}
tag = va_arg(ap, int); // read next tag
}
tag = va_arg(ap, int); // read next tag
@@
-1268,7
+1268,7
@@
static void HandleGadgetTags(struct GadgetInfo *gi, int first_tag, va_list ap)
gi->height = 2 * border_ysize + font_height;
if (gi->selectbox.options == NULL)
gi->height = 2 * border_ysize + font_height;
if (gi->selectbox.options == NULL)
-
Error(ERR_EXIT,
"selectbox gadget incomplete (missing options array)");
+
Fail(
"selectbox gadget incomplete (missing options array)");
gi->selectbox.num_values = 0;
while (gi->selectbox.options[gi->selectbox.num_values].text != NULL)
gi->selectbox.num_values = 0;
while (gi->selectbox.options[gi->selectbox.num_values].text != NULL)
@@
-1330,7
+1330,7
@@
static void HandleGadgetTags(struct GadgetInfo *gi, int first_tag, va_list ap)
if (gi->width == 0 || gi->height == 0 ||
gs->items_max == 0 || gs->items_visible == 0)
if (gi->width == 0 || gi->height == 0 ||
gs->items_max == 0 || gs->items_visible == 0)
-
Error(ERR_EXIT,
"scrollbar gadget incomplete (missing tags)");
+
Fail(
"scrollbar gadget incomplete (missing tags)");
// calculate internal scrollbar values
gs->size_min = (gi->type == GD_TYPE_SCROLLBAR_VERTICAL ?
// calculate internal scrollbar values
gs->size_min = (gi->type == GD_TYPE_SCROLLBAR_VERTICAL ?
@@
-2230,8
+2230,12
@@
boolean HandleGadgetsKeyInput(Key key)
{
// restore previous text (before activating text gadget)
if (gi->type & GD_TYPE_TEXT_INPUT)
{
// restore previous text (before activating text gadget)
if (gi->type & GD_TYPE_TEXT_INPUT)
+ {
strcpy(gi->textinput.value, gi->textinput.last_value);
strcpy(gi->textinput.value, gi->textinput.last_value);
+ CheckRangeOfNumericInputGadget(gi);
+ }
+
DrawGadget(gi, DG_UNPRESSED, gi->direct_draw);
last_gi = NULL;
DrawGadget(gi, DG_UNPRESSED, gi->direct_draw);
last_gi = NULL;