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 commit f987d22cd2)
This commit is contained in:
@@ -501,6 +501,8 @@ public final class XToolkit extends UNIXToolkit implements Runnable {
|
||||
|
||||
private static XMouseInfoPeer xPeer;
|
||||
|
||||
private static Boolean isXWayland;
|
||||
|
||||
static {
|
||||
initSecurityWarning();
|
||||
if (GraphicsEnvironment.isHeadless()) {
|
||||
@@ -2913,6 +2915,13 @@ public final class XToolkit extends UNIXToolkit implements Runnable {
|
||||
return AccessController.doPrivileged(new GetBooleanAction("sun.awt.disablegrab"));
|
||||
}
|
||||
|
||||
static synchronized boolean isXWayland() {
|
||||
if (isXWayland == null) {
|
||||
isXWayland = getEnv("WAYLAND_DISPLAY") != null;
|
||||
}
|
||||
return isXWayland;
|
||||
}
|
||||
|
||||
@SuppressWarnings("removal")
|
||||
private static final boolean useCachedInsets = Boolean.parseBoolean(AccessController.doPrivileged(
|
||||
new GetPropertyAction("x11.cache.screen.insets", "true")));
|
||||
|
||||
@@ -911,6 +911,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