ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/rxvt-unicode/src/main.C
(Generate patch)

Comparing rxvt-unicode/src/main.C (file contents):
Revision 1.10 by pcg, Wed Dec 3 23:19:44 2003 UTC vs.
Revision 1.11 by pcg, Mon Dec 8 23:14:40 2003 UTC

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

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines