Skip to content

Commit adb3422

Browse files
committed
JBR-9875 On wayland modal dialog moves the parent window when dragged
Support for gnome-specific dialog modality is disabled by default. Use -Dsun.awt.wl.NativeModality=true to enable.
1 parent f6951a4 commit adb3422

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

src/java.desktop/unix/classes/sun/awt/wl/WLComponentPeer.java

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,8 @@ public class WLComponentPeer implements ComponentPeer, WLSurfaceSizeListener {
116116
private boolean resizePending = false; // protected by stateLock
117117

118118
private static final boolean shadowEnabled = Boolean.parseBoolean(System.getProperty("sun.awt.wl.Shadow", "true"));
119+
private static final boolean nativeModalityEnabled = Boolean.parseBoolean(
120+
System.getProperty("sun.awt.wl.NativeModality", "false"));
119121

120122
static {
121123
initIDs();
@@ -506,9 +508,12 @@ static boolean isWlPopup(Window window) {
506508
}
507509

508510
private boolean targetIsModal() {
509-
return target instanceof Dialog dialog
510-
&& (dialog.getModalityType() == Dialog.ModalityType.APPLICATION_MODAL
511-
|| dialog.getModalityType() == Dialog.ModalityType.TOOLKIT_MODAL);
511+
if (nativeModalityEnabled) {
512+
return target instanceof Dialog dialog
513+
&& (dialog.getModalityType() == Dialog.ModalityType.APPLICATION_MODAL
514+
|| dialog.getModalityType() == Dialog.ModalityType.TOOLKIT_MODAL);
515+
}
516+
return false;
512517
}
513518

514519
void updateSurfaceData() {

0 commit comments

Comments
 (0)