From ec403abc6078e2236762d85fe206703602014377 Mon Sep 17 00:00:00 2001 From: Po Lu Date: Tue, 25 Jan 2022 11:49:39 +0800 Subject: [PATCH] Improve portability of X11 IM code * configure.ac: Test for XICCallback.callback if X11R6 or later. * src/xfns.c (Xxic_preedit_start_callback): Use XICCallback if present. --- configure.ac | 1 + src/xfns.c | 9 +++++++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/configure.ac b/configure.ac index e5574b6b054..ae92b85be13 100644 --- a/configure.ac +++ b/configure.ac @@ -2639,6 +2639,7 @@ fail; AC_DEFINE(HAVE_X11R6, 1, [Define to 1 if you have the X11R6 or newer version of Xlib.]) AC_DEFINE(HAVE_X_I18N, 1, [Define if you have usable i18n support.]) + AC_CHECK_MEMBERS([XICCallback.callback], [], [], [#include ]) ## inoue@ainet.or.jp says Solaris has a bug related to X11R6-style ## XIM support. case "$opsys" in diff --git a/src/xfns.c b/src/xfns.c index bb1e431ff87..faab1b11582 100644 --- a/src/xfns.c +++ b/src/xfns.c @@ -2342,14 +2342,19 @@ static void xic_preedit_caret_callback (XIC, XPointer, XIMPreeditCaretCallbackSt static void xic_preedit_done_callback (XIC, XPointer, XPointer); static int xic_preedit_start_callback (XIC, XPointer, XPointer); +#ifndef HAVE_XICCALLBACK_CALLBACK +#define XICCallback XIMCallback +#define XICProc XIMProc +#endif + static XIMCallback Xxic_preedit_draw_callback = { NULL, (XIMProc) xic_preedit_draw_callback }; static XIMCallback Xxic_preedit_caret_callback = { NULL, (XIMProc) xic_preedit_caret_callback }; static XIMCallback Xxic_preedit_done_callback = { NULL, (XIMProc) xic_preedit_done_callback }; -static XIMCallback Xxic_preedit_start_callback = { NULL, - (void *) xic_preedit_start_callback }; +static XICCallback Xxic_preedit_start_callback = { NULL, + (XICProc) xic_preedit_start_callback }; #if defined HAVE_X_WINDOWS && defined USE_X_TOOLKIT /* Create an X fontset on frame F with base font name BASE_FONTNAME. */ -- 2.39.2