korlibs / korge

KorGE Game Engine. Multiplatform Kotlin Game Engine
https://korge.org/
Other
2.52k stars 124 forks source link

[Nit Bug] Mac touchpad zoom in finger gesture on a JVM app window creates error log noise. #2142

Open davjhan opened 8 months ago

davjhan commented 8 months ago

Repro steps

  1. Run runJvmAutoReload on any Korge project. Hello World is fine.

  2. With the cursor on the newly launched app window, do a zoom in gesture on the mac trackpad. You know the one, with two fingers, like on an iphone.

  3. Your log windows will fill up with scary looking Console.error level log noise:

    Exception in thread "AppKit Thread" java.lang.NoSuchMethodError: Lcom/apple/eawt/event/GestureHandler;.handleGestureFromNative(Ljava/awt/Window;IDDDD)V
    2024-01-31 19:37:10.289 java[29876:3307781] Bad JNI lookup handleGestureFromNative
    2024-01-31 19:37:10.290 java[29876:3307781] (
    0   libawt_lwawt.dylib                  0x0000000128401a20 -[AWTWindow_Normal postGesture:as:a:b:] + 944
    1   AppKit                              0x00007ff814c65f7e forwardMethod + 311
    2   AppKit                              0x00007ff814be5736 -[NSWindow(NSEventRouting) _reallySendEvent:isDelayedEvent:] + 856
    3   AppKit                              0x00007ff814be51c3 -[NSWindow(NSEventRouting) sendEvent:] + 345
    4   libawt_lwawt.dylib                  0x0000000128401657 -[AWTWindow_Normal sendEvent:] + 87
    5   AppKit                              0x00007ff81537d6b0 routeGestureEvent + 393
    6   AppKit                              0x00007ff81537c977 -[NSApplication(NSEventRouting) sendEvent:] + 2239
    7   libosxapp.dylib                     0x000000012773c765 -[NSApplicationAWT sendEvent:] + 437
    8   AppKit                              0x00007ff814f38b93 -[NSApplication _handleEvent:] + 65
    9   AppKit                              0x00007ff814a76d57 -[NSApplication run] + 640
    10  libosxapp.dylib                     0x000000012773c365 +[NSApplicationAWT runAWTLoopWithApp:] + 165
    11  libawt_lwawt.dylib                  0x0000000128458d40 +[AWTStarter starter:headless:] + 496
    12  libosxapp.dylib                     0x000000012773e04f +[ThreadUtilities invokeBlockCopy:] + 15
    13  Foundation                          0x00007ff812431bd5 __NSThreadPerformPerform + 178
    14  CoreFoundation                      0x00007ff8115177d6 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 17
    15  CoreFoundation                      0x00007ff811517779 __CFRunLoopDoSource0 + 157
    16  CoreFoundation                      0x00007ff811517548 __CFRunLoopDoSources0 + 215
    17  CoreFoundation                      0x00007ff8115161b8 __CFRunLoopRun + 919
    18  CoreFoundation                      0x00007ff811515859 CFRunLoopRunSpecific + 557
    19  libjli.dylib                        0x0000000109520132 CreateExecutionEnvironment + 386
    20  libjli.dylib                        0x000000010951bc96 JLI_Launch + 1366
    21  java                                0x0000000100ba2c0a main + 394
    22  dyld                                0x0000000200c45386 start + 1942
    )

    Screenshot 2024-01-31 at 7 42 48 PM

  4. Done

Impact

I believe this is just a scary looking message, but it may confuse the developer, especially new folks trying the Hello World app who may have accidentally triggered this behavior.

Possible Solution

Since its a java.lang.NoSuchMethodErro, seems like these gestures just have to be handled with a default no-op listener? I have no idea.

Details

soywiz commented 8 months ago

Can you provide your java -version? I'm specially interested in JVM version & which JDK ie. Correto, Zulu, Oracle, OpenJDK, etc.

davjhan commented 8 months ago

Sure! The output of java -version is:

openjdk version "19.0.2" 2023-01-17
OpenJDK Runtime Environment (build 19.0.2+7-44)
OpenJDK 64-Bit Server VM (build 19.0.2+7-44, mixed mode, sharing)