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.
This commit is contained in:
Po Lu 2022-12-04 20:01:31 +08:00
parent be67cc276a
commit f96a9e10b1
3 changed files with 26 additions and 8 deletions

View file

@ -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

View file

@ -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

View file

@ -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