Group :: Terminais
RPM: aterm
Main Changelog Spec Patches Sources Download Gear Bugs e FR Repocop
Patch: aterm-1.0.0-alt-ulfr-XIM-methods.patch
Download
Download
diff -Naur aterm-1.0.0/src/command.c aterm-1.0.0.me/src/command.c
--- aterm-1.0.0/src/command.c 2005-07-15 18:20:37 +0300
+++ aterm-1.0.0.me/src/command.c 2005-07-15 18:33:30 +0300
@@ -253,7 +253,7 @@
/*{{{ defines: */
-#define KBUFSZ 8 /* size of keyboard mapping buffer */
+#define KBUFSZ 64 /* size of keyboard mapping buffer */
#define STRING_MAX 512 /* max string size for process_xterm_seq() */
#define ESC_ARGS 32 /* max # of args for esc sequences */
@@ -382,7 +382,7 @@
#ifndef NO_XLOCALE
static char *rs_inputMethod = ""; /* XtNinputMethod */
static char *rs_preeditType = NULL; /* XtNpreeditType */
-static XIC Input_Context; /* input context */
+static XIC Input_Context = NULL; /* input context */
#endif /* NO_XLOCALE */
/* command input buffering */
@@ -518,6 +518,13 @@
fprintf(stderr, "Restoring \"%s\" to mode %03o, uid %d, gid %d\n",
ttydev, ttyfd_stat.st_mode, ttyfd_stat.st_uid, ttyfd_stat.st_gid);
#endif
+#ifndef NO_XLOCALE
+ XUnregisterIMInstantiateCallback(Xdisplay, NULL, NULL, NULL, IMInstantiateCallback, NULL);
+/* XXX: Is it needed? If uncommet that then after killing aterm it cycles there;
+ if (Input_Context != NULL) XDestroyIC(Input_Context);
+*/
+ Input_Context = NULL;
+#endif
scr_release();
privileges(RESTORE);
#ifndef __CYGWIN32__
@@ -610,7 +617,7 @@
ttydev = tty_name;
# define PTYCHAR1 "pqrstuvwxyz"
-# define PTYCHAR2 "0123456789abcdef"
+# define PTYCHAR2 "0123456789abcdefghijklmnopqrstuvwxyz"
for (c1 = PTYCHAR1; *c1; c1++) {
ptydev[len - 2] = ttydev[len - 2] = *c1;
for (c2 = PTYCHAR2; *c2; c2++) {
@@ -1233,7 +1240,7 @@
DndSelection = XInternAtom(Xdisplay, "DndSelection", False);
#endif /* OFFIX_DND */
- init_xlocale();
+ XRegisterIMInstantiateCallback(Xdisplay, NULL, NULL, NULL, IMInstantiateCallback, NULL);
/* get number of available file descriptors */
#ifdef _POSIX_VERSION
@@ -1294,6 +1301,17 @@
}
/*}}} */
+/*{{{ XIM_destroy_callback() */
+/* PROTO */
+void
+IMDestroyCallback(XIM xim, XPointer client_data, XPointer call_data)
+{
+ XUnregisterIMInstantiateCallback(Xdisplay, NULL, NULL, NULL, IMInstantiateCallback, NULL);
+ if (Input_Context != NULL ) XDestroyIC(Input_Context);
+ Input_Context = NULL;
+ XRegisterIMInstantiateCallback(Xdisplay, NULL, NULL, NULL, IMInstantiateCallback, NULL);
+}
+
/*{{{ Xlocale */
/*
* This is more or less stolen straight from XFree86 xterm.
@@ -1301,7 +1319,7 @@
*/
/* PROTO */
void
-init_xlocale(void)
+IMInstantiateCallback(Display *display, XPointer client_data, XPointer call_data)
{
#ifndef NO_XLOCALE
char *p, *s, buf[32], tmp[1024];
@@ -1309,9 +1327,13 @@
XIMStyle input_style = 0;
XIMStyles *xim_styles = NULL;
int found;
+ XIMCallback ximcallback;
Input_Context = NULL;
+ ximcallback.callback = IMDestroyCallback;
+ ximcallback.client_data = NULL;
+
# ifndef NO_SETLOCALE
/* setlocale(LC_CTYPE, ""); */ /* XXX: should we do this? */
# endif
@@ -1351,6 +1373,7 @@
print_error("Failed to open input method");
return;
}
+ XSetIMValues(xim, XNDestroyCallback, &ximcallback, NULL);
if (XGetIMValues(xim, XNQueryInputStyle, &xim_styles, NULL) || !xim_styles) {
print_error("input method doesn't support any style");
XCloseIM(xim);
@@ -1405,6 +1428,7 @@
Input_Context = XCreateIC(xim, XNInputStyle, input_style,
XNClientWindow, TermWin.parent,
XNFocusWindow, TermWin.parent,
+ XNDestroyCallback, &ximcallback,
NULL);
if (Input_Context == NULL) {
@@ -1480,10 +1504,11 @@
PrivMode((!numlock_state), PrivMode_aplKP);
}
#ifndef NO_XLOCALE
- if (!XFilterEvent(ev, *(&ev->xkey.window))) {
+ len = 0;
if (Input_Context != NULL) {
Status status_return;
+ kbuf[0] = '\0';
len = XmbLookupString(Input_Context, &ev->xkey, kbuf,
sizeof(kbuf), &keysym,
&status_return);
@@ -1492,8 +1517,6 @@
sizeof(kbuf), &keysym,
&compose);
}
- } else
- len = 0;
#else /* NO_XLOCALE */
len = XLookupString(&ev->xkey, (char *) kbuf, sizeof(kbuf), &keysym, &compose);
/*
@@ -2084,6 +2107,7 @@
refreshed = 0;
XNextEvent(Xdisplay, &ev);
/*fprintf( stderr, "%s:%d Received event %d\n", __FUNCTION__, __LINE__, ev.type );*/
+ if( !XFilterEvent( &ev, ev.xany.window ) )
process_x_event(&ev);
/* in case button actions pushed chars to cmdbuf */