mirror of
https://github.com/yquake2/yquake2remaster.git
synced 2024-11-26 06:20:48 +00:00
Revert "Fix duplicate menu key keyboard entries"
This reverts commit 2180ca6c40
.
This commit is contained in:
parent
2180ca6c40
commit
ef456964e3
3 changed files with 87 additions and 78 deletions
|
@ -360,6 +360,7 @@ Key_Console(int key)
|
|||
case K_KP_HOME:
|
||||
case K_KP_UPARROW:
|
||||
case K_KP_PGUP:
|
||||
case K_KP_LEFTARROW:
|
||||
case K_KP_5:
|
||||
case K_KP_RIGHTARROW:
|
||||
case K_KP_END:
|
||||
|
|
|
@ -669,28 +669,6 @@ IN_Update(void)
|
|||
// fallback to scancodes if we don't know the keycode
|
||||
key = IN_TranslateScancodeToQ2Key(sc);
|
||||
}
|
||||
|
||||
// normal character events
|
||||
if ((event.key.keysym.mod & KMOD_NUM) == KMOD_NUM)
|
||||
{
|
||||
switch (key)
|
||||
{
|
||||
case K_KP_HOME:
|
||||
case K_KP_UPARROW:
|
||||
case K_KP_PGUP:
|
||||
case K_KP_LEFTARROW:
|
||||
case K_KP_5:
|
||||
case K_KP_RIGHTARROW:
|
||||
case K_KP_END:
|
||||
case K_KP_DOWNARROW:
|
||||
case K_KP_PGDN:
|
||||
case K_KP_INS:
|
||||
case K_KP_DEL:
|
||||
key = 0;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if(key != 0)
|
||||
{
|
||||
Key_Event(key, down, true);
|
||||
|
|
|
@ -223,35 +223,67 @@ extern int keydown[];
|
|||
qboolean
|
||||
Field_Key(menufield_s *f, int key)
|
||||
{
|
||||
/*
|
||||
* Ignore keypad in field to prevent duplicate
|
||||
* entries through key presses processed as a
|
||||
* normal char event and additionally as key
|
||||
* event.
|
||||
*/
|
||||
switch (key)
|
||||
{
|
||||
case K_KP_SLASH:
|
||||
key = '/';
|
||||
break;
|
||||
case K_KP_MINUS:
|
||||
key = '-';
|
||||
break;
|
||||
case K_KP_PLUS:
|
||||
key = '+';
|
||||
break;
|
||||
case K_KP_HOME:
|
||||
key = '7';
|
||||
break;
|
||||
case K_KP_UPARROW:
|
||||
key = '8';
|
||||
break;
|
||||
case K_KP_PGUP:
|
||||
key = '9';
|
||||
break;
|
||||
case K_KP_LEFTARROW:
|
||||
key = '4';
|
||||
break;
|
||||
case K_KP_5:
|
||||
key = '5';
|
||||
break;
|
||||
case K_KP_RIGHTARROW:
|
||||
key = '6';
|
||||
break;
|
||||
case K_KP_END:
|
||||
key = '1';
|
||||
break;
|
||||
case K_KP_DOWNARROW:
|
||||
key = '2';
|
||||
break;
|
||||
case K_KP_PGDN:
|
||||
key = '3';
|
||||
break;
|
||||
case K_KP_INS:
|
||||
key = '0';
|
||||
break;
|
||||
case K_KP_DEL:
|
||||
key = '.';
|
||||
break;
|
||||
}
|
||||
|
||||
if ((key == K_BACKSPACE) || (key == K_LEFTARROW) || (key == K_KP_LEFTARROW))
|
||||
if (key > 127)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
switch (key)
|
||||
{
|
||||
case K_KP_LEFTARROW:
|
||||
case K_LEFTARROW:
|
||||
case K_BACKSPACE:
|
||||
|
||||
if (f->cursor > 0)
|
||||
{
|
||||
memmove(&f->buffer[f->cursor - 1], &f->buffer[f->cursor],
|
||||
memmove(&f->buffer[f->cursor - 1],
|
||||
&f->buffer[f->cursor],
|
||||
strlen(&f->buffer[f->cursor]) + 1);
|
||||
f->cursor--;
|
||||
|
||||
|
@ -261,25 +293,22 @@ Field_Key(menufield_s *f, int key)
|
|||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
break;
|
||||
|
||||
if ((key == K_DEL) || (key == K_KP_DEL))
|
||||
{
|
||||
case K_KP_DEL:
|
||||
case K_DEL:
|
||||
memmove(&f->buffer[f->cursor], &f->buffer[f->cursor + 1],
|
||||
strlen(&f->buffer[f->cursor + 1]) + 1);
|
||||
return true;
|
||||
}
|
||||
break;
|
||||
|
||||
if (key == K_ENTER || key == K_KP_ENTER || key == K_ESCAPE || key == K_TAB)
|
||||
{
|
||||
case K_KP_ENTER:
|
||||
case K_ENTER:
|
||||
case K_ESCAPE:
|
||||
case K_TAB:
|
||||
return false;
|
||||
}
|
||||
|
||||
if ((key < 32) || (key > 127))
|
||||
{
|
||||
return false; /* non printable character */
|
||||
}
|
||||
case K_SPACE:
|
||||
default:
|
||||
|
||||
if (!isdigit(key) && (f->generic.flags & QMF_NUMBERSONLY))
|
||||
{
|
||||
|
@ -296,6 +325,7 @@ Field_Key(menufield_s *f, int key)
|
|||
f->visible_offset++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue