1
0
mirror of https://github.com/arduino/Arduino.git synced 2025-03-13 10:29:35 +01:00

Override desktop check when setting look and feel on linux

The swing UIManager class detects the correct look and feel settings by
looking inside the `sun.desktop` system property, here's the extract of
the JDK:

    String desktop = AccessController.doPrivileged(new GetPropertyAction("sun.desktop"));
    Toolkit toolkit = Toolkit.getDefaultToolkit();
    if ("gnome".equals(desktop) &&
            toolkit instanceof SunToolkit &&
            ((SunToolkit) toolkit).isNativeGTKAvailable()) {
        // May be set on Linux and Solaris boxs.
        return "com.sun.java.swing.plaf.gtk.GTKLookAndFeel";
    }

Since we want always the GTK look and feel (even if the desktop is not
strictly a GNOME desktop) we force the `sun.desktop` property always to
`gnome`.
This commit is contained in:
Cristian Maglie 2018-10-24 18:20:58 +02:00 committed by Cristian Maglie
parent 045877094b
commit afc0e0240e

View File

@ -39,6 +39,8 @@ public class Platform extends processing.app.Platform {
@Override
public void setLookAndFeel() throws Exception {
// Override desktop check
System.setProperty("sun.desktop", "gnome");
super.setLookAndFeel();
GTKLookAndFeelFixer.installGtkPopupBugWorkaround();
}