/*--------------------------------*-C-*---------------------------------*
* File: command.c
*----------------------------------------------------------------------*
- * $Id: command.C,v 1.13 2003-12-05 04:27:20 pcg Exp $
+ * $Id: command.C,v 1.14 2003-12-08 23:14:40 pcg Exp $
*
* All portions of code are copyright by their respective author/s.
* Copyright (c) 1992 John Bovey, University of Kent at Canterbury <jdb@ukc.ac.uk>
#ifdef DEBUG_CMD
static int debug_key = 1; /* accessible by a debugger only */
#endif
-#ifdef USE_XIM
int valid_keysym;
-#endif
unsigned char *kbuf = R->kbuf;
/*
shft = (ev->state & ShiftMask);
ctrl = (ev->state & ControlMask);
meta = (ev->state & R->ModMetaMask);
- if (R->numlock_state || (ev->state & R->ModNumLockMask)) {
+
+ if (R->numlock_state || (ev->state & R->ModNumLockMask))
+ {
R->numlock_state = (ev->state & R->ModNumLockMask);
PrivMode((!R->numlock_state), PrivMode_aplKP);
- }
+ }
+
+ kbuf[0] = 0;
+
#ifdef USE_XIM
- if (R->Input_Context != NULL) {
- Status status_return;
+ if (R->Input_Context)
+ {
+ Status status_return;
- kbuf[0] = '\0';
#ifdef X_HAVE_UTF8_STRING
len = Xutf8LookupString(R->Input_Context, ev, (char *)kbuf,
KBUFSZ, &keysym, &status_return);
#endif
valid_keysym = ((status_return == XLookupKeySym)
|| (status_return == XLookupBoth));
- } else {
- len = XLookupString(ev, (char *)kbuf, KBUFSZ, &keysym,
- &R->compose);
- valid_keysym = 1;
- }
-#else /* USE_XIM */
- len = XLookupString(ev, (char *)kbuf, KBUFSZ, &keysym,
- &R->compose);
-/*
- * map unmapped Latin[2-4]/Katakana/Arabic/Cyrillic/Greek entries -> Latin1
- * good for installations with correct fonts, but without XLOCALE
- */
- if (!len) {
- if ((keysym >= 0x0100) && (keysym < 0x0800)) {
- kbuf[0] = (keysym & 0xFF);
- kbuf[1] = '\0';
- len = 1;
- } else
- kbuf[0] = '\0';
- }
-#endif /* USE_XIM */
+ }
+ else
+#endif
+ {
+ len = XLookupString(ev, (char *)kbuf, KBUFSZ, &keysym, &R->compose);
+ valid_keysym = !len;
+ }
-#ifdef USE_XIM
if (valid_keysym)
-#endif
- {
+ {
/* for some backwards compatibility */
#if defined(HOTKEY_CTRL) || defined(HOTKEY_META)
# ifdef HOTKEY_CTRL
- if (ctrl) {
+ if (ctrl)
# else
- if (meta) {
+ if (meta)
# endif
- if (keysym == R->ks_bigfont) {
+ {
+ if (keysym == R->ks_bigfont)
+ {
rxvt_change_font(aR_ 0, FONT_UP);
return;
- } else if (keysym == R->ks_smallfont) {
+ }
+ else if (keysym == R->ks_smallfont)
+ {
rxvt_change_font(aR_ 0, FONT_DN);
return;
- }
- }
+ }
+ }
#endif
if (R->TermWin.saveLines) {
# ifdef META8_OPTION
if (R->meta_char == C0_ESC)
# endif
- R->tt_write(&ch, 1);
- R->tt_write(kbuf0, l);
+ R->tt_write (&ch, 1);
+ R->tt_write (kbuf0, l);
return;
} else
#endif
#endif
/* nil */ ;
}
- }
+ }
if (len <= 0)
return; /* not mapped */
/*--------------------------------*-C-*---------------------------------*
* File: init.c
*----------------------------------------------------------------------*
- * $Id: init.C,v 1.9 2003-12-02 21:49:46 pcg Exp $
+ * $Id: init.C,v 1.10 2003-12-08 23:14:40 pcg Exp $
*
* All portions of code are copyright by their respective author/s.
* Copyright (c) 1992 John Bovey, University of Kent at Canterbury <jdb@ukc.ac.uk>
rxvt_print_error("Setting locale failed.");
else
{
- Atom wmlocale;
+ Atom wmlocale;
wmlocale = XInternAtom(R->Xdisplay, "WM_LOCALE_NAME", False);
XChangeProperty(R->Xdisplay, R->TermWin.parent[0], wmlocale,
rxvt_print_error("The locale is not supported by Xlib");
return;
}
+
rxvt_setTermFontSet(aR_ 0);
/* see if we can connect yet */
/*--------------------------------*-C-*---------------------------------*
* File: main.c
*----------------------------------------------------------------------*
- * $Id: main.C,v 1.10 2003-12-03 23:19:44 pcg Exp $
+ * $Id: main.C,v 1.11 2003-12-08 23:14:40 pcg Exp $
*
* All portions of code are copyright by their respective author/s.
* Copyright (c) 1992 John Bovey, University of Kent at Canterbury <jdb@ukc.ac.uk>
__attribute__ ((unused)), XPointer call_data
__attribute__ ((unused)))
{
- dR;
- int i, found, had_im;
- const char *p;
- char **s;
- char buf[IMBUFSIZ];
+ dR;
+ int i, found, had_im;
+ const char *p;
+ char **s;
+ char buf[IMBUFSIZ];
- D_MAIN((stderr, "rxvt_IMInstantiateCallback()"));
- if (R->Input_Context)
- return;
+ D_MAIN((stderr, "rxvt_IMInstantiateCallback()"));
+ if (R->Input_Context)
+ return;
+
+ p = R->rs[Rs_inputMethod];
+ if (p && *p)
+ {
+ bool found = false;
- found = had_im = 0;
- p = R->rs[Rs_inputMethod];
- if (p && *p) {
- had_im = 1;
- s = rxvt_splitcommastring(p);
- for (i = 0; s[i]; i++) {
- if (*s[i]) {
- STRCPY(buf, "@im=");
- STRNCAT(buf, s[i], IMBUFSIZ - 5);
- if ((p = XSetLocaleModifiers(buf)) != NULL && *p
- && (rxvt_IM_get_IC(aR) == True)) {
- found = 1;
- break;
+ s = rxvt_splitcommastring (p);
+ for (i = 0; s[i]; i++)
+ {
+ if (*s[i])
+ {
+ STRCPY (buf, "@im=");
+ STRNCAT (buf, s[i], IMBUFSIZ - 5);
+ if ((p = XSetLocaleModifiers (buf)) && *p
+ && rxvt_IM_get_IC (aR))
+ {
+ found = true;
+ break;
}
}
}
- for (i = 0; s[i]; i++)
- free(s[i]);
- free(s);
- }
- if (found)
- return;
+ for (i = 0; s[i]; i++)
+ free(s[i]);
+ free(s);
-/* try with XMODIFIERS env. var. */
- if ((p = XSetLocaleModifiers("")) != NULL && *p) {
- rxvt_IM_get_IC(aR);
+ if (found)
return;
}
+/* try with XMODIFIERS env. var. */
+ if ((p = XSetLocaleModifiers ("")) && *p
+ && rxvt_IM_get_IC (aR))
+ return;
+
/* try with no modifiers base IF the user didn't specify an IM */
- if (!had_im && (p = XSetLocaleModifiers("@im=none")) != NULL && *p
- && rxvt_IM_get_IC(aR) == True)
- return;
+ if ((p = XSetLocaleModifiers ("@im=none")) && *p
+ && rxvt_IM_get_IC (aR) == True)
+ return;
}
/*