Skip to content

Commit

Permalink
Backport 7723611d5d5f8959d69d1000fa117166e3d3c5fb
Browse files Browse the repository at this point in the history
  • Loading branch information
TheRealMDoerr committed Jun 3, 2024
1 parent 1b807f9 commit cc85db8
Show file tree
Hide file tree
Showing 7 changed files with 34 additions and 15 deletions.
4 changes: 4 additions & 0 deletions src/java.desktop/unix/classes/sun/awt/X11/XWM.java
Original file line number Diff line number Diff line change
Expand Up @@ -1369,6 +1369,9 @@ Insets guessInsets(XDecoratedPeer window) {
case UNITY_COMPIZ_WM:
res = new Insets(28, 1, 1, 1);
break;
case MUTTER_WM:
res = new Insets(37, 0, 0, 0);
break;
case MOTIF_WM:
case OPENLOOK_WM:
default:
Expand All @@ -1380,6 +1383,7 @@ Insets guessInsets(XDecoratedPeer window) {
}
return res;
}

/*
* Some buggy WMs ignore window gravity when processing
* ConfigureRequest and position window as if the gravity is Static.
Expand Down
2 changes: 2 additions & 0 deletions test/jdk/ProblemList.txt
Original file line number Diff line number Diff line change
Expand Up @@ -505,6 +505,7 @@ java/awt/MenuBar/TestNoScreenMenuBar.java 8265987 macosx-all
java/awt/Graphics2D/DrawString/DrawRotatedStringUsingRotatedFont.java 8266283 generic-all
java/awt/Graphics2D/DrawString/RotTransText.java 8316878 linux-all
java/awt/KeyboardFocusmanager/TypeAhead/ButtonActionKeyTest/ButtonActionKeyTest.java 8257529 windows-x64
java/awt/KeyboardFocusmanager/ConsumeNextMnemonicKeyTypedTest/ConsumeNextMnemonicKeyTypedTest.java 8321303 linux-all

java/awt/Window/GetScreenLocation/GetScreenLocationTest.java 8225787 linux-x64
java/awt/Dialog/MakeWindowAlwaysOnTop/MakeWindowAlwaysOnTop.java 8266243 macosx-aarch64
Expand Down Expand Up @@ -681,6 +682,7 @@ javax/sound/midi/Sequencer/Looping.java 8136897 generic-all
javax/swing/plaf/basic/BasicTextUI/8001470/bug8001470.java 8233177 linux-all,windows-all

javax/swing/JComponent/6683775/bug6683775.java 8172337 generic-all
javax/swing/JFrame/MaximizeWindowTest.java 8321289 linux-all
javax/swing/JWindow/ShapedAndTranslucentWindows/ShapedTranslucentPerPixelTranslucentGradient.java 8233582 linux-all
javax/swing/JWindow/ShapedAndTranslucentWindows/ShapedPerPixelTranslucentGradient.java 8233582 linux-all
javax/swing/JWindow/ShapedAndTranslucentWindows/PerPixelTranslucentSwing.java 8194128 macosx-all
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2011, 2020, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2011, 2023, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
Expand Down Expand Up @@ -54,12 +54,11 @@
import java.awt.event.KeyEvent;

public class NestedModalDialogTest {
private static Frame frame;
private static StartFrame frame;
private static IntermediateDialog interDiag;
private static TextDialog txtDiag;

// Global variables so the robot thread can locate things.
private static Button[] robot_button = new Button[2];
private static TextField robot_text = null;
private static Robot robot = null;

Expand All @@ -78,6 +77,9 @@ private static void blockTillDisplayed(Component comp) {
}

private static void clickOnComp(Component comp) {
robot.waitForIdle();
robot.delay(1000);

Rectangle bounds = new Rectangle(comp.getLocationOnScreen(), comp.getSize());
robot.mouseMove(bounds.x + bounds.width / 2, bounds.y + bounds.height / 2);
robot.waitForIdle();
Expand All @@ -94,11 +96,11 @@ public void testModalDialogs() throws Exception {
// launch first frame with firstButton
frame = new StartFrame();
blockTillDisplayed(frame);
clickOnComp(robot_button[0]);
clickOnComp(frame.button);

// Dialog must be created and onscreen before we proceed.
blockTillDisplayed(interDiag);
clickOnComp(robot_button[1]);
clickOnComp(interDiag.button);

// Again, the Dialog must be created and onscreen before we proceed.
blockTillDisplayed(robot_text);
Expand Down Expand Up @@ -144,6 +146,8 @@ public void testModalDialogs() throws Exception {
*/
class StartFrame extends Frame {

public volatile Button button;

/**
* Constructs a new instance.
*/
Expand All @@ -168,7 +172,7 @@ public void actionPerformed(ActionEvent e) {
pan.add(but);
add(pan);
setVisible(true);
robot_button[0] = but;
button = but;
}
}

Expand All @@ -177,6 +181,7 @@ public void actionPerformed(ActionEvent e) {
class IntermediateDialog extends Dialog {

Dialog m_parent;
public volatile Button button;

public IntermediateDialog(Frame parent) {
super(parent, "Intermediate Modal", true /*Modal*/);
Expand All @@ -193,9 +198,7 @@ public void actionPerformed(ActionEvent e) {
pan.add(but);
add(pan);
pack();

// The robot needs to know about us, so set global
robot_button[1] = but;
button = but;
}
}

Expand All @@ -215,12 +218,12 @@ public TextDialog(Dialog parent) {
}
}

public static void main(String[] args) throws RuntimeException, Exception {
public static void main(String[] args) throws Exception {
try {
new NestedModalDialogTest().testModalDialogs();
} catch (Exception e) {
throw new RuntimeException("NestedModalDialogTest object creation "
+ "failed");
+ "failed", e);
}
}
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2008, 2016, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2008, 2023, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
Expand Down Expand Up @@ -64,6 +64,7 @@ public void start() {
window.setVisible(true);

Util.waitForIdle(robot);
robot.delay(1000);

test();

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2014, 2019, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2014, 2023, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
Expand Down Expand Up @@ -120,6 +120,7 @@ static void testSplash(ImageInfo test) throws Exception {
static void testFocus() throws Exception {

Robot robot = new Robot();
robot.setAutoWaitForIdle(true);
robot.setAutoDelay(50);

Frame frame = new Frame();
Expand All @@ -130,6 +131,7 @@ static void testFocus() throws Exception {
frame.add(textField);
frame.setVisible(true);
robot.waitForIdle();
robot.delay(1000);

robot.keyPress(KeyEvent.VK_A);
robot.keyRelease(KeyEvent.VK_A);
Expand Down
5 changes: 4 additions & 1 deletion test/jdk/javax/swing/JRootPane/DefaultButtonTest.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2022, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2022, 2023, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
Expand Down Expand Up @@ -83,6 +83,7 @@ private void createUI() {

public void runTest() throws Exception {
Robot robot = new Robot();
robot.setAutoWaitForIdle(true);
robot.setAutoDelay(100);
for (UIManager.LookAndFeelInfo laf : UIManager.getInstalledLookAndFeels()) {
try {
Expand All @@ -100,6 +101,8 @@ public void runTest() throws Exception {
createUI();
});
robot.waitForIdle();
robot.delay(1000);

robot.keyPress(KeyEvent.VK_ENTER);
robot.keyRelease(KeyEvent.VK_ENTER);
robot.waitForIdle();
Expand Down
6 changes: 5 additions & 1 deletion test/jdk/javax/swing/JTree/8003400/Test8003400.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2013, 2023, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
Expand Down Expand Up @@ -109,6 +109,10 @@ public void run() {

Robot robot = new Robot();
robot.setAutoDelay(100);
robot.setAutoWaitForIdle(true);
robot.waitForIdle();
robot.delay(500);

SwingUtilities.invokeAndWait(() -> {
point = tree.getLocationOnScreen();
rect = tree.getBounds();
Expand Down

0 comments on commit cc85db8

Please sign in to comment.