… | |
… | |
72 | free (p); |
72 | free (p); |
73 | } |
73 | } |
74 | |
74 | |
75 | rxvt_term::rxvt_term () |
75 | rxvt_term::rxvt_term () |
76 | : |
76 | : |
77 | #ifdef TRANSPARENT |
|
|
78 | rootwin_ev (this, &rxvt_term::rootwin_cb), |
77 | rootwin_ev (this, &rxvt_term::rootwin_cb), |
79 | #endif |
|
|
80 | termwin_ev (this, &rxvt_term::x_cb), |
78 | termwin_ev (this, &rxvt_term::x_cb), |
81 | vt_ev (this, &rxvt_term::x_cb), |
79 | vt_ev (this, &rxvt_term::x_cb), |
82 | #ifdef HAVE_SCROLLBARS |
80 | #ifdef HAVE_SCROLLBARS |
83 | scrollbar_ev (this, &rxvt_term::x_cb), |
81 | scrollbar_ev (this, &rxvt_term::x_cb), |
84 | #endif |
82 | #endif |
… | |
… | |
95 | pointer_ev (this, &rxvt_term::pointer_cb), |
93 | pointer_ev (this, &rxvt_term::pointer_cb), |
96 | #endif |
94 | #endif |
97 | check_ev (this, &rxvt_term::check_cb), |
95 | check_ev (this, &rxvt_term::check_cb), |
98 | destroy_ev (this, &rxvt_term::destroy_cb), |
96 | destroy_ev (this, &rxvt_term::destroy_cb), |
99 | pty_ev (this, &rxvt_term::pty_cb), |
97 | pty_ev (this, &rxvt_term::pty_cb), |
100 | incr_ev (this, &rxvt_term::incr_cb) |
98 | incr_ev (this, &rxvt_term::incr_cb), |
|
|
99 | #ifdef USE_XIM |
|
|
100 | im_ev (this, &rxvt_term::im_cb) |
|
|
101 | #endif |
101 | { |
102 | { |
102 | cmdbuf_ptr = cmdbuf_endp = cmdbuf_base; |
103 | cmdbuf_ptr = cmdbuf_endp = cmdbuf_base; |
103 | } |
104 | } |
104 | |
105 | |
105 | rxvt_term::~rxvt_term () |
106 | rxvt_term::~rxvt_term () |
106 | { |
107 | { |
|
|
108 | if (cmd_fd >= 0) |
|
|
109 | close (cmd_fd); |
|
|
110 | |
107 | scr_release (); |
111 | scr_release (); |
108 | |
112 | |
109 | free (locale); |
113 | free (locale); |
110 | free (codeset); |
114 | free (codeset); |
111 | |
115 | |
… | |
… | |
113 | privileged_ttydev (RESTORE); |
117 | privileged_ttydev (RESTORE); |
114 | #endif |
118 | #endif |
115 | #ifdef UTMP_SUPPORT |
119 | #ifdef UTMP_SUPPORT |
116 | privileged_utmp (RESTORE); |
120 | privileged_utmp (RESTORE); |
117 | #endif |
121 | #endif |
118 | #ifdef USE_XIM |
|
|
119 | if (Input_Context) |
|
|
120 | { |
|
|
121 | XDestroyIC (Input_Context); |
|
|
122 | Input_Context = NULL; |
|
|
123 | } |
|
|
124 | #endif |
|
|
125 | |
|
|
126 | if (TermWin.parent[0]) |
|
|
127 | XDestroyWindow (display->display, TermWin.parent[0]); |
|
|
128 | |
122 | |
129 | // TODO: free pixcolours, colours should become part of rxvt_display |
123 | // TODO: free pixcolours, colours should become part of rxvt_display |
130 | |
124 | |
131 | delete PixColors; |
125 | delete PixColors; |
132 | |
126 | |
133 | if (cmd_fd >= 0) |
127 | displays.put (display); |
134 | close (cmd_fd); |
128 | } |
135 | |
129 | |
|
|
130 | void |
|
|
131 | rxvt_term::destroy () |
|
|
132 | { |
136 | if (display) |
133 | if (display) |
137 | displays.release (display); |
|
|
138 | } |
|
|
139 | |
|
|
140 | void |
|
|
141 | rxvt_term::destroy () |
|
|
142 | { |
|
|
143 | if (display) |
|
|
144 | { |
134 | { |
|
|
135 | if (TermWin.parent[0]) |
|
|
136 | XDestroyWindow (display->display, TermWin.parent[0]); |
|
|
137 | |
145 | termwin_ev.stop (display); |
138 | termwin_ev.stop (display); |
146 | vt_ev.stop (display); |
139 | vt_ev.stop (display); |
|
|
140 | |
|
|
141 | #ifdef USE_XIM |
|
|
142 | im_destroy (); |
|
|
143 | im_ev.stop (display); |
|
|
144 | #endif |
147 | #ifdef HAVE_SCROLLBARS |
145 | #ifdef HAVE_SCROLLBARS |
148 | scrollbar_ev.stop (display); |
146 | scrollbar_ev.stop (display); |
149 | #endif |
147 | #endif |
150 | #ifdef MENUBAR |
148 | #ifdef MENUBAR |
151 | menubar_ev.stop (display); |
149 | menubar_ev.stop (display); |
… | |
… | |
275 | #endif |
273 | #endif |
276 | #ifdef TRANSPARENT |
274 | #ifdef TRANSPARENT |
277 | if (Options & Opt_transparent) |
275 | if (Options & Opt_transparent) |
278 | { |
276 | { |
279 | XSelectInput (display->display, display->root, PropertyChangeMask); |
277 | XSelectInput (display->display, display->root, PropertyChangeMask); |
280 | rootwin_ev.start (display, display->root); |
|
|
281 | check_our_parents (); |
278 | check_our_parents (); |
282 | } |
279 | } |
283 | #endif |
280 | #endif |
|
|
281 | |
|
|
282 | rootwin_ev.start (display, display->root); |
|
|
283 | |
284 | XMapWindow (display->display, TermWin.vt); |
284 | XMapWindow (display->display, TermWin.vt); |
285 | XMapWindow (display->display, TermWin.parent[0]); |
285 | XMapWindow (display->display, TermWin.parent[0]); |
286 | |
286 | |
287 | init_env (); |
287 | init_env (); |
288 | init_command (cmd_argv); |
288 | init_command (cmd_argv); |
… | |
… | |
1057 | |
1057 | |
1058 | /* -------------------------------------------------------------------- * |
1058 | /* -------------------------------------------------------------------- * |
1059 | * - X INPUT METHOD ROUTINES - * |
1059 | * - X INPUT METHOD ROUTINES - * |
1060 | * -------------------------------------------------------------------- */ |
1060 | * -------------------------------------------------------------------- */ |
1061 | #ifdef USE_XIM |
1061 | #ifdef USE_XIM |
|
|
1062 | |
1062 | void |
1063 | void |
1063 | rxvt_term::set_size (XRectangle *size) |
1064 | rxvt_term::im_set_size (XRectangle *size) |
1064 | { |
1065 | { |
1065 | size->x = TermWin.int_bwidth; |
1066 | size->x = TermWin.int_bwidth; |
1066 | size->y = TermWin.int_bwidth; |
1067 | size->y = TermWin.int_bwidth; |
1067 | size->width = Width2Pixel(TermWin.ncol); |
1068 | size->width = Width2Pixel(TermWin.ncol); |
1068 | size->height = Height2Pixel(TermWin.nrow); |
1069 | size->height = Height2Pixel(TermWin.nrow); |
1069 | } |
1070 | } |
1070 | |
1071 | |
1071 | void |
1072 | void |
1072 | rxvt_term::set_color (unsigned long *fg, unsigned long *bg) |
1073 | rxvt_term::im_set_color (unsigned long *fg, unsigned long *bg) |
1073 | { |
1074 | { |
1074 | *fg = PixColors[Color_fg]; |
1075 | *fg = PixColors[Color_fg]; |
1075 | *bg = PixColors[Color_bg]; |
1076 | *bg = PixColors[Color_bg]; |
1076 | } |
1077 | } |
1077 | |
1078 | |
… | |
… | |
1114 | || event_type == SelectionNotify |
1115 | || event_type == SelectionNotify |
1115 | || event_type == ButtonRelease || event_type == FocusIn) |
1116 | || event_type == ButtonRelease || event_type == FocusIn) |
1116 | || !IMisRunning ()) |
1117 | || !IMisRunning ()) |
1117 | return; |
1118 | return; |
1118 | |
1119 | |
1119 | set_position (&spot); |
1120 | im_set_position (&spot); |
1120 | |
1121 | |
1121 | preedit_attr = XVaCreateNestedList(0, XNSpotLocation, &spot, NULL); |
1122 | preedit_attr = XVaCreateNestedList(0, XNSpotLocation, &spot, NULL); |
1122 | XSetICValues(Input_Context, XNPreeditAttributes, preedit_attr, NULL); |
1123 | XSetICValues(Input_Context, XNPreeditAttributes, preedit_attr, NULL); |
1123 | XFree(preedit_attr); |
1124 | XFree(preedit_attr); |
1124 | } |
1125 | } |
1125 | |
1126 | |
1126 | void |
1127 | void |
1127 | rxvt_term::set_preedit_area (XRectangle * preedit_rect, XRectangle * status_rect, |
1128 | rxvt_term::im_set_preedit_area (XRectangle * preedit_rect, XRectangle * status_rect, |
1128 | XRectangle * needed_rect) |
1129 | XRectangle * needed_rect) |
1129 | { |
1130 | { |
1130 | int mbh, vtx = 0; |
1131 | int mbh, vtx = 0; |
1131 | |
1132 | |
1132 | if (scrollbar_visible () && !(Options & Opt_scrollBar_right)) |
1133 | if (scrollbar_visible () && !(Options & Opt_scrollBar_right)) |
1133 | vtx = scrollbar_TotalWidth(); |
1134 | vtx = scrollbar_TotalWidth(); |
… | |
… | |
1146 | |
1147 | |
1147 | status_rect->width = needed_rect->width ? needed_rect->width : Width2Pixel(TermWin.ncol + 1); |
1148 | status_rect->width = needed_rect->width ? needed_rect->width : Width2Pixel(TermWin.ncol + 1); |
1148 | status_rect->height = Height2Pixel(1); |
1149 | status_rect->height = Height2Pixel(1); |
1149 | } |
1150 | } |
1150 | |
1151 | |
1151 | /* ARGSUSED */ |
|
|
1152 | /* EXTPROTO */ |
|
|
1153 | void |
1152 | void |
1154 | rxvt_IMDestroyCallback(XIM xim __attribute__ ((unused)), XPointer client_data |
1153 | rxvt_term::im_destroy () |
1155 | __attribute__ ((unused)), XPointer call_data |
|
|
1156 | __attribute__ ((unused))) |
|
|
1157 | { |
1154 | { |
|
|
1155 | if (Input_Context) |
|
|
1156 | { |
|
|
1157 | XDestroyIC (Input_Context); |
1158 | GET_R->Input_Context = NULL; |
1158 | Input_Context = NULL; |
1159 | /* To avoid Segmentation Fault in C locale: Solaris only? */ |
1159 | } |
1160 | if (STRCMP (GET_R->locale, "C")) |
1160 | |
1161 | XRegisterIMInstantiateCallback(GET_R->display->display, NULL, NULL, NULL, |
1161 | if (input_method) |
1162 | rxvt_IMInstantiateCallback, NULL); |
1162 | { |
|
|
1163 | display->put_xim (input_method); |
|
|
1164 | input_method = 0; |
|
|
1165 | } |
1163 | } |
1166 | } |
1164 | |
1167 | |
1165 | /* |
1168 | /* |
1166 | * Try to open a XIM with the current modifiers, then see if we can |
1169 | * Try to open a XIM with the current modifiers, then see if we can |
1167 | * open a suitable preedit type |
1170 | * open a suitable preedit type |
1168 | */ |
1171 | */ |
1169 | bool |
1172 | bool |
1170 | rxvt_term::IM_get_IC () |
1173 | rxvt_term::IM_get_IC (const char *modifiers) |
1171 | { |
1174 | { |
1172 | int i, j, found; |
1175 | int i, j, found; |
1173 | XIM xim; |
1176 | XIM xim; |
1174 | XPoint spot; |
1177 | XPoint spot; |
1175 | XRectangle rect, status_rect, needed_rect; |
1178 | XRectangle rect, status_rect, needed_rect; |
1176 | unsigned long fg, bg; |
1179 | unsigned long fg, bg; |
1177 | const char *p; |
1180 | const char *p; |
1178 | char **s; |
1181 | char **s; |
1179 | XIMStyles *xim_styles; |
1182 | XIMStyles *xim_styles; |
1180 | XVaNestedList preedit_attr, status_attr; |
1183 | XVaNestedList preedit_attr, status_attr; |
1181 | XIMCallback ximcallback; |
1184 | |
|
|
1185 | if (!((p = XSetLocaleModifiers (modifiers)) && *p)) |
|
|
1186 | return false; |
1182 | |
1187 | |
1183 | D_MAIN((stderr, "rxvt_IM_get_IC()")); |
1188 | D_MAIN((stderr, "rxvt_IM_get_IC()")); |
1184 | xim = XOpenIM (display->display, NULL, NULL, NULL); |
1189 | input_method = display->get_xim (locale, modifiers); |
1185 | if (xim == NULL) |
1190 | if (input_method == NULL) |
1186 | return False; |
1191 | return false; |
|
|
1192 | |
|
|
1193 | xim = input_method->xim; |
1187 | |
1194 | |
1188 | xim_styles = NULL; |
1195 | xim_styles = NULL; |
1189 | if (XGetIMValues (xim, XNQueryInputStyle, &xim_styles, NULL) |
1196 | if (XGetIMValues (xim, XNQueryInputStyle, &xim_styles, NULL) |
1190 | || !xim_styles || !xim_styles->count_styles) |
1197 | || !xim_styles || !xim_styles->count_styles) |
1191 | { |
1198 | { |
1192 | XCloseIM(xim); |
1199 | display->put_xim (input_method); |
1193 | return False; |
1200 | return false; |
1194 | } |
1201 | } |
1195 | |
1202 | |
1196 | p = rs[Rs_preeditType] ? rs[Rs_preeditType] |
1203 | p = rs[Rs_preeditType] ? rs[Rs_preeditType] : "OverTheSpot,OffTheSpot,Root"; |
1197 | : "OverTheSpot,OffTheSpot,Root"; |
|
|
1198 | s = rxvt_splitcommastring(p); |
1204 | s = rxvt_splitcommastring(p); |
1199 | for (i = found = 0; !found && s[i]; i++) |
1205 | for (i = found = 0; !found && s[i]; i++) |
1200 | { |
1206 | { |
1201 | if (!STRCMP(s[i], "OverTheSpot")) |
1207 | if (!STRCMP(s[i], "OverTheSpot")) |
1202 | input_style = (XIMPreeditPosition | XIMStatusNothing); |
1208 | input_style = (XIMPreeditPosition | XIMStatusNothing); |
… | |
… | |
1210 | { |
1216 | { |
1211 | found = 1; |
1217 | found = 1; |
1212 | break; |
1218 | break; |
1213 | } |
1219 | } |
1214 | } |
1220 | } |
|
|
1221 | |
1215 | for (i = 0; s[i]; i++) |
1222 | for (i = 0; s[i]; i++) |
1216 | free(s[i]); |
1223 | free (s[i]); |
|
|
1224 | |
1217 | free(s); |
1225 | free (s); |
1218 | XFree(xim_styles); |
1226 | XFree (xim_styles); |
1219 | |
1227 | |
1220 | if (!found) |
1228 | if (!found) |
1221 | { |
1229 | { |
1222 | XCloseIM(xim); |
1230 | display->put_xim (input_method); |
1223 | return False; |
1231 | return false; |
1224 | } |
1232 | } |
1225 | |
|
|
1226 | ximcallback.callback = rxvt_IMDestroyCallback; |
|
|
1227 | |
|
|
1228 | /* XXX: not sure why we need this (as well as IC one below) */ |
|
|
1229 | XSetIMValues(xim, XNDestroyCallback, &ximcallback, NULL); |
|
|
1230 | |
1233 | |
1231 | preedit_attr = status_attr = NULL; |
1234 | preedit_attr = status_attr = NULL; |
1232 | |
1235 | |
1233 | if (input_style & XIMPreeditPosition) |
1236 | if (input_style & XIMPreeditPosition) |
1234 | { |
1237 | { |
1235 | set_size (&rect); |
1238 | im_set_size (&rect); |
1236 | set_position (&spot); |
1239 | im_set_position (&spot); |
1237 | set_color (&fg, &bg); |
1240 | im_set_color (&fg, &bg); |
1238 | |
1241 | |
1239 | preedit_attr = XVaCreateNestedList(0, XNArea, &rect, |
1242 | preedit_attr = XVaCreateNestedList(0, XNArea, &rect, |
1240 | XNSpotLocation, &spot, |
1243 | XNSpotLocation, &spot, |
1241 | XNForeground, fg, XNBackground, bg, |
1244 | XNForeground, fg, XNBackground, bg, |
1242 | //XNFontSet, TermWin.fontset, |
1245 | //XNFontSet, TermWin.fontset, |
1243 | NULL); |
1246 | NULL); |
1244 | } |
1247 | } |
1245 | else if (input_style & XIMPreeditArea) |
1248 | else if (input_style & XIMPreeditArea) |
1246 | { |
1249 | { |
1247 | set_color (&fg, &bg); |
1250 | im_set_color (&fg, &bg); |
1248 | |
1251 | |
1249 | /* |
1252 | /* |
1250 | * The necessary width of preedit area is unknown |
1253 | * The necessary width of preedit area is unknown |
1251 | * until create input context. |
1254 | * until create input context. |
1252 | */ |
1255 | */ |
1253 | needed_rect.width = 0; |
1256 | needed_rect.width = 0; |
1254 | |
1257 | |
1255 | set_preedit_area(&rect, &status_rect, &needed_rect); |
1258 | im_set_preedit_area (&rect, &status_rect, &needed_rect); |
1256 | |
1259 | |
1257 | preedit_attr = XVaCreateNestedList(0, XNArea, &rect, |
1260 | preedit_attr = XVaCreateNestedList(0, XNArea, &rect, |
1258 | XNForeground, fg, XNBackground, bg, |
1261 | XNForeground, fg, XNBackground, bg, |
1259 | //XNFontSet, TermWin.fontset, |
1262 | //XNFontSet, TermWin.fontset, |
1260 | NULL); |
1263 | NULL); |
1261 | status_attr = XVaCreateNestedList(0, XNArea, &status_rect, |
1264 | status_attr = XVaCreateNestedList(0, XNArea, &status_rect, |
1262 | XNForeground, fg, XNBackground, bg, |
1265 | XNForeground, fg, XNBackground, bg, |
1263 | //XNFontSet, TermWin.fontset, |
1266 | //XNFontSet, TermWin.fontset, |
1264 | NULL); |
1267 | NULL); |
1265 | } |
1268 | } |
|
|
1269 | |
1266 | Input_Context = XCreateIC(xim, XNInputStyle, input_style, |
1270 | Input_Context = XCreateIC(xim, XNInputStyle, input_style, |
1267 | XNClientWindow, TermWin.parent[0], |
1271 | XNClientWindow, TermWin.parent[0], |
1268 | XNFocusWindow, TermWin.parent[0], |
1272 | XNFocusWindow, TermWin.parent[0], |
1269 | XNDestroyCallback, &ximcallback, |
|
|
1270 | preedit_attr ? XNPreeditAttributes : NULL, |
1273 | preedit_attr ? XNPreeditAttributes : NULL, |
1271 | preedit_attr, |
1274 | preedit_attr, |
1272 | status_attr ? XNStatusAttributes : NULL, |
1275 | status_attr ? XNStatusAttributes : NULL, |
1273 | status_attr, NULL); |
1276 | status_attr, NULL); |
1274 | if (preedit_attr) |
1277 | if (preedit_attr) XFree(preedit_attr); |
1275 | XFree(preedit_attr); |
1278 | if (status_attr) XFree(status_attr); |
1276 | if (status_attr) |
1279 | |
1277 | XFree(status_attr); |
|
|
1278 | if (Input_Context == NULL) |
1280 | if (Input_Context == NULL) |
1279 | { |
1281 | { |
1280 | rxvt_print_error("failed to create input context"); |
1282 | rxvt_print_error("failed to create input context"); |
1281 | XCloseIM(xim); |
1283 | display->put_xim (input_method); |
1282 | return False; |
1284 | return false; |
1283 | } |
1285 | } |
|
|
1286 | |
1284 | if (input_style & XIMPreeditArea) |
1287 | if (input_style & XIMPreeditArea) |
1285 | IMSetStatusPosition (); |
1288 | IMSetStatusPosition (); |
|
|
1289 | |
1286 | D_MAIN((stderr, "rxvt_IM_get_IC() - successful connection")); |
1290 | D_MAIN((stderr, "rxvt_IM_get_IC() - successful connection")); |
1287 | return True; |
1291 | return true; |
1288 | } |
1292 | } |
1289 | |
1293 | |
1290 | /* |
|
|
1291 | * X manual pages and include files don't match on some systems: |
|
|
1292 | * some think this is an XIDProc and others an XIMProc so we can't |
|
|
1293 | * use the first argument - need to update this to be nice for |
|
|
1294 | * both types via some sort of configure detection |
|
|
1295 | */ |
|
|
1296 | /* ARGSUSED */ |
|
|
1297 | /* EXTPROTO */ |
|
|
1298 | void |
1294 | void |
1299 | rxvt_IMInstantiateCallback(Display * unused |
1295 | rxvt_term::im_cb () |
1300 | __attribute__ ((unused)), XPointer client_data |
|
|
1301 | __attribute__ ((unused)), XPointer call_data |
|
|
1302 | __attribute__ ((unused))) |
|
|
1303 | { |
1296 | { |
1304 | int i, found, had_im; |
1297 | int i, found, had_im; |
1305 | const char *p; |
1298 | const char *p; |
1306 | char **s; |
1299 | char **s; |
1307 | char buf[IMBUFSIZ]; |
1300 | char buf[IMBUFSIZ]; |
1308 | |
1301 | |
|
|
1302 | im_destroy (); |
|
|
1303 | |
1309 | D_MAIN((stderr, "rxvt_IMInstantiateCallback()")); |
1304 | D_MAIN((stderr, "rxvt_IMInstantiateCallback()")); |
1310 | if (GET_R->Input_Context) |
1305 | if (Input_Context) |
1311 | return; |
1306 | return; |
1312 | |
1307 | |
1313 | #if defined(HAVE_XSETLOCALE) || defined(HAVE_SETLOCALE) |
1308 | #if defined(HAVE_XSETLOCALE) || defined(HAVE_SETLOCALE) |
1314 | if (GET_R->rs[Rs_imLocale]) |
1309 | if (rs[Rs_imLocale]) |
1315 | setlocale (LC_CTYPE, GET_R->rs[Rs_imLocale]); |
1310 | setlocale (LC_CTYPE, rs[Rs_imLocale]); |
1316 | #endif |
1311 | #endif |
1317 | |
1312 | |
1318 | p = GET_R->rs[Rs_inputMethod]; |
1313 | p = rs[Rs_inputMethod]; |
1319 | if (p && *p) |
1314 | if (p && *p) |
1320 | { |
1315 | { |
1321 | bool found = false; |
1316 | bool found = false; |
1322 | |
1317 | |
1323 | s = rxvt_splitcommastring (p); |
1318 | s = rxvt_splitcommastring (p); |
… | |
… | |
1325 | { |
1320 | { |
1326 | if (*s[i]) |
1321 | if (*s[i]) |
1327 | { |
1322 | { |
1328 | STRCPY (buf, "@im="); |
1323 | STRCPY (buf, "@im="); |
1329 | STRNCAT (buf, s[i], IMBUFSIZ - 5); |
1324 | STRNCAT (buf, s[i], IMBUFSIZ - 5); |
1330 | if ((p = XSetLocaleModifiers (buf)) && *p && GET_R->IM_get_IC ()) |
1325 | if (IM_get_IC (buf)) |
1331 | { |
1326 | { |
1332 | found = true; |
1327 | found = true; |
1333 | break; |
1328 | break; |
1334 | } |
1329 | } |
1335 | } |
1330 | } |
… | |
… | |
1341 | if (found) |
1336 | if (found) |
1342 | goto done; |
1337 | goto done; |
1343 | } |
1338 | } |
1344 | |
1339 | |
1345 | /* try with XMODIFIERS env. var. */ |
1340 | /* try with XMODIFIERS env. var. */ |
1346 | if ((p = XSetLocaleModifiers ("")) && *p |
1341 | if (IM_get_IC ("")) |
1347 | && GET_R->IM_get_IC ()) |
|
|
1348 | goto done; |
1342 | goto done; |
1349 | |
1343 | |
1350 | /* try with no modifiers base IF the user didn't specify an IM */ |
1344 | /* try with no modifiers base IF the user didn't specify an IM */ |
1351 | if ((p = XSetLocaleModifiers ("@im=none")) && *p |
1345 | if (IM_get_IC ("@im=none")) |
1352 | && GET_R->IM_get_IC () == True) |
|
|
1353 | goto done; |
1346 | goto done; |
1354 | |
1347 | |
1355 | done: |
1348 | done: |
1356 | #if defined(HAVE_XSETLOCALE) || defined(HAVE_SETLOCALE) |
1349 | #if defined(HAVE_XSETLOCALE) || defined(HAVE_SETLOCALE) |
1357 | if (GET_R->rs[Rs_imLocale]) |
1350 | if (rs[Rs_imLocale]) |
1358 | setlocale (LC_CTYPE, GET_R->locale); |
1351 | setlocale (LC_CTYPE, locale); |
1359 | #endif |
1352 | #endif |
1360 | } |
1353 | } |
1361 | |
1354 | |
1362 | void |
1355 | void |
1363 | rxvt_term::IMSetStatusPosition () |
1356 | rxvt_term::IMSetStatusPosition () |
… | |
… | |
1373 | /* Getting the necessary width of preedit area */ |
1366 | /* Getting the necessary width of preedit area */ |
1374 | status_attr = XVaCreateNestedList(0, XNAreaNeeded, &needed_rect, NULL); |
1367 | status_attr = XVaCreateNestedList(0, XNAreaNeeded, &needed_rect, NULL); |
1375 | XGetICValues(Input_Context, XNStatusAttributes, status_attr, NULL); |
1368 | XGetICValues(Input_Context, XNStatusAttributes, status_attr, NULL); |
1376 | XFree(status_attr); |
1369 | XFree(status_attr); |
1377 | |
1370 | |
1378 | set_preedit_area(&preedit_rect, &status_rect, needed_rect); |
1371 | im_set_preedit_area (&preedit_rect, &status_rect, needed_rect); |
1379 | |
1372 | |
1380 | preedit_attr = XVaCreateNestedList(0, XNArea, &preedit_rect, NULL); |
1373 | preedit_attr = XVaCreateNestedList(0, XNArea, &preedit_rect, NULL); |
1381 | status_attr = XVaCreateNestedList(0, XNArea, &status_rect, NULL); |
1374 | status_attr = XVaCreateNestedList(0, XNArea, &status_rect, NULL); |
1382 | |
1375 | |
1383 | XSetICValues(Input_Context, |
1376 | XSetICValues(Input_Context, |