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.26k stars 192 forks source link

JBR-6763 Wayland: handle popup_done event #323

Closed xdom closed 5 months ago

xdom commented 6 months ago

Certain Wayland compositors (wlroots) invalidate xdg_surface after window with popup loses focus. Subsequent attempts to commit the popup window fail with protocol error "xdg_surface has never been configured".

Handle popup_done event by hiding the popup window and emitting WINDOW_CLOSING Window event.

mkartashev commented 6 months ago

Thank you for reporting the problem and the solution! I'm going to need some time to set up wlroots and then I will get back to you

mkartashev commented 6 months ago

I have not been able to reproduce that on the version of Sway that I have: 1.7. Can provide some more details on how to reproduce the issue?

xdom commented 5 months ago

I have not been able to reproduce that on the version of Sway that I have: 1.7. Can provide some more details on how to reproduce the issue?

Running IntelliJ IDEA 2024.1 EAP (Ultimate Edition) in Archlinux container (distrobox) with JBR 21.0.2b375.u1. New UI enabled in compact mode. Compositor sway 1.8.1 compiled with wlroots 0.16.2 running on Alpine Linux (musl libc).

The reproducer steps are: Click on a dropdown button (e.g. VCS branch select in the top bar), leave it open, and switch to another application window, either by clicking on it, or using a keybind (e.g. Meta+h[jkl]).

image

Another dropdown which this can be reproduced with is the one you get after pressing Ctrl+`. However, it is not reproducible by clicking on a recent projects dropdown (on the left, next to VCS branches dropdown), which is interesting.

Let me try on some more common setup with sway 1.7.1. Also, this might not be an issue on new Sway 1.9.x because newer wlroots changed the way it handles unconfigured _xdgsurface (rejecting, instead of erroring). Will test and let you know.

Details:

IntelliJ IDEA 2024.1 EAP (Ultimate Edition)
Build #IU-241.13688.18, built on February 21, 2024
Licensed to IntelliJ IDEA EAP user: ****
Expiration date: March 22, 2024
Runtime version: 21.0.2+13-b375.1 amd64
VM: OpenJDK 64-Bit Server VM by JetBrains s.r.o.
Linux 6.6.9-0-lts
GC: G1 Young Generation, G1 Concurrent GC, G1 Old Generation
Memory: 3960M
Cores: 20
Registry:
  ide.experimental.ui=true
  ide.experimental.ui.inter.font=true
Non-Bundled Plugins:
  com.jetbrains.space (241.13688.16)
  IdeaVIM (2.9.1)
  org.jetbrains.plugins.go-template (241.13688.16)
Kotlin: 241.13688.18-IJ
Current Desktop: sway
mkartashev commented 5 months ago

@xdom If you accept the edits I suggested, we can move forward with this PR.

xdom commented 5 months ago

@mkartashev Sorry for the delay, and thanks for the suggestions. We can proceed.

mkartashev commented 3 months ago

@xdom I'm now synchronizing Wayland-related work with the project Wakefield repository. Since this patch was contributed by you, I can't simply cherry-pick it to OpenJDK. Would you be willing to open a PR against branch jdk21.0.1-wayland in that repository? That is, assuming you are or can become an OpenJDK contributor?