Update #49 - Fix unclosable pause menu glitch

This commit is contained in:
lax1dude
2025-01-26 15:23:47 -08:00
parent ed97c1ac00
commit ad900211dd
47 changed files with 1051 additions and 274 deletions

View File

@ -328,6 +328,7 @@ public class PlatformInput {
public void handleEvent(MouseEvent evt) {
evt.preventDefault();
evt.stopPropagation();
handleWindowFocus();
if(tryGrabCursorHook()) return;
int b = evt.getButton();
b = b == 1 ? 2 : (b == 2 ? 1 : b);
@ -400,6 +401,7 @@ public class PlatformInput {
public void handleEvent(TouchEvent evt) {
evt.preventDefault();
evt.stopPropagation();
handleWindowFocus();
SortedTouchEvent sorted = new SortedTouchEvent(evt, touchUIDMapperCreate);
currentTouchState = sorted;
List<OffsetTouch> lst = sorted.getEventTouches();
@ -794,6 +796,14 @@ public class PlatformInput {
enumerateGamepads();
}
private static void handleWindowFocus() {
if(!isWindowFocused) {
PlatformRuntime.logger.warn("Detected mouse input while the window was not focused, setting the window focused so the client doesn't pause");
isWindowFocused = true;
}
isMouseOverWindow = true;
}
@JSFunctor
private static interface KeyboardLayoutIterator extends JSObject {
void call(String key, String val);

View File

@ -1,9 +1,11 @@
package net.lax1dude.eaglercraft.v1_8.internal.teavm;
import org.teavm.jso.JSBody;
import net.lax1dude.eaglercraft.v1_8.sp.server.internal.teavm.WorkerMain;
/**
* Copyright (c) 2022-2024 lax1dude. All Rights Reserved.
* Copyright (c) 2022-2025 lax1dude. All Rights Reserved.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
@ -20,6 +22,7 @@ import net.lax1dude.eaglercraft.v1_8.sp.server.internal.teavm.WorkerMain;
public class MainClass {
public static void main(String[] args) {
setStackTraceLimit();
if(args.length == 1) {
if("_worker_process_".equalsIgnoreCase(args[0])) {
workerMain();
@ -39,4 +42,8 @@ public class MainClass {
private static void workerMain() {
WorkerMain._main();
}
@JSBody(script = "Error.stackTraceLimit = 1024;")
private static native void setStackTraceLimit();
}