1 | /*--------------------------------*-C-*---------------------------------* |
1 | /*--------------------------------*-C-*---------------------------------* |
2 | * File: main.c |
2 | * File: main.c |
3 | *----------------------------------------------------------------------* |
3 | *----------------------------------------------------------------------* |
4 | * $Id: main.C,v 1.13 2003/12/17 09:00:35 pcg Exp $ |
4 | * $Id: main.C,v 1.14 2003/12/18 00:29:29 pcg Exp $ |
5 | * |
5 | * |
6 | * All portions of code are copyright by their respective author/s. |
6 | * All portions of code are copyright by their respective author/s. |
7 | * Copyright (c) 1992 John Bovey, University of Kent at Canterbury <jdb@ukc.ac.uk> |
7 | * Copyright (c) 1992 John Bovey, University of Kent at Canterbury <jdb@ukc.ac.uk> |
8 | * - original version |
8 | * - original version |
9 | * Copyright (c) 1994 Robert Nation <nation@rocket.sanders.lockheed.com> |
9 | * Copyright (c) 1994 Robert Nation <nation@rocket.sanders.lockheed.com> |
… | |
… | |
77 | |
77 | |
78 | rxvt_term::~rxvt_term () |
78 | rxvt_term::~rxvt_term () |
79 | { |
79 | { |
80 | scr_release (); |
80 | scr_release (); |
81 | |
81 | |
|
|
82 | #if defined(HAVE_XSETLOCALE) || defined(HAVE_SETLOCALE) |
|
|
83 | free (locale); |
|
|
84 | #endif |
82 | #ifndef NO_SETOWNER_TTYDEV |
85 | #ifndef NO_SETOWNER_TTYDEV |
83 | rxvt_privileged_ttydev (this, RESTORE); |
86 | rxvt_privileged_ttydev (this, RESTORE); |
84 | #endif |
87 | #endif |
85 | #ifdef UTMP_SUPPORT |
88 | #ifdef UTMP_SUPPORT |
86 | rxvt_privileged_utmp (this, RESTORE); |
89 | rxvt_privileged_utmp (this, RESTORE); |
… | |
… | |
1131 | |
1134 | |
1132 | D_MAIN((stderr, "rxvt_IMInstantiateCallback()")); |
1135 | D_MAIN((stderr, "rxvt_IMInstantiateCallback()")); |
1133 | if (R->Input_Context) |
1136 | if (R->Input_Context) |
1134 | return; |
1137 | return; |
1135 | |
1138 | |
|
|
1139 | #if defined(HAVE_XSETLOCALE) || defined(HAVE_SETLOCALE) |
|
|
1140 | if (R->rs[Rs_imLocale]) |
|
|
1141 | setlocale (LC_CTYPE, R->rs[Rs_imLocale]); |
|
|
1142 | #endif |
|
|
1143 | |
1136 | p = R->rs[Rs_inputMethod]; |
1144 | p = R->rs[Rs_inputMethod]; |
1137 | if (p && *p) |
1145 | if (p && *p) |
1138 | { |
1146 | { |
1139 | bool found = false; |
1147 | bool found = false; |
1140 | |
1148 | |
… | |
… | |
1156 | for (i = 0; s[i]; i++) |
1164 | for (i = 0; s[i]; i++) |
1157 | free(s[i]); |
1165 | free(s[i]); |
1158 | free(s); |
1166 | free(s); |
1159 | |
1167 | |
1160 | if (found) |
1168 | if (found) |
1161 | return; |
1169 | goto done; |
1162 | } |
1170 | } |
1163 | |
1171 | |
1164 | /* try with XMODIFIERS env. var. */ |
1172 | /* try with XMODIFIERS env. var. */ |
1165 | if ((p = XSetLocaleModifiers ("")) && *p |
1173 | if ((p = XSetLocaleModifiers ("")) && *p |
1166 | && rxvt_IM_get_IC (aR)) |
1174 | && rxvt_IM_get_IC (aR)) |
1167 | return; |
1175 | goto done; |
1168 | |
1176 | |
1169 | /* try with no modifiers base IF the user didn't specify an IM */ |
1177 | /* try with no modifiers base IF the user didn't specify an IM */ |
1170 | if ((p = XSetLocaleModifiers ("@im=none")) && *p |
1178 | if ((p = XSetLocaleModifiers ("@im=none")) && *p |
1171 | && rxvt_IM_get_IC (aR) == True) |
1179 | && rxvt_IM_get_IC (aR) == True) |
1172 | return; |
1180 | goto done; |
|
|
1181 | |
|
|
1182 | done: |
|
|
1183 | #if defined(HAVE_XSETLOCALE) || defined(HAVE_SETLOCALE) |
|
|
1184 | if (R->rs[Rs_imLocale]) |
|
|
1185 | setlocale (LC_CTYPE, R->locale); |
|
|
1186 | #endif |
1173 | } |
1187 | } |
1174 | |
1188 | |
1175 | /* |
1189 | /* |
1176 | * Try to open a XIM with the current modifiers, then see if we can |
1190 | * Try to open a XIM with the current modifiers, then see if we can |
1177 | * open a suitable preedit type |
1191 | * open a suitable preedit type |