8280990: [XWayland] XTest emulated mouse click does not bring window to front

Reviewed-by: avu, psadhukhan, kizune
This commit is contained in:
Alexander Zvegintsev 2024-06-03 07:12:06 +00:00
parent 7c83d7ab53
commit d2d78ad18e
3 changed files with 27 additions and 4 deletions

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2007, 2014, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2007, 2024, 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
@ -35,6 +35,9 @@ public class FrameToFrontModelessTest {
private boolean isModeless;
private static final boolean IS_ON_WAYLAND =
System.getenv("WAYLAND_DISPLAY") != null;
public FrameToFrontModelessTest(boolean modeless) throws Exception {
isModeless = modeless;
robot = new ExtendedRobot();
@ -76,6 +79,9 @@ public class FrameToFrontModelessTest {
robot.waitForIdle(delay);
// show the right frame appear on top of the dialog
if (IS_ON_WAYLAND) {
rightFrame.toFront();
}
rightFrame.clickDummyButton(robot);
robot.waitForIdle(delay);

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2007, 2018, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2007, 2024, 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
@ -45,6 +45,9 @@ public class TestDialog extends Dialog implements ActionListener,
public static int delay = 500;
public static int keyDelay = 100;
private static final boolean IS_ON_WAYLAND =
System.getenv("WAYLAND_DISPLAY") != null;
public TestDialog(Frame frame) {
super(frame);
initializeGUI();
@ -287,6 +290,9 @@ public class TestDialog extends Dialog implements ActionListener,
String message,
Button b) throws Exception {
focusGained.reset();
if (IS_ON_WAYLAND) {
toFront();
}
clickInside(robot);
focusGained.waitForFlagTriggered();
assertTrue(focusGained.flag(),
@ -303,6 +309,9 @@ public class TestDialog extends Dialog implements ActionListener,
String message,
Button b) throws Exception {
focusGained.reset();
if (IS_ON_WAYLAND) {
toFront();
}
clickInside(robot);
robot.waitForIdle(delay);

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2007, 2018, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2007, 2024, 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
@ -43,6 +43,8 @@ public class TestFrame extends Frame implements ActionListener,
public static int delay = 500;
public static int keyDelay = 100;
private static final boolean IS_ON_WAYLAND =
System.getenv("WAYLAND_DISPLAY") != null;
public TestFrame() {
super();
@ -251,7 +253,7 @@ public class TestFrame extends Frame implements ActionListener,
String message) throws Exception {
dummyClicked.reset();
clickButton(dummyButton, robot);
dummyClicked.waitForFlagTriggered();
dummyClicked.waitForFlagTriggered(attempts);
String msg = "Clicking the frame Dummy button " + (refState ?
"did not trigger an action." :
@ -277,6 +279,9 @@ public class TestFrame extends Frame implements ActionListener,
String message,
Button b) throws Exception {
focusGained.reset();
if (IS_ON_WAYLAND) {
toFront();
}
clickInside(robot);
focusGained.waitForFlagTriggered();
@ -293,6 +298,9 @@ public class TestFrame extends Frame implements ActionListener,
String message,
Button b) throws Exception {
focusGained.reset();
if (IS_ON_WAYLAND) {
toFront();
}
clickInside(robot);
robot.waitForIdle(delay);