emacs-diffs
[Top][All Lists]
Advanced

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

master f96a9e10b10: Make Emacs build with Xfixes support on old versions


From: Po Lu
Subject: master f96a9e10b10: Make Emacs build with Xfixes support on old versions of the library
Date: Sun, 4 Dec 2022 07:02:44 -0500 (EST)

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

    Make Emacs build with Xfixes support on old versions of the library
    
    * src/xterm.c (xfixes_toggle_visible_pointer):
    (x_toggle_visible_pointer):
    (XTtoggle_invisible_pointer, x_term_init): Disable code
    requiring fixes 4.0 or later when the fixes library is older.
    * src/xterm.h: Define missing types needed by other extensions
    when the fixes library is too old.
    * configure.ac: Allow building with any version of the Xfixes
    extension library.
---
 configure.ac |  2 +-
 src/xterm.c  | 14 ++++++++------
 src/xterm.h  | 18 +++++++++++++++++-
 3 files changed, 26 insertions(+), 8 deletions(-)

diff --git a/configure.ac b/configure.ac
index b5867cf839e..9f431fc78b2 100644
--- a/configure.ac
+++ b/configure.ac
@@ -4704,7 +4704,7 @@ AC_SUBST([XINERAMA_LIBS])
 ### Use Xfixes (-lXfixes) if available
 HAVE_XFIXES=no
 if test "${HAVE_X11}" = "yes"; then
-  XFIXES_REQUIRED=4.0.0
+  XFIXES_REQUIRED=1.0.0
   XFIXES_MODULES="xfixes >= $XFIXES_REQUIRED"
   EMACS_CHECK_MODULES([XFIXES], [$XFIXES_MODULES])
   if test $HAVE_XFIXES = no; then
diff --git a/src/xterm.c b/src/xterm.c
index 37b907ee9d2..d57830163cb 100644
--- a/src/xterm.c
+++ b/src/xterm.c
@@ -11578,7 +11578,7 @@ x_new_focus_frame (struct x_display_info *dpyinfo, 
struct frame *frame)
   x_frame_rehighlight (dpyinfo);
 }
 
-#ifdef HAVE_XFIXES
+#if defined HAVE_XFIXES && XFIXES_VERSION >= 40000
 
 /* True if the display in DPYINFO supports a version of Xfixes
    sufficient for pointer blanking.  */
@@ -11590,11 +11590,12 @@ x_fixes_pointer_blanking_supported (struct 
x_display_info *dpyinfo)
          && dpyinfo->xfixes_major >= 4);
 }
 
-#endif /* HAVE_XFIXES */
+#endif /* HAVE_XFIXES && XFIXES_VERSION >= 40000 */
 
 /* Toggle mouse pointer visibility on frame F using the XFixes
    extension.  */
-#ifdef HAVE_XFIXES
+#if defined HAVE_XFIXES && XFIXES_VERSION >= 40000
+
 static void
 xfixes_toggle_visible_pointer (struct frame *f, bool invisible)
 
@@ -11605,6 +11606,7 @@ xfixes_toggle_visible_pointer (struct frame *f, bool 
invisible)
     XFixesShowCursor (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f));
   f->pointer_invisible = invisible;
 }
+
 #endif /* HAVE_XFIXES */
 
 /* Create invisible cursor on the X display referred by DPYINFO.  */
@@ -11653,7 +11655,7 @@ x_toggle_visible_pointer (struct frame *f, bool 
invisible)
   if (dpyinfo->invisible_cursor == None)
     dpyinfo->invisible_cursor = make_invisible_cursor (dpyinfo);
 
-#ifndef HAVE_XFIXES
+#if !defined HAVE_XFIXES || XFIXES_VERSION < 40000
   if (dpyinfo->invisible_cursor == None)
     invisible = false;
 #else
@@ -11686,7 +11688,7 @@ static void
 XTtoggle_invisible_pointer (struct frame *f, bool invisible)
 {
   block_input ();
-#ifdef HAVE_XFIXES
+#if defined HAVE_XFIXES && XFIXES_VERSION >= 40000
   if (FRAME_DISPLAY_INFO (f)->fixes_pointer_blanking
       && x_fixes_pointer_blanking_supported (FRAME_DISPLAY_INFO (f)))
     xfixes_toggle_visible_pointer (f, invisible);
@@ -30327,7 +30329,7 @@ x_term_init (Lisp_Object display_name, char 
*xrm_option, char *resource_name)
                                   1, 0, 1);
 
   dpyinfo->invisible_cursor = make_invisible_cursor (dpyinfo);
-#ifdef HAVE_XFIXES
+#if defined HAVE_XFIXES && XFIXES_VERSION >= 40000
   dpyinfo->fixes_pointer_blanking = egetenv ("EMACS_XFIXES");
 #endif
 
diff --git a/src/xterm.h b/src/xterm.h
index 0b227cbdc09..fae40930e9b 100644
--- a/src/xterm.h
+++ b/src/xterm.h
@@ -21,6 +21,22 @@ along with GNU Emacs.  If not, see 
<https://www.gnu.org/licenses/>.  */
 #define XTERM_H
 
 #include <X11/Xlib.h>
+
+#ifdef HAVE_XFIXES
+#include <X11/extensions/Xfixes.h>
+
+#if defined HAVE_XINPUT2 && XFIXES_MAJOR < 5
+/* XI2 headers need PointerBarrier, which is not defined in old
+   versions of the fixes library.  Define that type here.  */
+typedef XID PointerBarrier;
+#endif
+#if defined HAVE_XCOMPOSITE && XFIXES_MAJOR < 2
+/* Recent Composite headers need XserverRegion, which is not defined
+   in old versions of the fixes library.  Define that type here.  */
+typedef XID XserverRegion;
+#endif
+#endif
+
 #include <X11/cursorfont.h>
 
 /* Include Xutil.h after keysym.h to work around a bug that prevents
@@ -406,7 +422,7 @@ struct x_display_info
      Unused if this display supports Xfixes extension.  */
   Cursor invisible_cursor;
 
-#ifdef HAVE_XFIXES
+#if defined HAVE_XFIXES && XFIXES_VERSION >= 40000
   /* Whether or not to use Xfixes for pointer blanking.  */
   bool fixes_pointer_blanking;
 #endif



reply via email to

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