jdk/src/java.desktop/unix/classes/sun/awt/X11/XWindowPeer.java
changeset 36881 3a22af76f434
parent 35667 ed476aba94de
child 36882 9347af61016c
equal deleted inserted replaced
36880:3a05117c7611 36881:3a22af76f434
     1 /*
     1 /*
     2  * Copyright (c) 2002, 2014, Oracle and/or its affiliates. All rights reserved.
     2  * Copyright (c) 2002, 2015, Oracle and/or its affiliates. All rights reserved.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     4  *
     4  *
     5  * This code is free software; you can redistribute it and/or modify it
     5  * This code is free software; you can redistribute it and/or modify it
     6  * under the terms of the GNU General Public License version 2 only, as
     6  * under the terms of the GNU General Public License version 2 only, as
     7  * published by the Free Software Foundation.  Oracle designates this
     7  * published by the Free Software Foundation.  Oracle designates this
   801      * Overridden to check if we need to update our GraphicsDevice/Config
   801      * Overridden to check if we need to update our GraphicsDevice/Config
   802      * Added for 4934052.
   802      * Added for 4934052.
   803      */
   803      */
   804     @Override
   804     @Override
   805     public void handleConfigureNotifyEvent(XEvent xev) {
   805     public void handleConfigureNotifyEvent(XEvent xev) {
       
   806         assert (SunToolkit.isAWTLockHeldByCurrentThread());
   806         XConfigureEvent xe = xev.get_xconfigure();
   807         XConfigureEvent xe = xev.get_xconfigure();
   807         /*
   808         if (insLog.isLoggable(PlatformLogger.Level.FINE)) {
   808          * Correct window location which could be wrong in some cases.
   809             insLog.fine(xe.toString());
   809          * See getNewLocation() for the details.
   810         }
   810          */
   811         checkIfOnNewScreen(toGlobal(new Rectangle(scaleDown(xe.get_x()),
   811         Point newLocation = getNewLocation(xe, 0, 0);
   812                 scaleDown(xe.get_y()),
   812         xe.set_x(scaleUp(newLocation.x));
   813                 scaleDown(xe.get_width()),
   813         xe.set_y(scaleUp(newLocation.y));
   814                 scaleDown(xe.get_height()))));
   814         checkIfOnNewScreen(new Rectangle(newLocation.x,
   815 
   815                                          newLocation.y,
   816         Rectangle oldBounds = getBounds();
   816                                          scaleDown(xe.get_width()),
   817 
   817                                          scaleDown(xe.get_height())));
   818         x = scaleDown(xe.get_x());
   818 
   819         y = scaleDown(xe.get_y());
   819         // Don't call super until we've handled a screen change.  Otherwise
   820         width = scaleDown(xe.get_width());
   820         // there could be a race condition in which a ComponentListener could
   821         height = scaleDown(xe.get_height());
   821         // see the old screen.
   822 
   822         super.handleConfigureNotifyEvent(xev);
   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         }
   823         repositionSecurityWarning();
   831         repositionSecurityWarning();
   824     }
   832     }
   825 
   833 
   826     final void requestXFocus(long time) {
   834     final void requestXFocus(long time) {
   827         requestXFocus(time, true);
   835         requestXFocus(time, true);