コード例 #1
0
ファイル: Viewport.java プロジェクト: TurboVNC/turbovnc
  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());
    }
  }
コード例 #2
0
ファイル: Viewport.java プロジェクト: TurboVNC/turbovnc
 public void toggleLionFS() {
   try {
     Class appClass = Class.forName("com.apple.eawt.Application");
     Method getApplication = appClass.getMethod("getApplication", (Class[]) null);
     Object app = getApplication.invoke(appClass);
     Method requestToggleFullScreen = appClass.getMethod("requestToggleFullScreen", Window.class);
     requestToggleFullScreen.invoke(app, this);
   } catch (Exception e) {
     vlog.debug("Could not toggle OS X 10.7+ full-screen mode:");
     vlog.debug("  " + e.toString());
   }
 }