JBR-5655 java/awt/Toolkit/Wayland/WaylandToolkit.java: WLToolkit not found

WLToolkit made operational in headless mode

(cherry picked from commit 5679e134a7)
This commit is contained in:
Maxim Kartashev
2023-05-19 20:22:00 +04:00
committed by jbrbot
parent edcc9a0ef9
commit e186d86f3e
2 changed files with 13 additions and 8 deletions

View File

@@ -150,13 +150,15 @@ public class WLToolkit extends UNIXToolkit implements Runnable {
return null;
});
Thread toolkitThread = new Thread(this, "AWT-Wayland");
toolkitThread.setDaemon(true);
toolkitThread.start();
if (!GraphicsEnvironment.isHeadless()) {
Thread toolkitThread = new Thread(this, "AWT-Wayland");
toolkitThread.setDaemon(true);
toolkitThread.start();
final Thread toolkitSystemThread = new Thread(this::dispatchNonDefaultQueues, "AWT-Wayland-system-dispatcher");
toolkitSystemThread.setDaemon(true);
toolkitSystemThread.start();
final Thread toolkitSystemThread = new Thread(this::dispatchNonDefaultQueues, "AWT-Wayland-system-dispatcher");
toolkitSystemThread.setDaemon(true);
toolkitSystemThread.start();
}
}
@Override

View File

@@ -34,8 +34,11 @@ public class WaylandToolkit {
public static void main(String args[]) {
Toolkit tk = Toolkit.getDefaultToolkit();
if (!"sun.awt.wl.WLToolkit".equals(tk.getClass().getName())) {
throw new RuntimeException("WLToolkit not found");
System.out.println("Toolkit.getDefaultToolkit(): " + tk);
if (!GraphicsEnvironment.isHeadless()) {
if (!"sun.awt.wl.WLToolkit".equals(tk.getClass().getName())) {
throw new RuntimeException("WLToolkit not found");
}
}
}
}