JBR-6547 WLToolkit: no app icon in GNOME

Allow to associate the application's window with .desktop file with icon
and other info with -Dawt.app.id=... (DBus application name similar to
WM_CLASS in X

(cherry picked from commit 5901915afb)
This commit is contained in:
Maxim Kartashev
2024-01-23 13:44:55 +04:00
committed by jbrbot
parent 41cea28e11
commit c6b614beb1
3 changed files with 10 additions and 4 deletions

View File

@@ -62,8 +62,6 @@ public class WLComponentPeer implements ComponentPeer {
private static final PlatformLogger focusLog = PlatformLogger.getLogger("sun.awt.wl.focus.WLComponentPeer");
private static final PlatformLogger popupLog = PlatformLogger.getLogger("sun.awt.wl.popup.WLComponentPeer");
private static final String appID = System.getProperty("sun.java.command");
// mapping of AWT cursor types to X cursor names
// multiple variants can be specified, that will be tried in order
private static final String[][] CURSOR_NAMES = {
@@ -282,7 +280,7 @@ public class WLComponentPeer implements ComponentPeer {
getParentNativePtr(target),
target.getX(), target.getY(),
isModal, isMaximized, isMinimized,
title, appID);
title, WLToolkit.getApplicationID());
}
final long wlSurfacePtr = getWLSurface(nativePtr);
WLToolkit.registerWLSurface(wlSurfacePtr, this);

View File

@@ -184,6 +184,14 @@ public class WLToolkit extends UNIXToolkit implements Runnable {
System.setProperty(extraButtons, String.valueOf(areExtraMouseButtonsEnabled));
}
static String getApplicationID() {
// Do not cache the properties as the application might want to change
// them at run time. Might also consider using JComponent's client property
// for per-window app ID
String appID = System.getProperty("awt.app.id");
return appID != null ? appID : System.getProperty("sun.java.command");
}
public static boolean isToolkitThread() {
return Thread.currentThread() == toolkitThread;
}

View File

@@ -143,7 +143,7 @@ public class WLWindowPeer extends WLComponentPeer implements WindowPeer {
@Override
public void updateIconImages() {
// No support for this from Wayland, icon is a desktop integration feature.
}
@Override