Lines 253-259
Link Here
|
253 |
|
253 |
|
254 |
/*{{{ defines: */ |
254 |
/*{{{ defines: */ |
255 |
|
255 |
|
256 |
#define KBUFSZ 8 /* size of keyboard mapping buffer */ |
256 |
#define KBUFSZ 64 /* size of keyboard mapping buffer */ |
257 |
#define STRING_MAX 512 /* max string size for process_xterm_seq() */ |
257 |
#define STRING_MAX 512 /* max string size for process_xterm_seq() */ |
258 |
#define ESC_ARGS 32 /* max # of args for esc sequences */ |
258 |
#define ESC_ARGS 32 /* max # of args for esc sequences */ |
259 |
|
259 |
|
Lines 382-388
Link Here
|
382 |
#ifndef NO_XLOCALE |
382 |
#ifndef NO_XLOCALE |
383 |
static char *rs_inputMethod = ""; /* XtNinputMethod */ |
383 |
static char *rs_inputMethod = ""; /* XtNinputMethod */ |
384 |
static char *rs_preeditType = NULL; /* XtNpreeditType */ |
384 |
static char *rs_preeditType = NULL; /* XtNpreeditType */ |
385 |
static XIC Input_Context; /* input context */ |
385 |
static XIC Input_Context = NULL; /* input context */ |
386 |
#endif /* NO_XLOCALE */ |
386 |
#endif /* NO_XLOCALE */ |
387 |
|
387 |
|
388 |
/* command input buffering */ |
388 |
/* command input buffering */ |
Lines 518-523
Link Here
|
518 |
fprintf(stderr, "Restoring \"%s\" to mode %03o, uid %d, gid %d\n", |
518 |
fprintf(stderr, "Restoring \"%s\" to mode %03o, uid %d, gid %d\n", |
519 |
ttydev, ttyfd_stat.st_mode, ttyfd_stat.st_uid, ttyfd_stat.st_gid); |
519 |
ttydev, ttyfd_stat.st_mode, ttyfd_stat.st_uid, ttyfd_stat.st_gid); |
520 |
#endif |
520 |
#endif |
|
|
521 |
#ifndef NO_XLOCALE |
522 |
XUnregisterIMInstantiateCallback(Xdisplay, NULL, NULL, NULL, IMInstantiateCallback, NULL); |
523 |
/* XXX: Is it needed? If uncommet that then after killing aterm it cycles there; |
524 |
if (Input_Context != NULL) XDestroyIC(Input_Context); |
525 |
*/ |
526 |
Input_Context = NULL; |
527 |
#endif |
521 |
scr_release(); |
528 |
scr_release(); |
522 |
privileges(RESTORE); |
529 |
privileges(RESTORE); |
523 |
#ifndef __CYGWIN32__ |
530 |
#ifndef __CYGWIN32__ |
Lines 610-616
Link Here
|
610 |
ttydev = tty_name; |
617 |
ttydev = tty_name; |
611 |
|
618 |
|
612 |
# define PTYCHAR1 "pqrstuvwxyz" |
619 |
# define PTYCHAR1 "pqrstuvwxyz" |
613 |
# define PTYCHAR2 "0123456789abcdef" |
620 |
# define PTYCHAR2 "0123456789abcdefghijklmnopqrstuvwxyz" |
614 |
for (c1 = PTYCHAR1; *c1; c1++) { |
621 |
for (c1 = PTYCHAR1; *c1; c1++) { |
615 |
ptydev[len - 2] = ttydev[len - 2] = *c1; |
622 |
ptydev[len - 2] = ttydev[len - 2] = *c1; |
616 |
for (c2 = PTYCHAR2; *c2; c2++) { |
623 |
for (c2 = PTYCHAR2; *c2; c2++) { |
Lines 1233-1239
Link Here
|
1233 |
DndSelection = XInternAtom(Xdisplay, "DndSelection", False); |
1240 |
DndSelection = XInternAtom(Xdisplay, "DndSelection", False); |
1234 |
#endif /* OFFIX_DND */ |
1241 |
#endif /* OFFIX_DND */ |
1235 |
|
1242 |
|
1236 |
init_xlocale(); |
1243 |
XRegisterIMInstantiateCallback(Xdisplay, NULL, NULL, NULL, IMInstantiateCallback, NULL); |
1237 |
|
1244 |
|
1238 |
/* get number of available file descriptors */ |
1245 |
/* get number of available file descriptors */ |
1239 |
#ifdef _POSIX_VERSION |
1246 |
#ifdef _POSIX_VERSION |
Lines 1294-1299
Link Here
|
1294 |
} |
1301 |
} |
1295 |
/*}}} */ |
1302 |
/*}}} */ |
1296 |
|
1303 |
|
|
|
1304 |
/*{{{ XIM_destroy_callback() */ |
1305 |
/* PROTO */ |
1306 |
void |
1307 |
IMDestroyCallback(XIM xim, XPointer client_data, XPointer call_data) |
1308 |
{ |
1309 |
XUnregisterIMInstantiateCallback(Xdisplay, NULL, NULL, NULL, IMInstantiateCallback, NULL); |
1310 |
if (Input_Context != NULL ) XDestroyIC(Input_Context); |
1311 |
Input_Context = NULL; |
1312 |
XRegisterIMInstantiateCallback(Xdisplay, NULL, NULL, NULL, IMInstantiateCallback, NULL); |
1313 |
} |
1314 |
|
1297 |
/*{{{ Xlocale */ |
1315 |
/*{{{ Xlocale */ |
1298 |
/* |
1316 |
/* |
1299 |
* This is more or less stolen straight from XFree86 xterm. |
1317 |
* This is more or less stolen straight from XFree86 xterm. |
Lines 1301-1307
Link Here
|
1301 |
*/ |
1319 |
*/ |
1302 |
/* PROTO */ |
1320 |
/* PROTO */ |
1303 |
void |
1321 |
void |
1304 |
init_xlocale(void) |
1322 |
IMInstantiateCallback(Display *display, XPointer client_data, XPointer call_data) |
1305 |
{ |
1323 |
{ |
1306 |
#ifndef NO_XLOCALE |
1324 |
#ifndef NO_XLOCALE |
1307 |
char *p, *s, buf[32], tmp[1024]; |
1325 |
char *p, *s, buf[32], tmp[1024]; |
Lines 1309-1317
Link Here
|
1309 |
XIMStyle input_style = 0; |
1327 |
XIMStyle input_style = 0; |
1310 |
XIMStyles *xim_styles = NULL; |
1328 |
XIMStyles *xim_styles = NULL; |
1311 |
int found; |
1329 |
int found; |
|
|
1330 |
XIMCallback ximcallback; |
1312 |
|
1331 |
|
1313 |
Input_Context = NULL; |
1332 |
Input_Context = NULL; |
1314 |
|
1333 |
|
|
|
1334 |
ximcallback.callback = IMDestroyCallback; |
1335 |
ximcallback.client_data = NULL; |
1336 |
|
1315 |
# ifndef NO_SETLOCALE |
1337 |
# ifndef NO_SETLOCALE |
1316 |
/* setlocale(LC_CTYPE, ""); */ /* XXX: should we do this? */ |
1338 |
/* setlocale(LC_CTYPE, ""); */ /* XXX: should we do this? */ |
1317 |
# endif |
1339 |
# endif |
Lines 1351-1356
Link Here
|
1351 |
print_error("Failed to open input method"); |
1373 |
print_error("Failed to open input method"); |
1352 |
return; |
1374 |
return; |
1353 |
} |
1375 |
} |
|
|
1376 |
XSetIMValues(xim, XNDestroyCallback, &ximcallback, NULL); |
1354 |
if (XGetIMValues(xim, XNQueryInputStyle, &xim_styles, NULL) || !xim_styles) { |
1377 |
if (XGetIMValues(xim, XNQueryInputStyle, &xim_styles, NULL) || !xim_styles) { |
1355 |
print_error("input method doesn't support any style"); |
1378 |
print_error("input method doesn't support any style"); |
1356 |
XCloseIM(xim); |
1379 |
XCloseIM(xim); |
Lines 1405-1410
Link Here
|
1405 |
Input_Context = XCreateIC(xim, XNInputStyle, input_style, |
1428 |
Input_Context = XCreateIC(xim, XNInputStyle, input_style, |
1406 |
XNClientWindow, TermWin.parent, |
1429 |
XNClientWindow, TermWin.parent, |
1407 |
XNFocusWindow, TermWin.parent, |
1430 |
XNFocusWindow, TermWin.parent, |
|
|
1431 |
XNDestroyCallback, &ximcallback, |
1408 |
NULL); |
1432 |
NULL); |
1409 |
|
1433 |
|
1410 |
if (Input_Context == NULL) { |
1434 |
if (Input_Context == NULL) { |
Lines 1480-1489
Link Here
|
1480 |
PrivMode((!numlock_state), PrivMode_aplKP); |
1504 |
PrivMode((!numlock_state), PrivMode_aplKP); |
1481 |
} |
1505 |
} |
1482 |
#ifndef NO_XLOCALE |
1506 |
#ifndef NO_XLOCALE |
1483 |
if (!XFilterEvent(ev, *(&ev->xkey.window))) { |
1507 |
len = 0; |
1484 |
if (Input_Context != NULL) { |
1508 |
if (Input_Context != NULL) { |
1485 |
Status status_return; |
1509 |
Status status_return; |
1486 |
|
1510 |
|
|
|
1511 |
kbuf[0] = '\0'; |
1487 |
len = XmbLookupString(Input_Context, &ev->xkey, kbuf, |
1512 |
len = XmbLookupString(Input_Context, &ev->xkey, kbuf, |
1488 |
sizeof(kbuf), &keysym, |
1513 |
sizeof(kbuf), &keysym, |
1489 |
&status_return); |
1514 |
&status_return); |
Lines 1492-1499
Link Here
|
1492 |
sizeof(kbuf), &keysym, |
1517 |
sizeof(kbuf), &keysym, |
1493 |
&compose); |
1518 |
&compose); |
1494 |
} |
1519 |
} |
1495 |
} else |
|
|
1496 |
len = 0; |
1497 |
#else /* NO_XLOCALE */ |
1520 |
#else /* NO_XLOCALE */ |
1498 |
len = XLookupString(&ev->xkey, (char *) kbuf, sizeof(kbuf), &keysym, &compose); |
1521 |
len = XLookupString(&ev->xkey, (char *) kbuf, sizeof(kbuf), &keysym, &compose); |
1499 |
/* |
1522 |
/* |
Lines 2084-2089
Link Here
|
2084 |
refreshed = 0; |
2107 |
refreshed = 0; |
2085 |
XNextEvent(Xdisplay, &ev); |
2108 |
XNextEvent(Xdisplay, &ev); |
2086 |
/*fprintf( stderr, "%s:%d Received event %d\n", __FUNCTION__, __LINE__, ev.type );*/ |
2109 |
/*fprintf( stderr, "%s:%d Received event %d\n", __FUNCTION__, __LINE__, ev.type );*/ |
|
|
2110 |
if( !XFilterEvent( &ev, ev.xany.window ) ) |
2087 |
process_x_event(&ev); |
2111 |
process_x_event(&ev); |
2088 |
|
2112 |
|
2089 |
/* in case button actions pushed chars to cmdbuf */ |
2113 |
/* in case button actions pushed chars to cmdbuf */ |