-
Notifications
You must be signed in to change notification settings - Fork 917
Description
Apache NetBeans version
Apache NetBeans 14
What happened
I encountered this problem with the output window detached from the main NetBeans Window and focus-follows-mouse is set in the linux the window manager. While editing, I moved the mouse from editor to detached window, when the detached window gets focus the undo/redo buttons go inactive, move the mouse back to the editor and the buttons remain inactive although I can edit/save as usual.
How to reproduce
As described in What happened
Did this work correctly in an earlier version?
No / Don't know
Operating System
Linux harmony 5.18.10-76051810-generic #202207071639165725231022.04~7d5e891 SMP PREEMPT_DYNAMIC Fri J x86_64 x86_64 x86_64 GNU/Linux
JDK
8,11,17
Apache NetBeans packaging
Own source build
Anything else
As a workaround, in a JEditorPane's focusListener.focusGained, I've essentially got:
TopComponent tc = NbEditorUtilities.getOuterTopComponent(getEditor());
if(tc != TopComponent.getRegistry().getActivated())
tc.requestActive();
where getEditor() is like FocusEvent.getComponent().
For NetBeans, perhaps something like this
Mode m = WindowManager.getDefault().findMode(tc);
if(m != null)
central.setActiveMode(m);
in MainWindow's windowListener (but without proper exerience in core.windows, I'd be hesitant to make changes in this area) or maybe a focus listener with something like the workaround I'm using above in an editor's TopComponent.
Relevant stack when moving mouse to detached window
at org.netbeans.core.windows.WindowManagerImpl.notifyRegistryTopComponentActivated(WindowManagerImpl.java:1199)
at org.netbeans.core.windows.Central.setActiveMode(Central.java:233)
at org.netbeans.core.windows.Central.userActivatedModeWindow(Central.java:1883)
at org.netbeans.core.windows.view.DefaultView.userActivatedModeWindow(DefaultView.java:654)
at org.netbeans.core.windows.view.ui.DefaultSeparateContainer$SharedModeUIBaseImpl$1.windowActivated(DefaultSeparateContainer.java:455)
at java.awt.AWTEventMulticaster.windowActivated(AWTEventMulticaster.java:398)
Are you willing to submit a pull request?
No
Code of Conduct
Yes