Skip to content

Commit aacb15b

Browse files
committed
Ensure window is fully activated on Wayland before continuing test
On GTK3 + wayland Display.post and some other operations, such as clipboard, cannot be issued until the window is fully activated. This change ensures that we have seen the paint, activate and focus in on Wayland in addition to GTK4. Part of #2714
1 parent 998edc9 commit aacb15b

File tree

2 files changed

+3
-4
lines changed

2 files changed

+3
-4
lines changed

tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/SwtTestUtil.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -252,7 +252,7 @@ public static boolean isBidi() {
252252
public static void openShell(Shell shell) {
253253
if (shell != null && !shell.getVisible()) {
254254
if (isGTK) {
255-
if (isGTK4()) {
255+
if (isGTK4() || isWayland()) {
256256
waitAllEvents(() -> shell.open(), shell, Set.of(SWT.Paint, SWT.Activate, SWT.FocusIn), 1000);
257257
} else {
258258
waitEvent(() -> shell.open(), shell, SWT.Paint, 1000);

tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_Display.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1055,13 +1055,12 @@ public void test_postLorg_eclipse_swt_widgets_Event() {
10551055

10561056
Shell shell = new Shell(display, SWT.NO_TRIM);
10571057
shell.setBounds(display.getBounds());
1058-
shell.open();
10591058

10601059
// The display.post needs to successfully obtain the focused window (at least on GTK3)
1061-
// so we can send events to it. This processEvents gives SWT/GTK time to draw/focus/etc
1060+
// so we can send events to it. This openShell gives SWT/GTK time to draw/focus/etc
10621061
// the window so that org.eclipse.swt.widgets.Display.findFocusedWindow()
10631062
// returns non-zero
1064-
SwtTestUtil.processEvents();
1063+
SwtTestUtil.openShell(shell);
10651064

10661065
Event event;
10671066

0 commit comments

Comments
 (0)