1 | /*--------------------------------*-C-*---------------------------------* |
1 | /*--------------------------------*-C-*---------------------------------* |
2 | * File: main.c |
2 | * File: main.c |
3 | *----------------------------------------------------------------------* |
3 | *----------------------------------------------------------------------* |
4 | * $Id: main.C,v 1.9 2003/12/02 21:49:46 pcg Exp $ |
4 | * $Id: main.C,v 1.12 2003/12/16 23:04:13 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 () |
… | |
… | |
238 | |
239 | |
239 | x_ev.start (Xfd, EVENT_READ); |
240 | x_ev.start (Xfd, EVENT_READ); |
240 | pty_ev.start (cmd_fd, EVENT_READ); |
241 | pty_ev.start (cmd_fd, EVENT_READ); |
241 | |
242 | |
242 | check_ev.start (); |
243 | check_ev.start (); |
|
|
244 | |
|
|
245 | process_x_events (); |
243 | |
246 | |
244 | return true; |
247 | return true; |
245 | } |
248 | } |
246 | |
249 | |
247 | /* ------------------------------------------------------------------------- * |
250 | /* ------------------------------------------------------------------------- * |
… | |
… | |
1116 | rxvt_IMInstantiateCallback(Display * unused |
1119 | rxvt_IMInstantiateCallback(Display * unused |
1117 | __attribute__ ((unused)), XPointer client_data |
1120 | __attribute__ ((unused)), XPointer client_data |
1118 | __attribute__ ((unused)), XPointer call_data |
1121 | __attribute__ ((unused)), XPointer call_data |
1119 | __attribute__ ((unused))) |
1122 | __attribute__ ((unused))) |
1120 | { |
1123 | { |
1121 | dR; |
1124 | dR; |
1122 | int i, found, had_im; |
1125 | int i, found, had_im; |
1123 | const char *p; |
1126 | const char *p; |
1124 | char **s; |
1127 | char **s; |
1125 | char buf[IMBUFSIZ]; |
1128 | char buf[IMBUFSIZ]; |
1126 | |
1129 | |
1127 | D_MAIN((stderr, "rxvt_IMInstantiateCallback()")); |
1130 | D_MAIN((stderr, "rxvt_IMInstantiateCallback()")); |
1128 | if (R->Input_Context) |
1131 | if (R->Input_Context) |
1129 | return; |
1132 | return; |
1130 | |
1133 | |
1131 | found = had_im = 0; |
|
|
1132 | p = R->rs[Rs_inputMethod]; |
1134 | p = R->rs[Rs_inputMethod]; |
1133 | if (p && *p) { |
1135 | if (p && *p) |
1134 | had_im = 1; |
1136 | { |
|
|
1137 | bool found = false; |
|
|
1138 | |
1135 | s = rxvt_splitcommastring(p); |
1139 | s = rxvt_splitcommastring (p); |
1136 | for (i = 0; s[i]; i++) { |
1140 | for (i = 0; s[i]; i++) |
|
|
1141 | { |
1137 | if (*s[i]) { |
1142 | if (*s[i]) |
|
|
1143 | { |
1138 | STRCPY(buf, "@im="); |
1144 | STRCPY (buf, "@im="); |
1139 | STRNCAT(buf, s[i], IMBUFSIZ - 5); |
1145 | STRNCAT (buf, s[i], IMBUFSIZ - 5); |
1140 | if ((p = XSetLocaleModifiers(buf)) != NULL && *p |
1146 | if ((p = XSetLocaleModifiers (buf)) && *p |
1141 | && (rxvt_IM_get_IC(aR) == True)) { |
1147 | && rxvt_IM_get_IC (aR)) |
|
|
1148 | { |
1142 | found = 1; |
1149 | found = true; |
1143 | break; |
1150 | break; |
1144 | } |
1151 | } |
1145 | } |
1152 | } |
1146 | } |
1153 | } |
1147 | for (i = 0; s[i]; i++) |
1154 | for (i = 0; s[i]; i++) |
1148 | free(s[i]); |
1155 | free(s[i]); |
1149 | free(s); |
1156 | free(s); |
1150 | } |
1157 | |
1151 | if (found) |
1158 | if (found) |
1152 | return; |
1159 | return; |
|
|
1160 | } |
1153 | |
1161 | |
1154 | /* try with XMODIFIERS env. var. */ |
1162 | /* try with XMODIFIERS env. var. */ |
1155 | if ((p = XSetLocaleModifiers("")) != NULL && *p) { |
1163 | if ((p = XSetLocaleModifiers ("")) && *p |
1156 | rxvt_IM_get_IC(aR); |
1164 | && rxvt_IM_get_IC (aR)) |
1157 | return; |
1165 | return; |
1158 | } |
|
|
1159 | |
1166 | |
1160 | /* try with no modifiers base IF the user didn't specify an IM */ |
1167 | /* try with no modifiers base IF the user didn't specify an IM */ |
1161 | if (!had_im && (p = XSetLocaleModifiers("@im=none")) != NULL && *p |
1168 | if ((p = XSetLocaleModifiers ("@im=none")) && *p |
1162 | && rxvt_IM_get_IC(aR) == True) |
1169 | && rxvt_IM_get_IC (aR) == True) |
1163 | return; |
1170 | return; |
1164 | } |
1171 | } |
1165 | |
1172 | |
1166 | /* |
1173 | /* |
1167 | * Try to open a XIM with the current modifiers, then see if we can |
1174 | * Try to open a XIM with the current modifiers, then see if we can |
1168 | * open a suitable preedit type |
1175 | * open a suitable preedit type |