From fcb872cff7bb842e36656d1851a5cd98556a71e6 Mon Sep 17 00:00:00 2001 From: Alexander Batalov Date: Mon, 27 Feb 2023 10:42:55 +0300 Subject: [PATCH] Fix mouse events processing (#55) --- src/plib/gnw/dxinput.cc | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/plib/gnw/dxinput.cc b/src/plib/gnw/dxinput.cc index ffd0e69..b696527 100644 --- a/src/plib/gnw/dxinput.cc +++ b/src/plib/gnw/dxinput.cc @@ -76,6 +76,14 @@ bool dxinput_unacquire_mouse() // 0x4E053C bool dxinput_get_mouse_state(MouseData* mouseState) { + // CE: This function is sometimes called outside loops calling `get_input` + // and subsequently `GNW95_process_message`, so mouse events might not be + // handled by SDL yet. + // + // TODO: Move mouse events processing into `GNW95_process_message` and + // update mouse position manually. + SDL_PumpEvents(); + if (gLastInputType == INPUT_TYPE_TOUCH) { mouseState->x = gTouchMouseDeltaX; mouseState->y = gTouchMouseDeltaY;