jdk/src/solaris/classes/sun/awt/X11/XDecoratedPeer.java
changeset 3938 ef327bd847c0
parent 2802 d05a9dcc8296
child 4214 0fa32d38146b
equal deleted inserted replaced
3934:487e1aa949c4 3938:ef327bd847c0
    28 
    28 
    29 import java.awt.event.ComponentEvent;
    29 import java.awt.event.ComponentEvent;
    30 import java.awt.event.InvocationEvent;
    30 import java.awt.event.InvocationEvent;
    31 import java.awt.event.WindowEvent;
    31 import java.awt.event.WindowEvent;
    32 
    32 
    33 import java.util.logging.Level;
    33 import sun.util.logging.PlatformLogger;
    34 import java.util.logging.Logger;
       
    35 
    34 
    36 import sun.awt.ComponentAccessor;
    35 import sun.awt.ComponentAccessor;
    37 import sun.awt.SunToolkit;
    36 import sun.awt.SunToolkit;
    38 
    37 
    39 abstract class XDecoratedPeer extends XWindowPeer {
    38 abstract class XDecoratedPeer extends XWindowPeer {
    40     private static final Logger log = Logger.getLogger("sun.awt.X11.XDecoratedPeer");
    39     private static final PlatformLogger log = PlatformLogger.getLogger("sun.awt.X11.XDecoratedPeer");
    41     private static final Logger insLog = Logger.getLogger("sun.awt.X11.insets.XDecoratedPeer");
    40     private static final PlatformLogger insLog = PlatformLogger.getLogger("sun.awt.X11.insets.XDecoratedPeer");
    42     private static final Logger focusLog = Logger.getLogger("sun.awt.X11.focus.XDecoratedPeer");
    41     private static final PlatformLogger focusLog = PlatformLogger.getLogger("sun.awt.X11.focus.XDecoratedPeer");
    43     private static final Logger iconLog = Logger.getLogger("sun.awt.X11.icon.XDecoratedPeer");
    42     private static final PlatformLogger iconLog = PlatformLogger.getLogger("sun.awt.X11.icon.XDecoratedPeer");
    44 
    43 
    45     // Set to true when we get the first ConfigureNotify after being
    44     // Set to true when we get the first ConfigureNotify after being
    46     // reparented - indicates that WM has adopted the top-level.
    45     // reparented - indicates that WM has adopted the top-level.
    47     boolean configure_seen;
    46     boolean configure_seen;
    48     boolean insets_corrected;
    47     boolean insets_corrected;
    77         applyGuessedInsets();
    76         applyGuessedInsets();
    78 
    77 
    79         Rectangle bounds = (Rectangle)params.get(BOUNDS);
    78         Rectangle bounds = (Rectangle)params.get(BOUNDS);
    80         dimensions = new WindowDimensions(bounds, getRealInsets(), false);
    79         dimensions = new WindowDimensions(bounds, getRealInsets(), false);
    81         params.put(BOUNDS, dimensions.getClientRect());
    80         params.put(BOUNDS, dimensions.getClientRect());
    82         insLog.log(Level.FINE, "Initial dimensions {0}", new Object[] { dimensions });
    81         insLog.fine("Initial dimensions {0}", dimensions);
    83 
    82 
    84         // Deny default processing of these events on the shell - proxy will take care of
    83         // Deny default processing of these events on the shell - proxy will take care of
    85         // them instead
    84         // them instead
    86         Long eventMask = (Long)params.get(EVENT_MASK);
    85         Long eventMask = (Long)params.get(EVENT_MASK);
    87         params.add(EVENT_MASK, Long.valueOf(eventMask.longValue() & ~(XConstants.FocusChangeMask | XConstants.KeyPressMask | XConstants.KeyReleaseMask)));
    86         params.add(EVENT_MASK, Long.valueOf(eventMask.longValue() & ~(XConstants.FocusChangeMask | XConstants.KeyPressMask | XConstants.KeyReleaseMask)));
   173                            ComponentAccessor.getBackground(target),
   172                            ComponentAccessor.getBackground(target),
   174                            ComponentAccessor.getFont_NoClientCode(target));
   173                            ComponentAccessor.getFont_NoClientCode(target));
   175     }
   174     }
   176 
   175 
   177     public void setTitle(String title) {
   176     public void setTitle(String title) {
   178         if (log.isLoggable(Level.FINE)) log.fine("Title is " + title);
   177         if (log.isLoggable(PlatformLogger.FINE)) log.fine("Title is " + title);
   179         winAttr.title = title;
   178         winAttr.title = title;
   180         updateWMName();
   179         updateWMName();
   181     }
   180     }
   182 
   181 
   183     protected String getWMName() {
   182     protected String getWMName() {
   263             wm_set_insets = XWM.getInsetsFromExtents(getWindow());
   262             wm_set_insets = XWM.getInsetsFromExtents(getWindow());
   264         } else {
   263         } else {
   265             wm_set_insets = XWM.getInsetsFromProp(getWindow(), changedAtom);
   264             wm_set_insets = XWM.getInsetsFromProp(getWindow(), changedAtom);
   266         }
   265         }
   267 
   266 
   268         insLog.log(Level.FINER, "FRAME_EXTENTS: {0}", new Object[]{wm_set_insets});
   267         insLog.finer("FRAME_EXTENTS: {0}", wm_set_insets);
   269 
   268 
   270         if (wm_set_insets != null) {
   269         if (wm_set_insets != null) {
   271             wm_set_insets = copy(wm_set_insets);
   270             wm_set_insets = copy(wm_set_insets);
   272         }
   271         }
   273         return wm_set_insets;
   272         return wm_set_insets;
   290 
   289 
   291     long reparent_serial = 0;
   290     long reparent_serial = 0;
   292 
   291 
   293     public void handleReparentNotifyEvent(XEvent xev) {
   292     public void handleReparentNotifyEvent(XEvent xev) {
   294         XReparentEvent  xe = xev.get_xreparent();
   293         XReparentEvent  xe = xev.get_xreparent();
   295         if (insLog.isLoggable(Level.FINE)) insLog.fine(xe.toString());
   294         if (insLog.isLoggable(PlatformLogger.FINE)) insLog.fine(xe.toString());
   296         reparent_serial = xe.get_serial();
   295         reparent_serial = xe.get_serial();
   297         XToolkit.awtLock();
   296         XToolkit.awtLock();
   298         try {
   297         try {
   299             long root = XlibWrapper.RootWindow(XToolkit.getDisplay(), getScreenNumber());
   298             long root = XlibWrapper.RootWindow(XToolkit.getDisplay(), getScreenNumber());
   300 
   299 
   329                 insets_corrected = false;
   328                 insets_corrected = false;
   330 
   329 
   331                 // Check if we have insets provided by the WM
   330                 // Check if we have insets provided by the WM
   332                 Insets correctWM = getWMSetInsets(null);
   331                 Insets correctWM = getWMSetInsets(null);
   333                 if (correctWM != null) {
   332                 if (correctWM != null) {
   334                     insLog.log(Level.FINER, "wm-provided insets {0}", new Object[]{correctWM});
   333                     insLog.finer("wm-provided insets {0}", correctWM);
   335                     // If these insets are equal to our current insets - no actions are necessary
   334                     // If these insets are equal to our current insets - no actions are necessary
   336                     Insets dimInsets = dimensions.getInsets();
   335                     Insets dimInsets = dimensions.getInsets();
   337                     if (correctWM.equals(dimInsets)) {
   336                     if (correctWM.equals(dimInsets)) {
   338                         insLog.finer("Insets are the same as estimated - no additional reshapes necessary");
   337                         insLog.finer("Insets are the same as estimated - no additional reshapes necessary");
   339                         no_reparent_artifacts = true;
   338                         no_reparent_artifacts = true;
   343                     }
   342                     }
   344                 } else {
   343                 } else {
   345                     correctWM = XWM.getWM().getInsets(this, xe.get_window(), xe.get_parent());
   344                     correctWM = XWM.getWM().getInsets(this, xe.get_window(), xe.get_parent());
   346 
   345 
   347                     if (correctWM != null) {
   346                     if (correctWM != null) {
   348                         insLog.log(Level.FINER, "correctWM {0}", new Object[] {correctWM});
   347                         insLog.finer("correctWM {0}", correctWM);
   349                     } else {
   348                     } else {
   350                         insLog.log(Level.FINER, "correctWM insets are not available, waiting for configureNotify");
   349                         insLog.finer("correctWM insets are not available, waiting for configureNotify");
   351                     }
   350                     }
   352                 }
   351                 }
   353 
   352 
   354                 if (correctWM != null) {
   353                 if (correctWM != null) {
   355                     handleCorrectInsets(correctWM);
   354                     handleCorrectInsets(correctWM);
   366             /*
   365             /*
   367              * Ok, now see if we need adjust window size because
   366              * Ok, now see if we need adjust window size because
   368              * initial insets were wrong (most likely they were).
   367              * initial insets were wrong (most likely they were).
   369              */
   368              */
   370             Insets correction = difference(correctWM, currentInsets);
   369             Insets correction = difference(correctWM, currentInsets);
   371             insLog.log(Level.FINEST, "Corrention {0}", new Object[] {correction});
   370             insLog.finest("Corrention {0}", correction);
   372             if (!isNull(correction)) {
   371             if (!isNull(correction)) {
   373                 currentInsets = copy(correctWM);
   372                 currentInsets = copy(correctWM);
   374                 applyGuessedInsets();
   373                 applyGuessedInsets();
   375 
   374 
   376                 //Fix for 6318109: PIT: Min Size is not honored properly when a
   375                 //Fix for 6318109: PIT: Min Size is not honored properly when a
   377                 //smaller size is specified in setSize(), XToolkit
   376                 //smaller size is specified in setSize(), XToolkit
   378                 //update minimum size hints
   377                 //update minimum size hints
   379                 updateMinSizeHints();
   378                 updateMinSizeHints();
   380             }
   379             }
   381             if (insLog.isLoggable(Level.FINER)) insLog.finer("Dimensions before reparent: " + dimensions);
   380             if (insLog.isLoggable(PlatformLogger.FINER)) insLog.finer("Dimensions before reparent: " + dimensions);
   382 
   381 
   383             dimensions.setInsets(getRealInsets());
   382             dimensions.setInsets(getRealInsets());
   384             insets_corrected = true;
   383             insets_corrected = true;
   385 
   384 
   386             if (isMaximized()) {
   385             if (isMaximized()) {
   450     }
   449     }
   451 
   450 
   452     public Insets getInsets() {
   451     public Insets getInsets() {
   453         Insets in = copy(getRealInsets());
   452         Insets in = copy(getRealInsets());
   454         in.top += getMenuBarHeight();
   453         in.top += getMenuBarHeight();
   455         if (insLog.isLoggable(Level.FINEST)) {
   454         if (insLog.isLoggable(PlatformLogger.FINEST)) {
   456             insLog.log(Level.FINEST, "Get insets returns {0}", new Object[] {in});
   455             insLog.finest("Get insets returns {0}", in);
   457         }
   456         }
   458         return in;
   457         return in;
   459     }
   458     }
   460 
   459 
   461     boolean gravityBug() {
   460     boolean gravityBug() {
   480     // Coordinates are that of the target
   479     // Coordinates are that of the target
   481     // Called only on Toolkit thread
   480     // Called only on Toolkit thread
   482     public void reshape(WindowDimensions newDimensions, int op,
   481     public void reshape(WindowDimensions newDimensions, int op,
   483                         boolean userReshape)
   482                         boolean userReshape)
   484     {
   483     {
   485         if (insLog.isLoggable(Level.FINE)) {
   484         if (insLog.isLoggable(PlatformLogger.FINE)) {
   486             insLog.fine("Reshaping " + this + " to " + newDimensions + " op " + op + " user reshape " + userReshape);
   485             insLog.fine("Reshaping " + this + " to " + newDimensions + " op " + op + " user reshape " + userReshape);
   487         }
   486         }
   488         if (userReshape) {
   487         if (userReshape) {
   489             // We handle only userReshape == true cases. It means that
   488             // We handle only userReshape == true cases. It means that
   490             // if the window manager or any other part of the windowing
   489             // if the window manager or any other part of the windowing
   501             newDimensions = new WindowDimensions(newBounds, insets, newDimensions.isClientSizeSet());
   500             newDimensions = new WindowDimensions(newBounds, insets, newDimensions.isClientSizeSet());
   502         }
   501         }
   503         XToolkit.awtLock();
   502         XToolkit.awtLock();
   504         try {
   503         try {
   505             if (!isReparented() || !isVisible()) {
   504             if (!isReparented() || !isVisible()) {
   506                 insLog.log(Level.FINE, "- not reparented({0}) or not visible({1}), default reshape",
   505                 insLog.fine("- not reparented({0}) or not visible({1}), default reshape",
   507                            new Object[] {Boolean.valueOf(isReparented()), Boolean.valueOf(visible)});
   506                            Boolean.valueOf(isReparented()), Boolean.valueOf(visible));
   508 
   507 
   509                 // Fix for 6323293.
   508                 // Fix for 6323293.
   510                 // This actually is needed to preserve compatibility with previous releases -
   509                 // This actually is needed to preserve compatibility with previous releases -
   511                 // some of licensees are expecting componentMoved event on invisible one while
   510                 // some of licensees are expecting componentMoved event on invisible one while
   512                 // its location changes.
   511                 // its location changes.
   607           default:
   606           default:
   608               dims.setLocation(x, y);
   607               dims.setLocation(x, y);
   609               dims.setSize(width, height);
   608               dims.setSize(width, height);
   610               break;
   609               break;
   611         }
   610         }
   612         if (insLog.isLoggable(Level.FINE)) insLog.log(Level.FINE, "For the operation {0} new dimensions are {1}",
   611         if (insLog.isLoggable(PlatformLogger.FINE))
   613                                                       new Object[] {operationToString(operation), dims});
   612             insLog.fine("For the operation {0} new dimensions are {1}",
       
   613                         operationToString(operation), dims);
   614 
   614 
   615         reshape(dims, operation, userReshape);
   615         reshape(dims, operation, userReshape);
   616     }
   616     }
   617 
   617 
   618     // This method gets overriden in XFramePeer & XDialogPeer.
   618     // This method gets overriden in XFramePeer & XDialogPeer.
   638 
   638 
   639     boolean no_reparent_artifacts = false;
   639     boolean no_reparent_artifacts = false;
   640     public void handleConfigureNotifyEvent(XEvent xev) {
   640     public void handleConfigureNotifyEvent(XEvent xev) {
   641         assert (SunToolkit.isAWTLockHeldByCurrentThread());
   641         assert (SunToolkit.isAWTLockHeldByCurrentThread());
   642         XConfigureEvent xe = xev.get_xconfigure();
   642         XConfigureEvent xe = xev.get_xconfigure();
   643         insLog.log(Level.FINE, "Configure notify {0}", new Object[] {xe});
   643         insLog.fine("Configure notify {0}", xe);
   644 
   644 
   645         // XXX: should really only consider synthetic events, but
   645         // XXX: should really only consider synthetic events, but
   646         if (isReparented()) {
   646         if (isReparented()) {
   647             configure_seen = true;
   647             configure_seen = true;
   648         }
   648         }
   675          * possibly MWM as well).  If we haven't been reparented yet
   675          * possibly MWM as well).  If we haven't been reparented yet
   676          * this is just the WM shuffling us into position.  Ignore
   676          * this is just the WM shuffling us into position.  Ignore
   677          * it!!!! or we wind up in a bogus location.
   677          * it!!!! or we wind up in a bogus location.
   678          */
   678          */
   679         int runningWM = XWM.getWMID();
   679         int runningWM = XWM.getWMID();
   680         if (insLog.isLoggable(Level.FINE)) {
   680         if (insLog.isLoggable(PlatformLogger.FINE)) {
   681             insLog.log(Level.FINE, "reparented={0}, visible={1}, WM={2}, decorations={3}",
   681             insLog.fine("reparented={0}, visible={1}, WM={2}, decorations={3}",
   682                     new Object[] {isReparented(), isVisible(), runningWM, getDecorations()});
   682                         isReparented(), isVisible(), runningWM, getDecorations());
   683         }
   683         }
   684         if (!isReparented() && isVisible() && runningWM != XWM.NO_WM
   684         if (!isReparented() && isVisible() && runningWM != XWM.NO_WM
   685                 &&  !XWM.isNonReparentingWM()
   685                 &&  !XWM.isNonReparentingWM()
   686                 && getDecorations() != XWindowAttributesData.AWT_DECOR_NONE) {
   686                 && getDecorations() != XWindowAttributesData.AWT_DECOR_NONE) {
   687             insLog.fine("- visible but not reparented, skipping");
   687             insLog.fine("- visible but not reparented, skipping");
   689         }
   689         }
   690         //Last chance to correct insets
   690         //Last chance to correct insets
   691         if (!insets_corrected && getDecorations() != XWindowAttributesData.AWT_DECOR_NONE) {
   691         if (!insets_corrected && getDecorations() != XWindowAttributesData.AWT_DECOR_NONE) {
   692             long parent = XlibUtil.getParentWindow(window);
   692             long parent = XlibUtil.getParentWindow(window);
   693             Insets correctWM = (parent != -1) ? XWM.getWM().getInsets(this, window, parent) : null;
   693             Insets correctWM = (parent != -1) ? XWM.getWM().getInsets(this, window, parent) : null;
   694             if (insLog.isLoggable(Level.FINER)) {
   694             if (insLog.isLoggable(PlatformLogger.FINER)) {
   695                 if (correctWM != null) {
   695                 if (correctWM != null) {
   696                     insLog.finer("Configure notify - insets : " + correctWM);
   696                     insLog.finer("Configure notify - insets : " + correctWM);
   697                 } else {
   697                 } else {
   698                     insLog.finer("Configure notify - insets are still not available");
   698                     insLog.finer("Configure notify - insets are still not available");
   699                 }
   699                 }
   730                 case XWM.MOTIF_WM:
   730                 case XWM.MOTIF_WM:
   731                 case XWM.METACITY_WM:
   731                 case XWM.METACITY_WM:
   732                 case XWM.SAWFISH_WM:
   732                 case XWM.SAWFISH_WM:
   733                 {
   733                 {
   734                     Point xlocation = queryXLocation();
   734                     Point xlocation = queryXLocation();
   735                     if (log.isLoggable(Level.FINE)) log.log(Level.FINE, "New X location: {0}", new Object[]{xlocation});
   735                     if (log.isLoggable(PlatformLogger.FINE)) log.fine("New X location: {0}", xlocation);
   736                     if (xlocation != null) {
   736                     if (xlocation != null) {
   737                         newLocation = xlocation;
   737                         newLocation = xlocation;
   738                     }
   738                     }
   739                     break;
   739                     break;
   740                 }
   740                 }
   747                 new WindowDimensions(newLocation,
   747                 new WindowDimensions(newLocation,
   748                 new Dimension(xe.get_width(), xe.get_height()),
   748                 new Dimension(xe.get_width(), xe.get_height()),
   749                 copy(currentInsets),
   749                 copy(currentInsets),
   750                 true);
   750                 true);
   751 
   751 
   752         insLog.log(Level.FINER, "Insets are {0}, new dimensions {1}",
   752         insLog.finer("Insets are {0}, new dimensions {1}",
   753                 new Object[] {currentInsets, newDimensions});
   753                      currentInsets, newDimensions);
   754 
   754 
   755         checkIfOnNewScreen(newDimensions.getBounds());
   755         checkIfOnNewScreen(newDimensions.getBounds());
   756 
   756 
   757         Point oldLocation = getLocation();
   757         Point oldLocation = getLocation();
   758         dimensions = newDimensions;
   758         dimensions = newDimensions;
   787         checkShellRectSize(shellRect);
   787         checkShellRectSize(shellRect);
   788         checkShellRectPos(shellRect);
   788         checkShellRectPos(shellRect);
   789     }
   789     }
   790 
   790 
   791     public void setShellBounds(Rectangle rec) {
   791     public void setShellBounds(Rectangle rec) {
   792         if (insLog.isLoggable(Level.FINE)) insLog.fine("Setting shell bounds on " +
   792         if (insLog.isLoggable(PlatformLogger.FINE)) insLog.fine("Setting shell bounds on " +
   793                                                        this + " to " + rec);
   793                                                                 this + " to " + rec);
   794         XToolkit.awtLock();
   794         XToolkit.awtLock();
   795         try {
   795         try {
   796             updateSizeHints(rec.x, rec.y, rec.width, rec.height);
   796             updateSizeHints(rec.x, rec.y, rec.width, rec.height);
   797             XlibWrapper.XResizeWindow(XToolkit.getDisplay(), getShell(), rec.width, rec.height);
   797             XlibWrapper.XResizeWindow(XToolkit.getDisplay(), getShell(), rec.width, rec.height);
   798             XlibWrapper.XMoveWindow(XToolkit.getDisplay(), getShell(), rec.x, rec.y);
   798             XlibWrapper.XMoveWindow(XToolkit.getDisplay(), getShell(), rec.x, rec.y);
   800         finally {
   800         finally {
   801             XToolkit.awtUnlock();
   801             XToolkit.awtUnlock();
   802         }
   802         }
   803     }
   803     }
   804     public void setShellSize(Rectangle rec) {
   804     public void setShellSize(Rectangle rec) {
   805         if (insLog.isLoggable(Level.FINE)) insLog.fine("Setting shell size on " +
   805         if (insLog.isLoggable(PlatformLogger.FINE)) insLog.fine("Setting shell size on " +
   806                                                        this + " to " + rec);
   806                                                                 this + " to " + rec);
   807         XToolkit.awtLock();
   807         XToolkit.awtLock();
   808         try {
   808         try {
   809             updateSizeHints(rec.x, rec.y, rec.width, rec.height);
   809             updateSizeHints(rec.x, rec.y, rec.width, rec.height);
   810             XlibWrapper.XResizeWindow(XToolkit.getDisplay(), getShell(), rec.width, rec.height);
   810             XlibWrapper.XResizeWindow(XToolkit.getDisplay(), getShell(), rec.width, rec.height);
   811         }
   811         }
   812         finally {
   812         finally {
   813             XToolkit.awtUnlock();
   813             XToolkit.awtUnlock();
   814         }
   814         }
   815     }
   815     }
   816     public void setShellPosition(Rectangle rec) {
   816     public void setShellPosition(Rectangle rec) {
   817         if (insLog.isLoggable(Level.FINE)) insLog.fine("Setting shell position on " +
   817         if (insLog.isLoggable(PlatformLogger.FINE)) insLog.fine("Setting shell position on " +
   818                                                        this + " to " + rec);
   818                                                                 this + " to " + rec);
   819         XToolkit.awtLock();
   819         XToolkit.awtLock();
   820         try {
   820         try {
   821             updateSizeHints(rec.x, rec.y, rec.width, rec.height);
   821             updateSizeHints(rec.x, rec.y, rec.width, rec.height);
   822             XlibWrapper.XMoveWindow(XToolkit.getDisplay(), getShell(), rec.x, rec.y);
   822             XlibWrapper.XMoveWindow(XToolkit.getDisplay(), getShell(), rec.x, rec.y);
   823         }
   823         }
   913         try {
   913         try {
   914             if (configure_seen) {
   914             if (configure_seen) {
   915                 return toGlobal(0,0);
   915                 return toGlobal(0,0);
   916             } else {
   916             } else {
   917                 Point location = target.getLocation();
   917                 Point location = target.getLocation();
   918                 if (insLog.isLoggable(Level.FINE))
   918                 if (insLog.isLoggable(PlatformLogger.FINE))
   919                     insLog.log(Level.FINE, "getLocationOnScreen {0} not reparented: {1} ",
   919                     insLog.fine("getLocationOnScreen {0} not reparented: {1} ",
   920                                new Object[] {this, location});
   920                                 this, location);
   921                 return location;
   921                 return location;
   922             }
   922             }
   923         } finally {
   923         } finally {
   924             XToolkit.awtUnlock();
   924             XToolkit.awtUnlock();
   925         }
   925         }
   952     int getFunctions() {
   952     int getFunctions() {
   953         return winAttr.functions;
   953         return winAttr.functions;
   954     }
   954     }
   955 
   955 
   956     public void setVisible(boolean vis) {
   956     public void setVisible(boolean vis) {
   957         log.log(Level.FINER, "Setting {0} to visible {1}", new Object[] {this, Boolean.valueOf(vis)});
   957         log.finer("Setting {0} to visible {1}", this, Boolean.valueOf(vis));
   958         if (vis && !isVisible()) {
   958         if (vis && !isVisible()) {
   959             XWM.setShellDecor(this);
   959             XWM.setShellDecor(this);
   960             super.setVisible(vis);
   960             super.setVisible(vis);
   961             if (winAttr.isResizable) {
   961             if (winAttr.isResizable) {
   962                 //Fix for 4320050: Minimum size for java.awt.Frame is not being enforced.
   962                 //Fix for 4320050: Minimum size for java.awt.Frame is not being enforced.
  1003             }
  1003             }
  1004         }
  1004         }
  1005     }
  1005     }
  1006 
  1006 
  1007     private void handleWmTakeFocus(XClientMessageEvent cl) {
  1007     private void handleWmTakeFocus(XClientMessageEvent cl) {
  1008         focusLog.log(Level.FINE, "WM_TAKE_FOCUS on {0}", new Object[]{this});
  1008         focusLog.fine("WM_TAKE_FOCUS on {0}", this);
  1009         requestWindowFocus(cl.get_data(1), true);
  1009         requestWindowFocus(cl.get_data(1), true);
  1010     }
  1010     }
  1011 
  1011 
  1012     /**
  1012     /**
  1013      * Requests focus to this decorated top-level by requesting X input focus
  1013      * Requests focus to this decorated top-level by requesting X input focus
  1016     protected void requestXFocus(long time, boolean timeProvided) {
  1016     protected void requestXFocus(long time, boolean timeProvided) {
  1017         // We have proxied focus mechanism - instead of shell the focus is held
  1017         // We have proxied focus mechanism - instead of shell the focus is held
  1018         // by "proxy" - invisible mapped window. When we want to set X input focus to
  1018         // by "proxy" - invisible mapped window. When we want to set X input focus to
  1019         // toplevel set it on proxy instead.
  1019         // toplevel set it on proxy instead.
  1020         if (focusProxy == null) {
  1020         if (focusProxy == null) {
  1021             if (focusLog.isLoggable(Level.FINE)) focusLog.warning("Focus proxy is null for " + this);
  1021             if (focusLog.isLoggable(PlatformLogger.FINE)) focusLog.warning("Focus proxy is null for " + this);
  1022         } else {
  1022         } else {
  1023             if (focusLog.isLoggable(Level.FINE)) focusLog.fine("Requesting focus to proxy: " + focusProxy);
  1023             if (focusLog.isLoggable(PlatformLogger.FINE)) focusLog.fine("Requesting focus to proxy: " + focusProxy);
  1024             if (timeProvided) {
  1024             if (timeProvided) {
  1025                 focusProxy.xRequestFocus(time);
  1025                 focusProxy.xRequestFocus(time);
  1026             } else {
  1026             } else {
  1027                 focusProxy.xRequestFocus();
  1027                 focusProxy.xRequestFocus();
  1028             }
  1028             }
  1109         // If this is Frame or Dialog we can't assure focus request success - but we still can try
  1109         // If this is Frame or Dialog we can't assure focus request success - but we still can try
  1110         // If this is Window and its owner Frame is active we can be sure request succedded.
  1110         // If this is Window and its owner Frame is active we can be sure request succedded.
  1111         Window focusedWindow = XKeyboardFocusManagerPeer.getCurrentNativeFocusedWindow();
  1111         Window focusedWindow = XKeyboardFocusManagerPeer.getCurrentNativeFocusedWindow();
  1112         Window activeWindow = XWindowPeer.getDecoratedOwner(focusedWindow);
  1112         Window activeWindow = XWindowPeer.getDecoratedOwner(focusedWindow);
  1113 
  1113 
  1114         focusLog.log(Level.FINER, "Current window is: active={0}, focused={1}",
  1114         focusLog.finer("Current window is: active={0}, focused={1}",
  1115                      new Object[]{ Boolean.valueOf(target == activeWindow),
  1115                        Boolean.valueOf(target == activeWindow),
  1116                                    Boolean.valueOf(target == focusedWindow)});
  1116                        Boolean.valueOf(target == focusedWindow));
  1117 
  1117 
  1118         XWindowPeer toFocus = this;
  1118         XWindowPeer toFocus = this;
  1119         while (toFocus.nextTransientFor != null) {
  1119         while (toFocus.nextTransientFor != null) {
  1120             toFocus = toFocus.nextTransientFor;
  1120             toFocus = toFocus.nextTransientFor;
  1121         }
  1121         }