1 | /*--------------------------------*-C-*---------------------------------* |
1 | /*--------------------------------*-C-*---------------------------------* |
2 | * File: main.c |
2 | * File: main.c |
3 | *----------------------------------------------------------------------* |
3 | *----------------------------------------------------------------------* |
4 | * $Id: main.C,v 1.11 2003/12/08 23:14:40 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> |
… | |
… | |
67 | #ifdef POINTER_BLANK |
67 | #ifdef POINTER_BLANK |
68 | pointer_ev (this, &rxvt_term::pointer_cb), |
68 | pointer_ev (this, &rxvt_term::pointer_cb), |
69 | #endif |
69 | #endif |
70 | x_ev (this, &rxvt_term::x_cb), |
70 | x_ev (this, &rxvt_term::x_cb), |
71 | destroy_ev (this, &rxvt_term::destroy_cb), |
71 | destroy_ev (this, &rxvt_term::destroy_cb), |
72 | check_ev (this, &rxvt_term::check_cb) |
72 | check_ev (this, &rxvt_term::check_cb), |
|
|
73 | incr_ev (this, &rxvt_term::incr_cb) |
73 | { |
74 | { |
74 | cmdbuf_ptr = cmdbuf_endp = cmdbuf_base; |
75 | cmdbuf_ptr = cmdbuf_endp = cmdbuf_base; |
75 | } |
76 | } |
76 | |
77 | |
77 | rxvt_term::~rxvt_term () |
78 | rxvt_term::~rxvt_term () |
78 | { |
79 | { |
79 | rxvt_scr_release (this); |
80 | scr_release (); |
80 | |
81 | |
|
|
82 | #if defined(HAVE_XSETLOCALE) || defined(HAVE_SETLOCALE) |
|
|
83 | free (locale); |
|
|
84 | #endif |
81 | #ifndef NO_SETOWNER_TTYDEV |
85 | #ifndef NO_SETOWNER_TTYDEV |
82 | rxvt_privileged_ttydev (this, RESTORE); |
86 | rxvt_privileged_ttydev (this, RESTORE); |
83 | #endif |
87 | #endif |
84 | #ifdef UTMP_SUPPORT |
88 | #ifdef UTMP_SUPPORT |
85 | rxvt_privileged_utmp (this, RESTORE); |
89 | rxvt_privileged_utmp (this, RESTORE); |
… | |
… | |
202 | |
206 | |
203 | rxvt_Create_Windows (this, argc, argv); |
207 | rxvt_Create_Windows (this, argc, argv); |
204 | |
208 | |
205 | rxvt_init_xlocale (this); |
209 | rxvt_init_xlocale (this); |
206 | |
210 | |
207 | rxvt_scr_reset (this); /* initialize screen */ |
211 | scr_reset (); /* initialize screen */ |
208 | #ifdef RXVT_GRAPHICS |
212 | #ifdef RXVT_GRAPHICS |
209 | rxvt_Gr_reset (this); /* reset graphics */ |
213 | rxvt_Gr_reset (this); /* reset graphics */ |
210 | #endif |
214 | #endif |
211 | |
215 | |
212 | #if 0 |
216 | #if 0 |
… | |
… | |
939 | uint16_t old_ncol = R->prev_ncol; |
943 | uint16_t old_ncol = R->prev_ncol; |
940 | |
944 | |
941 | /* scr_reset only works on the primary screen */ |
945 | /* scr_reset only works on the primary screen */ |
942 | if (R->old_height) /* this is not the first time through */ |
946 | if (R->old_height) /* this is not the first time through */ |
943 | curr_screen = rxvt_scr_change_screen(aR_ PRIMARY); |
947 | curr_screen = rxvt_scr_change_screen(aR_ PRIMARY); |
|
|
948 | |
944 | rxvt_scr_reset(aR); |
949 | R->scr_reset(); |
|
|
950 | |
945 | if (curr_screen >= 0) { /* this is not the first time through */ |
951 | if (curr_screen >= 0) { /* this is not the first time through */ |
946 | rxvt_scr_change_screen(aR_ curr_screen); |
952 | rxvt_scr_change_screen(aR_ curr_screen); |
947 | rxvt_selection_check(aR_(old_ncol != R->TermWin.ncol ? 4 : 0)); |
953 | rxvt_selection_check(aR_(old_ncol != R->TermWin.ncol ? 4 : 0)); |
948 | } |
954 | } |
949 | } |
955 | } |
… | |
… | |
1127 | char buf[IMBUFSIZ]; |
1133 | char buf[IMBUFSIZ]; |
1128 | |
1134 | |
1129 | D_MAIN((stderr, "rxvt_IMInstantiateCallback()")); |
1135 | D_MAIN((stderr, "rxvt_IMInstantiateCallback()")); |
1130 | if (R->Input_Context) |
1136 | if (R->Input_Context) |
1131 | 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 |
1132 | |
1143 | |
1133 | p = R->rs[Rs_inputMethod]; |
1144 | p = R->rs[Rs_inputMethod]; |
1134 | if (p && *p) |
1145 | if (p && *p) |
1135 | { |
1146 | { |
1136 | bool found = false; |
1147 | bool found = false; |
… | |
… | |
1153 | for (i = 0; s[i]; i++) |
1164 | for (i = 0; s[i]; i++) |
1154 | free(s[i]); |
1165 | free(s[i]); |
1155 | free(s); |
1166 | free(s); |
1156 | |
1167 | |
1157 | if (found) |
1168 | if (found) |
1158 | return; |
1169 | goto done; |
1159 | } |
1170 | } |
1160 | |
1171 | |
1161 | /* try with XMODIFIERS env. var. */ |
1172 | /* try with XMODIFIERS env. var. */ |
1162 | if ((p = XSetLocaleModifiers ("")) && *p |
1173 | if ((p = XSetLocaleModifiers ("")) && *p |
1163 | && rxvt_IM_get_IC (aR)) |
1174 | && rxvt_IM_get_IC (aR)) |
1164 | return; |
1175 | goto done; |
1165 | |
1176 | |
1166 | /* 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 */ |
1167 | if ((p = XSetLocaleModifiers ("@im=none")) && *p |
1178 | if ((p = XSetLocaleModifiers ("@im=none")) && *p |
1168 | && rxvt_IM_get_IC (aR) == True) |
1179 | && rxvt_IM_get_IC (aR) == True) |
1169 | 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 |
1170 | } |
1187 | } |
1171 | |
1188 | |
1172 | /* |
1189 | /* |
1173 | * 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 |
1174 | * open a suitable preedit type |
1191 | * open a suitable preedit type |