< prev index next >

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

Print this page




  29 import java.awt.event.ComponentEvent;
  30 import java.awt.event.InvocationEvent;
  31 import java.awt.event.WindowEvent;
  32 
  33 import sun.awt.IconInfo;
  34 import sun.util.logging.PlatformLogger;
  35 
  36 import sun.awt.AWTAccessor;
  37 import sun.awt.SunToolkit;
  38 
  39 abstract class XDecoratedPeer extends XWindowPeer {
  40     private static final PlatformLogger log = PlatformLogger.getLogger("sun.awt.X11.XDecoratedPeer");
  41     private static final PlatformLogger insLog = PlatformLogger.getLogger("sun.awt.X11.insets.XDecoratedPeer");
  42     private static final PlatformLogger focusLog = PlatformLogger.getLogger("sun.awt.X11.focus.XDecoratedPeer");
  43     private static final PlatformLogger iconLog = PlatformLogger.getLogger("sun.awt.X11.icon.XDecoratedPeer");
  44 
  45     // Set to true when we get the first ConfigureNotify after being
  46     // reparented - indicates that WM has adopted the top-level.
  47     boolean configure_seen;
  48     boolean insets_corrected;

  49 
  50     XIconWindow iconWindow;
  51     WindowDimensions dimensions;
  52     XContentWindow content;
  53     Insets currentInsets;
  54     XFocusProxyWindow focusProxy;
  55 
  56     XDecoratedPeer(Window target) {
  57         super(target);
  58     }
  59 
  60     XDecoratedPeer(XCreateWindowParams params) {
  61         super(params);
  62     }
  63 
  64     public long getShell() {
  65         return window;
  66     }
  67 
  68     public long getContentWindow() {


 334                  */
 335                 if (isVisible()) { /* WM exited */
 336                     /* Work around 4775545 */
 337                     XWM.getWM().unshadeKludge(this);
 338                     insLog.fine("- WM exited");
 339                 } else {
 340                     insLog.fine(" - reparent due to hide");
 341                 }
 342             } else { /* reparented to WM frame, figure out our insets */
 343                 setReparented(true);
 344                 insets_corrected = false;
 345 
 346                 // Check if we have insets provided by the WM
 347                 Insets correctWM = getWMSetInsets(null);
 348                 if (correctWM != null) {
 349                     if (insLog.isLoggable(PlatformLogger.Level.FINER)) {
 350                         insLog.finer("wm-provided insets {0}", correctWM);
 351                     }
 352                     // If these insets are equal to our current insets - no actions are necessary
 353                     Insets dimInsets = dimensions.getInsets();
 354                     if (correctWM.equals(dimInsets)) {
 355                         insLog.finer("Insets are the same as estimated - no additional reshapes necessary");
 356                         no_reparent_artifacts = true;
 357                         insets_corrected = true;
 358                         applyGuessedInsets();
 359                         return;
 360                     }
 361                 } else {
 362                     correctWM = XWM.getWM().getInsets(this, xe.get_window(), xe.get_parent());
 363 
 364                     if (insLog.isLoggable(PlatformLogger.Level.FINER)) {
 365                         if (correctWM != null) {
 366                             insLog.finer("correctWM {0}", correctWM);
 367                         } else {
 368                             insLog.finer("correctWM insets are not available, waiting for configureNotify");
 369                         }
 370                     }
 371                 }
 372 
 373                 if (correctWM != null) {
 374                     handleCorrectInsets(correctWM);
 375                 }
 376             }
 377         } finally {
 378             XToolkit.awtUnlock();
 379         }
 380     }
 381 
 382     protected void handleCorrectInsets(Insets correctWM) {
 383         XToolkit.awtLock();
 384         try {
 385             /*
 386              * Ok, now see if we need adjust window size because
 387              * initial insets were wrong (most likely they were).
 388              */
 389             Insets correction = difference(correctWM, currentInsets);
 390             if (insLog.isLoggable(PlatformLogger.Level.FINEST)) {
 391                 insLog.finest("Corrention {0}", correction);
 392             }


 942               // we receive only one set of cross notifications(first set is from content window)
 943               return true;
 944           default:
 945               return super.isEventDisabled(e);
 946         }
 947     }
 948 
 949     int getDecorations() {
 950         return winAttr.decorations;
 951     }
 952 
 953     int getFunctions() {
 954         return winAttr.functions;
 955     }
 956 
 957     public void setVisible(boolean vis) {
 958         if (log.isLoggable(PlatformLogger.Level.FINER)) {
 959             log.finer("Setting {0} to visible {1}", this, Boolean.valueOf(vis));
 960         }
 961         if (vis && !isVisible()) {

 962             XWM.setShellDecor(this);
 963             super.setVisible(vis);
 964             if (winAttr.isResizable) {
 965                 //Fix for 4320050: Minimum size for java.awt.Frame is not being enforced.
 966                 //We need to update frame's minimum size, not to reset it
 967                 XWM.removeSizeHints(this, XUtilConstants.PMaxSize);
 968                 updateMinimumSize();
 969             }
 970         } else {
 971             super.setVisible(vis);
 972         }
 973     }
 974 
 975     protected void suppressWmTakeFocus(boolean doSuppress) {
 976         XAtomList protocols = getWMProtocols();
 977         if (doSuppress) {
 978             protocols.remove(wm_take_focus);
 979         } else {
 980             protocols.add(wm_take_focus);
 981         }




  29 import java.awt.event.ComponentEvent;
  30 import java.awt.event.InvocationEvent;
  31 import java.awt.event.WindowEvent;
  32 
  33 import sun.awt.IconInfo;
  34 import sun.util.logging.PlatformLogger;
  35 
  36 import sun.awt.AWTAccessor;
  37 import sun.awt.SunToolkit;
  38 
  39 abstract class XDecoratedPeer extends XWindowPeer {
  40     private static final PlatformLogger log = PlatformLogger.getLogger("sun.awt.X11.XDecoratedPeer");
  41     private static final PlatformLogger insLog = PlatformLogger.getLogger("sun.awt.X11.insets.XDecoratedPeer");
  42     private static final PlatformLogger focusLog = PlatformLogger.getLogger("sun.awt.X11.focus.XDecoratedPeer");
  43     private static final PlatformLogger iconLog = PlatformLogger.getLogger("sun.awt.X11.icon.XDecoratedPeer");
  44 
  45     // Set to true when we get the first ConfigureNotify after being
  46     // reparented - indicates that WM has adopted the top-level.
  47     boolean configure_seen;
  48     boolean insets_corrected;
  49     private boolean force_correct_insets = false;
  50 
  51     XIconWindow iconWindow;
  52     WindowDimensions dimensions;
  53     XContentWindow content;
  54     Insets currentInsets;
  55     XFocusProxyWindow focusProxy;
  56 
  57     XDecoratedPeer(Window target) {
  58         super(target);
  59     }
  60 
  61     XDecoratedPeer(XCreateWindowParams params) {
  62         super(params);
  63     }
  64 
  65     public long getShell() {
  66         return window;
  67     }
  68 
  69     public long getContentWindow() {


 335                  */
 336                 if (isVisible()) { /* WM exited */
 337                     /* Work around 4775545 */
 338                     XWM.getWM().unshadeKludge(this);
 339                     insLog.fine("- WM exited");
 340                 } else {
 341                     insLog.fine(" - reparent due to hide");
 342                 }
 343             } else { /* reparented to WM frame, figure out our insets */
 344                 setReparented(true);
 345                 insets_corrected = false;
 346 
 347                 // Check if we have insets provided by the WM
 348                 Insets correctWM = getWMSetInsets(null);
 349                 if (correctWM != null) {
 350                     if (insLog.isLoggable(PlatformLogger.Level.FINER)) {
 351                         insLog.finer("wm-provided insets {0}", correctWM);
 352                     }
 353                     // If these insets are equal to our current insets - no actions are necessary
 354                     Insets dimInsets = dimensions.getInsets();
 355                     if (!force_correct_insets && correctWM.equals(dimInsets)) {
 356                         insLog.finer("Insets are the same as estimated - no additional reshapes necessary");
 357                         no_reparent_artifacts = true;
 358                         insets_corrected = true;
 359                         applyGuessedInsets();
 360                         return;
 361                     }
 362                 } else {
 363                     correctWM = XWM.getWM().getInsets(this, xe.get_window(), xe.get_parent());
 364 
 365                     if (insLog.isLoggable(PlatformLogger.Level.FINER)) {
 366                         if (correctWM != null) {
 367                             insLog.finer("correctWM {0}", correctWM);
 368                         } else {
 369                             insLog.finer("correctWM insets are not available, waiting for configureNotify");
 370                         }
 371                     }
 372                 }
 373                 force_correct_insets = false;
 374                 if (correctWM != null) {
 375                     handleCorrectInsets(correctWM);
 376                 }
 377             }
 378         } finally {
 379             XToolkit.awtUnlock();
 380         }
 381     }
 382 
 383     protected void handleCorrectInsets(Insets correctWM) {
 384         XToolkit.awtLock();
 385         try {
 386             /*
 387              * Ok, now see if we need adjust window size because
 388              * initial insets were wrong (most likely they were).
 389              */
 390             Insets correction = difference(correctWM, currentInsets);
 391             if (insLog.isLoggable(PlatformLogger.Level.FINEST)) {
 392                 insLog.finest("Corrention {0}", correction);
 393             }


 943               // we receive only one set of cross notifications(first set is from content window)
 944               return true;
 945           default:
 946               return super.isEventDisabled(e);
 947         }
 948     }
 949 
 950     int getDecorations() {
 951         return winAttr.decorations;
 952     }
 953 
 954     int getFunctions() {
 955         return winAttr.functions;
 956     }
 957 
 958     public void setVisible(boolean vis) {
 959         if (log.isLoggable(PlatformLogger.Level.FINER)) {
 960             log.finer("Setting {0} to visible {1}", this, Boolean.valueOf(vis));
 961         }
 962         if (vis && !isVisible()) {
 963             force_correct_insets = true;
 964             XWM.setShellDecor(this);
 965             super.setVisible(vis);
 966             if (winAttr.isResizable) {
 967                 //Fix for 4320050: Minimum size for java.awt.Frame is not being enforced.
 968                 //We need to update frame's minimum size, not to reset it
 969                 XWM.removeSizeHints(this, XUtilConstants.PMaxSize);
 970                 updateMinimumSize();
 971             }
 972         } else {
 973             super.setVisible(vis);
 974         }
 975     }
 976 
 977     protected void suppressWmTakeFocus(boolean doSuppress) {
 978         XAtomList protocols = getWMProtocols();
 979         if (doSuppress) {
 980             protocols.remove(wm_take_focus);
 981         } else {
 982             protocols.add(wm_take_focus);
 983         }


< prev index next >