Skip to content

Commit

Permalink
Fix keyboard input being swallowed due to missing events such as SDL_…
Browse files Browse the repository at this point in the history
…KEYUP.

This is due to a seemingly undocumented bug and/or feature in SDL, where SDL_EventState and SDL_SetEventFilter mysteriously discard all pending events.

The following SDL code in SDL_EventState and SDL_SetEventFilter discards all pending events, with a comment saying it does so:
    while ( SDL_PollEvent(&bitbucket) > 0 )
        ;
There appears to be no documentation of this fact anywhere outside the comment in the SDL code.

I am not aware of any logical reason why enabling events with SDL_EventState should cause less events to be received than otherwise.
  • Loading branch information
Cyp committed Jan 17, 2011
1 parent 9cacfc5 commit 942c2f1
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
4 changes: 4 additions & 0 deletions lib/framework/frame.c
Expand Up @@ -35,6 +35,7 @@
#include "frameint.h"
#include "frameresource.h"
#include "input.h"
#include "lib/widget/scrap.h"
#include "SDL_framerate.h"
#include "physfs_ext.h"

Expand Down Expand Up @@ -260,6 +261,9 @@ bool frameInitialise(
/* Initialise the input system */
inputInitialise();

// Initialise clipboard stuff.
init_scrap();

/* Initialise the frame rate stuff */
InitFrameStuff();

Expand Down
2 changes: 0 additions & 2 deletions lib/widget/editbox.c
Expand Up @@ -114,8 +114,6 @@ W_EDITBOX* editBoxCreate(const W_EDBINIT* psInit)

psWidget->blinkOffset = SDL_GetTicks();

init_scrap();

return psWidget;
}

Expand Down

0 comments on commit 942c2f1

Please sign in to comment.