Feat[input]: send mouse position events before all other events

This commit is contained in:
artdeell 2024-04-05 12:10:20 -04:00 committed by Maksim Belov
parent 93cf884d8b
commit b876d3c3a5

View File

@ -104,6 +104,13 @@ void pojavPumpEvents(void* window) {
// by spec, they will be called on the same thread so no synchronization here
pojav_environ->isPumpingEvents = true;
if((pojav_environ->cLastX != pojav_environ->cursorX || pojav_environ->cLastY != pojav_environ->cursorY) && pojav_environ->GLFW_invoke_CursorPos) {
pojav_environ->cLastX = pojav_environ->cursorX;
pojav_environ->cLastY = pojav_environ->cursorY;
pojav_environ->GLFW_invoke_CursorPos(window, floor(pojav_environ->cursorX),
floor(pojav_environ->cursorY));
}
size_t index = pojav_environ->outEventIndex;
size_t targetIndex = pojav_environ->outTargetIndex;
@ -139,12 +146,6 @@ void pojavPumpEvents(void* window) {
if (index >= EVENT_WINDOW_SIZE)
index -= EVENT_WINDOW_SIZE;
}
if((pojav_environ->cLastX != pojav_environ->cursorX || pojav_environ->cLastY != pojav_environ->cursorY) && pojav_environ->GLFW_invoke_CursorPos) {
pojav_environ->cLastX = pojav_environ->cursorX;
pojav_environ->cLastY = pojav_environ->cursorY;
pojav_environ->GLFW_invoke_CursorPos(window, floor(pojav_environ->cursorX),
floor(pojav_environ->cursorY));
}
// The out target index is updated by the rewinder
pojav_environ->isPumpingEvents = false;