]> git.eshelyaron.com Git - emacs.git/commitdiff
Improve portability of X11 IM code
authorPo Lu <luangruo@yahoo.com>
Tue, 25 Jan 2022 03:49:39 +0000 (11:49 +0800)
committerPo Lu <luangruo@yahoo.com>
Tue, 25 Jan 2022 03:49:39 +0000 (11:49 +0800)
* configure.ac: Test for XICCallback.callback if X11R6 or later.
* src/xfns.c (Xxic_preedit_start_callback): Use XICCallback if
present.

configure.ac
src/xfns.c

index e5574b6b054afd912d60b31e920fd68242c93e62..ae92b85be134e878407c38a5f484e98f7ef44df7 100644 (file)
@@ -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 <X11/Xlib.h>])
     ## inoue@ainet.or.jp says Solaris has a bug related to X11R6-style
     ## XIM support.
     case "$opsys" in
index bb1e431ff87c53ec31fb915baed4be753c855c21..faab1b115824a566d9699ff921d0a700cd98ad13 100644 (file)
@@ -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.  */