emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

master 0b3692251c: Stop quering for Xinerama inside x_get_monitor_attrib


From: Po Lu
Subject: master 0b3692251c: Stop quering for Xinerama inside x_get_monitor_attributes
Date: Sat, 12 Feb 2022 22:04:44 -0500 (EST)

branch: master
commit 0b3692251ce4767654aa57e1d7a9c151801414a6
Author: Po Lu <luangruo@yahoo.com>
Commit: Po Lu <luangruo@yahoo.com>

    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 6d4a4f47cf..94f215eaf8 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 e45d3e8f07..50b7c9a606 100644
--- a/src/xterm.c
+++ b/src/xterm.c
@@ -126,6 +126,10 @@ along with GNU Emacs.  If not, see 
<https://www.gnu.org/licenses/>.  */
 #include <X11/extensions/sync.h>
 #endif
 
+#ifdef HAVE_XINERAMA
+#include <X11/extensions/Xinerama.h>
+#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 3a69c02879..99c86ced56 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



reply via email to

[Prev in Thread] Current Thread [Next in Thread]