public static boolean isHelperAvailable() { if (!triedHelperInit) { try { System.loadLibrary("turbovnchelper"); helperAvailable = true; } catch (java.lang.UnsatisfiedLinkError e) { vlog.info("WARNING: Could not find TurboVNC Helper JNI library. If it is in a"); vlog.info(" non-standard location, then add -Djava.library.path=<dir>"); vlog.info(" to the Java command line to specify its location."); vlog.info(" Full-screen mode may not work correctly."); if (VncViewer.osEID()) vlog.info(" Keyboard grabbing and extended input device support will be disabled."); else if (VncViewer.osGrab()) vlog.info(" Keyboard grabbing will be disabled."); } catch (java.lang.Exception e) { vlog.info("WARNING: Could not initialize TurboVNC Helper JNI library:"); vlog.info(" " + e.toString()); vlog.info(" Full-screen mode may not work correctly."); if (VncViewer.osEID()) vlog.info(" Keyboard grabbing and extended input device support will be disabled."); else if (VncViewer.osGrab()) vlog.info(" Keyboard grabbing will be disabled."); } } triedHelperInit = true; return helperAvailable; }
void enableLionFS() { try { String version = System.getProperty("os.version"); String[] tokens = version.split("\\."); int major = Integer.parseInt(tokens[0]), minor = 0; if (tokens.length > 1) minor = Integer.parseInt(tokens[1]); if (major < 10 || (major == 10 && minor < 7)) throw new Exception("Operating system version is " + version); Class fsuClass = Class.forName("com.apple.eawt.FullScreenUtilities"); Class argClasses[] = new Class[] {Window.class, Boolean.TYPE}; Method setWindowCanFullScreen = fsuClass.getMethod("setWindowCanFullScreen", argClasses); setWindowCanFullScreen.invoke(fsuClass, this, true); Class fsListenerClass = Class.forName("com.apple.eawt.FullScreenListener"); InvocationHandler fsHandler = new MyInvocationHandler(cc); Object proxy = Proxy.newProxyInstance( fsListenerClass.getClassLoader(), new Class[] {fsListenerClass}, fsHandler); argClasses = new Class[] {Window.class, fsListenerClass}; Method addFullScreenListenerTo = fsuClass.getMethod("addFullScreenListenerTo", argClasses); addFullScreenListenerTo.invoke(fsuClass, this, proxy); canDoLionFS = true; } catch (Exception e) { vlog.debug("Could not enable OS X 10.7+ full-screen mode:"); vlog.debug(" " + e.toString()); } }