OpenJDK / jdk7u / jdk7u-dev / jdk
changeset 7251:252fa19d21bc
6993873: java/awt/Focus/FocusOwnerFrameOnClick/FocusOwnerFrameOnClick.java test indicates ".a frame wasn't focused on click" jdk7 issue on linux
Reviewed-by: ant, pchelko
author | anashaty |
---|---|
date | Tue, 08 Jul 2014 17:04:12 +0400 |
parents | ebb2c60b579c |
children | d212c9f2451f |
files | src/solaris/classes/sun/awt/X11/XContentWindow.java |
diffstat | 1 files changed, 18 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/src/solaris/classes/sun/awt/X11/XContentWindow.java Mon Jul 07 17:54:42 2014 +0400 +++ b/src/solaris/classes/sun/awt/X11/XContentWindow.java Tue Jul 08 17:04:12 2014 +0400 @@ -24,9 +24,7 @@ */ package sun.awt.X11; -import java.awt.Component; -import java.awt.Rectangle; -import java.awt.Insets; +import java.awt.*; import java.awt.event.ComponentEvent; @@ -162,6 +160,23 @@ } } + public void handleButtonPressRelease(XEvent xev) { + if (xev.get_type() == XConstants.ButtonPress) { + Window parentWindow = (Window)parentFrame.getTarget(); + /* + * In case the decorated frame is active but not focused + * (that is an owned window is currently focused) + * it should be made a focused window. + * This is needed to focus the frame when it's clicked + * in an empty spot of its content area. See 6886678. + */ + if (parentWindow != null && parentWindow.isActive() && !parentWindow.isFocused()) { + parentFrame.requestWindowFocus(); + } + } + super.handleButtonPressRelease(xev); + } + void purgeIconifiedExposeEvents() { for (SavedExposeEvent evt : iconifiedExposeEvents) { super.handleExposeEvent(evt.target, evt.x, evt.y, evt.w, evt.h);