786 log.fine("New X location: {0}", xlocation); 787 } 788 if (xlocation != null) { 789 newLocation = xlocation; 790 } 791 break; 792 } 793 default: 794 break; 795 } 796 } 797 return newLocation; 798 } 799 800 /* 801 * Overridden to check if we need to update our GraphicsDevice/Config 802 * Added for 4934052. 803 */ 804 @Override 805 public void handleConfigureNotifyEvent(XEvent xev) { 806 XConfigureEvent xe = xev.get_xconfigure(); 807 /* 808 * Correct window location which could be wrong in some cases. 809 * See getNewLocation() for the details. 810 */ 811 Point newLocation = getNewLocation(xe, 0, 0); 812 xe.set_x(scaleUp(newLocation.x)); 813 xe.set_y(scaleUp(newLocation.y)); 814 checkIfOnNewScreen(new Rectangle(newLocation.x, 815 newLocation.y, 816 scaleDown(xe.get_width()), 817 scaleDown(xe.get_height()))); 818 819 // Don't call super until we've handled a screen change. Otherwise 820 // there could be a race condition in which a ComponentListener could 821 // see the old screen. 822 super.handleConfigureNotifyEvent(xev); 823 repositionSecurityWarning(); 824 } 825 826 final void requestXFocus(long time) { 827 requestXFocus(time, true); 828 } 829 830 final void requestXFocus() { 831 requestXFocus(0, false); 832 } 833 834 /** 835 * Requests focus to this top-level. Descendants should override to provide 836 * implementations based on a class of top-level. 837 */ 838 protected void requestXFocus(long time, boolean timeProvided) { 839 // Since in XAWT focus is synthetic and all basic Windows are 840 // override_redirect all we can do is check whether our parent 841 // is active. If it is - we can freely synthesize focus transfer. 842 // Luckily, this logic is already implemented in requestWindowFocus. | 786 log.fine("New X location: {0}", xlocation); 787 } 788 if (xlocation != null) { 789 newLocation = xlocation; 790 } 791 break; 792 } 793 default: 794 break; 795 } 796 } 797 return newLocation; 798 } 799 800 /* 801 * Overridden to check if we need to update our GraphicsDevice/Config 802 * Added for 4934052. 803 */ 804 @Override 805 public void handleConfigureNotifyEvent(XEvent xev) { 806 assert (SunToolkit.isAWTLockHeldByCurrentThread()); 807 XConfigureEvent xe = xev.get_xconfigure(); 808 if (insLog.isLoggable(PlatformLogger.Level.FINE)) { 809 insLog.fine(xe.toString()); 810 } 811 checkIfOnNewScreen(toGlobal(new Rectangle(scaleDown(xe.get_x()), 812 scaleDown(xe.get_y()), 813 scaleDown(xe.get_width()), 814 scaleDown(xe.get_height())))); 815 816 Rectangle oldBounds = getBounds(); 817 818 x = scaleDown(xe.get_x()); 819 y = scaleDown(xe.get_y()); 820 width = scaleDown(xe.get_width()); 821 height = scaleDown(xe.get_height()); 822 823 if (!getBounds().getSize().equals(oldBounds.getSize())) { 824 AWTAccessor.getComponentAccessor().setSize(target, width, height); 825 postEvent(new ComponentEvent(target, ComponentEvent.COMPONENT_RESIZED)); 826 } 827 if (!getBounds().getLocation().equals(oldBounds.getLocation())) { 828 AWTAccessor.getComponentAccessor().setLocation(target, x, y); 829 postEvent(new ComponentEvent(target, ComponentEvent.COMPONENT_MOVED)); 830 } 831 832 repositionSecurityWarning(); 833 } 834 835 final void requestXFocus(long time) { 836 requestXFocus(time, true); 837 } 838 839 final void requestXFocus() { 840 requestXFocus(0, false); 841 } 842 843 /** 844 * Requests focus to this top-level. Descendants should override to provide 845 * implementations based on a class of top-level. 846 */ 847 protected void requestXFocus(long time, boolean timeProvided) { 848 // Since in XAWT focus is synthetic and all basic Windows are 849 // override_redirect all we can do is check whether our parent 850 // is active. If it is - we can freely synthesize focus transfer. 851 // Luckily, this logic is already implemented in requestWindowFocus. |