JetBrains / JetBrainsRuntime

Runtime environment based on OpenJDK for running IntelliJ Platform-based products on Windows, macOS, and Linux
GNU General Public License v2.0
1.36k stars 199 forks source link

JBR-7072 Wayland: clicks on items of floating context menus are ignored #405

Closed mkartashev closed 5 months ago

mkartashev commented 5 months ago

JBR-7072 Wayland: clicks on items of floating context menus are ignored

The origin of the problem lies in an unexpected sequence of FocusEvent's generated on the popup invocation. In order to make that sequence more standard, I used the corresponding method from LWComponentPeer as a template. It doesn't cover all Wayland cases yet and falls through to WLKeyboardFocusManagerPeer.SNFH_FAILURE case in some instances, but that's a task for another day.

Also verified that this fix did not regress on the test from JBR-6145 [Wayland toolkit] Popup windows aren't focusable.

JB-Dmitry commented 5 months ago

Worth creating an automated test case? Or at least a simple reproducer for manual checking, not requiring to launch the IDE?

mkartashev commented 5 months ago

Worth creating an automated test case? Or at least a simple reproducer for manual checking, not requiring to launch the IDE?

Yes, I attached a manual test to the issue here.

avu commented 5 months ago

Worth creating an automated test case? Or at least a simple reproducer for manual checking, not requiring to launch the IDE?

Yes, I attached a manual test to the issue here.

I think that a manual jtreg test would be useful here. We have too many reproducers inside the issue without at least a semi-automated way to verify them.

mkartashev commented 5 months ago

I added a manual test. It can be run on Wayland like so

$ jtreg -testjdk:`pwd`/build/linux-x86_64-server-release/images/jdk -javaoptions:'-Dawt.toolkit.name=WLToolkit' test/jdk/jb/java/awt/Focus/ContextMenuFocusTest.java