Keyboard focus can activate top component#4603
Keyboard focus can activate top component#4603geertjanw merged 1 commit intoapache:masterfrom errael:KeyboardFocusCanActivateTopComponent
Conversation
|
For others passing through, here is @neilcsmith-net's reproducibility comment from the other thread:
I can confirm this on my own Windows 11 machine; this is obviously incorrect behavior. If the patch fixes this problem, then great; thank you! Looking at the patch, it does carefully apply the modified behavior only in some specific cases, which should make it lower-risk. Looks good to me, but maybe good to have one more reviewer look at it. The next time I make a private NetBeans build I'll include this patch and test it... |
That would be great, I moved to linux last year, not tested on windows. BTW, note that mouse click processing happens before keyboard focus change processing so this doesn't kick in when focus change due to mouse click. |
|
I just tested this in a custom NetBeans build; the fix seems to work! Tested for correct active tab indication and Undo/Redo effect on Windows 11 with focus changed with Alt+Tab, Ctrl+Tab, clicking in Windows taskbar, clicking on tab within NetBeans, and clicking on window title bar. I'll now leave this patch in my working IDE for a while to see that there are no problems. Thanks for this! |
eirikbakke
left a comment
There was a problem hiding this comment.
I've been running my IDE with this patch active for the past few days with no problems, and it fixes the problem. I also reviewed the code previously.
I think this PR should be safe to merge.
Fix for #4437. Discussion in that issue is useful in understanding this patch.
platform/core.windowsis a mystery to me; this patch is almost identical to getting a mouse click, except it is triggered by keyboard focus change to handle other situations where the MainWindow is activated. There may be better solutions, but I believe this is safe.After getting a focus event, the activate code is only invoked when it is strictly needed. This is an optimization, invoking the activation code multiple times shouldn't matter; it would be like clicking on an already active window.
@jtulach, any idea for a good candidate to review this? This area was written by Peter Zavadsky.