From d937fe9ca56519539232c4cffba3d7e72bc7f269 Mon Sep 17 00:00:00 2001 From: Cristian Maglie Date: Wed, 24 Oct 2018 17:28:41 +0200 Subject: [PATCH 1/2] Fix LookAndFeel loader Fix #8119 Close #8122 --- arduino-core/src/processing/app/linux/Platform.java | 3 +-- build/linux/dist/arduino | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/arduino-core/src/processing/app/linux/Platform.java b/arduino-core/src/processing/app/linux/Platform.java index 8c507234795..28cdc63f4df 100644 --- a/arduino-core/src/processing/app/linux/Platform.java +++ b/arduino-core/src/processing/app/linux/Platform.java @@ -37,10 +37,9 @@ */ public class Platform extends processing.app.Platform { - // TODO Need to be smarter here since KDE people ain't gonna like that GTK. - // It may even throw a weird exception at 'em for their trouble. @Override public void setLookAndFeel() throws Exception { + super.setLookAndFeel(); GTKLookAndFeelFixer.installGtkPopupBugWorkaround(); } diff --git a/build/linux/dist/arduino b/build/linux/dist/arduino index ad97c916022..f70c65082bf 100755 --- a/build/linux/dist/arduino +++ b/build/linux/dist/arduino @@ -25,7 +25,7 @@ if [ -x "$APPDIR/java/bin/java" ]; then fi # Collect options to java in an array, to properly handle whitespace in options -JAVA_OPTIONS=("-DAPP_DIR=$APPDIR" "-Dswing.defaultlaf=com.sun.java.swing.plaf.gtk.GTKLookAndFeel") +JAVA_OPTIONS=("-DAPP_DIR=$APPDIR") # Only show the splash screen when no options are present if [[ "$@" != *"--"* ]] ; then From 3e0a0a30e2f6694aaf46f4caf9ef990d4a122342 Mon Sep 17 00:00:00 2001 From: Cristian Maglie Date: Wed, 24 Oct 2018 18:20:58 +0200 Subject: [PATCH 2/2] 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`. --- arduino-core/src/processing/app/linux/Platform.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/arduino-core/src/processing/app/linux/Platform.java b/arduino-core/src/processing/app/linux/Platform.java index 28cdc63f4df..2220aaeb67d 100644 --- a/arduino-core/src/processing/app/linux/Platform.java +++ b/arduino-core/src/processing/app/linux/Platform.java @@ -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(); }