mirror of
https://github.com/ZDoom/gzdoom.git
synced 2024-11-22 20:21:26 +00:00
- D_ProcessEvents()
: Delay EV_KeyUp
events until any EV_KeyDown
events for the corresponding key have been processed. This makes the mouse under SDL a lot better.
This commit is contained in:
parent
312b5ce66e
commit
c4f7760ab2
1 changed files with 17 additions and 3 deletions
|
@ -67,11 +67,20 @@ CVAR(Bool, m_filter, false, CVAR_ARCHIVE | CVAR_GLOBALCONFIG)
|
|||
|
||||
void D_ProcessEvents (void)
|
||||
{
|
||||
event_t *ev;
|
||||
bool keywasdown[NUM_KEYS] = { false };
|
||||
TArray<event_t*> delayedevents;
|
||||
|
||||
while (eventtail != eventhead)
|
||||
{
|
||||
ev = &events[eventtail];
|
||||
event_t *ev = &events[eventtail];
|
||||
eventtail = (eventtail + 1) & (MAXEVENTS - 1);
|
||||
|
||||
if (ev->type == EV_KeyUp && keywasdown[ev->data1])
|
||||
{
|
||||
delayedevents.Push(ev);
|
||||
continue;
|
||||
}
|
||||
|
||||
if (ev->type == EV_None)
|
||||
continue;
|
||||
if (ev->type == EV_DeviceChange)
|
||||
|
@ -85,7 +94,12 @@ void D_ProcessEvents (void)
|
|||
continue; // menu ate the event
|
||||
}
|
||||
|
||||
G_Responder (ev);
|
||||
keywasdown[ev->data1] = G_Responder(ev) && ev->type == EV_KeyDown;
|
||||
}
|
||||
|
||||
for (auto& ev: delayedevents)
|
||||
{
|
||||
D_PostEvent(ev);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue