errael opened a new issue, #4437:
URL: https://github.com/apache/netbeans/issues/4437

   ### 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 
#202207071639~1657252310~22.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


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists

Reply via email to