summaryrefslogtreecommitdiff
path: root/src/gtkutil.c
diff options
context:
space:
mode:
authorPo Lu <luangruo@yahoo.com>2022-01-31 18:13:19 +0800
committerPo Lu <luangruo@yahoo.com>2022-01-31 18:13:19 +0800
commit5edef4e98ce638069e37984537a9c5e5c7750667 (patch)
treea689b9b3ca7c8a12f845711d59758b6111e283ef /src/gtkutil.c
parent1472b046eaeb8b2177341fb1c2b42bf5d1207ec7 (diff)
downloademacs-5edef4e98ce638069e37984537a9c5e5c7750667.tar.gz
Improve portability of GDK visual code
* src/gtkutil.c (xg_create_frame_widgets): Look up the visual instead of assuming it based on the depth.
Diffstat (limited to 'src/gtkutil.c')
-rw-r--r--src/gtkutil.c14
1 files changed, 8 insertions, 6 deletions
diff --git a/src/gtkutil.c b/src/gtkutil.c
index ea9c91d316b..b961cdedca9 100644
--- a/src/gtkutil.c
+++ b/src/gtkutil.c
@@ -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