mirror of
https://github.com/JetBrains/JetBrainsRuntime.git
synced 2025-12-06 09:29:38 +01:00
JBR-1740 Menu remains open when application loses focus
(cherry picked from commitf987d22cd2) (cherry picked from commit4a7913c9e6)
This commit is contained in:
@@ -494,6 +494,8 @@ public final class XToolkit extends UNIXToolkit implements Runnable {
|
||||
|
||||
private static XMouseInfoPeer xPeer;
|
||||
|
||||
private static Boolean isXWayland;
|
||||
|
||||
static {
|
||||
if (GraphicsEnvironment.isHeadless()) {
|
||||
localEnv = null;
|
||||
@@ -2877,4 +2879,11 @@ public final class XToolkit extends UNIXToolkit implements Runnable {
|
||||
public static boolean getSunAwtDisableGrab() {
|
||||
return Boolean.getBoolean("sun.awt.disablegrab");
|
||||
}
|
||||
|
||||
static synchronized boolean isXWayland() {
|
||||
if (isXWayland == null) {
|
||||
isXWayland = getEnv("WAYLAND_DISPLAY") != null;
|
||||
}
|
||||
return isXWayland;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -878,6 +878,12 @@ class XWindowPeer extends XPanelPeer implements WindowPeer,
|
||||
}
|
||||
handleWindowFocusOut(oppositeWindow, xfe.get_serial());
|
||||
}
|
||||
if (XToolkit.isXWayland() && XAwtState.getGrabWindow() != null) {
|
||||
// under XWayland, pointer grab doesn't give us ability to receive button events for native Wayland
|
||||
// windows, so the logic in handleButtonPressRelease method won't work, and we need this workaround
|
||||
// to cancel the grab on switching to another application
|
||||
postEventToEventQueue(new sun.awt.UngrabEvent(getEventSource()));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user