src/windows/classes/sun/java2d/d3d/D3DGraphicsDevice.java

Print this page


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


 218             } finally {
 219                 rq.unlock();
 220             }
 221         } else {
 222             super.exitFullScreenExclusive(screen, w);
 223         }
 224     }
 225 
 226     /**
 227      * WindowAdapter class for the full-screen frame, responsible for
 228      * restoring the devices. This is important to do because unless the device
 229      * is restored it will not go back into the FS mode once alt+tabbed out.
 230      * This is a problem for windows for which we do not do any d3d-related
 231      * operations (like when we disabled on-screen rendering).
 232      *
 233      * REMIND: we create an instance per each full-screen device while a single
 234      * instance would suffice (but requires more management).
 235      */
 236     private static class D3DFSWindowAdapter extends WindowAdapter {
 237         @Override

 238         public void windowDeactivated(WindowEvent e) {
 239             D3DRenderQueue.getInstance().restoreDevices();
 240         }
 241         @Override

 242         public void windowActivated(WindowEvent e) {
 243             D3DRenderQueue.getInstance().restoreDevices();
 244         }
 245     }
 246 
 247     @Override
 248     protected void addFSWindowListener(Window w) {
 249         // if the window is not a toplevel (has an owner) we have to use the
 250         // real toplevel to enter the full-screen mode with (4933099).
 251         if (!(w instanceof Frame) && !(w instanceof Dialog) &&
 252             (realFSWindow = getToplevelOwner(w)) != null)
 253         {
 254             ownerOrigBounds = realFSWindow.getBounds();
 255             WWindowPeer fp = (WWindowPeer)realFSWindow.getPeer();
 256 
 257             ownerWasVisible = realFSWindow.isVisible();
 258             Rectangle r = w.getBounds();
 259             // we use operations on peer instead of component because calling
 260             // them on component will take the tree lock
 261             fp.reshape(r.x, r.y, r.width, r.height);


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


 218             } finally {
 219                 rq.unlock();
 220             }
 221         } else {
 222             super.exitFullScreenExclusive(screen, w);
 223         }
 224     }
 225 
 226     /**
 227      * WindowAdapter class for the full-screen frame, responsible for
 228      * restoring the devices. This is important to do because unless the device
 229      * is restored it will not go back into the FS mode once alt+tabbed out.
 230      * This is a problem for windows for which we do not do any d3d-related
 231      * operations (like when we disabled on-screen rendering).
 232      *
 233      * REMIND: we create an instance per each full-screen device while a single
 234      * instance would suffice (but requires more management).
 235      */
 236     private static class D3DFSWindowAdapter extends WindowAdapter {
 237         @Override
 238         @SuppressWarnings("static")
 239         public void windowDeactivated(WindowEvent e) {
 240             D3DRenderQueue.getInstance().restoreDevices();
 241         }
 242         @Override
 243         @SuppressWarnings("static")
 244         public void windowActivated(WindowEvent e) {
 245             D3DRenderQueue.getInstance().restoreDevices();
 246         }
 247     }
 248 
 249     @Override
 250     protected void addFSWindowListener(Window w) {
 251         // if the window is not a toplevel (has an owner) we have to use the
 252         // real toplevel to enter the full-screen mode with (4933099).
 253         if (!(w instanceof Frame) && !(w instanceof Dialog) &&
 254             (realFSWindow = getToplevelOwner(w)) != null)
 255         {
 256             ownerOrigBounds = realFSWindow.getBounds();
 257             WWindowPeer fp = (WWindowPeer)realFSWindow.getPeer();
 258 
 259             ownerWasVisible = realFSWindow.isVisible();
 260             Rectangle r = w.getBounds();
 261             // we use operations on peer instead of component because calling
 262             // them on component will take the tree lock
 263             fp.reshape(r.x, r.y, r.width, r.height);