< prev index next >

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

Print this page




  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.X11;
  26 
  27 import java.awt.*;
  28 
  29 import java.awt.event.ComponentEvent;
  30 import java.awt.event.InvocationEvent;
  31 import java.awt.event.WindowEvent;
  32 import java.util.Collections;
  33 import java.util.HashMap;
  34 import java.util.Map;
  35 
  36 import sun.awt.IconInfo;
  37 import sun.util.logging.PlatformLogger;
  38 
  39 import sun.awt.AWTAccessor;
  40 import sun.awt.SunToolkit;

  41 
  42 abstract class XDecoratedPeer extends XWindowPeer {
  43     private static final PlatformLogger log = PlatformLogger.getLogger("sun.awt.X11.XDecoratedPeer");
  44     private static final PlatformLogger insLog = PlatformLogger.getLogger("sun.awt.X11.insets.XDecoratedPeer");
  45     private static final PlatformLogger focusLog = PlatformLogger.getLogger("sun.awt.X11.focus.XDecoratedPeer");
  46     private static final PlatformLogger iconLog = PlatformLogger.getLogger("sun.awt.X11.icon.XDecoratedPeer");
  47 
  48     // Set to true when we get the first ConfigureNotify after being
  49     // reparented - indicates that WM has adopted the top-level.
  50     boolean configure_seen;
  51     boolean insets_corrected;
  52 
  53     XIconWindow iconWindow;
  54     volatile WindowDimensions dimensions;
  55     XContentWindow content;
  56     volatile Insets currentInsets;
  57     XFocusProxyWindow focusProxy;
  58     static final Map<Class<?>,Insets> lastKnownInsets =
  59                                    Collections.synchronizedMap(new HashMap<>());
  60 


 791             Insets correctWM = (parent != -1) ? XWM.getWM().getInsets(this, window, parent) : null;
 792             if (insLog.isLoggable(PlatformLogger.Level.FINER)) {
 793                 if (correctWM != null) {
 794                     insLog.finer("Configure notify - insets : " + correctWM);
 795                 } else {
 796                     insLog.finer("Configure notify - insets are still not available");
 797                 }
 798             }
 799             if (correctWM != null) {
 800                 handleCorrectInsets(copyAndScaleDown(correctWM));
 801             } else {
 802                 //Only one attempt to correct insets is made (to lower risk)
 803                 //if insets are still not available we simply set the flag
 804                 insets_corrected = true;
 805             }
 806         }
 807 
 808         updateChildrenSizes();
 809 
 810         Point newLocation = getNewLocation(xe, currentInsets.left, currentInsets.top);






 811         WindowDimensions newDimensions =
 812                 new WindowDimensions(newLocation,
 813                                      new Dimension(scaleDown(xe.get_width()),
 814                                                    scaleDown(xe.get_height())),
 815                                      copy(currentInsets), true);
 816 
 817         if (insLog.isLoggable(PlatformLogger.Level.FINER)) {
 818             insLog.finer("Insets are {0}, new dimensions {1}",
 819                      currentInsets, newDimensions);
 820         }
 821 
 822         checkIfOnNewScreen(newDimensions.getBounds());
 823 
 824         Point oldLocation = getLocation();
 825         dimensions = newDimensions;
 826         if (!newLocation.equals(oldLocation)) {
 827             handleMoved(newDimensions);
 828         }
 829         reconfigureContentWindow(newDimensions);
 830         updateChildrenSizes();




  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.X11;
  26 
  27 import java.awt.*;
  28 
  29 import java.awt.event.ComponentEvent;
  30 import java.awt.event.InvocationEvent;
  31 import java.awt.event.WindowEvent;
  32 import java.util.Collections;
  33 import java.util.HashMap;
  34 import java.util.Map;
  35 
  36 import sun.awt.IconInfo;
  37 import sun.util.logging.PlatformLogger;
  38 
  39 import sun.awt.AWTAccessor;
  40 import sun.awt.SunToolkit;
  41 import sun.font.FontUtilities;
  42 
  43 abstract class XDecoratedPeer extends XWindowPeer {
  44     private static final PlatformLogger log = PlatformLogger.getLogger("sun.awt.X11.XDecoratedPeer");
  45     private static final PlatformLogger insLog = PlatformLogger.getLogger("sun.awt.X11.insets.XDecoratedPeer");
  46     private static final PlatformLogger focusLog = PlatformLogger.getLogger("sun.awt.X11.focus.XDecoratedPeer");
  47     private static final PlatformLogger iconLog = PlatformLogger.getLogger("sun.awt.X11.icon.XDecoratedPeer");
  48 
  49     // Set to true when we get the first ConfigureNotify after being
  50     // reparented - indicates that WM has adopted the top-level.
  51     boolean configure_seen;
  52     boolean insets_corrected;
  53 
  54     XIconWindow iconWindow;
  55     volatile WindowDimensions dimensions;
  56     XContentWindow content;
  57     volatile Insets currentInsets;
  58     XFocusProxyWindow focusProxy;
  59     static final Map<Class<?>,Insets> lastKnownInsets =
  60                                    Collections.synchronizedMap(new HashMap<>());
  61 


 792             Insets correctWM = (parent != -1) ? XWM.getWM().getInsets(this, window, parent) : null;
 793             if (insLog.isLoggable(PlatformLogger.Level.FINER)) {
 794                 if (correctWM != null) {
 795                     insLog.finer("Configure notify - insets : " + correctWM);
 796                 } else {
 797                     insLog.finer("Configure notify - insets are still not available");
 798                 }
 799             }
 800             if (correctWM != null) {
 801                 handleCorrectInsets(copyAndScaleDown(correctWM));
 802             } else {
 803                 //Only one attempt to correct insets is made (to lower risk)
 804                 //if insets are still not available we simply set the flag
 805                 insets_corrected = true;
 806             }
 807         }
 808 
 809         updateChildrenSizes();
 810 
 811         Point newLocation = getNewLocation(xe, currentInsets.left, currentInsets.top);
 812         if (XWM.isMotif()) {
 813             if (!isFocusableWindow() && FontUtilities.isAIX) {
 814                 Rectangle targetBounds = AWTAccessor.getComponentAccessor().getBounds(target);
 815                 newLocation = targetBounds.getLocation();
 816             }
 817         }
 818         WindowDimensions newDimensions =
 819                 new WindowDimensions(newLocation,
 820                                      new Dimension(scaleDown(xe.get_width()),
 821                                                    scaleDown(xe.get_height())),
 822                                      copy(currentInsets), true);
 823 
 824         if (insLog.isLoggable(PlatformLogger.Level.FINER)) {
 825             insLog.finer("Insets are {0}, new dimensions {1}",
 826                      currentInsets, newDimensions);
 827         }
 828 
 829         checkIfOnNewScreen(newDimensions.getBounds());
 830 
 831         Point oldLocation = getLocation();
 832         dimensions = newDimensions;
 833         if (!newLocation.equals(oldLocation)) {
 834             handleMoved(newDimensions);
 835         }
 836         reconfigureContentWindow(newDimensions);
 837         updateChildrenSizes();


< prev index next >