Skip to content

Commit 942c2f1

Browse files
committed
Fix keyboard input being swallowed due to missing events such as SDL_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.
1 parent 9cacfc5 commit 942c2f1

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

lib/framework/frame.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@
3535
#include "frameint.h"
3636
#include "frameresource.h"
3737
#include "input.h"
38+
#include "lib/widget/scrap.h"
3839
#include "SDL_framerate.h"
3940
#include "physfs_ext.h"
4041

@@ -260,6 +261,9 @@ bool frameInitialise(
260261
/* Initialise the input system */
261262
inputInitialise();
262263

264+
// Initialise clipboard stuff.
265+
init_scrap();
266+
263267
/* Initialise the frame rate stuff */
264268
InitFrameStuff();
265269

lib/widget/editbox.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -114,8 +114,6 @@ W_EDITBOX* editBoxCreate(const W_EDBINIT* psInit)
114114

115115
psWidget->blinkOffset = SDL_GetTicks();
116116

117-
init_scrap();
118-
119117
return psWidget;
120118
}
121119

0 commit comments

Comments
 (0)