No drawing on AWT canvas using SWT_AWT bridge on Linux/wayland [message #1858649] |
Thu, 13 April 2023 14:01 |
ChristianR Mising name Messages: 25 Registered: December 2009 Location: Germany |
Junior Member |
|
|
I just upgraded to Eclipse RCP 4.27 and I am facing troubles on Linux/Wayland. It was not working before and I was hoping upgrading from 4.9 to 4.27 would help with Wayland integration.
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 get some scaling issues on GTK recently and need to investigate this but it is a separate problem).
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.
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
I appreciate any hints.
[Updated on: Tue, 18 April 2023 05:57] Report message to a moderator
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.02961 seconds