mirror of
https://git.code.sf.net/p/quake/quake2forge
synced 2024-12-12 13:42:21 +00:00
- Don't need the extra comparision, the switch statement has
already done it. (Closes: #23)
This commit is contained in:
parent
a3b38df57f
commit
315b13e4fd
1 changed files with 6 additions and 3 deletions
|
@ -928,7 +928,10 @@ int XLateKey(XKeyEvent *ev)
|
||||||
/* Check to see if this is a repeated key.
|
/* Check to see if this is a repeated key.
|
||||||
* (shamelessly lifted from icculus quake2 who
|
* (shamelessly lifted from icculus quake2 who
|
||||||
* shamelessly lifted from SDL who
|
* shamelessly lifted from SDL who
|
||||||
* shamelessly lifted from GII -- thanks guys! :) */
|
* shamelessly lifted from GII -- thanks guys! :)
|
||||||
|
*
|
||||||
|
* This has bugs if two keys are being pressed simultaneously and the events
|
||||||
|
* start getting interleaved */
|
||||||
int X11_KeyRepeat(Display * dpy, XEvent * evt) {
|
int X11_KeyRepeat(Display * dpy, XEvent * evt) {
|
||||||
XEvent peekevt;
|
XEvent peekevt;
|
||||||
int repeated = 0;
|
int repeated = 0;
|
||||||
|
@ -961,12 +964,12 @@ void HandleEvents(void)
|
||||||
case KeyPress:
|
case KeyPress:
|
||||||
myxtime = event.xkey.time;
|
myxtime = event.xkey.time;
|
||||||
if (in_state && in_state->Key_Event_fp)
|
if (in_state && in_state->Key_Event_fp)
|
||||||
in_state->Key_Event_fp(XLateKey(&event.xkey), event.type == KeyPress);
|
in_state->Key_Event_fp(XLateKey(&event.xkey), true);
|
||||||
break;
|
break;
|
||||||
case KeyRelease:
|
case KeyRelease:
|
||||||
if (!X11_KeyRepeat(dpy, &event)) {
|
if (!X11_KeyRepeat(dpy, &event)) {
|
||||||
if (in_state && in_state->Key_Event_fp)
|
if (in_state && in_state->Key_Event_fp)
|
||||||
in_state->Key_Event_fp (XLateKey(&event.xkey), event.type == KeyPress);
|
in_state->Key_Event_fp(XLateKey(&event.xkey), false);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue