aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDmitry Batrak <Dmitry.Batrak@jetbrains.com>2022-03-05 19:46:12 +0300
committerDmitry Batrak <Dmitry.Batrak@jetbrains.com>2022-03-09 13:40:40 +0300
commitd53de90f8aba5462fe4d73a30c2c04d0f3ab45b4 (patch)
tree9c8774543f673f75beacffec35b5055bb83c64c8
parent6196076b9507b790f603701c80158f7560183d30 (diff)
downloadJetBrainsRuntime-d53de90f8aba5462fe4d73a30c2c04d0f3ab45b4.tar.gz
JBR-3751 Window content isn't rendered with some window managers on Linuxjb17-b365
(cherry picked from commit 8d22e4dcb0c0a599ef3f03a7a0a2d3a2e528134c)
-rw-r--r--src/java.desktop/unix/classes/sun/awt/X11/XDecoratedPeer.java9
-rw-r--r--src/java.desktop/unix/classes/sun/awt/X11/XWindowPeer.java20
2 files changed, 18 insertions, 11 deletions
diff --git a/src/java.desktop/unix/classes/sun/awt/X11/XDecoratedPeer.java b/src/java.desktop/unix/classes/sun/awt/X11/XDecoratedPeer.java
index 076a214aeac..f089abe370b 100644
--- a/src/java.desktop/unix/classes/sun/awt/X11/XDecoratedPeer.java
+++ b/src/java.desktop/unix/classes/sun/awt/X11/XDecoratedPeer.java
@@ -781,19 +781,12 @@ abstract class XDecoratedPeer extends XWindowPeer {
return;
}
- /*
- * Some window managers configure before we are reparented and
- * the send event flag is set! ugh... (Enlighetenment for one,
- * possibly MWM as well). If we haven't been reparented yet
- * this is just the WM shuffling us into position. Ignore
- * it!!!! or we wind up in a bogus location.
- */
int runningWM = XWM.getWMID();
if (insLog.isLoggable(PlatformLogger.Level.FINE)) {
insLog.fine("reparented={0}, visible={1}, WM={2}, decorations={3}",
isReparented(), isVisible(), runningWM, getDecorations());
}
- if (!isReparented() && isVisible() && runningWM != XWM.NO_WM
+ if (ENABLE_REPARENTING_CHECK && !isReparented() && isVisible() && runningWM != XWM.NO_WM
&& !XWM.isNonReparentingWM()
&& getDecorations() != XWindowAttributesData.AWT_DECOR_NONE) {
insLog.fine("- visible but not reparented, skipping");
diff --git a/src/java.desktop/unix/classes/sun/awt/X11/XWindowPeer.java b/src/java.desktop/unix/classes/sun/awt/X11/XWindowPeer.java
index 903938986a2..b89cd7ed4b9 100644
--- a/src/java.desktop/unix/classes/sun/awt/X11/XWindowPeer.java
+++ b/src/java.desktop/unix/classes/sun/awt/X11/XWindowPeer.java
@@ -52,6 +52,8 @@ import sun.awt.X11GraphicsEnvironment;
import sun.java2d.pipe.Region;
import sun.util.logging.PlatformLogger;
+import sun.security.action.GetPropertyAction;
+
class XWindowPeer extends XPanelPeer implements WindowPeer,
DisplayChangedListener {
@@ -61,6 +63,9 @@ class XWindowPeer extends XPanelPeer implements WindowPeer,
private static final PlatformLogger grabLog = PlatformLogger.getLogger("sun.awt.X11.grab.XWindowPeer");
private static final PlatformLogger iconLog = PlatformLogger.getLogger("sun.awt.X11.icon.XWindowPeer");
+ static final boolean ENABLE_REPARENTING_CHECK
+ = "true".equals(GetPropertyAction.privilegedGetProperty("reparenting.check"));
+
// should be synchronized on awtLock
private static Set<XWindowPeer> windows = new HashSet<XWindowPeer>();
@@ -747,7 +752,8 @@ class XWindowPeer extends XPanelPeer implements WindowPeer,
int runningWM = XWM.getWMID();
Point newLocation = targetBounds.getLocation();
- if (xe.get_send_event() || runningWM == XWM.NO_WM || XWM.isNonReparentingWM()) {
+ if (xe.get_send_event() ||
+ (ENABLE_REPARENTING_CHECK ? (runningWM == XWM.NO_WM || XWM.isNonReparentingWM()) : !isReparented())) {
// Location, Client size + insets
newLocation = new Point(scaleDown(xe.get_x()) - leftInset,
scaleDown(xe.get_y()) - topInset);
@@ -1443,6 +1449,14 @@ class XWindowPeer extends XPanelPeer implements WindowPeer,
isUnhiding |= isWMStateNetHidden();
super.handleMapNotifyEvent(xev);
+
+ if (!ENABLE_REPARENTING_CHECK && delayedModalBlocking) {
+ // case of non-re-parenting WM
+ // (for a re-parenting WM this should have been already done on ReparentNotify processing)
+ addToTransientFors(AWTAccessor.getComponentAccessor().getPeer(modalBlocker));
+ delayedModalBlocking = false;
+ }
+
if (isBeforeFirstMapNotify && !winAttr.initialFocus && shouldSuppressWmTakeFocus()) {
suppressWmTakeFocus(false); // restore the protocol.
if (!XWM.isKDE2()) {
@@ -1662,7 +1676,7 @@ class XWindowPeer extends XPanelPeer implements WindowPeer,
}
modalBlocker = d;
- if (isReparented() || XWM.isNonReparentingWM()) {
+ if (isReparented() || ENABLE_REPARENTING_CHECK && XWM.isNonReparentingWM()) {
addToTransientFors(blockerPeer, javaToplevels);
} else {
delayedModalBlocking = true;
@@ -1673,7 +1687,7 @@ class XWindowPeer extends XPanelPeer implements WindowPeer,
}
modalBlocker = null;
- if (isReparented() || XWM.isNonReparentingWM()) {
+ if (isReparented() || ENABLE_REPARENTING_CHECK && XWM.isNonReparentingWM()) {
removeFromTransientFors();
} else {
delayedModalBlocking = false;