JDK-6480534 : REG: Iconifying and restoring the frame programmatically takes the focus off the initial component
  • Type: Bug
  • Component: client-libs
  • Sub-Component: java.awt
  • Affected Version: 6
  • Priority: P3
  • Status: Closed
  • Resolution: Won't Fix
  • OS: linux_suse_sles_10
  • CPU: x86
  • Submitted: 2006-10-11
  • Updated: 2011-01-19
  • Resolved: 2007-06-18
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 7
7Fixed
Related Reports
Relates :  
Relates :  
Description
Iconifying the frame programmatically by calling frame.setExtendedState(ICONIFIED) and then restoring it with a subsequent call to setExtendedState(NORMAL) removes the focus from the initial component on the frame. In my app, I have added a button to the frame and I am calling the above methods when the button is clicked. When the frame gets restored, the button no longer has the focus and window is also not activated. 

This is a regression in Mustang, introduced somewhere in-between b11-b20. This is reproducible only on XToolkit and works fine on Win32. I reproduced it with SolSparc10-JDS and SuSE10. This works fine on Tiger-fcs on the specified platforms with XToolkit.

I have attached a sample test. Run the test. A frame would appear with a button. Click on the button and wait for sometime. Frame would iconify and restore. When the frame comes back, check if button has the focus. If not, the bug is reproduced.

Comments
EVALUATION The bug is fixed in JDK 7. I think it's not so critical to be fixed in JDK 6 Update. So, I'm closing it.
18-06-2007

EVALUATION Another issue with Metacity of newer versions. I tried 2.14.5. When a window is restored from minimized state, is focused (via XSetInputFocus) and is moved to the front (via XRaiseWindow) it gets focus but it doesn't appear on the top. Attached is the native app that can demonstrate the behavior on Metacity 2.14.5. 1. Compile native.c with gcc -o native -L/usr/X11R6/lib -lX11 native.c 2. Add 'x' attribute to the executable. 3. Run the app. You will see a frame. Click inside it. The frame will be minimized and then restored automatically. After restoring it appears focused but not on the top. However, if you move the frame and then click it again, it WILL go to the top after restoring.
24-10-2006

EVALUATION There have been found some difference in behavior of Metacity and KWM when minimizing a window. Below are xev traces. On KWM: PropertyNotify event, serial 14, synthetic NO, window 0x4800006, atom 0x4b (WM_STATE), time 1923040890, state PropertyNewValue PropertyNotify event, serial 14, synthetic NO, window 0x4800006, atom 0x9c (_NET_WM_STATE), time 1923040890, state PropertyNewValue UnmapNotify event, serial 14, synthetic NO, window 0x4800006, event 0x4800006, window 0x4800006, from_configure NO ------------------------------------------------------------------------------ On Metacity: UnmapNotify event, serial 13, synthetic NO, window 0x2400007, event 0x2400007, window 0x2400007, from_configure NO PropertyNotify event, serial 13, synthetic NO, window 0x2400007, atom 0xf4 (WM_STATE), time 2055252131, state PropertyNewValue PropertyNotify event, serial 13, synthetic NO, window 0x2400007, atom 0xe6 (_NET_WM_STATE), time 2055252134, state PropertyNewValue ------------------------------------------------------------------------------- So, it can be seen that the order of UnmapNotify and PropertyNotify(_NET_WM_STATE) differs. This PropertyNotify notifies of _NET_WM_STATE_HIDDEN hint being set. When restoring the window, the order is as follows: On KWM: PropertyNotify event, serial 15, synthetic NO, window 0x4800006, atom 0x9c (_NET_WM_STATE), time 1923787593, state PropertyNewValue PropertyNotify event, serial 15, synthetic NO, window 0x4800006, atom 0x4b (WM_STATE), time 1923787843, state PropertyNewValue MapNotify event, serial 15, synthetic NO, window 0x4800006, event 0x4800006, window 0x4800006, override NO -------------------------------------------------- On Metacity: MapNotify event, serial 16, synthetic NO, window 0x2400007, event 0x2400007, window 0x2400007, override NO VisibilityNotify event, serial 16, synthetic NO, window 0x2400007, state VisibilityUnobscured PropertyNotify event, serial 16, synthetic NO, window 0x2400007, atom 0xf4 (WM_STATE), time 2055751938, state PropertyNewValue PropertyNotify event, serial 16, synthetic NO, window 0x2400007, atom 0xe6 (_NET_WM_STATE), time 2055751939, state PropertyNewValue ---------------------------------------------------------------------- Based on this we could check for _NET_WM_STATE_HIDDEN in UnmapNotify handler on KWM, and in MapNotify handler on Metacity.
24-10-2006

EVALUATION The problem is that iconifying a window and switching the desktop takes nearly the same effect for the window. Its WM_STATE is set to IconicState, it receives UnmapNotify event. The only difference found is that WM adds _NET_WM_STATE_HIDDEN property (into _NET_WM_STATE protocol) for the window being iconified.
18-10-2006

EVALUATION It's is a regression of the fix for 5094112 "Java application steals a focus after switch between workplaces with Ctrl+Alt+->", introduced in Mustang-b15.
12-10-2006