New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Editor with Keyboard focus is not active TopComponent (undo/redo don't work while editing) #4437
Comments
i am not sure that this is a bug. Since other windows can have their own undo history. For example, even the ctrl+f combo box has a history. Whatever has focus should listen to the undo events. |
Not sure this is about just undo, or specifically focus on hover. Try detaching a source editor tab into a separate window and Alt-TABing between. The cursor moves from one editor to the other, but the window system active tab doesn't change - undo/redo is wrong, navigator is wrong, and wrong tab is coloured as focused. Typing goes in the right place, though. |
Right, the key is that the editor is not the active TopComponent. The description is just to point out that there's an issue, without getting into the weeds. Maybe: Editor with Keyboard focus is not active TopComponent is a good description. I didn't think to say that Ctrl-Z,Ctrl-Y stop working in the editor, that's probably better than talking about the buttons (but I never use those shortcuts). An editor shortcut, "ActivateMe", could be used with the workaround code I showed. |
There are a lot of exceptions that come through
|
@errael are you using Wayland? I think that might be separate issue.
Yes, probably better. That definitely seems like a valid issue to me. |
Not wayland; current System76/PopOS; gtk3 |
@errael I should have paid more attention - have seen issues with component ID on Wayland in the past, but the key thing is the |
|
@neilcsmith-net Thanks, (but I don't understand how the pieces fit together)
Statement implies the fix goes into JDK; any idea which, if any, openjdk release has, or will have, it? Probably not important, but I'm curious if I'll see difference. But wait, I see the jna jars in NetBeans... Could NetBeans include jna with the fix? It's not in NB-15.
|
It's due to compilation and linking options used in certain JDK builds, particularly from various Linux distros, that cause older versions of JNA not to find libjawt. If you run on another JDK like Azul or Adoptium, you shouldn't see that error. Can you open another issue for that, though, including the stack trace? It's not triggering the main issue. |
Opened #4441 |
When a mouse click is used to activate the top component, the stack is
I'm guessing a safe approach would be to use this same path when the activation should be done due to a focus change. The following change to The change adds a KeyboardFocusManager propertyChangeListener to
|
#4603 fixes this AFAICT. |
I was going to close this since #4603 is merged. But until it's released... What's best practice for closing an issue? |
Fixed in NB16-RC1 |
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
165725231022.04~7d5e891 SMP PREEMPT_DYNAMIC Fri J x86_64 x86_64 x86_64 GNU/LinuxJDK
8,11,17
Apache NetBeans packaging
Own source build
Anything else
As a workaround, in a
JEditorPane
'sfocusListener.focusGained
, I've essentially got:where getEditor() is like
FocusEvent.getComponent()
.For NetBeans, perhaps something like this
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
Are you willing to submit a pull request?
No
Code of Conduct
Yes
The text was updated successfully, but these errors were encountered: