8214765: All TrayIcon MessageType icons does not show up with gtk3 option set
authorpbansal
Fri, 18 Jan 2019 13:54:32 +0530
changeset 53668 ac04efe9feed
parent 53667 6dae74bb8a43
child 53669 420d0198e26a
8214765: All TrayIcon MessageType icons does not show up with gtk3 option set Reviewed-by: serb, psadhukhan
src/java.desktop/unix/classes/sun/awt/X11/InfoWindow.java
--- a/src/java.desktop/unix/classes/sun/awt/X11/InfoWindow.java	Fri Jan 18 13:36:16 2019 +0530
+++ b/src/java.desktop/unix/classes/sun/awt/X11/InfoWindow.java	Fri Jan 18 13:54:32 2019 +0530
@@ -53,6 +53,7 @@
 import java.util.concurrent.ArrayBlockingQueue;
 
 import sun.awt.SunToolkit;
+import sun.awt.UNIXToolkit;
 
 /**
  * An utility window class. This is a base class for Tooltip and Balloon.
@@ -437,12 +438,24 @@
 
         private void loadGtkImages() {
             if (!gtkImagesLoaded) {
-                errorImage = (Image)Toolkit.getDefaultToolkit().getDesktopProperty(
-                    "gtk.icon.gtk-dialog-error.6.rtl");
-                warnImage = (Image)Toolkit.getDefaultToolkit().getDesktopProperty(
-                    "gtk.icon.gtk-dialog-warning.6.rtl");
-                infoImage = (Image)Toolkit.getDefaultToolkit().getDesktopProperty(
-                    "gtk.icon.gtk-dialog-info.6.rtl");
+                //check whether the gtk version is >= 3.10 as the Icon names were
+                //changed from this release
+                UNIXToolkit tk = (UNIXToolkit) Toolkit.getDefaultToolkit();
+                if (tk.checkGtkVersion(3, 10, 0)) {
+                    errorImage = (Image) tk.getDesktopProperty(
+                            "gtk.icon.dialog-error.6.rtl");
+                    warnImage = (Image) tk.getDesktopProperty(
+                            "gtk.icon.dialog-warning.6.rtl");
+                    infoImage = (Image) tk.getDesktopProperty(
+                            "gtk.icon.dialog-information.6.rtl");
+                } else {
+                    errorImage = (Image) tk.getDesktopProperty(
+                            "gtk.icon.gtk-dialog-error.6.rtl");
+                    warnImage = (Image) tk.getDesktopProperty(
+                            "gtk.icon.gtk-dialog-warning.6.rtl");
+                    infoImage = (Image) tk.getDesktopProperty(
+                            "gtk.icon.gtk-dialog-info.6.rtl");
+                }
                 gtkImagesLoaded = true;
             }
         }