src/solaris/classes/sun/awt/X11/XComponentPeer.java

Print this page




 601               break;
 602           default:
 603               break;
 604         }
 605 
 606     }
 607 
 608     public void handleButtonPressRelease(XEvent xev) {
 609         /*
 610          * Fix for 6385277.
 611          * We request focus on simple Window by click in order
 612          * to make it behave like Frame/Dialog in this case and also to unify
 613          * the behaviour with what we have on MS Windows.
 614          * handleJavaMouseEvent() would be more suitable place to do this
 615          * but we want Swing to have this functionality also.
 616          */
 617         if (xev.get_type() == XConstants.ButtonPress) {
 618             final XWindowPeer parentXWindow = getParentTopLevel();
 619             Window parentWindow = (Window)parentXWindow.getTarget();
 620             if (parentXWindow.isFocusableWindow() && parentXWindow.isSimpleWindow() &&
 621                 XKeyboardFocusManagerPeer.getCurrentNativeFocusedWindow() != parentWindow)
 622             {
 623                 postEvent(new InvocationEvent(parentWindow, new  Runnable() {
 624                         public void run() {
 625                             // Request focus on the EDT of 'parentWindow' because
 626                             // XDecoratedPeer.requestWindowFocus() calls client code.
 627                             parentXWindow.requestXFocus();
 628                         }
 629                     }));
 630             }
 631         }
 632         super.handleButtonPressRelease(xev);
 633     }
 634 
 635     public Dimension getMinimumSize() {
 636         return target.getSize();
 637     }
 638 
 639     public Dimension getPreferredSize() {
 640         return getMinimumSize();
 641     }




 601               break;
 602           default:
 603               break;
 604         }
 605 
 606     }
 607 
 608     public void handleButtonPressRelease(XEvent xev) {
 609         /*
 610          * Fix for 6385277.
 611          * We request focus on simple Window by click in order
 612          * to make it behave like Frame/Dialog in this case and also to unify
 613          * the behaviour with what we have on MS Windows.
 614          * handleJavaMouseEvent() would be more suitable place to do this
 615          * but we want Swing to have this functionality also.
 616          */
 617         if (xev.get_type() == XConstants.ButtonPress) {
 618             final XWindowPeer parentXWindow = getParentTopLevel();
 619             Window parentWindow = (Window)parentXWindow.getTarget();
 620             if (parentXWindow.isFocusableWindow() && parentXWindow.isSimpleWindow() &&
 621                 XKeyboardFocusManagerPeer.getInstance().getCurrentFocusedWindow() != parentWindow)
 622             {
 623                 postEvent(new InvocationEvent(parentWindow, new  Runnable() {
 624                         public void run() {
 625                             // Request focus on the EDT of 'parentWindow' because
 626                             // XDecoratedPeer.requestWindowFocus() calls client code.
 627                             parentXWindow.requestXFocus();
 628                         }
 629                     }));
 630             }
 631         }
 632         super.handleButtonPressRelease(xev);
 633     }
 634 
 635     public Dimension getMinimumSize() {
 636         return target.getSize();
 637     }
 638 
 639     public Dimension getPreferredSize() {
 640         return getMinimumSize();
 641     }