588 // Skip all painting while layouting and all UPDATEs 589 // while waiting for native paint 590 if (!isLayouting && !paintPending) { 591 paintArea.paint(target,false); 592 } 593 return; 594 case FocusEvent.FOCUS_LOST: 595 case FocusEvent.FOCUS_GAINED: 596 handleJavaFocusEvent(e); 597 break; 598 case WindowEvent.WINDOW_LOST_FOCUS: 599 case WindowEvent.WINDOW_GAINED_FOCUS: 600 handleJavaWindowFocusEvent(e); 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 } 642 643 public void layout() {} 644 645 public java.awt.Toolkit getToolkit() { 646 return Toolkit.getDefaultToolkit(); 647 } 648 649 void updateMotifColors(Color bg) { 650 int red = bg.getRed(); 651 int green = bg.getGreen(); 652 int blue = bg.getBlue(); 653 654 darkShadow = new Color(MotifColorUtilities.calculateBottomShadowFromBackground(red,green,blue)); | 588 // Skip all painting while layouting and all UPDATEs 589 // while waiting for native paint 590 if (!isLayouting && !paintPending) { 591 paintArea.paint(target,false); 592 } 593 return; 594 case FocusEvent.FOCUS_LOST: 595 case FocusEvent.FOCUS_GAINED: 596 handleJavaFocusEvent(e); 597 break; 598 case WindowEvent.WINDOW_LOST_FOCUS: 599 case WindowEvent.WINDOW_GAINED_FOCUS: 600 handleJavaWindowFocusEvent(e); 601 break; 602 default: 603 break; 604 } 605 606 } 607 608 public Dimension getMinimumSize() { 609 return target.getSize(); 610 } 611 612 public Dimension getPreferredSize() { 613 return getMinimumSize(); 614 } 615 616 public void layout() {} 617 618 public java.awt.Toolkit getToolkit() { 619 return Toolkit.getDefaultToolkit(); 620 } 621 622 void updateMotifColors(Color bg) { 623 int red = bg.getRed(); 624 int green = bg.getGreen(); 625 int blue = bg.getBlue(); 626 627 darkShadow = new Color(MotifColorUtilities.calculateBottomShadowFromBackground(red,green,blue)); |