8159460: On Ubuntu Unity, problem with java/awt/Window/FindOwner/FindOwnerTest

Reviewed-by: azvegint
This commit is contained in:
Semyon Sadetsky 2016-07-13 10:50:58 +03:00
parent d84f5adf24
commit b15c691620
3 changed files with 30 additions and 6 deletions

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2002, 2014, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2002, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -1010,7 +1010,22 @@ abstract class XDecoratedPeer extends XWindowPeer {
if (focusLog.isLoggable(PlatformLogger.Level.FINE)) {
focusLog.fine("WM_TAKE_FOCUS on {0}", this);
}
requestWindowFocus(cl.get_data(1), true);
if (XWM.getWMID() == XWM.UNITY_COMPIZ_WM) {
// JDK-8159460
Window focusedWindow = XKeyboardFocusManagerPeer.getInstance()
.getCurrentFocusedWindow();
Window activeWindow = XWindowPeer.getDecoratedOwner(focusedWindow);
if (activeWindow != target) {
requestWindowFocus(cl.get_data(1), true);
} else {
WindowEvent we = new WindowEvent(focusedWindow,
WindowEvent.WINDOW_GAINED_FOCUS);
sendEvent(we);
}
} else {
requestWindowFocus(cl.get_data(1), true);
}
}
/**

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2003, 2014, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2003, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -104,7 +104,8 @@ final class XWM
COMPIZ_WM = 12,
LG3D_WM = 13,
CWM_WM = 14,
MUTTER_WM = 15;
MUTTER_WM = 15,
UNITY_COMPIZ_WM = 16;
public String toString() {
switch (WMID) {
case NO_WM:
@ -129,6 +130,8 @@ final class XWM
return "Metacity";
case COMPIZ_WM:
return "Compiz";
case UNITY_COMPIZ_WM:
return "Unity Compiz";
case LG3D_WM:
return "LookingGlass";
case CWM_WM:
@ -572,6 +575,10 @@ final class XWM
return isNetWMName("compiz");
}
static boolean isUnityCompiz() {
return isNetWMName("Compiz");
}
static boolean isLookingGlass() {
return isNetWMName("LG3D");
}
@ -790,6 +797,8 @@ final class XWM
awt_wmgr = CWM_WM;
} else if (doIsIceWM && isIceWM()) {
awt_wmgr = XWM.ICE_WM;
} else if (isUnityCompiz()) {
awt_wmgr = XWM.UNITY_COMPIZ_WM;
}
/*
* We don't check for legacy WM when we already know that WM

View File

@ -1,5 +1,5 @@
<!--
Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
This code is free software; you can redistribute it and/or modify it
@ -23,7 +23,7 @@
@test
@key headful
@bug 8139227
@bug 8139227 8159460
@summary Text fields in JPopupMenu structure do not receive focus in hosted
Applets
@author Semyon Sadetsky