This works properly on Solaris. Please submit patch if everybody is happy with it.
Thanks,
Petr
Kusanagi Kouichi wrote:
On Mon, Apr 14, 2008 at 06:36:44PM +0100, Robert Shearman wrote:
I think a configure check may be a more appropriate fix.
I don't know proper way to check whether XICCallback is defined. But this seems to work.
diff --git a/configure b/configure index b66a40a..01fdf19 100755 --- a/configure +++ b/configure @@ -10686,6 +10686,115 @@ esac fi
{ echo "$as_me:$LINENO: checking for XICCallback.callback" >&5
+echo $ECHO_N "checking for XICCallback.callback... $ECHO_C" >&6; } +if test "${ac_cv_member_XICCallback_callback+set}" = set; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
+else
- cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#ifdef HAVE_X11_XLIB_H +#include <X11/Xlib.h> +#endif
+int +main () +{ +static XICCallback ac_aggr; +if (ac_aggr.callback) +return 0;
- ;
- return 0;
+} +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in
- *"* | *`* | *\*) ac_try_echo=$ac_try;;
- *) ac_try_echo=$ac_try;;
+esac +eval "echo "$as_me:$LINENO: $ac_try_echo"") >&5
- (eval "$ac_compile") 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- echo "$as_me:$LINENO: $? = $ac_status" >&5
- (exit $ac_status); } && {
test -z "$ac_c_werror_flag" ||
test ! -s conftest.err
} && test -s conftest.$ac_objext; then
- ac_cv_member_XICCallback_callback=yes
+else
- echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
- cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#ifdef HAVE_X11_XLIB_H +#include <X11/Xlib.h> +#endif
+int +main () +{ +static XICCallback ac_aggr; +if (sizeof ac_aggr.callback) +return 0;
- ;
- return 0;
+} +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in
- *"* | *`* | *\*) ac_try_echo=$ac_try;;
- *) ac_try_echo=$ac_try;;
+esac +eval "echo "$as_me:$LINENO: $ac_try_echo"") >&5
- (eval "$ac_compile") 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- echo "$as_me:$LINENO: $? = $ac_status" >&5
- (exit $ac_status); } && {
test -z "$ac_c_werror_flag" ||
test ! -s conftest.err
} && test -s conftest.$ac_objext; then
- ac_cv_member_XICCallback_callback=yes
+else
- echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
- ac_cv_member_XICCallback_callback=no
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +{ echo "$as_me:$LINENO: result: $ac_cv_member_XICCallback_callback" >&5 +echo "${ECHO_T}$ac_cv_member_XICCallback_callback" >&6; } +if test $ac_cv_member_XICCallback_callback = yes; then
+cat >>confdefs.h <<_ACEOF +#define HAVE_XICCALLBACK_CALLBACK 1 +_ACEOF
+fi
opengl_msg=""
if test "x$with_opengl" != "xno"
diff --git a/configure.ac b/configure.ac index e9dadee..b5c4bf2 100644 --- a/configure.ac +++ b/configure.ac @@ -698,6 +698,12 @@ then WINE_NOTICE_WITH(xcomposite,[test "x$ac_cv_lib_soname_Xcomposite" = "x"], [libxcomposite development files not found, Xcomposite won't be supported.])
dnl *** Check for XICCallback struct
AC_CHECK_MEMBERS([XICCallback.callback],,,
+[#ifdef HAVE_X11_XLIB_H +#include <X11/Xlib.h> +#endif])
dnl *** End of X11/Xlib.h check
dnl Check for the presence of OpenGL
diff --git a/dlls/winex11.drv/xim.c b/dlls/winex11.drv/xim.c index d4df9f7..85d37e8 100644 --- a/dlls/winex11.drv/xim.c +++ b/dlls/winex11.drv/xim.c @@ -501,11 +501,13 @@ XIC X11DRV_CreateIC(XIM xim, struct x11drv_win_data *data) XVaNestedList preedit = NULL; XVaNestedList status = NULL; XIC xic;
- XICCallback destroy = {(XPointer)data, X11DRV_DestroyIC};
- XIMCallback P_StartCB;
- XIMCallback P_DoneCB;
- XIMCallback P_DrawCB;
- XIMCallback P_CaretCB;
+#ifdef HAVE_XICCALLBACK_CALLBACK
- XICCallback destroy = {(XPointer)data, (XICProc)X11DRV_DestroyIC};
- XICCallback P_StartCB, P_DoneCB, P_DrawCB, P_CaretCB;
+#else
- XIMCallback destroy = {(XPointer)data, (XIMProc)X11DRV_DestroyIC};
- XIMCallback P_StartCB, P_DoneCB, P_DrawCB, P_CaretCB;
+#endif LANGID langid = PRIMARYLANGID(LANGIDFROMLCID(GetThreadLocale())); Window win = data->whole_window;
@@ -531,13 +533,20 @@ XIC X11DRV_CreateIC(XIM xim, struct x11drv_win_data *data)
/* create callbacks */ P_StartCB.client_data = NULL;
- P_StartCB.callback = (XIMProc)XIMPreEditStartCallback; P_DoneCB.client_data = NULL;
- P_DoneCB.callback = (XIMProc)XIMPreEditDoneCallback; P_DrawCB.client_data = NULL;
- P_DrawCB.callback = (XIMProc)XIMPreEditDrawCallback; P_CaretCB.client_data = NULL;
+#ifdef HAVE_XICCALLBACK_CALLBACK
- P_StartCB.callback = (XICProc)XIMPreEditStartCallback;
- P_DoneCB.callback = (XICProc)XIMPreEditDoneCallback;
- P_DrawCB.callback = (XICProc)XIMPreEditDrawCallback;
- P_CaretCB.callback = (XICProc)XIMPreEditCaretCallback;
+#else
- P_StartCB.callback = (XIMProc)XIMPreEditStartCallback;
- P_DoneCB.callback = (XIMProc)XIMPreEditDoneCallback;
- P_DrawCB.callback = (XIMProc)XIMPreEditDrawCallback; P_CaretCB.callback = (XIMProc)XIMPreEditCaretCallback;
+#endif
if ((ximStyle & (XIMPreeditNothing | XIMPreeditNone)) == 0) {
diff --git a/include/config.h.in b/include/config.h.in index ac464db..f867662 100644 --- a/include/config.h.in +++ b/include/config.h.in @@ -945,6 +945,9 @@ /* Define to 1 if you have the <X11/Xutil.h> header file. */ #undef HAVE_X11_XUTIL_H
+/* Define to 1 if `callback' is member of `XICCallback'. */ +#undef HAVE_XICCALLBACK_CALLBACK
/* Define if you have the XKB extension */ #undef HAVE_XKB