Exemplo n.º 1
0
 public void getData(CreateWindowMsgArgs msgArgs) throws EOFException {
   msgArgs.decorated = bufQueue.nextByte() != 0;
   bufQueue.nextShort(); // Skip 2 bytes of pad
   msgArgs.wid = bufQueue.nextInt();
   msgArgs.x = bufQueue.nextShort();
   msgArgs.y = bufQueue.nextShort();
   msgArgs.wAndBorder = bufQueue.nextInt();
   msgArgs.hAndBorder = bufQueue.nextInt();
 }
Exemplo n.º 2
0
  private void syncWindowStateNext() throws EOFException {
    AppXrw.logger.info("Enter syncWindowStateNext");

    CreateWindowMsgArgs crtMsgArgs = new CreateWindowMsgArgs();
    WindowXrw win;
    int controllingUserLen;
    int desiredZOrder;
    float rotY; // Currently ignored
    Vector3f userTranslation = new Vector3f();

    crtMsgArgs.wid = bufQueue.nextInt();
    crtMsgArgs.x = (short) bufQueue.nextInt();
    crtMsgArgs.y = (short) bufQueue.nextInt();
    crtMsgArgs.wAndBorder = bufQueue.nextInt();
    crtMsgArgs.hAndBorder = bufQueue.nextInt();
    crtMsgArgs.borderWidth = bufQueue.nextInt();
    controllingUserLen = bufQueue.nextInt();
    desiredZOrder = bufQueue.nextInt();
    rotY = bufQueue.nextFloat(); // Just skipped
    userTranslation.x = bufQueue.nextFloat();
    userTranslation.y = bufQueue.nextFloat();
    userTranslation.z = bufQueue.nextFloat();
    AppXrw.logger.info("userTranslation = " + userTranslation);
    /* TODO: 0.4 protocol:
    int transientFor = bufQueue.nextInt();
    AppXrw.logger.info("transientFor = " + transientFor);
     */
    // TODO: 0.4 protocol: skip isTransient
    int transientFor = bufQueue.nextInt();
    int typeOrdinal = bufQueue.nextInt();
    Window2D.Type type = Window2D.Type.values()[typeOrdinal];
    AppXrw.logger.info("type = " + type);
    int parentWid = bufQueue.nextInt();
    AppXrw.logger.info("parentWid = " + parentWid);

    crtMsgArgs.decorated = (bufQueue.nextByte() == 1) ? true : false;
    AppXrw.logger.info("client = " + client);
    AppXrw.logger.info("crtMsgArgs = " + crtMsgArgs);
    AppXrw.logger.info("desiredZOrder= " + desiredZOrder);

    // Make sure window is ready to receive data on creation
    win = client.createWindow(crtMsgArgs);
    if (win == null) {
      AppXrw.logger.warning("Cannot create slave window for " + crtMsgArgs.wid);
      return;
    }

    if (win.getType() != type) {
      win.setType(type);
    }

    // Defer parent assignment until all windows are created
    if (parentWid != WindowXrw.INVALID_WID) {
      windowParents.put(win, parentWid);
    }

    win.setDesiredZOrder(desiredZOrder);

    CellTransform userTransformCell = new CellTransform(null, null);
    userTransformCell.setTranslation(userTranslation);
    win.setUserTransformCellLocal(userTransformCell);

    boolean show = (bufQueue.nextByte() == 1) ? true : false;
    AppXrw.logger.info("show = " + show);

    if (controllingUserLen > 0) {
      byte[] controllingUserBuf = bufQueue.nextBuffer();
      String controllingUser = new String(controllingUserBuf);
      AppXrw.logger.info("controlling user = " + controllingUser);
      win.setControllingUser(controllingUser);
    }

    int srcWidth = crtMsgArgs.wAndBorder;
    int srcHeight = crtMsgArgs.hAndBorder;
    int[] pixels = new int[srcWidth * srcHeight];

    for (int y = 0; y < srcHeight; y++) {
      int srcLineOffset = y * srcWidth;
      for (int x = 0; x < srcWidth; x++) {
        pixels[srcLineOffset + x] = bufQueue.nextInt();
      }
    }
    win.displayPixels(0, 0, srcWidth, srcHeight, pixels);

    /* TODO: 0.4 protocol:
    WindowXrw winTransientFor = client.lookupWindow(transientFor);
    win.setVisibleApp(show, winTransientFor);
     */
    win.setVisibleApp(show);
  }