This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.
Product Version: NetBeans IDE Dev (Build 20081002085508) Java: 1.6.0_10-beta; Java HotSpot(TM) Client VM 11.0-b11 System: Linux version 2.6.24-19-generic running on i386; UTF-8; en_US (nb) Userdir: /tmp/ud ----------------- - created j2se project (anagram game) - invoked debug target (using build.xml node) - debugger is started, jframe is opened - close the frame window, debugger finished, but focus is not returned to main window, Netbeans if flashing in status bar (but no modal dialog is present), and focus cannot be obtained by clicking into main window. reproducible for me, Ubuntu + KDE. Run target works fine.
Works fine for me. I did not much get what do you mean by "invoked debug target (using build.xml node)", but it worked both ways. Via AnagramGame -> Debug and AnagrameGame -> build.xml -> Run Target -> Debug.
Please test with other applications on your system. If you close one, does the focus move to the previous one?
> I did not much get what do you mean by "invoked debug target (using build.xml node)" I expanded build.xml node, and invoked "Run target" on debug target. Anyway I'm not sure if this matters. I wouldn't say the problem is in desktop manager or wherever, important thing is that i cannot reproduce when running "run" target, only with "debug" target. And just one more note: it is not always reproducible on first attempt in my environment. But once i reproduce, I'm able to reproduce constantly.
Not reproducible for me on Windows. I have made several attempts and there have not been any problems with the focus.
According to tests, so far it seems that it's reproducible only on KDE. When closing the GUI of the application, focus is transferred back to the NetBeans IDE when the application is executed via "Run". But not when it's executed via "Debug". The user needs to switch to some other app and then back to NetBeans in order to get the focus to the IDE. Therefore this is an accessibility and usability problem.
Installed KDE and reproduced. Investigating... seems to be caused by some focus request of the IDE. KDE is confused by this.
:-) The problem is, that IDE tries to move the focus to the main window! When it does not try to do so, all works fine. Moving to core/windows for further investigation, it can be a bug in NetBeans window system, or Swing, or KDE. This bug can not be reproduced after this patch: diff -r 209b78feb8ba core.windows/src/org/netbeans/core/windows/view/DefaultView.java --- a/core.windows/src/org/netbeans/core/windows/view/DefaultView.java Mon Oct 06 18:11:25 2008 +0200 +++ b/core.windows/src/org/netbeans/core/windows/view/DefaultView.java Tue Oct 07 13:38:45 2008 +0200 @@ -348,7 +348,7 @@ if(modeView != null) { modeView.removeTopComponent((TopComponent)viewEvent.getNewValue()); } - hierarchy.activateMode(wsa.getActiveModeAccessor()); + //hierarchy.activateMode(wsa.getActiveModeAccessor()); } else if(changeType == CHANGE_TOPCOMPONENT_DISPLAY_NAME_CHANGED) { if(DEBUG) { debugLog("TopComponent display name changed, tc=" + viewEvent.getNewValue()); // NOI18N The problematic behavior seems to be caused by request of the focus after debugger TopComponents are closed. If all debugger-related top components are closed explicitely before the end of the debugger session, the problem can not be reproduced. From my tests it looks like the faulty behavior is caused by TopComponent.requestFocus() called at AbstractModeContainer.java:197. This is deprecated, thus perhaps some other method will do the job... The method calls JComponent.requestFocus(), thus the problem can be in Swing as well.
Well, what to do? TopComponent.requestFocus() is deprecated but only for Winsys API clients, not for winsys code, which needs to call it (it delegates to JComponent.requestFocus). This is almost certainly bug between JDK x KDE. Maybe we can change call to requestFocusInWindow, but other than that it's wontfix. Also personally I think this is P3/P4, not P2.
potential fix: 4396eec9b3b0 I modified code in AbstractModeContainer.focusSelectedTopComponent to call requestFocusInWindow instead of requestFocus when netbeans has no focused window at the moment. musilt and mentlicher, please try to verify my fix, thank you.
Integrated into 'main-golden', will be available in build *200810111401* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress) Changeset: http://hg.netbeans.org/main/rev/4396eec9b3b0 User: Dafe Simonek <dsimonek@netbeans.org> Log: #148954: requestFocusInWindow instead of requestFocus when system is not active in OS context
great, great, works fine now, thanks Dafe...verified! Product Version: NetBeans IDE Dev (Build 200810111401) Java: 1.6.0_10-beta; Java HotSpot(TM) Client VM 11.0-b11 System: Linux version 2.6.24-19-generic running on i386; UTF-8; en_US (nb) Userdir: /tmp/ud
Sorry this causes regression. See issue #156694. If TopComponent.requestActive is called, TC is docked in main window and main window is not active ie. does not have focus we MUST call java.awt.Component.requestFocus to make main window active. Period. If KDE refuses to activate window when we call request focus on that window then again sorry it is problem of KDE. File issue against KDE. We do not want to break IDE functionality due to KDE bug. I am going to rollback this fix.
Fix is rollbacked core-main #c9f1f7c344ff We will investigate and eventually add specific fix for KDE
It looks there is no reliable way how to detect if Gnome or KDE desktop is running. Only thing I found is to check if KDE_FULL_SESSION or GNOME_DESKTOP_SESSION_ID environment variables are set.
We cannot reproduce it now with KDE 4.1.4 on Ubuntu Intrepid 8.10, JDK 6u12 b04, NB 090127. I tried with and without 'ergonomics' cluster. I tried to debug Anagram game and after closing its window I do not see that problem with not being able to activate IDE window. I even tried to activate different window first so that IDE is not just below Anagram window in z-order.
verified.
Integrated into 'main-golden', will be available in build *200901280348* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress) Changeset: http://hg.netbeans.org/main/rev/c9f1f7c344ff User: Marek Slama <mslama@netbeans.org> Log: Rollback fix of #148954 due to regression.