annotate src/input-method-xfs.c @ 371:cc15677e0335 r21-2b1

Import from CVS: tag r21-2b1
author cvs
date Mon, 13 Aug 2007 11:03:08 +0200
parents 19dcec799385
children d883f39b8495
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
136
b980b6286996 Import from CVS: tag r20-2b2
cvs
parents:
diff changeset
1 /* input-method-xfs.c provides just only locale initialize
b980b6286996 Import from CVS: tag r20-2b2
cvs
parents:
diff changeset
2 for non Motif people. (stoled from input-method-xlib.c)
b980b6286996 Import from CVS: tag r20-2b2
cvs
parents:
diff changeset
3 Why I made this code is to initialize X locale environment for
b980b6286996 Import from CVS: tag r20-2b2
cvs
parents:
diff changeset
4 the purpose of use XFontSet correctly in lwlib/xlwmenu.c.
b980b6286996 Import from CVS: tag r20-2b2
cvs
parents:
diff changeset
5 And this code donot provides input methods under Xlib while they
b980b6286996 Import from CVS: tag r20-2b2
cvs
parents:
diff changeset
6 prefer to use Canna, Wnn, skk or something like that.
b980b6286996 Import from CVS: tag r20-2b2
cvs
parents:
diff changeset
7 This code has been tested on FreeBSD 2.2.1 and Solaris2.5.
b980b6286996 Import from CVS: tag r20-2b2
cvs
parents:
diff changeset
8
b980b6286996 Import from CVS: tag r20-2b2
cvs
parents:
diff changeset
9 Copyright (C) 1997 Kazuyuki IENAGA.
b980b6286996 Import from CVS: tag r20-2b2
cvs
parents:
diff changeset
10
b980b6286996 Import from CVS: tag r20-2b2
cvs
parents:
diff changeset
11 This file is a part of XEmacs.
b980b6286996 Import from CVS: tag r20-2b2
cvs
parents:
diff changeset
12
b980b6286996 Import from CVS: tag r20-2b2
cvs
parents:
diff changeset
13 XEmacs is free software; you can redistribute it and/or modify it
b980b6286996 Import from CVS: tag r20-2b2
cvs
parents:
diff changeset
14 under the terms of the GNU General Public License as published by the
b980b6286996 Import from CVS: tag r20-2b2
cvs
parents:
diff changeset
15 Free Software Foundation; either version 2, or (at your option) any
b980b6286996 Import from CVS: tag r20-2b2
cvs
parents:
diff changeset
16 later version.
b980b6286996 Import from CVS: tag r20-2b2
cvs
parents:
diff changeset
17
b980b6286996 Import from CVS: tag r20-2b2
cvs
parents:
diff changeset
18 XEmacs is distributed in the hope that it will be useful, but WITHOUT
b980b6286996 Import from CVS: tag r20-2b2
cvs
parents:
diff changeset
19 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
b980b6286996 Import from CVS: tag r20-2b2
cvs
parents:
diff changeset
20 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
b980b6286996 Import from CVS: tag r20-2b2
cvs
parents:
diff changeset
21 for more details.
b980b6286996 Import from CVS: tag r20-2b2
cvs
parents:
diff changeset
22
b980b6286996 Import from CVS: tag r20-2b2
cvs
parents:
diff changeset
23 You should have received a copy of the GNU General Public License
b980b6286996 Import from CVS: tag r20-2b2
cvs
parents:
diff changeset
24 along with XEmacs; see the file COPYING. If not, write to
b980b6286996 Import from CVS: tag r20-2b2
cvs
parents:
diff changeset
25 the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
b980b6286996 Import from CVS: tag r20-2b2
cvs
parents:
diff changeset
26 Boston, MA 02111-1307, USA. */
b980b6286996 Import from CVS: tag r20-2b2
cvs
parents:
diff changeset
27
207
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents: 175
diff changeset
28 #include <config.h>
136
b980b6286996 Import from CVS: tag r20-2b2
cvs
parents:
diff changeset
29 #include <X11/Xlocale.h> /* More portable than <locale.h> ? */
b980b6286996 Import from CVS: tag r20-2b2
cvs
parents:
diff changeset
30 #include "lisp.h"
b980b6286996 Import from CVS: tag r20-2b2
cvs
parents:
diff changeset
31 #include "frame.h"
b980b6286996 Import from CVS: tag r20-2b2
cvs
parents:
diff changeset
32 #include "device.h"
b980b6286996 Import from CVS: tag r20-2b2
cvs
parents:
diff changeset
33 #include "window.h"
b980b6286996 Import from CVS: tag r20-2b2
cvs
parents:
diff changeset
34 #include "buffer.h"
b980b6286996 Import from CVS: tag r20-2b2
cvs
parents:
diff changeset
35 #include "console-x.h"
b980b6286996 Import from CVS: tag r20-2b2
cvs
parents:
diff changeset
36 #include "EmacsFrame.h"
b980b6286996 Import from CVS: tag r20-2b2
cvs
parents:
diff changeset
37 #include "events.h"
b980b6286996 Import from CVS: tag r20-2b2
cvs
parents:
diff changeset
38
b980b6286996 Import from CVS: tag r20-2b2
cvs
parents:
diff changeset
39 #ifdef USE_XFONTSET
b980b6286996 Import from CVS: tag r20-2b2
cvs
parents:
diff changeset
40 void
b980b6286996 Import from CVS: tag r20-2b2
cvs
parents:
diff changeset
41 Initialize_Locale (void)
b980b6286996 Import from CVS: tag r20-2b2
cvs
parents:
diff changeset
42 {
b980b6286996 Import from CVS: tag r20-2b2
cvs
parents:
diff changeset
43 char *locale;
223
2c611d1463a6 Import from CVS: tag r20-4b10
cvs
parents: 207
diff changeset
44
371
cc15677e0335 Import from CVS: tag r21-2b1
cvs
parents: 321
diff changeset
45 XtSetLanguageProc (NULL, (XtLanguageProc) NULL, NULL);
136
b980b6286996 Import from CVS: tag r20-2b2
cvs
parents:
diff changeset
46 if ((locale = setlocale (LC_ALL, "")) == NULL)
b980b6286996 Import from CVS: tag r20-2b2
cvs
parents:
diff changeset
47 {
b980b6286996 Import from CVS: tag r20-2b2
cvs
parents:
diff changeset
48 stderr_out ("Can't set locale.\n");
b980b6286996 Import from CVS: tag r20-2b2
cvs
parents:
diff changeset
49 stderr_out ("Using C locale instead.\n");
b980b6286996 Import from CVS: tag r20-2b2
cvs
parents:
diff changeset
50 putenv ("LANG=C");
b980b6286996 Import from CVS: tag r20-2b2
cvs
parents:
diff changeset
51 putenv ("LC_ALL=C");
b980b6286996 Import from CVS: tag r20-2b2
cvs
parents:
diff changeset
52 if ((locale = setlocale (LC_ALL, "C")) == NULL)
b980b6286996 Import from CVS: tag r20-2b2
cvs
parents:
diff changeset
53 {
b980b6286996 Import from CVS: tag r20-2b2
cvs
parents:
diff changeset
54 stderr_out ("Can't even set locale to `C'!\n");
b980b6286996 Import from CVS: tag r20-2b2
cvs
parents:
diff changeset
55 return;
b980b6286996 Import from CVS: tag r20-2b2
cvs
parents:
diff changeset
56 }
b980b6286996 Import from CVS: tag r20-2b2
cvs
parents:
diff changeset
57 }
b980b6286996 Import from CVS: tag r20-2b2
cvs
parents:
diff changeset
58
b980b6286996 Import from CVS: tag r20-2b2
cvs
parents:
diff changeset
59 if (!XSupportsLocale ())
b980b6286996 Import from CVS: tag r20-2b2
cvs
parents:
diff changeset
60 {
b980b6286996 Import from CVS: tag r20-2b2
cvs
parents:
diff changeset
61 stderr_out ("X Windows does not support locale `%s'\n", locale);
b980b6286996 Import from CVS: tag r20-2b2
cvs
parents:
diff changeset
62 stderr_out ("Using C Locale instead\n");
b980b6286996 Import from CVS: tag r20-2b2
cvs
parents:
diff changeset
63 putenv ("LANG=C");
b980b6286996 Import from CVS: tag r20-2b2
cvs
parents:
diff changeset
64 putenv ("LC_ALL=C");
b980b6286996 Import from CVS: tag r20-2b2
cvs
parents:
diff changeset
65 if ((locale = setlocale (LC_ALL, "C")) == NULL)
b980b6286996 Import from CVS: tag r20-2b2
cvs
parents:
diff changeset
66 {
b980b6286996 Import from CVS: tag r20-2b2
cvs
parents:
diff changeset
67 stderr_out ("Can't even set locale to `C'!\n");
b980b6286996 Import from CVS: tag r20-2b2
cvs
parents:
diff changeset
68 return;
b980b6286996 Import from CVS: tag r20-2b2
cvs
parents:
diff changeset
69 }
b980b6286996 Import from CVS: tag r20-2b2
cvs
parents:
diff changeset
70 if (!XSupportsLocale ())
b980b6286996 Import from CVS: tag r20-2b2
cvs
parents:
diff changeset
71 {
b980b6286996 Import from CVS: tag r20-2b2
cvs
parents:
diff changeset
72 stderr_out ("X Windows does not even support locale `C'!\n");
b980b6286996 Import from CVS: tag r20-2b2
cvs
parents:
diff changeset
73 return;
b980b6286996 Import from CVS: tag r20-2b2
cvs
parents:
diff changeset
74 }
b980b6286996 Import from CVS: tag r20-2b2
cvs
parents:
diff changeset
75 }
223
2c611d1463a6 Import from CVS: tag r20-4b10
cvs
parents: 207
diff changeset
76
2c611d1463a6 Import from CVS: tag r20-4b10
cvs
parents: 207
diff changeset
77 setlocale(LC_NUMERIC, "C");
257
65c19d2020f7 Import from CVS: tag r20-5b27
cvs
parents: 223
diff changeset
78 setlocale(LC_CTYPE, ""); /* take back CTYPE to previous state */
136
b980b6286996 Import from CVS: tag r20-2b2
cvs
parents:
diff changeset
79
b980b6286996 Import from CVS: tag r20-2b2
cvs
parents:
diff changeset
80 if (XSetLocaleModifiers ("") == NULL)
b980b6286996 Import from CVS: tag r20-2b2
cvs
parents:
diff changeset
81 {
b980b6286996 Import from CVS: tag r20-2b2
cvs
parents:
diff changeset
82 stderr_out ("XSetLocaleModifiers(\"\") failed\n");
b980b6286996 Import from CVS: tag r20-2b2
cvs
parents:
diff changeset
83 stderr_out ("Check the value of the XMODIFIERS environment variable.\n");
b980b6286996 Import from CVS: tag r20-2b2
cvs
parents:
diff changeset
84 }
b980b6286996 Import from CVS: tag r20-2b2
cvs
parents:
diff changeset
85 }
b980b6286996 Import from CVS: tag r20-2b2
cvs
parents:
diff changeset
86 #endif /* USE_XFONTSET */