comparison src/input-method-xlib.c @ 771:943eaba38521

[xemacs-hg @ 2002-03-13 08:51:24 by ben] The big ben-mule-21-5 check-in! Various files were added and deleted. See CHANGES-ben-mule. There are still some test suite failures. No crashes, though. Many of the failures have to do with problems in the test suite itself rather than in the actual code. I'll be addressing these in the next day or so -- none of the test suite failures are at all critical. Meanwhile I'll be trying to address the biggest issues -- i.e. build or run failures, which will almost certainly happen on various platforms. All comments should be sent to ben@xemacs.org -- use a Cc: if necessary when sending to mailing lists. There will be pre- and post- tags, something like pre-ben-mule-21-5-merge-in, and post-ben-mule-21-5-merge-in.
author ben
date Wed, 13 Mar 2002 08:54:06 +0000
parents 183866b06e0b
children e38acbeb1cae
comparison
equal deleted inserted replaced
770:336a418893b5 771:943eaba38521
82 82
83 #if !defined (XIM_XLIB) && !defined (USE_XFONTSET) 83 #if !defined (XIM_XLIB) && !defined (USE_XFONTSET)
84 #error neither XIM_XLIB nor USE_XFONTSET is defined?? 84 #error neither XIM_XLIB nor USE_XFONTSET is defined??
85 #endif 85 #endif
86 86
87 Lisp_Object Qxim_xlib;
88 #define xim_warn(str) warn_when_safe (Qxim_xlib, Qwarning, str);
89 #define xim_warn1(fmt, str) warn_when_safe (Qxim_xlib, Qwarning, fmt, str);
90 #define xim_info(str) warn_when_safe (Qxim_xlib, Qinfo, str);
91
92 #ifdef XIM_XLIB /* XIM_XLIB specific */ 87 #ifdef XIM_XLIB /* XIM_XLIB specific */
88
93 /* Get/Set IC values for just one attribute */ 89 /* Get/Set IC values for just one attribute */
94 #ifdef DEBUG_XEMACS 90 #ifdef DEBUG_XEMACS
95 #define XIC_Value(Get_Set, xic, name, attr, value) \ 91 #define XIC_Value(Get_Set, xic, name, attr, value) \
96 do { \ 92 do { \
97 char *bad_arg; \ 93 char *bad_arg; \
119 "XIMPreeditNone|XIMStatusArea\n" 115 "XIMPreeditNone|XIMStatusArea\n"
120 "XIMPreeditNone|XIMStatusNothing\n" 116 "XIMPreeditNone|XIMStatusNothing\n"
121 "XIMPreeditNone|XIMStatusNone"; 117 "XIMPreeditNone|XIMStatusNone";
122 118
123 static XIMStyle best_style (XIMStyles *user, XIMStyles *xim); 119 static XIMStyle best_style (XIMStyles *user, XIMStyles *xim);
120
124 #endif /* XIM_XLIB only */ 121 #endif /* XIM_XLIB only */
125 122
126 /* This function is documented, but no prototype in the header files */ 123 /* This function is documented, but no prototype in the header files */
127 EXTERN_C char * XSetIMValues(XIM, ...); 124 EXTERN_C char * XSetIMValues(XIM, ...);
128
129 void
130 Initialize_Locale (void)
131 {
132 char *locale;
133
134 /* dverna - Nov. 98: #### DON'T DO THIS !!! The default XtLanguageProc
135 routine calls setlocale(LC_ALL, lang) which fucks up our lower-level
136 locale management, and especially the value of LC_NUMERIC. Anyway, since
137 at this point, we don't know yet whether we're gonna need an X11 frame,
138 we should really do it manually and not use Xlib's dumb default routine */
139 /*XtSetLanguageProc (NULL, (XtLanguageProc) NULL, NULL);*/
140 if ((locale = setlocale (LC_ALL, "")) == NULL)
141 {
142 xim_warn ("Can't set locale.\n"
143 "Using C locale instead.\n");
144 putenv ("LANG=C");
145 putenv ("LC_ALL=C");
146 if ((locale = setlocale (LC_ALL, "C")) == NULL)
147 {
148 xim_warn ("Can't even set locale to `C'!\n");
149 return;
150 }
151 }
152
153 if (!XSupportsLocale ())
154 {
155 xim_warn1 ("X Windows does not support locale `%s'\n"
156 "Using C Locale instead\n", locale);
157 putenv ("LANG=C");
158 putenv ("LC_ALL=C");
159 if ((locale = setlocale (LC_ALL, "C")) == NULL)
160 {
161 xim_warn ("Can't even set locale to `C'!\n");
162 return;
163 }
164 if (!XSupportsLocale ())
165 {
166 xim_warn ("X Windows does not even support locale `C'!\n");
167 return;
168 }
169 }
170
171 setlocale(LC_NUMERIC, "C");
172
173 if (XSetLocaleModifiers ("") == NULL)
174 {
175 xim_warn ("XSetLocaleModifiers(\"\") failed\n"
176 "Check the value of the XMODIFIERS environment variable.\n");
177 }
178 }
179 125
180 #ifdef XIM_XLIB /* starting XIM specific codes */ 126 #ifdef XIM_XLIB /* starting XIM specific codes */
181 127
182 /* Callbacks for IM are supported from X11R6 or later. */ 128 /* Callbacks for IM are supported from X11R6 or later. */
183 #ifdef HAVE_XREGISTERIMINSTANTIATECALLBACK 129 #ifdef HAVE_XREGISTERIMINSTANTIATECALLBACK
271 217
272 XtGetApplicationNameAndClass (dpy, &name, &class); 218 XtGetApplicationNameAndClass (dpy, &name, &class);
273 DEVICE_X_XIM (d) = xim = XOpenIM (dpy, XtDatabase (dpy), name, class); 219 DEVICE_X_XIM (d) = xim = XOpenIM (dpy, XtDatabase (dpy), name, class);
274 if (xim == NULL) 220 if (xim == NULL)
275 { 221 {
276 xim_warn ("XOpenIM() failed...no input server available\n"); 222 xintl_warn ("XOpenIM() failed...no input server available\n");
277 return; 223 return;
278 } 224 }
279 else 225 else
280 { 226 {
281 XGetIMValues (xim, XNQueryInputStyle, &DEVICE_X_XIM_STYLES (d), NULL); 227 XGetIMValues (xim, XNQueryInputStyle, &DEVICE_X_XIM_STYLES (d), NULL);
361 XtGetApplicationResources (w, &xic_vars, 307 XtGetApplicationResources (w, &xic_vars,
362 resources, XtNumber (resources), 308 resources, XtNumber (resources),
363 NULL, 0); 309 NULL, 0);
364 if (!xic_vars.fontset) 310 if (!xic_vars.fontset)
365 { 311 {
366 xim_warn ("Can't get fontset resource for Input Method\n"); 312 xintl_warn ("Can't get fontset resource for Input Method\n");
367 FRAME_X_XIC (f) = NULL; 313 FRAME_X_XIC (f) = NULL;
368 return; 314 return;
369 } 315 }
370 316
371 /* construct xic */ 317 /* construct xic */
399 XFree (p_list); 345 XFree (p_list);
400 XFree (s_list); 346 XFree (s_list);
401 347
402 if (!xic) 348 if (!xic)
403 { 349 {
404 xim_warn ("Warning: XCreateIC failed.\n"); 350 xintl_warn ("Warning: XCreateIC failed.\n");
405 return; 351 return;
406 } 352 }
407 353
408 if (style & XIMPreeditPosition) 354 if (style & XIMPreeditPosition)
409 { 355 {
848 #endif /* if 0 */ 794 #endif /* if 0 */
849 795
850 void 796 void
851 syms_of_input_method_xlib (void) 797 syms_of_input_method_xlib (void)
852 { 798 {
853 DEFSYMBOL (Qxim_xlib);
854 #if 0 /* see above */ 799 #if 0 /* see above */
855 DEFSUBR (Fx_open_xim); 800 DEFSUBR (Fx_open_xim);
856 DEFSUBR (Fx_close_xim); 801 DEFSUBR (Fx_close_xim);
857 #endif 802 #endif
858 } 803 }