Пример #1
0
  void preInit(XCreateWindowParams params) {
    super.preInit(params);
    if (!resize_request.isInterned()) {
      resize_request.intern(false);
    }
    winAttr.initialFocus = true;

    currentInsets = new Insets(0, 0, 0, 0); // replacemenet for wdata->top, left, bottom, right

    applyGuessedInsets();
    Rectangle bounds = (Rectangle) params.get(BOUNDS);
    dimensions = new WindowDimensions(bounds, getRealInsets(), false);
    params.put(BOUNDS, dimensions.getClientRect());

    if (insLog.isLoggable(Level.FINE)) {
      insLog.log(Level.FINE, "Initial dimensions {0}", new Object[] {String.valueOf(dimensions)});
    }

    // Deny default processing of these events on the shell - proxy will take care of
    // them instead
    Long eventMask = (Long) params.get(EVENT_MASK);
    params.add(
        EVENT_MASK,
        Long.valueOf(eventMask.longValue() & ~(FocusChangeMask | KeyPressMask | KeyReleaseMask)));
  }
Пример #2
0
 Rectangle getShellBounds() {
   return dimensions.getClientRect();
 }
Пример #3
0
  // Coordinates are that of the target
  // Called only on Toolkit thread
  public void reshape(WindowDimensions newDimensions, int op, boolean userReshape) {
    if (insLog.isLoggable(Level.FINE)) {
      insLog.fine(
          "Reshaping "
              + this
              + " to "
              + newDimensions
              + " op "
              + op
              + " user reshape "
              + userReshape);
    }
    if (userReshape) {
      // We handle only userReshape == true cases. It means that
      // if the window manager or any other part of the windowing
      // system sets inappropriate size for this window, we can
      // do nothing but accept it.
      Rectangle reqBounds = newDimensions.getBounds();
      Rectangle newBounds =
          constrainBounds(reqBounds.x, reqBounds.y, reqBounds.width, reqBounds.height);
      Insets insets = newDimensions.getInsets();
      Rectangle clientBounds =
          new Rectangle(
              newBounds.x,
              newBounds.y,
              newBounds.width - insets.left - insets.right,
              newBounds.height - insets.top - insets.bottom);
      newDimensions =
          new WindowDimensions(
              newDimensions.isClientSizeSet() ? clientBounds : newBounds,
              insets,
              newDimensions.isClientSizeSet());
    }
    XToolkit.awtLock();
    try {
      if (!isReparented() || !isVisible()) {
        insLog.log(
            Level.FINE,
            "- not reparented({0}) or not visible({1}), default reshape",
            new Object[] {Boolean.valueOf(isReparented()), Boolean.valueOf(visible)});

        // Fix for 6323293.
        // This actually is needed to preserve compatibility with previous releases -
        // some of licensees are expecting componentMoved event on invisible one while
        // its location changes.
        Point oldLocation = getLocation();

        Point newLocation =
            new Point(
                ComponentAccessor.getX((Component) target),
                ComponentAccessor.getY((Component) target));

        if (!newLocation.equals(oldLocation)) {
          handleMoved(newDimensions);
        }

        dimensions = new WindowDimensions(newDimensions);
        updateSizeHints(dimensions);
        Rectangle client = dimensions.getClientRect();
        checkShellRect(client);
        setShellBounds(client);
        if (content != null && !content.getSize().equals(newDimensions.getSize())) {
          reconfigureContentWindow(newDimensions);
        }
        return;
      }

      int wm = XWM.getWMID();
      updateChildrenSizes();
      applyGuessedInsets();

      Rectangle shellRect = newDimensions.getClientRect();

      if (gravityBug()) {
        Insets in = newDimensions.getInsets();
        shellRect.translate(in.left, in.top);
      }

      if ((op & NO_EMBEDDED_CHECK) == 0 && isEmbedded()) {
        shellRect.setLocation(0, 0);
      }

      checkShellRectSize(shellRect);
      if (!isEmbedded()) {
        checkShellRectPos(shellRect);
      }

      op = op & ~NO_EMBEDDED_CHECK;

      if (op == SET_LOCATION) {
        setShellPosition(shellRect);
      } else if (isResizable()) {
        if (op == SET_BOUNDS) {
          setShellBounds(shellRect);
        } else {
          setShellSize(shellRect);
        }
      } else {
        XWM.setShellNotResizable(this, newDimensions, shellRect, true);
        if (op == SET_BOUNDS) {
          setShellPosition(shellRect);
        }
      }

      reconfigureContentWindow(newDimensions);
    } finally {
      XToolkit.awtUnlock();
    }
  }
Пример #4
0
 void updateSizeHints(WindowDimensions dims) {
   Rectangle rec = dims.getClientRect();
   checkShellRect(rec);
   updateSizeHints(rec.x, rec.y, rec.width, rec.height);
 }