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.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 () |
… | |
… | |
1118 | rxvt_IMInstantiateCallback(Display * unused |
1119 | rxvt_IMInstantiateCallback(Display * unused |
1119 | __attribute__ ((unused)), XPointer client_data |
1120 | __attribute__ ((unused)), XPointer client_data |
1120 | __attribute__ ((unused)), XPointer call_data |
1121 | __attribute__ ((unused)), XPointer call_data |
1121 | __attribute__ ((unused))) |
1122 | __attribute__ ((unused))) |
1122 | { |
1123 | { |
1123 | dR; |
1124 | dR; |
1124 | int i, found, had_im; |
1125 | int i, found, had_im; |
1125 | const char *p; |
1126 | const char *p; |
1126 | char **s; |
1127 | char **s; |
1127 | char buf[IMBUFSIZ]; |
1128 | char buf[IMBUFSIZ]; |
1128 | |
1129 | |
1129 | D_MAIN((stderr, "rxvt_IMInstantiateCallback()")); |
1130 | D_MAIN((stderr, "rxvt_IMInstantiateCallback()")); |
1130 | if (R->Input_Context) |
1131 | if (R->Input_Context) |
1131 | return; |
1132 | return; |
1132 | |
1133 | |
1133 | found = had_im = 0; |
|
|
1134 | p = R->rs[Rs_inputMethod]; |
1134 | p = R->rs[Rs_inputMethod]; |
1135 | if (p && *p) { |
1135 | if (p && *p) |
1136 | had_im = 1; |
1136 | { |
|
|
1137 | bool found = false; |
|
|
1138 | |
1137 | s = rxvt_splitcommastring(p); |
1139 | s = rxvt_splitcommastring (p); |
1138 | for (i = 0; s[i]; i++) { |
1140 | for (i = 0; s[i]; i++) |
|
|
1141 | { |
1139 | if (*s[i]) { |
1142 | if (*s[i]) |
|
|
1143 | { |
1140 | STRCPY(buf, "@im="); |
1144 | STRCPY (buf, "@im="); |
1141 | STRNCAT(buf, s[i], IMBUFSIZ - 5); |
1145 | STRNCAT (buf, s[i], IMBUFSIZ - 5); |
1142 | if ((p = XSetLocaleModifiers(buf)) != NULL && *p |
1146 | if ((p = XSetLocaleModifiers (buf)) && *p |
1143 | && (rxvt_IM_get_IC(aR) == True)) { |
1147 | && rxvt_IM_get_IC (aR)) |
|
|
1148 | { |
1144 | found = 1; |
1149 | found = true; |
1145 | break; |
1150 | break; |
1146 | } |
1151 | } |
1147 | } |
1152 | } |
1148 | } |
1153 | } |
1149 | for (i = 0; s[i]; i++) |
1154 | for (i = 0; s[i]; i++) |
1150 | free(s[i]); |
1155 | free(s[i]); |
1151 | free(s); |
1156 | free(s); |
1152 | } |
1157 | |
1153 | if (found) |
1158 | if (found) |
1154 | return; |
1159 | return; |
|
|
1160 | } |
1155 | |
1161 | |
1156 | /* try with XMODIFIERS env. var. */ |
1162 | /* try with XMODIFIERS env. var. */ |
1157 | if ((p = XSetLocaleModifiers("")) != NULL && *p) { |
1163 | if ((p = XSetLocaleModifiers ("")) && *p |
1158 | rxvt_IM_get_IC(aR); |
1164 | && rxvt_IM_get_IC (aR)) |
1159 | return; |
1165 | return; |
1160 | } |
|
|
1161 | |
1166 | |
1162 | /* 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 */ |
1163 | if (!had_im && (p = XSetLocaleModifiers("@im=none")) != NULL && *p |
1168 | if ((p = XSetLocaleModifiers ("@im=none")) && *p |
1164 | && rxvt_IM_get_IC(aR) == True) |
1169 | && rxvt_IM_get_IC (aR) == True) |
1165 | return; |
1170 | return; |
1166 | } |
1171 | } |
1167 | |
1172 | |
1168 | /* |
1173 | /* |
1169 | * 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 |
1170 | * open a suitable preedit type |
1175 | * open a suitable preedit type |