You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I use AWT canvas for Java2D painting. I am embedding this into an otherwise SWT application. The canvas stays empty on Linux Wayland. Operation on Windows and Linux/GTK is OK. I saw it on RCP 4.27 but it also happens on RCP 4.9
I tried to make a minimum example to reproduce the problem:
package swtawttest;
import java.awt.Color;
import org.eclipse.swt.SWT;
import org.eclipse.swt.awt.SWT_AWT;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Shell;
public class Main {
public static void main(String[] args) {
Display display = new Display();
Shell shell = new Shell(display);
Composite composite = new Composite(shell, SWT.EMBEDDED);
composite.setBounds(0, 0, 100, 100);
java.awt.Frame frame = SWT_AWT.new_Frame(composite);
java.awt.Canvas canvas = new java.awt.Canvas();
canvas.setBackground(Color.BLACK);
frame.add(canvas);
shell.open();
while (!shell.isDisposed()) {
if (!display.readAndDispatch()) {
display.sleep();
}
}
display.dispose();
}
}
The canvas in this example sets a black background which does not appear on Wayland but GTK. I did not retest this minimum example on Windows.
In the original RCP application I am writing I get these errors on the console when I am moving the SWT composite containing the AWT canvas:
Gdk-Message: 15:52:24.677: Window 0x7fa29cd98c80 is a temporary window without parent, application will not be able to position it on screen.
This does not happen on the minimum example as no canvas is moved there but maybe it hints to the problem.
I am using Java 17.0.6
I am running on Ubuntu 22.04.2 LTS
The SWT Bundle Version I am using is 3.123.0.v20230220-1431
The text was updated successfully, but these errors were encountered:
I found a workaround:
If I set environment variable GDK_BACKEND=x11
I get the graphical output. This tells GTK to not use wayland as backend for default but instead run Xwayland for compatibility.
I get other problems then that I do not have running directly on X11 (like Wizard dialogs appearing behind my main window) but that is a different issue.
I use AWT canvas for Java2D painting. I am embedding this into an otherwise SWT application. The canvas stays empty on Linux Wayland. Operation on Windows and Linux/GTK is OK. I saw it on RCP 4.27 but it also happens on RCP 4.9
I tried to make a minimum example to reproduce the problem:
The canvas in this example sets a black background which does not appear on Wayland but GTK. I did not retest this minimum example on Windows.
In the original RCP application I am writing I get these errors on the console when I am moving the SWT composite containing the AWT canvas:
Gdk-Message: 15:52:24.677: Window 0x7fa29cd98c80 is a temporary window without parent, application will not be able to position it on screen.
This does not happen on the minimum example as no canvas is moved there but maybe it hints to the problem.
I am using Java 17.0.6
I am running on Ubuntu 22.04.2 LTS
The SWT Bundle Version I am using is 3.123.0.v20230220-1431
The text was updated successfully, but these errors were encountered: