diff options
| author | Dave Love | 2002-10-06 13:29:21 +0000 |
|---|---|---|
| committer | Dave Love | 2002-10-06 13:29:21 +0000 |
| commit | 2e801687ecd8ac6564b35738fbf6e35a77a8825c (patch) | |
| tree | a5fad2edaba62abd8429881e46bf8ca2719f10a9 /src | |
| parent | 75d0333328261e7e0e40d9cca0123b5d77cf02c0 (diff) | |
| download | emacs-2e801687ecd8ac6564b35738fbf6e35a77a8825c.tar.gz emacs-2e801687ecd8ac6564b35738fbf6e35a77a8825c.zip | |
(use_xim): Initialize.
(xim_open_dpy, xim_initialize, xim_close_dpy): Use use_xim.
(x_term_init): Maybe set use_xim.
Diffstat (limited to 'src')
| -rw-r--r-- | src/xterm.c | 112 |
1 files changed, 64 insertions, 48 deletions
diff --git a/src/xterm.c b/src/xterm.c index 2331cdcfdd2..07d14959f7f 100644 --- a/src/xterm.c +++ b/src/xterm.c | |||
| @@ -237,6 +237,8 @@ static unsigned char ov_bits[] = { | |||
| 237 | 237 | ||
| 238 | extern Lisp_Object Qhelp_echo; | 238 | extern Lisp_Object Qhelp_echo; |
| 239 | 239 | ||
| 240 | /* Default to using XIM if available. */ | ||
| 241 | int use_xim = 1; | ||
| 240 | 242 | ||
| 241 | /* Non-nil means Emacs uses toolkit scroll bars. */ | 243 | /* Non-nil means Emacs uses toolkit scroll bars. */ |
| 242 | 244 | ||
| @@ -12457,31 +12459,32 @@ xim_open_dpy (dpyinfo, resource_name) | |||
| 12457 | struct x_display_info *dpyinfo; | 12459 | struct x_display_info *dpyinfo; |
| 12458 | char *resource_name; | 12460 | char *resource_name; |
| 12459 | { | 12461 | { |
| 12460 | #ifdef USE_XIM | ||
| 12461 | XIM xim; | 12462 | XIM xim; |
| 12462 | 12463 | ||
| 12463 | xim = XOpenIM (dpyinfo->display, dpyinfo->xrdb, resource_name, EMACS_CLASS); | 12464 | if (use_xim) |
| 12464 | dpyinfo->xim = xim; | ||
| 12465 | |||
| 12466 | if (xim) | ||
| 12467 | { | 12465 | { |
| 12466 | xim = XOpenIM (dpyinfo->display, dpyinfo->xrdb, resource_name, | ||
| 12467 | EMACS_CLASS); | ||
| 12468 | dpyinfo->xim = xim; | ||
| 12469 | |||
| 12470 | if (xim) | ||
| 12471 | { | ||
| 12468 | #ifdef HAVE_X11R6 | 12472 | #ifdef HAVE_X11R6 |
| 12469 | XIMCallback destroy; | 12473 | XIMCallback destroy; |
| 12470 | #endif | 12474 | #endif |
| 12471 | 12475 | ||
| 12472 | /* Get supported styles and XIM values. */ | 12476 | /* Get supported styles and XIM values. */ |
| 12473 | XGetIMValues (xim, XNQueryInputStyle, &dpyinfo->xim_styles, NULL); | 12477 | XGetIMValues (xim, XNQueryInputStyle, &dpyinfo->xim_styles, NULL); |
| 12474 | 12478 | ||
| 12475 | #ifdef HAVE_X11R6 | 12479 | #ifdef HAVE_X11R6 |
| 12476 | destroy.callback = xim_destroy_callback; | 12480 | destroy.callback = xim_destroy_callback; |
| 12477 | destroy.client_data = (XPointer)dpyinfo; | 12481 | destroy.client_data = (XPointer)dpyinfo; |
| 12478 | XSetIMValues (xim, XNDestroyCallback, &destroy, NULL); | 12482 | XSetIMValues (xim, XNDestroyCallback, &destroy, NULL); |
| 12479 | #endif | 12483 | #endif |
| 12484 | } | ||
| 12480 | } | 12485 | } |
| 12481 | 12486 | else | |
| 12482 | #else /* not USE_XIM */ | 12487 | dpyinfo->xim = NULL; |
| 12483 | dpyinfo->xim = NULL; | ||
| 12484 | #endif /* not USE_XIM */ | ||
| 12485 | } | 12488 | } |
| 12486 | 12489 | ||
| 12487 | 12490 | ||
| @@ -12555,32 +12558,32 @@ xim_initialize (dpyinfo, resource_name) | |||
| 12555 | struct x_display_info *dpyinfo; | 12558 | struct x_display_info *dpyinfo; |
| 12556 | char *resource_name; | 12559 | char *resource_name; |
| 12557 | { | 12560 | { |
| 12558 | #ifdef USE_XIM | 12561 | if (use_xim) |
| 12562 | { | ||
| 12559 | #ifdef HAVE_X11R6_XIM | 12563 | #ifdef HAVE_X11R6_XIM |
| 12560 | struct xim_inst_t *xim_inst; | 12564 | struct xim_inst_t *xim_inst; |
| 12561 | int len; | 12565 | int len; |
| 12562 | 12566 | ||
| 12563 | dpyinfo->xim = NULL; | 12567 | dpyinfo->xim = NULL; |
| 12564 | xim_inst = (struct xim_inst_t *) xmalloc (sizeof (struct xim_inst_t)); | 12568 | xim_inst = (struct xim_inst_t *) xmalloc (sizeof (struct xim_inst_t)); |
| 12565 | xim_inst->dpyinfo = dpyinfo; | 12569 | xim_inst->dpyinfo = dpyinfo; |
| 12566 | len = strlen (resource_name); | 12570 | len = strlen (resource_name); |
| 12567 | xim_inst->resource_name = (char *) xmalloc (len + 1); | 12571 | xim_inst->resource_name = (char *) xmalloc (len + 1); |
| 12568 | bcopy (resource_name, xim_inst->resource_name, len + 1); | 12572 | bcopy (resource_name, xim_inst->resource_name, len + 1); |
| 12569 | XRegisterIMInstantiateCallback (dpyinfo->display, dpyinfo->xrdb, | 12573 | XRegisterIMInstantiateCallback (dpyinfo->display, dpyinfo->xrdb, |
| 12570 | resource_name, EMACS_CLASS, | 12574 | resource_name, EMACS_CLASS, |
| 12571 | xim_instantiate_callback, | 12575 | xim_instantiate_callback, |
| 12572 | /* Fixme: This is XPointer in | 12576 | /* Fixme: This is XPointer in |
| 12573 | XFree86 but (XPointer *) on | 12577 | XFree86 but (XPointer *) on |
| 12574 | Tru64, at least. */ | 12578 | Tru64, at least. */ |
| 12575 | (XPointer) xim_inst); | 12579 | (XPointer) xim_inst); |
| 12576 | #else /* not HAVE_X11R6_XIM */ | 12580 | #else /* not HAVE_X11R6_XIM */ |
| 12577 | dpyinfo->xim = NULL; | 12581 | dpyinfo->xim = NULL; |
| 12578 | xim_open_dpy (dpyinfo, resource_name); | 12582 | xim_open_dpy (dpyinfo, resource_name); |
| 12579 | #endif /* not HAVE_X11R6_XIM */ | 12583 | #endif /* not HAVE_X11R6_XIM */ |
| 12580 | 12584 | } | |
| 12581 | #else /* not USE_XIM */ | 12585 | else |
| 12582 | dpyinfo->xim = NULL; | 12586 | dpyinfo->xim = NULL; |
| 12583 | #endif /* not USE_XIM */ | ||
| 12584 | } | 12587 | } |
| 12585 | 12588 | ||
| 12586 | 12589 | ||
| @@ -12590,18 +12593,19 @@ static void | |||
| 12590 | xim_close_dpy (dpyinfo) | 12593 | xim_close_dpy (dpyinfo) |
| 12591 | struct x_display_info *dpyinfo; | 12594 | struct x_display_info *dpyinfo; |
| 12592 | { | 12595 | { |
| 12593 | #ifdef USE_XIM | 12596 | if (use_xim) |
| 12597 | { | ||
| 12594 | #ifdef HAVE_X11R6_XIM | 12598 | #ifdef HAVE_X11R6_XIM |
| 12595 | if (dpyinfo->display) | 12599 | if (dpyinfo->display) |
| 12596 | XUnregisterIMInstantiateCallback (dpyinfo->display, dpyinfo->xrdb, | 12600 | XUnregisterIMInstantiateCallback (dpyinfo->display, dpyinfo->xrdb, |
| 12597 | NULL, EMACS_CLASS, | 12601 | NULL, EMACS_CLASS, |
| 12598 | xim_instantiate_callback, NULL); | 12602 | xim_instantiate_callback, NULL); |
| 12599 | #endif /* not HAVE_X11R6_XIM */ | 12603 | #endif /* not HAVE_X11R6_XIM */ |
| 12600 | if (dpyinfo->display) | 12604 | if (dpyinfo->display) |
| 12601 | XCloseIM (dpyinfo->xim); | 12605 | XCloseIM (dpyinfo->xim); |
| 12602 | dpyinfo->xim = NULL; | 12606 | dpyinfo->xim = NULL; |
| 12603 | XFree (dpyinfo->xim_styles); | 12607 | XFree (dpyinfo->xim_styles); |
| 12604 | #endif /* USE_XIM */ | 12608 | } |
| 12605 | } | 12609 | } |
| 12606 | 12610 | ||
| 12607 | #endif /* not HAVE_X11R6_XIM */ | 12611 | #endif /* not HAVE_X11R6_XIM */ |
| @@ -15001,6 +15005,18 @@ x_term_init (display_name, xrm_option, resource_name) | |||
| 15001 | XSynchronize (dpyinfo->display, True); | 15005 | XSynchronize (dpyinfo->display, True); |
| 15002 | } | 15006 | } |
| 15003 | 15007 | ||
| 15008 | { | ||
| 15009 | Lisp_Object value; | ||
| 15010 | value = display_x_get_resource (dpyinfo, | ||
| 15011 | build_string ("useXIM"), | ||
| 15012 | build_string ("UseXIM"), | ||
| 15013 | Qnil, Qnil); | ||
| 15014 | if (STRINGP (value) | ||
| 15015 | && (!strcmp (XSTRING (value)->data, "false") | ||
| 15016 | || !strcmp (XSTRING (value)->data, "off"))) | ||
| 15017 | use_xim = 0; | ||
| 15018 | } | ||
| 15019 | |||
| 15004 | UNBLOCK_INPUT; | 15020 | UNBLOCK_INPUT; |
| 15005 | 15021 | ||
| 15006 | return dpyinfo; | 15022 | return dpyinfo; |