504 List<WWindowPeer> l = (List<WWindowPeer>)appContext.get(ACTIVE_WINDOWS_KEY);
505 if (l == null) {
506 return null;
507 }
508 long[] result = new long[l.size()];
509 for (int j = 0; j < l.size(); j++) {
510 result[j] = l.get(j).getHWnd();
511 }
512 return result;
513 }
514 }
515
516 /*
517 * ----DISPLAY CHANGE SUPPORT----
518 */
519
520 /*
521 * Called from native code when we have been dragged onto another screen.
522 */
523 void draggedToNewScreen() {
524 SunToolkit.executeOnEventHandlerThread((Component)target,new Runnable()
525 {
526 @Override
527 public void run() {
528 displayChanged();
529 }
530 });
531 }
532
533 public void updateGC() {
534 int scrn = getScreenImOn();
535 if (screenLog.isLoggable(PlatformLogger.Level.FINER)) {
536 log.finer("Screen number: " + scrn);
537 }
538
539 // get current GD
540 Win32GraphicsDevice oldDev = winGraphicsConfig.getDevice();
541
542 Win32GraphicsDevice newDev;
543 GraphicsDevice[] devs = GraphicsEnvironment
544 .getLocalGraphicsEnvironment()
545 .getScreenDevices();
546 // Occasionally during device addition/removal getScreenImOn can return
547 // a non-existing screen number. Use the default device in this case.
548 if (scrn >= devs.length) {
549 newDev = (Win32GraphicsDevice)GraphicsEnvironment
550 .getLocalGraphicsEnvironment().getDefaultScreenDevice();
551 } else {
583 windowDPIChange(oldDev.getScreen(), scaleX, scaleY,
584 newDev.getScreen(), newScaleX, newScaleY);
585 scaleX = newScaleX;
586 scaleY = newScaleY;
587 }
588 }
589
590 /**
591 * From the DisplayChangedListener interface.
592 *
593 * This method handles a display change - either when the display settings
594 * are changed, or when the window has been dragged onto a different
595 * display.
596 * Called after a change in the display mode. This event
597 * triggers replacing the surfaceData object (since that object
598 * reflects the current display depth information, which has
599 * just changed).
600 */
601 @Override
602 public void displayChanged() {
603 updateGC();
604 }
605
606 /**
607 * Part of the DisplayChangedListener interface: components
608 * do not need to react to this event
609 */
610 @Override
611 public void paletteChanged() {
612 }
613
614 private native int getScreenImOn();
615
616 // Used in Win32GraphicsDevice.
617 public final native void setFullScreenExclusiveModeState(boolean state);
618
619 /*
620 * ----END DISPLAY CHANGE SUPPORT----
621 */
622
623 public void grab() {
|
504 List<WWindowPeer> l = (List<WWindowPeer>)appContext.get(ACTIVE_WINDOWS_KEY);
505 if (l == null) {
506 return null;
507 }
508 long[] result = new long[l.size()];
509 for (int j = 0; j < l.size(); j++) {
510 result[j] = l.get(j).getHWnd();
511 }
512 return result;
513 }
514 }
515
516 /*
517 * ----DISPLAY CHANGE SUPPORT----
518 */
519
520 /*
521 * Called from native code when we have been dragged onto another screen.
522 */
523 void draggedToNewScreen() {
524 displayChanged();
525 }
526
527 public void updateGC() {
528 int scrn = getScreenImOn();
529 if (screenLog.isLoggable(PlatformLogger.Level.FINER)) {
530 log.finer("Screen number: " + scrn);
531 }
532
533 // get current GD
534 Win32GraphicsDevice oldDev = winGraphicsConfig.getDevice();
535
536 Win32GraphicsDevice newDev;
537 GraphicsDevice[] devs = GraphicsEnvironment
538 .getLocalGraphicsEnvironment()
539 .getScreenDevices();
540 // Occasionally during device addition/removal getScreenImOn can return
541 // a non-existing screen number. Use the default device in this case.
542 if (scrn >= devs.length) {
543 newDev = (Win32GraphicsDevice)GraphicsEnvironment
544 .getLocalGraphicsEnvironment().getDefaultScreenDevice();
545 } else {
577 windowDPIChange(oldDev.getScreen(), scaleX, scaleY,
578 newDev.getScreen(), newScaleX, newScaleY);
579 scaleX = newScaleX;
580 scaleY = newScaleY;
581 }
582 }
583
584 /**
585 * From the DisplayChangedListener interface.
586 *
587 * This method handles a display change - either when the display settings
588 * are changed, or when the window has been dragged onto a different
589 * display.
590 * Called after a change in the display mode. This event
591 * triggers replacing the surfaceData object (since that object
592 * reflects the current display depth information, which has
593 * just changed).
594 */
595 @Override
596 public void displayChanged() {
597 SunToolkit.executeOnEventHandlerThread(target, this::updateGC);
598 }
599
600 /**
601 * Part of the DisplayChangedListener interface: components
602 * do not need to react to this event
603 */
604 @Override
605 public void paletteChanged() {
606 }
607
608 private native int getScreenImOn();
609
610 // Used in Win32GraphicsDevice.
611 public final native void setFullScreenExclusiveModeState(boolean state);
612
613 /*
614 * ----END DISPLAY CHANGE SUPPORT----
615 */
616
617 public void grab() {
|