From: Po Lu Date: Sat, 25 Dec 2021 12:09:37 +0000 (+0800) Subject: Add a utility function to query the XI2 version on a display X-Git-Tag: emacs-29.0.90~3461 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=e0a78429cab632ae269e1845c588506e64e09654;p=emacs.git Add a utility function to query the XI2 version on a display * src/xfns.c (Fx_server_input_version): New function. (syms_of_xfns): Define new subr. --- diff --git a/src/xfns.c b/src/xfns.c index b02996c0d3c..f911f9898a5 100644 --- a/src/xfns.c +++ b/src/xfns.c @@ -4506,6 +4506,27 @@ If omitted or nil, that stands for the selected frame's display. */) VendorRelease (dpy)); } +DEFUN ("x-server-input-version", Fx_server_input_version, + Sx_server_input_version, 0, 1, 0, + doc: /* Return the version of the X Input Extension supported by TERMINAL. +The value is nil if TERMINAL's X server doesn't support the X Input +Extension extension, or if Emacs doesn't support the version present +on that server. Otherwise, the return value is a list of the the +major and minor versions of the X Input Extension extension running on +that server. */) + (Lisp_Object terminal) +{ + struct x_display_info *dpyinfo = check_x_display_info (terminal); + +#ifdef HAVE_XINPUT2 + return (dpyinfo->supports_xi2 + ? list2i (2, dpyinfo->xi2_version) + : Qnil); +#else + return Qnil; +#endif +} + DEFUN ("x-display-screens", Fx_display_screens, Sx_display_screens, 0, 1, 0, doc: /* Return the number of screens on the X server of display TERMINAL. The optional argument TERMINAL specifies which display to ask about. @@ -8193,6 +8214,7 @@ eliminated in future versions of Emacs. */); defsubr (&Sx_server_max_request_size); defsubr (&Sx_server_vendor); defsubr (&Sx_server_version); + defsubr (&Sx_server_input_version); defsubr (&Sx_display_pixel_width); defsubr (&Sx_display_pixel_height); defsubr (&Sx_display_mm_width);