projects
/
rocksndiamonds.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
318d83c
)
added deactivating text (and selectbox) gadgets with "Escape" key
author
Holger Schemel
<info@artsoft.org>
Fri, 16 Nov 2018 20:52:26 +0000
(21:52 +0100)
committer
Holger Schemel
<info@artsoft.org>
Fri, 16 Nov 2018 20:53:05 +0000
(21:53 +0100)
src/libgame/gadgets.c
patch
|
blob
|
history
diff --git
a/src/libgame/gadgets.c
b/src/libgame/gadgets.c
index 4b237b88d416c0e096581b0abb4d280dd4927e69..0295eec69a48d1b4cabfb4d08c44fe76bc4d1519 100644
(file)
--- a/
src/libgame/gadgets.c
+++ b/
src/libgame/gadgets.c
@@
-2117,7
+2117,18
@@
boolean HandleGadgetsKeyInput(Key key)
if (key == KSYM_Escape)
{
- StopTextInput();
+ if (anyTextGadgetActive())
+ {
+ // restore previous text (before activating text gadget)
+ if (gi->type & GD_TYPE_TEXT_INPUT)
+ strcpy(gi->textinput.value, gi->textinput.last_value);
+
+ DrawGadget(gi, DG_UNPRESSED, gi->direct_draw);
+
+ last_gi = NULL;
+
+ StopTextInput();
+ }
}
else if (key == KSYM_Return) // valid for both text input and selectbox
{