annotate src/input-method-xfs.c @ 165:5a88923fcbfe r20-3b9

Import from CVS: tag r20-3b9
author cvs
date Mon, 13 Aug 2007 09:44:42 +0200
parents b980b6286996
children 2d532a89d707
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
b980b6286996 Import from CVS: tag r20-2b2
cvs
parents:
diff changeset
28 #include <X11/Xlocale.h> /* More portable than <locale.h> ? */
b980b6286996 Import from CVS: tag r20-2b2
cvs
parents:
diff changeset
29 #include <config.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 __FreeBSD__
b980b6286996 Import from CVS: tag r20-2b2
cvs
parents:
diff changeset
40 #include <osreldate.h>
b980b6286996 Import from CVS: tag r20-2b2
cvs
parents:
diff changeset
41 #endif
b980b6286996 Import from CVS: tag r20-2b2
cvs
parents:
diff changeset
42
b980b6286996 Import from CVS: tag r20-2b2
cvs
parents:
diff changeset
43 #ifdef USE_XFONTSET
b980b6286996 Import from CVS: tag r20-2b2
cvs
parents:
diff changeset
44 void
b980b6286996 Import from CVS: tag r20-2b2
cvs
parents:
diff changeset
45 Initialize_Locale (void)
b980b6286996 Import from CVS: tag r20-2b2
cvs
parents:
diff changeset
46 {
b980b6286996 Import from CVS: tag r20-2b2
cvs
parents:
diff changeset
47 char *locale;
b980b6286996 Import from CVS: tag r20-2b2
cvs
parents:
diff changeset
48
b980b6286996 Import from CVS: tag r20-2b2
cvs
parents:
diff changeset
49 XtSetLanguageProc (NULL, (XtLanguageProc) NULL, NULL);
b980b6286996 Import from CVS: tag r20-2b2
cvs
parents:
diff changeset
50 #ifdef __FreeBSD_version
b980b6286996 Import from CVS: tag r20-2b2
cvs
parents:
diff changeset
51 # if __FreeBSD_version >= 199701 /* waiting FreeBSD supports all locale */
b980b6286996 Import from CVS: tag r20-2b2
cvs
parents:
diff changeset
52 if ((locale = setlocale(LC_CTYPE, "")) == NULL)
b980b6286996 Import from CVS: tag r20-2b2
cvs
parents:
diff changeset
53 # else
b980b6286996 Import from CVS: tag r20-2b2
cvs
parents:
diff changeset
54 if ((locale = setlocale (LC_ALL, "")) == NULL)
b980b6286996 Import from CVS: tag r20-2b2
cvs
parents:
diff changeset
55 # endif
b980b6286996 Import from CVS: tag r20-2b2
cvs
parents:
diff changeset
56 #else
b980b6286996 Import from CVS: tag r20-2b2
cvs
parents:
diff changeset
57 if ((locale = setlocale (LC_ALL, "")) == NULL)
b980b6286996 Import from CVS: tag r20-2b2
cvs
parents:
diff changeset
58 #endif
b980b6286996 Import from CVS: tag r20-2b2
cvs
parents:
diff changeset
59 {
b980b6286996 Import from CVS: tag r20-2b2
cvs
parents:
diff changeset
60 stderr_out ("Can't set locale.\n");
b980b6286996 Import from CVS: tag r20-2b2
cvs
parents:
diff changeset
61 stderr_out ("Using C locale instead.\n");
b980b6286996 Import from CVS: tag r20-2b2
cvs
parents:
diff changeset
62 putenv ("LANG=C");
b980b6286996 Import from CVS: tag r20-2b2
cvs
parents:
diff changeset
63 putenv ("LC_ALL=C");
b980b6286996 Import from CVS: tag r20-2b2
cvs
parents:
diff changeset
64 if ((locale = setlocale (LC_ALL, "C")) == NULL)
b980b6286996 Import from CVS: tag r20-2b2
cvs
parents:
diff changeset
65 {
b980b6286996 Import from CVS: tag r20-2b2
cvs
parents:
diff changeset
66 stderr_out ("Can't even set locale to `C'!\n");
b980b6286996 Import from CVS: tag r20-2b2
cvs
parents:
diff changeset
67 return;
b980b6286996 Import from CVS: tag r20-2b2
cvs
parents:
diff changeset
68 }
b980b6286996 Import from CVS: tag r20-2b2
cvs
parents:
diff changeset
69 }
b980b6286996 Import from CVS: tag r20-2b2
cvs
parents:
diff changeset
70
b980b6286996 Import from CVS: tag r20-2b2
cvs
parents:
diff changeset
71 if (!XSupportsLocale ())
b980b6286996 Import from CVS: tag r20-2b2
cvs
parents:
diff changeset
72 {
b980b6286996 Import from CVS: tag r20-2b2
cvs
parents:
diff changeset
73 stderr_out ("X Windows does not support locale `%s'\n", locale);
b980b6286996 Import from CVS: tag r20-2b2
cvs
parents:
diff changeset
74 stderr_out ("Using C Locale instead\n");
b980b6286996 Import from CVS: tag r20-2b2
cvs
parents:
diff changeset
75 putenv ("LANG=C");
b980b6286996 Import from CVS: tag r20-2b2
cvs
parents:
diff changeset
76 putenv ("LC_ALL=C");
b980b6286996 Import from CVS: tag r20-2b2
cvs
parents:
diff changeset
77 if ((locale = setlocale (LC_ALL, "C")) == NULL)
b980b6286996 Import from CVS: tag r20-2b2
cvs
parents:
diff changeset
78 {
b980b6286996 Import from CVS: tag r20-2b2
cvs
parents:
diff changeset
79 stderr_out ("Can't even set locale to `C'!\n");
b980b6286996 Import from CVS: tag r20-2b2
cvs
parents:
diff changeset
80 return;
b980b6286996 Import from CVS: tag r20-2b2
cvs
parents:
diff changeset
81 }
b980b6286996 Import from CVS: tag r20-2b2
cvs
parents:
diff changeset
82 if (!XSupportsLocale ())
b980b6286996 Import from CVS: tag r20-2b2
cvs
parents:
diff changeset
83 {
b980b6286996 Import from CVS: tag r20-2b2
cvs
parents:
diff changeset
84 stderr_out ("X Windows does not even support locale `C'!\n");
b980b6286996 Import from CVS: tag r20-2b2
cvs
parents:
diff changeset
85 return;
b980b6286996 Import from CVS: tag r20-2b2
cvs
parents:
diff changeset
86 }
b980b6286996 Import from CVS: tag r20-2b2
cvs
parents:
diff changeset
87 }
b980b6286996 Import from CVS: tag r20-2b2
cvs
parents:
diff changeset
88
b980b6286996 Import from CVS: tag r20-2b2
cvs
parents:
diff changeset
89 if (XSetLocaleModifiers ("") == NULL)
b980b6286996 Import from CVS: tag r20-2b2
cvs
parents:
diff changeset
90 {
b980b6286996 Import from CVS: tag r20-2b2
cvs
parents:
diff changeset
91 stderr_out ("XSetLocaleModifiers(\"\") failed\n");
b980b6286996 Import from CVS: tag r20-2b2
cvs
parents:
diff changeset
92 stderr_out ("Check the value of the XMODIFIERS environment variable.\n");
b980b6286996 Import from CVS: tag r20-2b2
cvs
parents:
diff changeset
93 }
b980b6286996 Import from CVS: tag r20-2b2
cvs
parents:
diff changeset
94 }
b980b6286996 Import from CVS: tag r20-2b2
cvs
parents:
diff changeset
95 #endif /* USE_XFONTSET */