changeset 55614:040cb8bf265e

8226654: Some swing gtk regression tests fail with "java.lang.InternalError: Unable to load native GTK librarie Reviewed-by: prr, psadhukhan
author avu
date Sun, 07 Jul 2019 10:52:30 -0700
parents a55b46a208d1
children 3af213fe4704
files src/java.desktop/unix/native/libawt_xawt/awt/gtk3_interface.c
diffstat 1 files changed, 9 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- 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;