< prev index next >

src/java.desktop/windows/classes/sun/awt/Win32GraphicsEnvironment.java

Print this page


   1 /*
   2  * Copyright (c) 1997, 2015, 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


 124      * all monitors.
 125      * @return number of pixels per logical inch in Y direction
 126      */
 127     public native int getYResolution();
 128 
 129 
 130 /*
 131  * ----DISPLAY CHANGE SUPPORT----
 132  */
 133 
 134     // list of invalidated graphics devices (those which were removed)
 135     private ArrayList<WeakReference<Win32GraphicsDevice>> oldDevices;
 136     /*
 137      * From DisplayChangeListener interface.
 138      * Called from WToolkit and executed on the event thread when the
 139      * display settings are changed.
 140      */
 141     @Override
 142     public void displayChanged() {
 143         // getNumScreens() will return the correct current number of screens
 144         GraphicsDevice newDevices[] = new GraphicsDevice[getNumScreens()];
 145         GraphicsDevice oldScreens[] = screens;
 146         // go through the list of current devices and determine if they
 147         // could be reused, or will have to be replaced
 148         if (oldScreens != null) {
 149             for (int i = 0; i < oldScreens.length; i++) {
 150                 if (!(screens[i] instanceof Win32GraphicsDevice)) {
 151                     // REMIND: can we ever have anything other than Win32GD?
 152                     assert (false) : oldScreens[i];
 153                     continue;
 154                 }
 155                 Win32GraphicsDevice gd = (Win32GraphicsDevice)oldScreens[i];
 156                 // devices may be invalidated from the native code when the
 157                 // display change happens (device add/removal also causes a
 158                 // display change)
 159                 if (!gd.isValid()) {
 160                     if (oldDevices == null) {
 161                         oldDevices =
 162                             new ArrayList<WeakReference<Win32GraphicsDevice>>();
 163                     }
 164                     oldDevices.add(new WeakReference<Win32GraphicsDevice>(gd));
 165                 } else if (i < newDevices.length) {


   1 /*
   2  * Copyright (c) 1997, 2018, 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


 124      * all monitors.
 125      * @return number of pixels per logical inch in Y direction
 126      */
 127     public native int getYResolution();
 128 
 129 
 130 /*
 131  * ----DISPLAY CHANGE SUPPORT----
 132  */
 133 
 134     // list of invalidated graphics devices (those which were removed)
 135     private ArrayList<WeakReference<Win32GraphicsDevice>> oldDevices;
 136     /*
 137      * From DisplayChangeListener interface.
 138      * Called from WToolkit and executed on the event thread when the
 139      * display settings are changed.
 140      */
 141     @Override
 142     public void displayChanged() {
 143         // getNumScreens() will return the correct current number of screens
 144         GraphicsDevice[] newDevices = new GraphicsDevice[getNumScreens()];
 145         GraphicsDevice[] oldScreens = screens;
 146         // go through the list of current devices and determine if they
 147         // could be reused, or will have to be replaced
 148         if (oldScreens != null) {
 149             for (int i = 0; i < oldScreens.length; i++) {
 150                 if (!(screens[i] instanceof Win32GraphicsDevice)) {
 151                     // REMIND: can we ever have anything other than Win32GD?
 152                     assert (false) : oldScreens[i];
 153                     continue;
 154                 }
 155                 Win32GraphicsDevice gd = (Win32GraphicsDevice)oldScreens[i];
 156                 // devices may be invalidated from the native code when the
 157                 // display change happens (device add/removal also causes a
 158                 // display change)
 159                 if (!gd.isValid()) {
 160                     if (oldDevices == null) {
 161                         oldDevices =
 162                             new ArrayList<WeakReference<Win32GraphicsDevice>>();
 163                     }
 164                     oldDevices.add(new WeakReference<Win32GraphicsDevice>(gd));
 165                 } else if (i < newDevices.length) {


< prev index next >