@Override public void setBounds(int x, int y, int w, int h, int op) { if ((op & NO_EMBEDDED_CHECK) == 0 && getPeerType() == PeerType.VIEW_EMBEDDED_FRAME) { return; } if ((op & SET_CLIENT_SIZE) != 0) { // SET_CLIENT_SIZE is only applicable to window peers, so handle it here // instead of pulling 'insets' field up to LWComponentPeer // no need to add insets since Window's notion of width and height includes insets. op &= ~SET_CLIENT_SIZE; op |= SET_SIZE; } // Don't post ComponentMoved/Resized and Paint events // until we've got a notification from the delegate Rectangle cb = constrainBounds(x, y, w, h); Rectangle newBounds = new Rectangle(getBounds()); if ((op & (SET_LOCATION | SET_BOUNDS)) != 0) { newBounds.x = cb.x; newBounds.y = cb.y; } if ((op & (SET_SIZE | SET_BOUNDS)) != 0) { newBounds.width = cb.width; newBounds.height = cb.height; } // Native system could constraint bounds, so the peer wold be updated in the callback platformWindow.setBounds(newBounds.x, newBounds.y, newBounds.width, newBounds.height); }
@Override public void setBounds(int x, int y, int w, int h, int op) { if ((op & NO_EMBEDDED_CHECK) == 0 && getPeerType() == PeerType.VIEW_EMBEDDED_FRAME) { return; } if ((op & SET_CLIENT_SIZE) != 0) { // SET_CLIENT_SIZE is only applicable to window peers, so handle it here // instead of pulling 'insets' field up to LWComponentPeer // no need to add insets since Window's notion of width and height includes insets. op &= ~SET_CLIENT_SIZE; op |= SET_SIZE; } if (w < MINIMUM_WIDTH) { w = MINIMUM_WIDTH; } if (h < MINIMUM_HEIGHT) { h = MINIMUM_HEIGHT; } if (graphicsConfig instanceof TextureSizeConstraining) { final int maxW = ((TextureSizeConstraining) graphicsConfig).getMaxTextureWidth(); final int maxH = ((TextureSizeConstraining) graphicsConfig).getMaxTextureHeight(); if (w > maxW) { w = maxW; } if (h > maxH) { h = maxH; } } // Don't post ComponentMoved/Resized and Paint events // until we've got a notification from the delegate setBounds(x, y, w, h, op, false, false); // Get updated bounds, so we don't have to handle 'op' here manually Rectangle r = getBounds(); platformWindow.setBounds(r.x, r.y, r.width, r.height); }