Skip to content
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

Missing "Show opened documents list" widget with FlatLaf theme #6587

Closed
jherkel opened this issue Oct 18, 2023 · 12 comments · Fixed by #6605
Closed

Missing "Show opened documents list" widget with FlatLaf theme #6587

jherkel opened this issue Oct 18, 2023 · 12 comments · Fixed by #6605
Labels
kind:bug Bug report or fix
Milestone

Comments

@jherkel
Copy link
Contributor

jherkel commented Oct 18, 2023

Apache NetBeans version

Apache NetBeans 20 release candidate

What happened

I tried netbeans rc1 and I have a problem with "Show opened documents list" action. When I clicked to the icon, nothing has displayed. The first time I could see a window for maybe half a second but after that time the window has hidden.
I also tried GTK theme and I can see this widget so I think there is something wrong with the FlatLaf theme.

How to reproduce

  1. Select FlatLaf Light (but the same issue I can see with all FlatLaf themes)
  2. Click to icon for "Show opened documents list" action.

Did this work correctly in an earlier version?

Apache NetBeans 18

Operating System

Fedora 39 - Wayland

JDK

OpenJDK 21 64bit

Apache NetBeans packaging

Apache NetBeans binary zip

Anything else

No response

Are you willing to submit a pull request?

No

@jherkel jherkel added kind:bug Bug report or fix needs:triage Requires attention from one of the committers labels Oct 18, 2023
@mbien
Copy link
Member

mbien commented Oct 18, 2023

Do other popups work? Anything in the log?

can't reproduce this in fedora/virtualbox

image

@mbien mbien added the pending-response Awaiting further information to be supplied label Oct 18, 2023
@jherkel
Copy link
Contributor Author

jherkel commented Oct 18, 2023 via email

@neilcsmith-net neilcsmith-net removed needs:triage Requires attention from one of the committers pending-response Awaiting further information to be supplied labels Oct 19, 2023
@neilcsmith-net neilcsmith-net added this to the NB20 milestone Oct 19, 2023
@neilcsmith-net
Copy link
Member

neilcsmith-net commented Oct 19, 2023

Can replicate on my laptop which has Wayland on Ubuntu 22.04. My main machine is X11 (dual monitor setup doesn't work on Wayland) and doesn't show this issue.

It appears to be a JDK regression. NetBeans 19 and 20-rc1 show this issue running on JDK 21, but neither have a problem on JDK 20. Please can you verify this?

@mbien which JDK are you using there?

@neilcsmith-net
Copy link
Member

cc @DevCharly any idea what FlatLaf is doing differently with popups that might cause this? This change in the JDK looks like it might be a culprit? openjdk/jdk@3d550f7

@mbien
Copy link
Member

mbien commented Oct 19, 2023

@mbien which JDK are you using there?

testing on fedora default:

[mbien@fedora bin]$ java -version
openjdk version "17.0.8" 2023-07-18
OpenJDK Runtime Environment (Red_Hat-17.0.8.0.7-1.fc38) (build 17.0.8+7)
OpenJDK 64-Bit Server VM (Red_Hat-17.0.8.0.7-1.fc38) (build 17.0.8+7, mixed mode, sharing)

unzip and run

@neilcsmith-net
Copy link
Member

neilcsmith-net commented Oct 19, 2023

Could you try with JDK 21 too? Be good to get confirmation that's where the problem is.

We also have two somewhat different implementations of ButtonPopupSwitcher depending on whether multitabs are in use too. Both seem affected though.

@mbien
Copy link
Member

mbien commented Oct 19, 2023

yes I am testing as we speak:
reproducible with both:
amazon-corretto-21.0.0.35.1-linux-x64 and
amazon-corretto-21.0.1.12.1-linux-x64

I sometimes see the popup flickering for a split second but it disappears right away.

"sort by project" and window decoration switches do not influence the result for me

edit: all other popups I tried are working fine

@trixon
Copy link
Contributor

trixon commented Oct 21, 2023

NetBeans 19 and 20-rc1 show this issue running on JDK 21, but neither have a problem on JDK 20. Please can you verify this?

Yes, I can confirm that.

@DevCharly
Copy link
Member

cc @DevCharly any idea what FlatLaf is doing differently with popups that might cause this?

Yes, FlatLaf always uses so-called heavy-weight popups (JWindow) to get that nice drop-shadow for all popups (menus, tooltips, combobox lists, etc).
Other Lafs use light-weight popups (JPanel) as long as the popup fits into the owner window. Otherwise they also use heavy-weight popups. So this issue also occurs in Metal or GTK Laf if the NB "document list" popup does not fit into the NB main window.

This change in the JDK looks like it might be a culprit? openjdk/jdk@3d550f7

Yes, this is the cause. I've debugged it.
The popup JWindow gains focus, therefore the main window looses focus and the popup is hidden. This is a regression in JDK 21.

So why do other popups (menu, tooltips, etc) work in NB with Java 21? Because they do not receive focus.

The NB "document list" popup internally uses a JTable and for keyboard navigation is seems that the focus is transferred to the table.

I'm working on a fix/hack for FlatLaf that removes that bad window focus listener 😒

@mbien mbien linked a pull request Oct 21, 2023 that will close this issue
@mbien
Copy link
Member

mbien commented Oct 21, 2023

test build: https://github.com/apache/netbeans/suites/17486031545/artifacts/999291196
new: https://github.com/apache/netbeans/suites/17490364978/artifacts/999430543

tested on 21+35, 21.0.1 and 20.0.2 and the fix solves the issue for me (fedora test setup). Thanks @DevCharly!

@DevCharly
Copy link
Member

BTW I've reported the issue in Java 21 to "Java bug database"

@DevCharly
Copy link
Member

BTW I've reported the issue in Java 21 to "Java bug database"

https://bugs.openjdk.org/browse/JDK-8319103

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind:bug Bug report or fix
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants