mirror of
https://github.com/libretro/RetroArch
synced 2025-03-28 08:37:41 +00:00
(SDL2) Attempt to fix missing events issue
This commit is contained in:
parent
f53b67aab7
commit
0e5305b10f
@ -473,7 +473,9 @@ error:
|
||||
static void check_window(sdl2_video_t *vid)
|
||||
{
|
||||
SDL_Event event;
|
||||
while (SDL_PollEvent(&event))
|
||||
|
||||
SDL_PumpEvents();
|
||||
while (SDL_PeepEvents(&event, 1, SDL_GETEVENT, SDL_QUIT, SDL_WINDOWEVENT) > 0)
|
||||
{
|
||||
switch (event.type)
|
||||
{
|
||||
@ -482,12 +484,8 @@ static void check_window(sdl2_video_t *vid)
|
||||
break;
|
||||
|
||||
case SDL_WINDOWEVENT:
|
||||
switch (event.window.event)
|
||||
{
|
||||
case SDL_WINDOWEVENT_RESIZED:
|
||||
vid->should_resize = true;
|
||||
break;
|
||||
}
|
||||
if (event.window.event == SDL_WINDOWEVENT_RESIZED)
|
||||
vid->should_resize = true;
|
||||
break;
|
||||
|
||||
default:
|
||||
|
@ -224,8 +224,7 @@ static void sdl2_input_free(void *data)
|
||||
return;
|
||||
|
||||
// Flush out all pending events.
|
||||
SDL_Event event;
|
||||
while (SDL_PollEvent(&event));
|
||||
SDL_FlushEvents(SDL_FIRSTEVENT, SDL_LASTEVENT);
|
||||
|
||||
sdl2_input_t *sdl = (sdl2_input_t*)data;
|
||||
|
||||
@ -268,7 +267,8 @@ static void sdl2_input_poll(void *data)
|
||||
|
||||
SDL_Event event;
|
||||
|
||||
while (SDL_PollEvent(&event))
|
||||
SDL_PumpEvents();
|
||||
while (SDL_PeepEvents(&event, 1, SDL_GETEVENT, SDL_MOUSEWHEEL, SDL_MOUSEWHEEL) > 0)
|
||||
{
|
||||
if (event.type == SDL_MOUSEWHEEL)
|
||||
{
|
||||
|
@ -113,6 +113,8 @@ static bool sdl2_joypad_init(void)
|
||||
return false;
|
||||
}
|
||||
|
||||
SDL_JoystickEventState(SDL_ENABLE);
|
||||
|
||||
// TODO: Add SDL_GameController support.
|
||||
// if (SDL_Init(SDL_INIT_GAMECONTROLLER) < 0)
|
||||
// RARCH_LOG("[SDL]: Failed to initialize game controller interface: %s\n",
|
||||
@ -222,10 +224,10 @@ static int16_t sdl2_joypad_axis(unsigned port, uint32_t joyaxis)
|
||||
|
||||
static void sdl2_joypad_poll(void)
|
||||
{
|
||||
// SDL_JoystickUpdate();
|
||||
SDL_Event event;
|
||||
|
||||
while (SDL_PollEvent(&event))
|
||||
SDL_PumpEvents();
|
||||
while (SDL_PeepEvents(&event, 1, SDL_GETEVENT, SDL_JOYDEVICEADDED, SDL_JOYDEVICEREMOVED) > 0)
|
||||
{
|
||||
if (event.type == SDL_JOYDEVICEADDED)
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user