mirror of
https://github.com/2009scape/2009Scape-mobile.git
synced 2026-08-01 14:19:12 -06:00
Prevent calls to pojavPumpEvents until the loop is finished
Should fix sticky keys and fastload
This commit is contained in:
parent
fbb43319f6
commit
76494960da
2 changed files with 6 additions and 1 deletions
|
|
@ -49,7 +49,7 @@ struct pojav_environ_s {
|
|||
JavaVM* dalvikJavaVMPtr;
|
||||
JNIEnv* dalvikJNIEnvPtr_ANDROID;
|
||||
long showingWindow;
|
||||
bool isInputReady, isCursorEntered, isUseStackQueueCall;
|
||||
bool isInputReady, isCursorEntered, isUseStackQueueCall, isPumpingEvents;
|
||||
int savedWidth, savedHeight;
|
||||
#define ADD_CALLBACK_WWIN(NAME) \
|
||||
GLFW_invoke_##NAME##_func* GLFW_invoke_##NAME;
|
||||
|
|
|
|||
|
|
@ -96,6 +96,10 @@ void handleFramebufferSizeJava(long window, int w, int h) {
|
|||
}
|
||||
|
||||
void pojavPumpEvents(void* window) {
|
||||
if(pojav_environ->isPumpingEvents) return;
|
||||
// prevent further calls until we exit the loop
|
||||
// by spec, they will be called on the same thread so no synchronization here
|
||||
pojav_environ->isPumpingEvents = true;
|
||||
size_t counter = atomic_load_explicit(&pojav_environ->eventCounter, memory_order_acquire);
|
||||
for(size_t i = 0; i < counter; i++) {
|
||||
GLFWInputEvent event = pojav_environ->events[i];
|
||||
|
|
@ -131,6 +135,7 @@ void pojavPumpEvents(void* window) {
|
|||
pojav_environ->GLFW_invoke_CursorPos(window, pojav_environ->cursorX, pojav_environ->cursorY);
|
||||
}
|
||||
atomic_store_explicit(&pojav_environ->eventCounter, counter, memory_order_release);
|
||||
pojav_environ->isPumpingEvents = false;
|
||||
}
|
||||
void pojavRewindEvents() {
|
||||
atomic_store_explicit(&pojav_environ->eventCounter, 0, memory_order_release);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue