< prev index next >

src/java.desktop/unix/classes/sun/awt/X11/XContentWindow.java

Print this page


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


 122             // Fix for 5023533:
 123             // Change in the size of the content window means, well, change of the size
 124             // Change in the location of the content window means change in insets
 125             boolean needHandleResize = !(newBounds.equals(getBounds()));
 126             boolean needPaint = width <= 0 || height <= 0;
 127             reshape(newBounds);
 128             if (needHandleResize) {
 129                 insLog.fine("Sending RESIZED");
 130                 handleResize(newBounds);
 131             }
 132             if (needPaint) {
 133                 postPaintEvent(target, 0, 0, newBounds.width, newBounds.height);
 134             }
 135         } finally {
 136             XToolkit.awtUnlock();
 137         }
 138     }
 139 
 140     @Override
 141     public void handleExposeEvent(XEvent xev) {






 142         if (width <= 0 || height <= 0) {
 143             return;
 144         }
 145         super.handleExposeEvent(xev);
 146     }
 147 
 148     // NOTE: This method may be called by privileged threads.
 149     //       DO NOT INVOKE CLIENT CODE ON THIS THREAD!
 150     public void handleResize(Rectangle bounds) {
 151         AWTAccessor.getComponentAccessor().setSize(target, bounds.width, bounds.height);
 152         postEvent(new ComponentEvent(target, ComponentEvent.COMPONENT_RESIZED));
 153     }
 154 
 155 
 156     public void postPaintEvent(Component target, int x, int y, int w, int h) {
 157         // TODO: ?
 158         // get rid of 'istanceof' by subclassing:
 159         // XContentWindow -> XFrameContentWindow
 160 
 161         // Expose event(s) that result from deiconification


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


 122             // Fix for 5023533:
 123             // Change in the size of the content window means, well, change of the size
 124             // Change in the location of the content window means change in insets
 125             boolean needHandleResize = !(newBounds.equals(getBounds()));
 126             boolean needPaint = width <= 0 || height <= 0;
 127             reshape(newBounds);
 128             if (needHandleResize) {
 129                 insLog.fine("Sending RESIZED");
 130                 handleResize(newBounds);
 131             }
 132             if (needPaint) {
 133                 postPaintEvent(target, 0, 0, newBounds.width, newBounds.height);
 134             }
 135         } finally {
 136             XToolkit.awtUnlock();
 137         }
 138     }
 139 
 140     @Override
 141     public void handleExposeEvent(XEvent xev) {
 142         if(parentFrame.isTargetUndecorated() &&
 143            XWM.getWMID() != XWM.UNITY_COMPIZ_WM &&
 144                 width <= 0 && height <= 0) {
 145             // WM didn't send initial ConfigureNotify, so set the bounds here
 146             setContentBounds(parentFrame.getDimensions());
 147         }
 148         if (width <= 0 || height <= 0) {
 149             return;
 150         }
 151         super.handleExposeEvent(xev);
 152     }
 153 
 154     // NOTE: This method may be called by privileged threads.
 155     //       DO NOT INVOKE CLIENT CODE ON THIS THREAD!
 156     public void handleResize(Rectangle bounds) {
 157         AWTAccessor.getComponentAccessor().setSize(target, bounds.width, bounds.height);
 158         postEvent(new ComponentEvent(target, ComponentEvent.COMPONENT_RESIZED));
 159     }
 160 
 161 
 162     public void postPaintEvent(Component target, int x, int y, int w, int h) {
 163         // TODO: ?
 164         // get rid of 'istanceof' by subclassing:
 165         // XContentWindow -> XFrameContentWindow
 166 
 167         // Expose event(s) that result from deiconification


< prev index next >