1 | /*--------------------------------*-C-*---------------------------------* |
1 | /*--------------------------------*-C-*---------------------------------* |
2 | * File: main.c |
2 | * File: main.c |
3 | *----------------------------------------------------------------------* |
3 | *----------------------------------------------------------------------* |
4 | * $Id: main.C,v 1.10 2003/12/03 23:19:44 pcg Exp $ |
4 | * $Id: main.C,v 1.13 2003/12/17 09:00:35 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 | |
81 | #ifndef NO_SETOWNER_TTYDEV |
82 | #ifndef NO_SETOWNER_TTYDEV |
82 | rxvt_privileged_ttydev (this, RESTORE); |
83 | rxvt_privileged_ttydev (this, RESTORE); |
83 | #endif |
84 | #endif |
84 | #ifdef UTMP_SUPPORT |
85 | #ifdef UTMP_SUPPORT |
… | |
… | |
202 | |
203 | |
203 | rxvt_Create_Windows (this, argc, argv); |
204 | rxvt_Create_Windows (this, argc, argv); |
204 | |
205 | |
205 | rxvt_init_xlocale (this); |
206 | rxvt_init_xlocale (this); |
206 | |
207 | |
207 | rxvt_scr_reset (this); /* initialize screen */ |
208 | scr_reset (); /* initialize screen */ |
208 | #ifdef RXVT_GRAPHICS |
209 | #ifdef RXVT_GRAPHICS |
209 | rxvt_Gr_reset (this); /* reset graphics */ |
210 | rxvt_Gr_reset (this); /* reset graphics */ |
210 | #endif |
211 | #endif |
211 | |
212 | |
212 | #if 0 |
213 | #if 0 |
… | |
… | |
939 | uint16_t old_ncol = R->prev_ncol; |
940 | uint16_t old_ncol = R->prev_ncol; |
940 | |
941 | |
941 | /* scr_reset only works on the primary screen */ |
942 | /* scr_reset only works on the primary screen */ |
942 | if (R->old_height) /* this is not the first time through */ |
943 | if (R->old_height) /* this is not the first time through */ |
943 | curr_screen = rxvt_scr_change_screen(aR_ PRIMARY); |
944 | curr_screen = rxvt_scr_change_screen(aR_ PRIMARY); |
|
|
945 | |
944 | rxvt_scr_reset(aR); |
946 | R->scr_reset(); |
|
|
947 | |
945 | if (curr_screen >= 0) { /* this is not the first time through */ |
948 | if (curr_screen >= 0) { /* this is not the first time through */ |
946 | rxvt_scr_change_screen(aR_ curr_screen); |
949 | rxvt_scr_change_screen(aR_ curr_screen); |
947 | rxvt_selection_check(aR_(old_ncol != R->TermWin.ncol ? 4 : 0)); |
950 | rxvt_selection_check(aR_(old_ncol != R->TermWin.ncol ? 4 : 0)); |
948 | } |
951 | } |
949 | } |
952 | } |
… | |
… | |
1118 | rxvt_IMInstantiateCallback(Display * unused |
1121 | rxvt_IMInstantiateCallback(Display * unused |
1119 | __attribute__ ((unused)), XPointer client_data |
1122 | __attribute__ ((unused)), XPointer client_data |
1120 | __attribute__ ((unused)), XPointer call_data |
1123 | __attribute__ ((unused)), XPointer call_data |
1121 | __attribute__ ((unused))) |
1124 | __attribute__ ((unused))) |
1122 | { |
1125 | { |
1123 | dR; |
1126 | dR; |
1124 | int i, found, had_im; |
1127 | int i, found, had_im; |
1125 | const char *p; |
1128 | const char *p; |
1126 | char **s; |
1129 | char **s; |
1127 | char buf[IMBUFSIZ]; |
1130 | char buf[IMBUFSIZ]; |
1128 | |
1131 | |
1129 | D_MAIN((stderr, "rxvt_IMInstantiateCallback()")); |
1132 | D_MAIN((stderr, "rxvt_IMInstantiateCallback()")); |
1130 | if (R->Input_Context) |
1133 | if (R->Input_Context) |
1131 | return; |
1134 | return; |
1132 | |
1135 | |
1133 | found = had_im = 0; |
|
|
1134 | p = R->rs[Rs_inputMethod]; |
1136 | p = R->rs[Rs_inputMethod]; |
1135 | if (p && *p) { |
1137 | if (p && *p) |
1136 | had_im = 1; |
1138 | { |
|
|
1139 | bool found = false; |
|
|
1140 | |
1137 | s = rxvt_splitcommastring(p); |
1141 | s = rxvt_splitcommastring (p); |
1138 | for (i = 0; s[i]; i++) { |
1142 | for (i = 0; s[i]; i++) |
|
|
1143 | { |
1139 | if (*s[i]) { |
1144 | if (*s[i]) |
|
|
1145 | { |
1140 | STRCPY(buf, "@im="); |
1146 | STRCPY (buf, "@im="); |
1141 | STRNCAT(buf, s[i], IMBUFSIZ - 5); |
1147 | STRNCAT (buf, s[i], IMBUFSIZ - 5); |
1142 | if ((p = XSetLocaleModifiers(buf)) != NULL && *p |
1148 | if ((p = XSetLocaleModifiers (buf)) && *p |
1143 | && (rxvt_IM_get_IC(aR) == True)) { |
1149 | && rxvt_IM_get_IC (aR)) |
|
|
1150 | { |
1144 | found = 1; |
1151 | found = true; |
1145 | break; |
1152 | break; |
1146 | } |
1153 | } |
1147 | } |
1154 | } |
1148 | } |
1155 | } |
1149 | for (i = 0; s[i]; i++) |
1156 | for (i = 0; s[i]; i++) |
1150 | free(s[i]); |
1157 | free(s[i]); |
1151 | free(s); |
1158 | free(s); |
1152 | } |
1159 | |
1153 | if (found) |
1160 | if (found) |
1154 | return; |
1161 | return; |
|
|
1162 | } |
1155 | |
1163 | |
1156 | /* try with XMODIFIERS env. var. */ |
1164 | /* try with XMODIFIERS env. var. */ |
1157 | if ((p = XSetLocaleModifiers("")) != NULL && *p) { |
1165 | if ((p = XSetLocaleModifiers ("")) && *p |
1158 | rxvt_IM_get_IC(aR); |
1166 | && rxvt_IM_get_IC (aR)) |
1159 | return; |
1167 | return; |
1160 | } |
|
|
1161 | |
1168 | |
1162 | /* try with no modifiers base IF the user didn't specify an IM */ |
1169 | /* try with no modifiers base IF the user didn't specify an IM */ |
1163 | if (!had_im && (p = XSetLocaleModifiers("@im=none")) != NULL && *p |
1170 | if ((p = XSetLocaleModifiers ("@im=none")) && *p |
1164 | && rxvt_IM_get_IC(aR) == True) |
1171 | && rxvt_IM_get_IC (aR) == True) |
1165 | return; |
1172 | return; |
1166 | } |
1173 | } |
1167 | |
1174 | |
1168 | /* |
1175 | /* |
1169 | * Try to open a XIM with the current modifiers, then see if we can |
1176 | * Try to open a XIM with the current modifiers, then see if we can |
1170 | * open a suitable preedit type |
1177 | * open a suitable preedit type |