Skip to content
Snippets Groups Projects
Commit dfd8fdc3 authored by Semyon Sadetsky's avatar Semyon Sadetsky
Browse files

8143295: Validating issue in AWT

Reviewed-by: serb, alexsch
parent 01983638
No related branches found
No related tags found
No related merge requests found
...@@ -1008,13 +1008,10 @@ class XWindow extends XBaseWindow implements X11ComponentPeer { ...@@ -1008,13 +1008,10 @@ class XWindow extends XBaseWindow implements X11ComponentPeer {
// if ( Check if it's a resize, a move, or a stacking order change ) // if ( Check if it's a resize, a move, or a stacking order change )
// { // {
Rectangle bounds = getBounds(); Rectangle bounds = getBounds();
final ComponentAccessor acc = AWTAccessor.getComponentAccessor();
if (!bounds.getSize().equals(oldBounds.getSize())) { if (!bounds.getSize().equals(oldBounds.getSize())) {
acc.setSize(target, bounds.width, bounds.height);
postEventToEventQueue(new ComponentEvent(getEventSource(), ComponentEvent.COMPONENT_RESIZED)); postEventToEventQueue(new ComponentEvent(getEventSource(), ComponentEvent.COMPONENT_RESIZED));
} }
if (!bounds.getLocation().equals(oldBounds.getLocation())) { if (!bounds.getLocation().equals(oldBounds.getLocation())) {
acc.setLocation(target, bounds.x, bounds.y);
postEventToEventQueue(new ComponentEvent(getEventSource(), ComponentEvent.COMPONENT_MOVED)); postEventToEventQueue(new ComponentEvent(getEventSource(), ComponentEvent.COMPONENT_MOVED));
} }
// } // }
......
/* /*
* Copyright (c) 2002, 2014, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2002, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
...@@ -803,23 +803,31 @@ class XWindowPeer extends XPanelPeer implements WindowPeer, ...@@ -803,23 +803,31 @@ class XWindowPeer extends XPanelPeer implements WindowPeer,
*/ */
@Override @Override
public void handleConfigureNotifyEvent(XEvent xev) { public void handleConfigureNotifyEvent(XEvent xev) {
assert (SunToolkit.isAWTLockHeldByCurrentThread());
XConfigureEvent xe = xev.get_xconfigure(); XConfigureEvent xe = xev.get_xconfigure();
/* if (insLog.isLoggable(PlatformLogger.Level.FINE)) {
* Correct window location which could be wrong in some cases. insLog.fine(xe.toString());
* See getNewLocation() for the details. }
*/ checkIfOnNewScreen(toGlobal(new Rectangle(scaleDown(xe.get_x()),
Point newLocation = getNewLocation(xe, 0, 0); scaleDown(xe.get_y()),
xe.set_x(scaleUp(newLocation.x));
xe.set_y(scaleUp(newLocation.y));
checkIfOnNewScreen(new Rectangle(newLocation.x,
newLocation.y,
scaleDown(xe.get_width()), scaleDown(xe.get_width()),
scaleDown(xe.get_height()))); scaleDown(xe.get_height()))));
Rectangle oldBounds = getBounds();
x = scaleDown(xe.get_x());
y = scaleDown(xe.get_y());
width = scaleDown(xe.get_width());
height = scaleDown(xe.get_height());
// Don't call super until we've handled a screen change. Otherwise if (!getBounds().getSize().equals(oldBounds.getSize())) {
// there could be a race condition in which a ComponentListener could AWTAccessor.getComponentAccessor().setSize(target, width, height);
// see the old screen. postEvent(new ComponentEvent(target, ComponentEvent.COMPONENT_RESIZED));
super.handleConfigureNotifyEvent(xev); }
if (!getBounds().getLocation().equals(oldBounds.getLocation())) {
AWTAccessor.getComponentAccessor().setLocation(target, x, y);
postEvent(new ComponentEvent(target, ComponentEvent.COMPONENT_MOVED));
}
repositionSecurityWarning(); repositionSecurityWarning();
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment