<Swing Dev> MacOS BigSur: AllowsAutomaticWindowTabbing
Roger Tönz
roger.toenz at gmx.ch
Mon Jan 4 12:27:38 UTC 2021
Hi,
A little workaround for:
https://bugs.openjdk.java.net/browse/JDK-8256465
Calling:
ObjCRuntime.disableAllowsAutomaticWindowTabbing()
before first Window opens.
It’s just a workaround, not a solution.
Cheers
Roger Tönz
import java.util.logging.Level;
import java.util.logging.Logger;
import com.sun.jna.Library;
import com.sun.jna.Native;
import com.sun.jna.Pointer;
public interface ObjCRuntime extends Library {
Pointer objc_lookUpClass(final String className);
Pointer sel_getUid(final String s);
long objc_msgSend(final Pointer pointer, final Pointer selector, Object... args);
private static long invoke(final String className, final String selectorN, Object... args){
final ObjCRuntime objCRuntime = Native.load("objc", ObjCRuntime.class);
final Pointer clazz = objCRuntime.objc_lookUpClass(className);
final Pointer selector = objCRuntime.sel_getUid(selectorN);
return objCRuntime.objc_msgSend(clazz, selector, args);
}
//for MacOS 10.13 and higher (workaround for https://bugs.openjdk.java.net/browse/JDK-8256465)
public static void disableAllowsAutomaticWindowTabbing() {
try {
ObjCRuntime.invoke("NSWindow", "setAllowsAutomaticWindowTabbing:", Boolean.FALSE);
} catch(Throwable e){
Logger.getAnonymousLogger("ObjCRuntime").log(Level.WARNING, e, ()->"NSWindow#AllowsAutomaticWindowTabbing=???");
}
}
}
More information about the swing-dev
mailing list