aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorPo Lu2022-12-04 20:01:31 +0800
committerPo Lu2022-12-04 20:02:32 +0800
commitf96a9e10b108237e4aa192eca962ceb0ca07e431 (patch)
tree202bbdb3f6dc79f100cae61cd97b65f698aa5321 /src
parentbe67cc276a95a97a329fa633fef686ba06c8e6d2 (diff)
downloademacs-f96a9e10b108237e4aa192eca962ceb0ca07e431.tar.gz
emacs-f96a9e10b108237e4aa192eca962ceb0ca07e431.zip
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.
Diffstat (limited to 'src')
-rw-r--r--src/xterm.c14
-rw-r--r--src/xterm.h18
2 files changed, 25 insertions, 7 deletions
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)
11578 x_frame_rehighlight (dpyinfo); 11578 x_frame_rehighlight (dpyinfo);
11579} 11579}
11580 11580
11581#ifdef HAVE_XFIXES 11581#if defined HAVE_XFIXES && XFIXES_VERSION >= 40000
11582 11582
11583/* True if the display in DPYINFO supports a version of Xfixes 11583/* True if the display in DPYINFO supports a version of Xfixes
11584 sufficient for pointer blanking. */ 11584 sufficient for pointer blanking. */
@@ -11590,11 +11590,12 @@ x_fixes_pointer_blanking_supported (struct x_display_info *dpyinfo)
11590 && dpyinfo->xfixes_major >= 4); 11590 && dpyinfo->xfixes_major >= 4);
11591} 11591}
11592 11592
11593#endif /* HAVE_XFIXES */ 11593#endif /* HAVE_XFIXES && XFIXES_VERSION >= 40000 */
11594 11594
11595/* Toggle mouse pointer visibility on frame F using the XFixes 11595/* Toggle mouse pointer visibility on frame F using the XFixes
11596 extension. */ 11596 extension. */
11597#ifdef HAVE_XFIXES 11597#if defined HAVE_XFIXES && XFIXES_VERSION >= 40000
11598
11598static void 11599static void
11599xfixes_toggle_visible_pointer (struct frame *f, bool invisible) 11600xfixes_toggle_visible_pointer (struct frame *f, bool invisible)
11600 11601
@@ -11605,6 +11606,7 @@ xfixes_toggle_visible_pointer (struct frame *f, bool invisible)
11605 XFixesShowCursor (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f)); 11606 XFixesShowCursor (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f));
11606 f->pointer_invisible = invisible; 11607 f->pointer_invisible = invisible;
11607} 11608}
11609
11608#endif /* HAVE_XFIXES */ 11610#endif /* HAVE_XFIXES */
11609 11611
11610/* Create invisible cursor on the X display referred by DPYINFO. */ 11612/* Create invisible cursor on the X display referred by DPYINFO. */
@@ -11653,7 +11655,7 @@ x_toggle_visible_pointer (struct frame *f, bool invisible)
11653 if (dpyinfo->invisible_cursor == None) 11655 if (dpyinfo->invisible_cursor == None)
11654 dpyinfo->invisible_cursor = make_invisible_cursor (dpyinfo); 11656 dpyinfo->invisible_cursor = make_invisible_cursor (dpyinfo);
11655 11657
11656#ifndef HAVE_XFIXES 11658#if !defined HAVE_XFIXES || XFIXES_VERSION < 40000
11657 if (dpyinfo->invisible_cursor == None) 11659 if (dpyinfo->invisible_cursor == None)
11658 invisible = false; 11660 invisible = false;
11659#else 11661#else
@@ -11686,7 +11688,7 @@ static void
11686XTtoggle_invisible_pointer (struct frame *f, bool invisible) 11688XTtoggle_invisible_pointer (struct frame *f, bool invisible)
11687{ 11689{
11688 block_input (); 11690 block_input ();
11689#ifdef HAVE_XFIXES 11691#if defined HAVE_XFIXES && XFIXES_VERSION >= 40000
11690 if (FRAME_DISPLAY_INFO (f)->fixes_pointer_blanking 11692 if (FRAME_DISPLAY_INFO (f)->fixes_pointer_blanking
11691 && x_fixes_pointer_blanking_supported (FRAME_DISPLAY_INFO (f))) 11693 && x_fixes_pointer_blanking_supported (FRAME_DISPLAY_INFO (f)))
11692 xfixes_toggle_visible_pointer (f, invisible); 11694 xfixes_toggle_visible_pointer (f, invisible);
@@ -30327,7 +30329,7 @@ x_term_init (Lisp_Object display_name, char *xrm_option, char *resource_name)
30327 1, 0, 1); 30329 1, 0, 1);
30328 30330
30329 dpyinfo->invisible_cursor = make_invisible_cursor (dpyinfo); 30331 dpyinfo->invisible_cursor = make_invisible_cursor (dpyinfo);
30330#ifdef HAVE_XFIXES 30332#if defined HAVE_XFIXES && XFIXES_VERSION >= 40000
30331 dpyinfo->fixes_pointer_blanking = egetenv ("EMACS_XFIXES"); 30333 dpyinfo->fixes_pointer_blanking = egetenv ("EMACS_XFIXES");
30332#endif 30334#endif
30333 30335
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/>. */
21#define XTERM_H 21#define XTERM_H
22 22
23#include <X11/Xlib.h> 23#include <X11/Xlib.h>
24
25#ifdef HAVE_XFIXES
26#include <X11/extensions/Xfixes.h>
27
28#if defined HAVE_XINPUT2 && XFIXES_MAJOR < 5
29/* XI2 headers need PointerBarrier, which is not defined in old
30 versions of the fixes library. Define that type here. */
31typedef XID PointerBarrier;
32#endif
33#if defined HAVE_XCOMPOSITE && XFIXES_MAJOR < 2
34/* Recent Composite headers need XserverRegion, which is not defined
35 in old versions of the fixes library. Define that type here. */
36typedef XID XserverRegion;
37#endif
38#endif
39
24#include <X11/cursorfont.h> 40#include <X11/cursorfont.h>
25 41
26/* Include Xutil.h after keysym.h to work around a bug that prevents 42/* Include Xutil.h after keysym.h to work around a bug that prevents
@@ -406,7 +422,7 @@ struct x_display_info
406 Unused if this display supports Xfixes extension. */ 422 Unused if this display supports Xfixes extension. */
407 Cursor invisible_cursor; 423 Cursor invisible_cursor;
408 424
409#ifdef HAVE_XFIXES 425#if defined HAVE_XFIXES && XFIXES_VERSION >= 40000
410 /* Whether or not to use Xfixes for pointer blanking. */ 426 /* Whether or not to use Xfixes for pointer blanking. */
411 bool fixes_pointer_blanking; 427 bool fixes_pointer_blanking;
412#endif 428#endif