1 | /*--------------------------------*-C-*---------------------------------* |
1 | /*--------------------------------*-C-*---------------------------------* |
2 | * File: main.c |
2 | * File: main.c |
3 | *----------------------------------------------------------------------* |
3 | *----------------------------------------------------------------------* |
4 | * $Id: main.C,v 1.12 2003/12/16 23:04:13 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> |
… | |
… | |
75 | cmdbuf_ptr = cmdbuf_endp = cmdbuf_base; |
75 | cmdbuf_ptr = cmdbuf_endp = cmdbuf_base; |
76 | } |
76 | } |
77 | |
77 | |
78 | rxvt_term::~rxvt_term () |
78 | rxvt_term::~rxvt_term () |
79 | { |
79 | { |
80 | rxvt_scr_release (this); |
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); |
… | |
… | |
203 | |
206 | |
204 | rxvt_Create_Windows (this, argc, argv); |
207 | rxvt_Create_Windows (this, argc, argv); |
205 | |
208 | |
206 | rxvt_init_xlocale (this); |
209 | rxvt_init_xlocale (this); |
207 | |
210 | |
208 | rxvt_scr_reset (this); /* initialize screen */ |
211 | scr_reset (); /* initialize screen */ |
209 | #ifdef RXVT_GRAPHICS |
212 | #ifdef RXVT_GRAPHICS |
210 | rxvt_Gr_reset (this); /* reset graphics */ |
213 | rxvt_Gr_reset (this); /* reset graphics */ |
211 | #endif |
214 | #endif |
212 | |
215 | |
213 | #if 0 |
216 | #if 0 |
… | |
… | |
940 | uint16_t old_ncol = R->prev_ncol; |
943 | uint16_t old_ncol = R->prev_ncol; |
941 | |
944 | |
942 | /* scr_reset only works on the primary screen */ |
945 | /* scr_reset only works on the primary screen */ |
943 | if (R->old_height) /* this is not the first time through */ |
946 | if (R->old_height) /* this is not the first time through */ |
944 | curr_screen = rxvt_scr_change_screen(aR_ PRIMARY); |
947 | curr_screen = rxvt_scr_change_screen(aR_ PRIMARY); |
|
|
948 | |
945 | rxvt_scr_reset(aR); |
949 | R->scr_reset(); |
|
|
950 | |
946 | if (curr_screen >= 0) { /* this is not the first time through */ |
951 | if (curr_screen >= 0) { /* this is not the first time through */ |
947 | rxvt_scr_change_screen(aR_ curr_screen); |
952 | rxvt_scr_change_screen(aR_ curr_screen); |
948 | rxvt_selection_check(aR_(old_ncol != R->TermWin.ncol ? 4 : 0)); |
953 | rxvt_selection_check(aR_(old_ncol != R->TermWin.ncol ? 4 : 0)); |
949 | } |
954 | } |
950 | } |
955 | } |
… | |
… | |
1128 | char buf[IMBUFSIZ]; |
1133 | char buf[IMBUFSIZ]; |
1129 | |
1134 | |
1130 | D_MAIN((stderr, "rxvt_IMInstantiateCallback()")); |
1135 | D_MAIN((stderr, "rxvt_IMInstantiateCallback()")); |
1131 | if (R->Input_Context) |
1136 | if (R->Input_Context) |
1132 | return; |
1137 | return; |
|
|
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 |
1133 | |
1143 | |
1134 | p = R->rs[Rs_inputMethod]; |
1144 | p = R->rs[Rs_inputMethod]; |
1135 | if (p && *p) |
1145 | if (p && *p) |
1136 | { |
1146 | { |
1137 | bool found = false; |
1147 | bool found = false; |
… | |
… | |
1154 | for (i = 0; s[i]; i++) |
1164 | for (i = 0; s[i]; i++) |
1155 | free(s[i]); |
1165 | free(s[i]); |
1156 | free(s); |
1166 | free(s); |
1157 | |
1167 | |
1158 | if (found) |
1168 | if (found) |
1159 | return; |
1169 | goto done; |
1160 | } |
1170 | } |
1161 | |
1171 | |
1162 | /* try with XMODIFIERS env. var. */ |
1172 | /* try with XMODIFIERS env. var. */ |
1163 | if ((p = XSetLocaleModifiers ("")) && *p |
1173 | if ((p = XSetLocaleModifiers ("")) && *p |
1164 | && rxvt_IM_get_IC (aR)) |
1174 | && rxvt_IM_get_IC (aR)) |
1165 | return; |
1175 | goto done; |
1166 | |
1176 | |
1167 | /* 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 */ |
1168 | if ((p = XSetLocaleModifiers ("@im=none")) && *p |
1178 | if ((p = XSetLocaleModifiers ("@im=none")) && *p |
1169 | && rxvt_IM_get_IC (aR) == True) |
1179 | && rxvt_IM_get_IC (aR) == True) |
1170 | 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 |
1171 | } |
1187 | } |
1172 | |
1188 | |
1173 | /* |
1189 | /* |
1174 | * 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 |
1175 | * open a suitable preedit type |
1191 | * open a suitable preedit type |