JDK-4524015 : WINDOW_ACTIVATED and WINDOW_ DEACTIVATED events are not always fired
  • Type: Bug
  • Component: client-libs
  • Sub-Component: java.awt
  • Affected Version: 1.3.1_01
  • Priority: P4
  • Status: Closed
  • Resolution: Duplicate
  • OS: linux
  • CPU: x86
  • Submitted: 2001-11-07
  • Updated: 2002-03-21
  • Resolved: 2002-02-28
Related Reports
Duplicate :  
Relates :  
Description
Config: Linux + Sawfish/Enligntenment + jdk 1.3.1_01

WINDOW_DEACTIVATED and WINDOW_ACTIVATED events are expected to be fired when the
user switches the focus from/to an AWT Frame.   This does not happen if the user uses Alt+TAB
to do the switching.   This causes a  significant problem for Forte for Java/NetBeans IDE. 
See the IDE bug description at
 
	http://www.netbeans.org/issues/show_bug.cgi?id=16755

After playing with xev utility and studying JDK source code I conclude
that this is a bug in JDK.  XEvent of FocusIn/FocusOut type
is mapped and routed to java.awt.Window iff xev->mode == NotifyNormal,
which does not hold when switching b/w native windows using Alt+Tab.

For jdk 1.3.1 we can work around the bug by hooking into AWTEvent queue
(using AWTEventListener) and react to FOCUS_GAINED event.  The hack is
extremely ugly but it works.  On JDK 1.4 beta3 even FOCUS_GAINED is not
fired so we are out of luck.

Although the testing environment is Linux + Sawfish, I suspect that the same
defect is present on Solaris+CDE

Comments
EVALUATION Commit to fix in Merlin (Forte) ###@###.### 2001-11-07 Some text from the responsible engineer, ###@###.### the cause of this bug the same as for 4503980 (Focus lost/gain events get lost when gaining focus on external CDE component). When we use Alt-Tab to switch between toplevels window receives FocusIn/FocusOut with NotifyWhileGrabbed mode instead of NormalNotify expected by our code. This WM behavior looks like a hack (Alt-Tab is not a standard feature for X11). When you and Denis discussed 4503980, you decided that now it is too late/risky to fix this problem, because to fix it we have to change Solaris native code (this is always too risky :), and so we have a chance to catch a few new regressions. For example, the same type of events (FocusIn/Out with NotifyWhileGrabbed mode) arrives when menus are opened. So potentially we can break a lot of things. BTW this bug is not a regression, we have the same behavior in 1.3, and so i suggest to resolve this bug and 4503980 in Hopper/Tiger. I think we should commit one of these bugs to Hopper/Tiger and close another one as duplicate. ###@###.### 2001-11-08 If we can't fix this for Merlin, we should fix it for Hopper/Tiger. ###@###.### 2001-11-08 Name: rpR10076 Date: 11/16/2001 commit to hopper and tiger ====================================================================== It's getting too late to put this into Merlin ###@###.### 2001-11-19 Name: dmR10075 Date: 02/28/2002 The bug was fixed along with the 4503980. Closing as duplicate. ###@###.### 2002-02-28 ======================================================================
2002-02-28