]> git.eshelyaron.com Git - emacs.git/commitdiff
Improve portability of GDK visual code
authorPo Lu <luangruo@yahoo.com>
Mon, 31 Jan 2022 10:13:19 +0000 (18:13 +0800)
committerPo Lu <luangruo@yahoo.com>
Mon, 31 Jan 2022 10:13:19 +0000 (18:13 +0800)
* src/gtkutil.c (xg_create_frame_widgets): Look up the visual
instead of assuming it based on the depth.

src/gtkutil.c

index ea9c91d316bc0bad414f1606ebc8841e24089047..b961cdedca96cb46833bdb94ac5c0ca9a05d5833 100644 (file)
@@ -1601,12 +1601,14 @@ xg_create_frame_widgets (struct frame *f)
   GdkScreen *screen = gtk_widget_get_screen (wtop);
 
 #if !defined HAVE_PGTK
-  if (FRAME_DISPLAY_INFO (f)->n_planes == 32)
-    {
-      GdkVisual *visual = gdk_screen_get_rgba_visual (screen);
-      gtk_widget_set_visual (wtop, visual);
-      gtk_widget_set_visual (wfixed, visual);
-    }
+  GdkVisual *visual = gdk_x11_screen_lookup_visual (screen,
+                                                   XVisualIDFromVisual (FRAME_X_VISUAL (f)));
+
+  if (!visual)
+    emacs_abort ();
+
+  gtk_widget_set_visual (wtop, visual);
+  gtk_widget_set_visual (wfixed, visual);
 #endif
 
 #ifndef HAVE_PGTK