comparison src/input-method-xfs.c @ 136:b980b6286996 r20-2b2

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