]> git.eshelyaron.com Git - emacs.git/commitdiff
Fix some problems with inconsistent visuals on GDK
authorPo Lu <luangruo@yahoo.com>
Sun, 30 Jan 2022 06:02:40 +0000 (14:02 +0800)
committerPo Lu <luangruo@yahoo.com>
Sun, 30 Jan 2022 06:04:12 +0000 (14:04 +0800)
* src/xterm.c (x_xr_ensure_picture): Use the visual GDK used
instead of our own.

src/xterm.c

index 209e99fc09c6e467ec1853e7103894abfba5ff18..0ecebfb4205d6a042dd8038e2eb7710530eef561 100644 (file)
@@ -382,11 +382,22 @@ x_xr_ensure_picture (struct frame *f)
     {
       XRenderPictureAttributes attrs;
       attrs.clip_mask = None;
+      XRenderPictFormat *fmt;
+
+#ifdef USE_GTK
+      GdkWindow *wnd = gtk_widget_get_window (FRAME_GTK_OUTER_WIDGET (f));
+      GdkVisual *visual = gdk_window_get_visual (wnd);
+      Visual *xvisual = gdk_x11_visual_get_xvisual (visual);
+
+      fmt = XRenderFindVisualFormat (FRAME_X_DISPLAY (f), xvisual);
+
+      if (!fmt)
+#endif
+       fmt = FRAME_X_PICTURE_FORMAT (f);
 
       FRAME_X_PICTURE (f) = XRenderCreatePicture (FRAME_X_DISPLAY (f),
                                                  FRAME_X_RAW_DRAWABLE (f),
-                                                 FRAME_X_PICTURE_FORMAT (f),
-                                                 CPClipMask, &attrs);
+                                                 fmt, CPClipMask, &attrs);
     }
 }
 #endif