changeset 54167:9b93a6b30cbe

8212677: X11 default visual support for IM status window on VNC Reviewed-by: serb, naoto
author itakiguchi
date Fri, 01 Feb 2019 15:34:53 -0800
parents 01980f91eac1
children ec5e5bc74f17
files src/java.desktop/unix/native/libawt_xawt/awt/awt_GraphicsEnv.c src/java.desktop/unix/native/libawt_xawt/awt/awt_InputMethod.c
diffstat 2 files changed, 28 insertions(+), 14 deletions(-) [+]
line wrap: on
line diff
--- a/src/java.desktop/unix/native/libawt_xawt/awt/awt_GraphicsEnv.c	Thu Jan 31 15:20:42 2019 -0800
+++ b/src/java.desktop/unix/native/libawt_xawt/awt/awt_GraphicsEnv.c	Fri Feb 01 15:34:53 2019 -0800
@@ -190,6 +190,8 @@
     visualList = XGetVisualInfo(awt_display,
                                 mask, vinfo, &visualsMatched);
     if (visualList) {
+        int id = -1;
+        VisualID defaultVisual = XVisualIDFromVisual(DefaultVisual(awt_display, vinfo->screen));
         defaultConfig = ZALLOC(_AwtGraphicsConfigData);
         for (i = 0; i < visualsMatched; i++) {
             memcpy(&defaultConfig->awt_visInfo, &visualList[i], sizeof(XVisualInfo));
@@ -198,19 +200,30 @@
             /* we can't use awtJNI_CreateColorData here, because it'll pull,
                SystemColor, which in turn will cause toolkit to be reinitialized */
             if (awtCreateX11Colormap(defaultConfig)) {
-                /* Allocate white and black pixels for this visual */
-                color.flags = DoRed | DoGreen | DoBlue;
-                color.red = color.green = color.blue = 0x0000;
-                XAllocColor(awt_display, defaultConfig->awt_cmap, &color);
-                x11Screens[visualList[i].screen].blackpixel = color.pixel;
-                color.flags = DoRed | DoGreen | DoBlue;
-                color.red = color.green = color.blue = 0xffff;
-                XAllocColor(awt_display, defaultConfig->awt_cmap, &color);
-                x11Screens[visualList[i].screen].whitepixel = color.pixel;
+                if (visualList[i].visualid == defaultVisual) {
+                    id = i;
+                    break;
+                } else if (-1 == id) {
+                    // Keep 1st match for fallback
+                    id = i;
+                }
+            }
+        }
+        if (-1 != id) {
+            memcpy(&defaultConfig->awt_visInfo, &visualList[id], sizeof(XVisualInfo));
+            defaultConfig->awt_depth = visualList[id].depth;
+            /* Allocate white and black pixels for this visual */
+            color.flags = DoRed | DoGreen | DoBlue;
+            color.red = color.green = color.blue = 0x0000;
+            XAllocColor(awt_display, defaultConfig->awt_cmap, &color);
+            x11Screens[visualList[id].screen].blackpixel = color.pixel;
+            color.flags = DoRed | DoGreen | DoBlue;
+            color.red = color.green = color.blue = 0xffff;
+            XAllocColor(awt_display, defaultConfig->awt_cmap, &color);
+            x11Screens[visualList[id].screen].whitepixel = color.pixel;
 
-                XFree(visualList);
-                return defaultConfig;
-            }
+            XFree(visualList);
+            return defaultConfig;
         }
         XFree(visualList);
         free((void *)defaultConfig);
--- a/src/java.desktop/unix/native/libawt_xawt/awt/awt_InputMethod.c	Thu Jan 31 15:20:42 2019 -0800
+++ b/src/java.desktop/unix/native/libawt_xawt/awt/awt_InputMethod.c	Fri Feb 01 15:34:53 2019 -0800
@@ -676,9 +676,10 @@
         return NULL;
     }
     statusWindow->w = status;
-    //12-point font
+    //12, 13-point fonts
     statusWindow->fontset = XCreateFontSet(dpy,
-                                           "-*-*-medium-r-normal-*-*-120-*-*-*-*",
+                                           "-*-*-medium-r-normal-*-*-120-*-*-*-*," \
+                                           "-*-*-medium-r-normal-*-*-130-*-*-*-*",
                                            &mclr, &mccr, &dsr);
     /* In case we didn't find the font set, release the list of missing characters */
     if (mccr > 0) {