From 7c16f691011deb0843ea8d7c8324aca034cbd56c Mon Sep 17 00:00:00 2001 From: Po Lu Date: Sun, 23 Jan 2022 09:14:16 +0800 Subject: [PATCH] Clean up some of the X extension related code * src/image.c (Fimage_transforms_p): Remove unused variables. * src/xterm.c (x_probe_xfixes_extension): (x_term_init): Probe for xfixes during terminal initialization instead. * src/xterm.h (struct x_display_info): New fields for xfixes support. --- src/image.c | 2 -- src/xterm.c | 22 ++++++++++++++++++++-- src/xterm.h | 6 ++++++ 3 files changed, 26 insertions(+), 4 deletions(-) diff --git a/src/image.c b/src/image.c index ce9af2dd677..7ee595297fa 100644 --- a/src/image.c +++ b/src/image.c @@ -11195,8 +11195,6 @@ The list of capabilities can include one or more of the following: || defined (HAVE_HAIKU) return list2 (Qscale, Qrotate90); # elif defined (HAVE_X_WINDOWS) && defined (HAVE_XRENDER) - int event_basep, error_basep; - if (FRAME_DISPLAY_INFO (f)->xrender_supported_p) return list2 (Qscale, Qrotate90); # elif defined (HAVE_NTGUI) diff --git a/src/xterm.c b/src/xterm.c index 36e0045d2ed..2a4ea883bc1 100644 --- a/src/xterm.c +++ b/src/xterm.c @@ -14920,8 +14920,12 @@ static bool x_probe_xfixes_extension (Display *dpy) { #ifdef HAVE_XFIXES - int major, minor; - return XFixesQueryVersion (dpy, &major, &minor) && major >= 4; + struct x_display_info *info + = x_display_info_for_display (dpy); + + return (info + && info->xfixes_supported_p + && info->xfixes_major >= 4); #else return false; #endif /* HAVE_XFIXES */ @@ -15431,6 +15435,20 @@ x_term_init (Lisp_Object display_name, char *xrm_option, char *resource_name) } #endif +#ifdef HAVE_XFIXES + int xfixes_event_base, xfixes_error_base; + dpyinfo->xfixes_supported_p + = XFixesQueryExtension (dpyinfo->display, &xfixes_event_base, + &xfixes_error_base); + + if (dpyinfo->xfixes_supported_p) + { + if (!XFixesQueryVersion (dpyinfo->display, &dpyinfo->xfixes_major, + &dpyinfo->xfixes_minor)) + dpyinfo->xfixes_supported_p = false; + } +#endif + #if defined USE_CAIRO || defined HAVE_XFT { /* If we are using Xft, the following precautions should be made: diff --git a/src/xterm.h b/src/xterm.h index 26b2851590d..a4ad57eddaa 100644 --- a/src/xterm.h +++ b/src/xterm.h @@ -546,6 +546,12 @@ struct x_display_info int xrender_major; int xrender_minor; #endif + +#ifdef HAVE_XFIXES + bool xfixes_supported_p; + int xfixes_major; + int xfixes_minor; +#endif }; #ifdef HAVE_X_I18N -- 2.39.5