Mercurial > emacs
changeset 89160:5b452d9d5875
(use_xim): Initialize.
(xim_open_dpy, xim_initialize, xim_close_dpy): Use use_xim.
(x_term_init): Maybe set use_xim.
author | Dave Love <fx@gnu.org> |
---|---|
date | Sun, 06 Oct 2002 13:29:21 +0000 |
parents | bb4e004f868f |
children | dc16da3f414d |
files | src/xterm.c |
diffstat | 1 files changed, 69 insertions(+), 53 deletions(-) [+] |
line wrap: on
line diff
--- a/src/xterm.c Sat Oct 05 23:19:04 2002 +0000 +++ b/src/xterm.c Sun Oct 06 13:29:21 2002 +0000 @@ -237,6 +237,8 @@ extern Lisp_Object Qhelp_echo; +/* Default to using XIM if available. */ +int use_xim = 1; /* Non-nil means Emacs uses toolkit scroll bars. */ @@ -12457,31 +12459,32 @@ struct x_display_info *dpyinfo; char *resource_name; { -#ifdef USE_XIM XIM xim; - xim = XOpenIM (dpyinfo->display, dpyinfo->xrdb, resource_name, EMACS_CLASS); - dpyinfo->xim = xim; - - if (xim) - { + if (use_xim) + { + xim = XOpenIM (dpyinfo->display, dpyinfo->xrdb, resource_name, + EMACS_CLASS); + dpyinfo->xim = xim; + + if (xim) + { #ifdef HAVE_X11R6 - XIMCallback destroy; -#endif - - /* Get supported styles and XIM values. */ - XGetIMValues (xim, XNQueryInputStyle, &dpyinfo->xim_styles, NULL); + XIMCallback destroy; +#endif + + /* Get supported styles and XIM values. */ + XGetIMValues (xim, XNQueryInputStyle, &dpyinfo->xim_styles, NULL); #ifdef HAVE_X11R6 - destroy.callback = xim_destroy_callback; - destroy.client_data = (XPointer)dpyinfo; - XSetIMValues (xim, XNDestroyCallback, &destroy, NULL); -#endif - } - -#else /* not USE_XIM */ - dpyinfo->xim = NULL; -#endif /* not USE_XIM */ + destroy.callback = xim_destroy_callback; + destroy.client_data = (XPointer)dpyinfo; + XSetIMValues (xim, XNDestroyCallback, &destroy, NULL); +#endif + } + } + else + dpyinfo->xim = NULL; } @@ -12555,32 +12558,32 @@ struct x_display_info *dpyinfo; char *resource_name; { -#ifdef USE_XIM + if (use_xim) + { #ifdef HAVE_X11R6_XIM - struct xim_inst_t *xim_inst; - int len; - - dpyinfo->xim = NULL; - xim_inst = (struct xim_inst_t *) xmalloc (sizeof (struct xim_inst_t)); - xim_inst->dpyinfo = dpyinfo; - len = strlen (resource_name); - xim_inst->resource_name = (char *) xmalloc (len + 1); - bcopy (resource_name, xim_inst->resource_name, len + 1); - XRegisterIMInstantiateCallback (dpyinfo->display, dpyinfo->xrdb, - resource_name, EMACS_CLASS, - xim_instantiate_callback, - /* Fixme: This is XPointer in - XFree86 but (XPointer *) on - Tru64, at least. */ - (XPointer) xim_inst); + struct xim_inst_t *xim_inst; + int len; + + dpyinfo->xim = NULL; + xim_inst = (struct xim_inst_t *) xmalloc (sizeof (struct xim_inst_t)); + xim_inst->dpyinfo = dpyinfo; + len = strlen (resource_name); + xim_inst->resource_name = (char *) xmalloc (len + 1); + bcopy (resource_name, xim_inst->resource_name, len + 1); + XRegisterIMInstantiateCallback (dpyinfo->display, dpyinfo->xrdb, + resource_name, EMACS_CLASS, + xim_instantiate_callback, + /* Fixme: This is XPointer in + XFree86 but (XPointer *) on + Tru64, at least. */ + (XPointer) xim_inst); #else /* not HAVE_X11R6_XIM */ - dpyinfo->xim = NULL; - xim_open_dpy (dpyinfo, resource_name); + dpyinfo->xim = NULL; + xim_open_dpy (dpyinfo, resource_name); #endif /* not HAVE_X11R6_XIM */ - -#else /* not USE_XIM */ - dpyinfo->xim = NULL; -#endif /* not USE_XIM */ + } + else + dpyinfo->xim = NULL; } @@ -12590,18 +12593,19 @@ xim_close_dpy (dpyinfo) struct x_display_info *dpyinfo; { -#ifdef USE_XIM + if (use_xim) + { #ifdef HAVE_X11R6_XIM - if (dpyinfo->display) - XUnregisterIMInstantiateCallback (dpyinfo->display, dpyinfo->xrdb, - NULL, EMACS_CLASS, - xim_instantiate_callback, NULL); + if (dpyinfo->display) + XUnregisterIMInstantiateCallback (dpyinfo->display, dpyinfo->xrdb, + NULL, EMACS_CLASS, + xim_instantiate_callback, NULL); #endif /* not HAVE_X11R6_XIM */ - if (dpyinfo->display) - XCloseIM (dpyinfo->xim); - dpyinfo->xim = NULL; - XFree (dpyinfo->xim_styles); -#endif /* USE_XIM */ + if (dpyinfo->display) + XCloseIM (dpyinfo->xim); + dpyinfo->xim = NULL; + XFree (dpyinfo->xim_styles); + } } #endif /* not HAVE_X11R6_XIM */ @@ -15001,6 +15005,18 @@ XSynchronize (dpyinfo->display, True); } + { + Lisp_Object value; + value = display_x_get_resource (dpyinfo, + build_string ("useXIM"), + build_string ("UseXIM"), + Qnil, Qnil); + if (STRINGP (value) + && (!strcmp (XSTRING (value)->data, "false") + || !strcmp (XSTRING (value)->data, "off"))) + use_xim = 0; + } + UNBLOCK_INPUT; return dpyinfo;