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 // Bugfix for 8066436
492 // setSize has an aynchronous native call to osx which in turn calls
493 // deliverMoveResizeEvent which set the size of the peer
494 // if that call is still in process and the peer is size is not set,
495 // we may get bounds which are previous to setSize
496 // To avoid this we flush all the native events before getting bounds
497 LWCToolkit.flushNativeSelectors();
498 this.normalBounds = peer.getBounds();
499
500 GraphicsConfiguration config = getPeer().getGraphicsConfiguration();
501 Insets i = ((CGraphicsDevice)config.getDevice()).getScreenInsets();
502 Rectangle toBounds = config.getBounds();
503 setBounds(toBounds.x + i.left,
504 toBounds.y + i.top,
505 toBounds.width - i.left - i.right,
506 toBounds.height - i.top - i.bottom);
507 }
508 }
509
510 private void unmaximize() {
511 if (!isMaximized()) {
512 return;
513 }
514 if (!undecorated) {
515 CWrapper.NSWindow.zoom(getNSWindowPtr());
516 } else {
517 deliverZoom(false);
|