< prev index next >

src/java.desktop/macosx/classes/sun/lwawt/LWWindowPeer.java

Print this page


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


 307                     owner.requestWindowFocus(FocusEvent.Cause.ACTIVATION);
 308                 }
 309             }
 310         }
 311     }
 312 
 313     @Override
 314     public final GraphicsConfiguration getGraphicsConfiguration() {
 315         synchronized (getStateLock()) {
 316             return graphicsConfig;
 317         }
 318     }
 319 
 320     @Override
 321     public boolean updateGraphicsData(GraphicsConfiguration gc) {
 322         setGraphicsConfig(gc);
 323         return false;
 324     }
 325 
 326     protected final Graphics getOnscreenGraphics(Color fg, Color bg, Font f) {
 327         if (getSurfaceData() == null) {

 328             return null;
 329         }
 330         if (fg == null) {
 331             fg = SystemColor.windowText;
 332         }
 333         if (bg == null) {
 334             bg = SystemColor.window;
 335         }
 336         if (f == null) {
 337             f = DEFAULT_FONT;
 338         }
 339         return new SunGraphics2D(getSurfaceData(), fg, bg, f);
 340     }
 341 
 342     @Override
 343     public void setBounds(int x, int y, int w, int h, int op) {
 344 
 345         if((op & NO_EMBEDDED_CHECK) == 0 && getPeerType() == PeerType.VIEW_EMBEDDED_FRAME) {
 346             return;
 347         }
 348 
 349         if ((op & SET_CLIENT_SIZE) != 0) {
 350             // SET_CLIENT_SIZE is only applicable to window peers, so handle it here
 351             // instead of pulling 'insets' field up to LWComponentPeer
 352             // no need to add insets since Window's notion of width and height includes insets.
 353             op &= ~SET_CLIENT_SIZE;
 354             op |= SET_SIZE;
 355         }
 356 
 357         // Don't post ComponentMoved/Resized and Paint events
 358         // until we've got a notification from the delegate
 359         Rectangle cb = constrainBounds(x, y, w, h);


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


 307                     owner.requestWindowFocus(FocusEvent.Cause.ACTIVATION);
 308                 }
 309             }
 310         }
 311     }
 312 
 313     @Override
 314     public final GraphicsConfiguration getGraphicsConfiguration() {
 315         synchronized (getStateLock()) {
 316             return graphicsConfig;
 317         }
 318     }
 319 
 320     @Override
 321     public boolean updateGraphicsData(GraphicsConfiguration gc) {
 322         setGraphicsConfig(gc);
 323         return false;
 324     }
 325 
 326     protected final Graphics getOnscreenGraphics(Color fg, Color bg, Font f) {
 327         SurfaceData surfaceData = getSurfaceData();
 328         if (surfaceData == null) {
 329             return null;
 330         }
 331         if (fg == null) {
 332             fg = SystemColor.windowText;
 333         }
 334         if (bg == null) {
 335             bg = SystemColor.window;
 336         }
 337         if (f == null) {
 338             f = DEFAULT_FONT;
 339         }
 340         return new SunGraphics2D(surfaceData, fg, bg, f);
 341     }
 342 
 343     @Override
 344     public void setBounds(int x, int y, int w, int h, int op) {
 345 
 346         if((op & NO_EMBEDDED_CHECK) == 0 && getPeerType() == PeerType.VIEW_EMBEDDED_FRAME) {
 347             return;
 348         }
 349 
 350         if ((op & SET_CLIENT_SIZE) != 0) {
 351             // SET_CLIENT_SIZE is only applicable to window peers, so handle it here
 352             // instead of pulling 'insets' field up to LWComponentPeer
 353             // no need to add insets since Window's notion of width and height includes insets.
 354             op &= ~SET_CLIENT_SIZE;
 355             op |= SET_SIZE;
 356         }
 357 
 358         // Don't post ComponentMoved/Resized and Paint events
 359         // until we've got a notification from the delegate
 360         Rectangle cb = constrainBounds(x, y, w, h);


< prev index next >