< prev index next >

src/windows/classes/sun/awt/windows/WWindowPeer.java

Print this page


   1 /*
   2  * Copyright (c) 1996, 2014, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.  Oracle designates this
   8  * particular file as subject to the "Classpath" exception as provided
   9  * by Oracle in the LICENSE file that accompanied this code.
  10  *
  11  * This code is distributed in the hope that it will be useful, but WITHOUT
  12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  13  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  14  * version 2 for more details (a copy is included in the LICENSE file that
  15  * accompanied this code).
  16  *
  17  * You should have received a copy of the GNU General Public License version
  18  * 2 along with this work; if not, write to the Free Software Foundation,
  19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  20  *
  21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  22  * or visit www.oracle.com if you need additional information or have any


 457             List<WWindowPeer> l = (List<WWindowPeer>)appContext.get(ACTIVE_WINDOWS_KEY);
 458             if (l == null) {
 459                 return null;
 460             }
 461             long[] result = new long[l.size()];
 462             for (int j = 0; j < l.size(); j++) {
 463                 result[j] = l.get(j).getHWnd();
 464             }
 465             return result;
 466         }
 467     }
 468 
 469 /*
 470  * ----DISPLAY CHANGE SUPPORT----
 471  */
 472 
 473     /*
 474      * Called from native code when we have been dragged onto another screen.
 475      */
 476     void draggedToNewScreen() {
 477         SunToolkit.executeOnEventHandlerThread((Component)target,new Runnable()
 478         {
 479             @Override
 480             public void run() {
 481                 displayChanged();
 482             }
 483         });
 484     }
 485 
 486     public void updateGC() {
 487         int scrn = getScreenImOn();
 488         if (screenLog.isLoggable(PlatformLogger.Level.FINER)) {
 489             log.finer("Screen number: " + scrn);
 490         }
 491 
 492         // get current GD
 493         Win32GraphicsDevice oldDev = (Win32GraphicsDevice)winGraphicsConfig
 494                                      .getDevice();
 495 
 496         Win32GraphicsDevice newDev;
 497         GraphicsDevice devs[] = GraphicsEnvironment
 498             .getLocalGraphicsEnvironment()
 499             .getScreenDevices();
 500         // Occasionally during device addition/removal getScreenImOn can return
 501         // a non-existing screen number. Use the default device in this case.
 502         if (scrn >= devs.length) {
 503             newDev = (Win32GraphicsDevice)GraphicsEnvironment
 504                 .getLocalGraphicsEnvironment().getDefaultScreenDevice();


 522             newDev.addDisplayChangedListener(this);
 523         }
 524 
 525         AWTAccessor.getComponentAccessor().
 526             setGraphicsConfiguration((Component)target, winGraphicsConfig);
 527     }
 528 
 529     /**
 530      * From the DisplayChangedListener interface.
 531      *
 532      * This method handles a display change - either when the display settings
 533      * are changed, or when the window has been dragged onto a different
 534      * display.
 535      * Called after a change in the display mode.  This event
 536      * triggers replacing the surfaceData object (since that object
 537      * reflects the current display depth information, which has
 538      * just changed).
 539      */
 540     @Override
 541     public void displayChanged() {
 542         updateGC();
 543     }
 544 
 545     /**
 546      * Part of the DisplayChangedListener interface: components
 547      * do not need to react to this event
 548      */
 549     @Override
 550     public void paletteChanged() {
 551     }
 552 
 553     private native int getScreenImOn();
 554 
 555     // Used in Win32GraphicsDevice.
 556     public final native void setFullScreenExclusiveModeState(boolean state);
 557 
 558 /*
 559  * ----END DISPLAY CHANGE SUPPORT----
 560  */
 561 
 562      public void grab() {


   1 /*
   2  * Copyright (c) 1996, 2019, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.  Oracle designates this
   8  * particular file as subject to the "Classpath" exception as provided
   9  * by Oracle in the LICENSE file that accompanied this code.
  10  *
  11  * This code is distributed in the hope that it will be useful, but WITHOUT
  12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  13  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  14  * version 2 for more details (a copy is included in the LICENSE file that
  15  * accompanied this code).
  16  *
  17  * You should have received a copy of the GNU General Public License version
  18  * 2 along with this work; if not, write to the Free Software Foundation,
  19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  20  *
  21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  22  * or visit www.oracle.com if you need additional information or have any


 457             List<WWindowPeer> l = (List<WWindowPeer>)appContext.get(ACTIVE_WINDOWS_KEY);
 458             if (l == null) {
 459                 return null;
 460             }
 461             long[] result = new long[l.size()];
 462             for (int j = 0; j < l.size(); j++) {
 463                 result[j] = l.get(j).getHWnd();
 464             }
 465             return result;
 466         }
 467     }
 468 
 469 /*
 470  * ----DISPLAY CHANGE SUPPORT----
 471  */
 472 
 473     /*
 474      * Called from native code when we have been dragged onto another screen.
 475      */
 476     void draggedToNewScreen() {




 477         displayChanged();
 478     }


 479 
 480     public void updateGC() {
 481         int scrn = getScreenImOn();
 482         if (screenLog.isLoggable(PlatformLogger.Level.FINER)) {
 483             log.finer("Screen number: " + scrn);
 484         }
 485 
 486         // get current GD
 487         Win32GraphicsDevice oldDev = (Win32GraphicsDevice)winGraphicsConfig
 488                                      .getDevice();
 489 
 490         Win32GraphicsDevice newDev;
 491         GraphicsDevice devs[] = GraphicsEnvironment
 492             .getLocalGraphicsEnvironment()
 493             .getScreenDevices();
 494         // Occasionally during device addition/removal getScreenImOn can return
 495         // a non-existing screen number. Use the default device in this case.
 496         if (scrn >= devs.length) {
 497             newDev = (Win32GraphicsDevice)GraphicsEnvironment
 498                 .getLocalGraphicsEnvironment().getDefaultScreenDevice();


 516             newDev.addDisplayChangedListener(this);
 517         }
 518 
 519         AWTAccessor.getComponentAccessor().
 520             setGraphicsConfiguration((Component)target, winGraphicsConfig);
 521     }
 522 
 523     /**
 524      * From the DisplayChangedListener interface.
 525      *
 526      * This method handles a display change - either when the display settings
 527      * are changed, or when the window has been dragged onto a different
 528      * display.
 529      * Called after a change in the display mode.  This event
 530      * triggers replacing the surfaceData object (since that object
 531      * reflects the current display depth information, which has
 532      * just changed).
 533      */
 534     @Override
 535     public void displayChanged() {
 536         SunToolkit.executeOnEventHandlerThread(target, this::updateGC);
 537     }
 538 
 539     /**
 540      * Part of the DisplayChangedListener interface: components
 541      * do not need to react to this event
 542      */
 543     @Override
 544     public void paletteChanged() {
 545     }
 546 
 547     private native int getScreenImOn();
 548 
 549     // Used in Win32GraphicsDevice.
 550     public final native void setFullScreenExclusiveModeState(boolean state);
 551 
 552 /*
 553  * ----END DISPLAY CHANGE SUPPORT----
 554  */
 555 
 556      public void grab() {


< prev index next >