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

Print this page




   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
  23  * questions.
  24  */
  25 package sun.awt.windows;
  26 
  27 import java.util.Vector;
  28 
  29 import java.awt.*;
  30 import java.awt.peer.*;
  31 import java.awt.image.ImageObserver;
  32 
  33 import java.awt.image.Raster;
  34 import java.awt.image.DataBuffer;
  35 import java.awt.image.DataBufferInt;
  36 import java.awt.image.BufferedImage;
  37 
  38 import java.awt.image.ColorModel;
  39 
  40 import sun.awt.image.ImageRepresentation;
  41 import sun.awt.image.IntegerComponentRaster;
  42 import sun.awt.image.ToolkitImage;
  43 import sun.awt.im.*;
  44 import sun.awt.Win32GraphicsDevice;
  45 import sun.awt.AWTAccessor;



  46 
  47 class WFramePeer extends WWindowPeer implements FramePeer {
  48 
  49     static {
  50         initIDs();
  51     }
  52 
  53     // initialize JNI field and method IDs
  54     private static native void initIDs();
  55 
  56     // FramePeer implementation
  57     public native void setState(int state);
  58     public native int getState();
  59 
  60     // sync target and peer
  61     public void setExtendedState(int state) {
  62         AWTAccessor.getFrameAccessor().setExtendedState((Frame)target, state);
  63     }
  64     public int getExtendedState() {
  65         return AWTAccessor.getFrameAccessor().getExtendedState((Frame)target);
  66     }
  67 
  68     // Convenience methods to save us from trouble of extracting
  69     // Rectangle fields in native code.
  70     private native void setMaximizedBounds(int x, int y, int w, int h);
  71     private native void clearMaximizedBounds();
  72 
  73     private static final boolean keepOnMinimize = "true".equals(
  74         (String)java.security.AccessController.doPrivileged(
  75             new sun.security.action.GetPropertyAction(
  76                 "sun.awt.keepWorkingSetOnMinimize")));
  77 
  78     public void setMaximizedBounds(Rectangle b) {
  79         if (b == null) {
  80             clearMaximizedBounds();
  81         } else {
  82             Rectangle adjBounds = (Rectangle)b.clone();
  83             adjustMaximizedBounds(adjBounds);
  84             setMaximizedBounds(adjBounds.x, adjBounds.y, adjBounds.width, adjBounds.height);
  85         }
  86     }
  87 
  88     /**
  89      * The incoming bounds describe the maximized size and position of the
  90      * window on the monitor that displays the window. But the window manager
  91      * expects that the bounds are based on the size and position of the
  92      * primary monitor, even if the window ultimately maximizes onto a
  93      * secondary monitor. And the window manager adjusts these values to
  94      * compensate for differences between the primary monitor and the monitor
  95      * that displays the window.




   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
  23  * questions.
  24  */
  25 package sun.awt.windows;
  26 


  27 import java.awt.*;
  28 import java.awt.peer.*;














  29 import sun.awt.AWTAccessor;
  30 import sun.awt.im.InputMethodManager;
  31 import java.security.AccessController;
  32 import sun.security.action.GetPropertyAction;
  33 
  34 class WFramePeer extends WWindowPeer implements FramePeer {
  35 
  36     static {
  37         initIDs();
  38     }
  39 
  40     // initialize JNI field and method IDs
  41     private static native void initIDs();
  42 
  43     // FramePeer implementation
  44     public native void setState(int state);
  45     public native int getState();
  46 
  47     // sync target and peer
  48     public void setExtendedState(int state) {
  49         AWTAccessor.getFrameAccessor().setExtendedState((Frame)target, state);
  50     }
  51     public int getExtendedState() {
  52         return AWTAccessor.getFrameAccessor().getExtendedState((Frame)target);
  53     }
  54 
  55     // Convenience methods to save us from trouble of extracting
  56     // Rectangle fields in native code.
  57     private native void setMaximizedBounds(int x, int y, int w, int h);
  58     private native void clearMaximizedBounds();
  59 
  60     private static final boolean keepOnMinimize = "true".equals(
  61         AccessController.doPrivileged(
  62             new GetPropertyAction(
  63             "sun.awt.keepWorkingSetOnMinimize")));
  64 
  65     public void setMaximizedBounds(Rectangle b) {
  66         if (b == null) {
  67             clearMaximizedBounds();
  68         } else {
  69             Rectangle adjBounds = (Rectangle)b.clone();
  70             adjustMaximizedBounds(adjBounds);
  71             setMaximizedBounds(adjBounds.x, adjBounds.y, adjBounds.width, adjBounds.height);
  72         }
  73     }
  74 
  75     /**
  76      * The incoming bounds describe the maximized size and position of the
  77      * window on the monitor that displays the window. But the window manager
  78      * expects that the bounds are based on the size and position of the
  79      * primary monitor, even if the window ultimately maximizes onto a
  80      * secondary monitor. And the window manager adjusts these values to
  81      * compensate for differences between the primary monitor and the monitor
  82      * that displays the window.