changeset 10248:1e166033763f jdk-9+153

8171985: Fx applet fails to get loaded on Ubuntu Reviewed-by: kcr
author ddhill
date Thu, 12 Jan 2017 16:53:23 -0500
parents 1c7c3b03c6fe
children 281f03c7d7d5
files modules/javafx.graphics/src/main/java/com/sun/glass/ui/Window.java modules/javafx.graphics/src/main/native-glass/gtk/GlassWindow.cpp modules/javafx.graphics/src/main/native-glass/gtk/glass_window.cpp
diffstat 3 files changed, 13 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/modules/javafx.graphics/src/main/java/com/sun/glass/ui/Window.java	Thu Jan 12 11:40:37 2017 -0800
+++ b/modules/javafx.graphics/src/main/java/com/sun/glass/ui/Window.java	Thu Jan 12 16:53:23 2017 -0500
@@ -308,6 +308,17 @@
         if (this.ptr == 0L) {
             throw new RuntimeException("could not create platform window");
         }
+
+        if (screen == null) {
+            screen = Screen.getMainScreen(); // start with a default
+
+            if (PrismSettings.allowHiDPIScaling) {
+                this.platformScaleX = this.screen.getPlatformScaleX();
+                this.platformScaleY = this.screen.getPlatformScaleY();
+                this.outputScaleX = this.screen.getRecommendedOutputScaleX();
+                this.outputScaleY = this.screen.getRecommendedOutputScaleY();
+            }
+        }
     }
 
     public boolean isClosed() {
--- a/modules/javafx.graphics/src/main/native-glass/gtk/GlassWindow.cpp	Thu Jan 12 11:40:37 2017 -0800
+++ b/modules/javafx.graphics/src/main/native-glass/gtk/GlassWindow.cpp	Thu Jan 12 16:53:23 2017 -0500
@@ -110,11 +110,9 @@
     WindowContextPlug *parent_ctx = NULL;
     WindowContext *ctx = NULL;
 
-    WindowContext* parent = JLONG_TO_WINDOW_CTX(owner);
-
     parent_window = gdk_x11_window_lookup_for_display(
                         gdk_display_get_default(),
-                        GDK_WINDOW_XID(ctx->get_gdk_window()));
+                        (Window)PTR_TO_JLONG(owner));
 
     if (parent_window != NULL) {
         parent_ctx = (WindowContextPlug *)g_object_get_data(G_OBJECT(parent_window), GDK_WINDOW_DATA_CONTEXT);
--- a/modules/javafx.graphics/src/main/native-glass/gtk/glass_window.cpp	Thu Jan 12 11:40:37 2017 -0800
+++ b/modules/javafx.graphics/src/main/native-glass/gtk/glass_window.cpp	Thu Jan 12 16:53:23 2017 -0500
@@ -1483,9 +1483,7 @@
 {
     jwindow = mainEnv->NewGlobalRef(_jwindow);
 
-    WindowContext* parent = ((WindowContext*)JLONG_TO_PTR(_owner));
-    Window win = GDK_WINDOW_XID(parent->get_gdk_window());
-    gtk_widget = gtk_plug_new(win);
+    gtk_widget = gtk_plug_new((Window)PTR_TO_JLONG(_owner));
 
     g_signal_connect(G_OBJECT(gtk_widget), "configure-event", G_CALLBACK(plug_configure), this);