From 0b3692251ce4767654aa57e1d7a9c151801414a6 Mon Sep 17 00:00:00 2001 From: Po Lu Date: Sun, 13 Feb 2022 11:00:52 +0800 Subject: [PATCH] Stop quering for Xinerama inside x_get_monitor_attributes * src/xfns.c (x_get_monitor_attributes): Remove Xinerama check and use xinerama_supported_p instead. * src/xterm.c (x_term_init): Set `xinerama_supported_p' * src/xterm.h (struct x_display_info): New field `xinerama_supported_p'. --- src/xfns.c | 5 +---- src/xterm.c | 11 +++++++++++ src/xterm.h | 4 ++++ 3 files changed, 16 insertions(+), 4 deletions(-) diff --git a/src/xfns.c b/src/xfns.c index 6d4a4f47cfc..94f215eaf8b 100644 --- a/src/xfns.c +++ b/src/xfns.c @@ -5720,10 +5720,7 @@ x_get_monitor_attributes (struct x_display_info *dpyinfo) #ifdef HAVE_XINERAMA if (NILP (attributes_list)) { - int xin_event_base, xin_error_base; - bool xin_ok = false; - xin_ok = XineramaQueryExtension (dpy, &xin_event_base, &xin_error_base); - if (xin_ok && XineramaIsActive (dpy)) + if (dpyinfo->xinerama_supported_p && XineramaIsActive (dpy)) attributes_list = x_get_monitor_attributes_xinerama (dpyinfo); } #endif /* HAVE_XINERAMA */ diff --git a/src/xterm.c b/src/xterm.c index e45d3e8f07a..50b7c9a6067 100644 --- a/src/xterm.c +++ b/src/xterm.c @@ -126,6 +126,10 @@ along with GNU Emacs. If not, see . */ #include #endif +#ifdef HAVE_XINERAMA +#include +#endif + /* Load sys/types.h if not already loaded. In some systems loading it twice is suicidal. */ #ifndef makedev @@ -15937,6 +15941,13 @@ x_term_init (Lisp_Object display_name, char *xrm_option, char *resource_name) dpyinfo->xsync_supported_p = false; } #endif + +#ifdef HAVE_XINERAMA + int xin_event_base, xin_error_base; + dpyinfo->xinerama_supported_p + = XineramaQueryExtension (dpy, &xin_event_base, &xin_error_base); +#endif + /* See if a private colormap is requested. */ if (dpyinfo->visual == DefaultVisualOfScreen (dpyinfo->screen)) { diff --git a/src/xterm.h b/src/xterm.h index 3a69c028797..99c86ced56c 100644 --- a/src/xterm.h +++ b/src/xterm.h @@ -579,6 +579,10 @@ struct x_display_info int xsync_major; int xsync_minor; #endif + +#ifdef HAVE_XINERAMA + bool xinerama_supported_p; +#endif }; #ifdef HAVE_X_I18N -- 2.39.5