471
472 @Override // PlatformWindow
473 public void setBounds(int x, int y, int w, int h) {
474 nativeSetNSWindowBounds(getNSWindowPtr(), x, y, w, h);
475 }
476
477 private boolean isMaximized() {
478 return undecorated ? this.normalBounds != null
479 : CWrapper.NSWindow.isZoomed(getNSWindowPtr());
480 }
481
482 private void maximize() {
483 if (peer == null || isMaximized()) {
484 return;
485 }
486 if (!undecorated) {
487 CWrapper.NSWindow.zoom(getNSWindowPtr());
488 } else {
489 deliverZoom(true);
490
491 this.normalBounds = peer.getBounds();
492
493 GraphicsConfiguration config = getPeer().getGraphicsConfiguration();
494 Insets i = ((CGraphicsDevice)config.getDevice()).getScreenInsets();
495 Rectangle toBounds = config.getBounds();
496 setBounds(toBounds.x + i.left,
497 toBounds.y + i.top,
498 toBounds.width - i.left - i.right,
499 toBounds.height - i.top - i.bottom);
500 }
501 }
502
503 private void unmaximize() {
504 if (!isMaximized()) {
505 return;
506 }
507 if (!undecorated) {
508 CWrapper.NSWindow.zoom(getNSWindowPtr());
509 } else {
510 deliverZoom(false);
|
471
472 @Override // PlatformWindow
473 public void setBounds(int x, int y, int w, int h) {
474 nativeSetNSWindowBounds(getNSWindowPtr(), x, y, w, h);
475 }
476
477 private boolean isMaximized() {
478 return undecorated ? this.normalBounds != null
479 : CWrapper.NSWindow.isZoomed(getNSWindowPtr());
480 }
481
482 private void maximize() {
483 if (peer == null || isMaximized()) {
484 return;
485 }
486 if (!undecorated) {
487 CWrapper.NSWindow.zoom(getNSWindowPtr());
488 } else {
489 deliverZoom(true);
490
491 // We need an up to date size of the peer, so we flush the native events
492 // to be sure that there are no setBounds requests in the queue.
493 LWCToolkit.flushNativeSelectors();
494 this.normalBounds = peer.getBounds();
495
496 GraphicsConfiguration config = getPeer().getGraphicsConfiguration();
497 Insets i = ((CGraphicsDevice)config.getDevice()).getScreenInsets();
498 Rectangle toBounds = config.getBounds();
499 setBounds(toBounds.x + i.left,
500 toBounds.y + i.top,
501 toBounds.width - i.left - i.right,
502 toBounds.height - i.top - i.bottom);
503 }
504 }
505
506 private void unmaximize() {
507 if (!isMaximized()) {
508 return;
509 }
510 if (!undecorated) {
511 CWrapper.NSWindow.zoom(getNSWindowPtr());
512 } else {
513 deliverZoom(false);
|