8226654: Some swing gtk regression tests fail with "java.lang.InternalError: Unable to load native GTK librarie
authoravu
Sun, 07 Jul 2019 10:52:30 -0700
changeset 55614 040cb8bf265e
parent 55613 a55b46a208d1
child 55615 3af213fe4704
8226654: Some swing gtk regression tests fail with "java.lang.InternalError: Unable to load native GTK librarie Reviewed-by: prr, psadhukhan
src/java.desktop/unix/native/libawt_xawt/awt/gtk3_interface.c
--- a/src/java.desktop/unix/native/libawt_xawt/awt/gtk3_interface.c	Sat Jul 06 08:11:19 2019 +0800
+++ b/src/java.desktop/unix/native/libawt_xawt/awt/gtk3_interface.c	Sun Jul 07 10:52:30 2019 -0700
@@ -324,8 +324,6 @@
         /* GDK */
         fp_gdk_get_default_root_window =
             dl_symbol("gdk_get_default_root_window");
-        fp_gdk_window_get_scale_factor =
-                    dl_symbol("gdk_window_get_scale_factor");
 
         /* Pixbuf */
         fp_gdk_pixbuf_new = dl_symbol("gdk_pixbuf_new");
@@ -400,6 +398,8 @@
         } else {
             fp_gdk_window_create_similar_image_surface =
                        dl_symbol("gdk_window_create_similar_image_surface");
+            fp_gdk_window_get_scale_factor =
+                    dl_symbol("gdk_window_get_scale_factor");
         }
         gtk3_version_3_14 = !fp_gtk_check_version(3, 14, 0);
 
@@ -2890,9 +2890,13 @@
     jint *ary;
 
     GdkWindow *root = (*fp_gdk_get_default_root_window)();
-    int win_scale = (*fp_gdk_window_get_scale_factor)(root);
-    pixbuf = (*fp_gdk_pixbuf_get_from_drawable)(
-        root, x, y, (int)(width / (float)win_scale + 0.5), (int)(height / (float)win_scale + 0.5));
+    if (gtk3_version_3_10) {
+        int win_scale = (*fp_gdk_window_get_scale_factor)(root);
+        pixbuf = (*fp_gdk_pixbuf_get_from_drawable)(
+            root, x, y, (int) (width / (float) win_scale + 0.5), (int) (height / (float) win_scale + 0.5));
+    } else {
+        pixbuf = (*fp_gdk_pixbuf_get_from_drawable)(root, x, y, width, height);
+    }
 
     if (pixbuf && scale != 1) {
         GdkPixbuf *scaledPixbuf;