JDK-5094112 : Java application steals a focus after switch between workplaces with Ctrl+Alt+->
  • Type: Bug
  • Component: client-libs
  • Sub-Component: java.awt
  • Affected Version: 5.0,5.0u1
  • Priority: P4
  • Status: Resolved
  • Resolution: Fixed
  • OS: linux
  • CPU: x86
  • Submitted: 2004-08-30
  • Updated: 2004-12-22
  • Resolved: 2004-12-06
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.
Other JDK 6
5.0u2Fixed 6 b15Fixed
Related Reports
Duplicate :  
Duplicate :  
Duplicate :  
Description
Name: gm110360			Date: 08/30/2004


FULL PRODUCT VERSION :
java version "1.5.0-beta2"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0-beta2-b51)
Java HotSpot(TM) Client VM (build 1.5.0-beta2-b51, mixed mode, sharing)

ADDITIONAL OS VERSION INFORMATION :
Linux iguana 2.6.8-1.521 #1 Mon Aug 16 09:01:18 EDT 2004 i686 athlon i386 GNU/Linux


EXTRA RELEVANT SYSTEM CONFIGURATION :
Fedora Core 2
WindowMaker standalone window manager

A DESCRIPTION OF THE PROBLEM :
I've got several workspaces in WindowMaker to
separate window placement.

This was not an issue with NetBeans 3.6 and jdk1.4.2_05

Let's say I've got two windows open in the first workplace, say Mozilla and NetBeans. I can switch between windows with Alt+Tab. I've also got second
workplace where xterms are located with output from tail -f <tomcat log files>. I can switch between workplaces with Ctrl+Alt+-> from first to the second and with Ctrl+Alt+<- from the second to the first.

If I focus mozilla window and go to the second workplace and return to the first one mozilla does not have focus. It's stolen by NetBeans. Why it does that is out of my imagination. NetBeans got the focus because if I type some characters they are typed in the editor.

It's not a netbeans problem. other java applications behave the same.


REPRODUCIBILITY :
This bug can be reproduced always.
(Incident Review ID: 301072) 
======================================================================

Comments
SUGGESTED FIX ------- XWindowPeer.java ------- *** /tmp/sccs.Q3aqZdMon Oct 18 12:19:06 2004 --- XWindowPeer.javaFri Oct 15 12:49:07 2004 *************** *** 38,47 **** --- 38,48 ---- private boolean stateChanged; // Indicates whether the value on savedState is valid private int savedState; // Holds last known state of the top-level window private boolean mustControlStackPosition = false; // Am override-redirect not on top private XEventDispatcher rootPropertyEventDispatcher = null; + private boolean firstMapped = true; // Is the top-level mapped (shown) for the first time. XWindowPeer(XCreateWindowParams params) { super(params.putIfNull(PARENT_WINDOW, new Long(0))); } *************** *** 672,683 **** } } public void handleMapNotifyEvent(long ptr) { super.handleMapNotifyEvent(ptr); ! if (!isNativelyNonFocusableWindow()) { requestInitialFocus(); } updateAlwaysOnTop(); } protected void requestInitialFocus() { --- 673,685 ---- } } public void handleMapNotifyEvent(long ptr) { super.handleMapNotifyEvent(ptr); ! if (!isNativelyNonFocusableWindow() && firstMapped) { requestInitialFocus(); + firstMapped = false; } updateAlwaysOnTop(); } protected void requestInitialFocus() { ###@###.### 10/18/04 10:11 GMT
18-10-2004

EVALUATION Name: at153223Date: 09/01/2004 It's XToolkit problem. Switching b/w workspaces causes MapNotify to be generated for a window. XAWT, in response, requests focus to the window (thus Java app really steals it). Trying to figure out when we need to request focus and when we can ignore it. ###@###.### 09/01/2004 ====================================================================== ###@###.### 10/8/04 08:28 GMT It's enought to request focus on first mapping only and then allow WM to decide on which top-level to set focus. ###@###.### 10/18/04 10:11 GMT should fix it in update release. ###@###.### 2004-12-09 08:56:38 GMT
18-10-0004