Exemplo n.º 1
0
  private void parseOptions(Params params) throws RdesktopException {
    byte flags = 0x00;

    if (params.seamless) flags |= RdpConnectionOvd.MODE_APPLICATION;
    else flags |= RdpConnectionOvd.MODE_DESKTOP;

    if (params.multimedia) flags |= RdpConnectionOvd.MODE_MULTIMEDIA;

    RdpConnectionOvd connection = new RdpConnectionOvd(flags);

    if (params.shell != null) connection.setShell(params.shell);
    if (params.seamless) {
      Rectangle maxWindowSize =
          GraphicsEnvironment.getLocalGraphicsEnvironment().getMaximumWindowBounds();
      params.width = maxWindowSize.width - maxWindowSize.x;
      params.height = maxWindowSize.height - maxWindowSize.y;

      if (params.shell.equalsIgnoreCase(seamlessShell)
          || params.shell.equalsIgnoreCase(seamlessShell.concat(".exe")))
        connection.setSeamForm(true);
      connection.getSeamlessChannel().setMainFrame(this);
    }

    connection.setServer(params.server, params.port);
    connection.setCredentials(params.username, params.password);
    connection.setGraphic(params.width, params.height, params.bpp);

    connection.setPacketCompression(params.packetCompression);

    connection.setVolatileCaching(params.volatileCache);
    if (params.volatileCache && params.persistentCache) {
      connection.setPersistentCaching(true);
      connection.setPersistentCachingPath(params.persistentCachePath);
      connection.setPersistentCachingMaxSize(params.persistentCacheMaxSize);
    }

    connection.initSecondaryChannels();

    connection.addRdpListener(this);

    connection.setKeymap(LayoutDetector.get());
    this.co.add(connection);
  }