static Item *matches, *matchend;
static Item *prev, *curr, *next, *sel;
static Window win;
+static XIC xic;
static int (*fstrncmp)(const char *, const char *, size_t) = strncmp;
static char *(*fstrstr)(const char *, const char *) = strstr;
keypress(XKeyEvent *ev) {
char buf[32];
KeySym ksym;
+ int len;
+ Status status;
- XLookupString(ev, buf, sizeof buf, &ksym, NULL);
+ len = XmbLookupString(xic, ev, buf, sizeof(buf), &ksym, &status);
if(ev->state & ControlMask) {
KeySym lower, upper;
switch(ksym) {
default:
if(!iscntrl(*buf))
- insert(buf, strlen(buf));
+ insert(buf, len);
break;
case XK_Delete:
if(text[cursor] == '\0')
run(void) {
XEvent ev;
- while(!XNextEvent(dc->dpy, &ev))
+ while(!XNextEvent(dc->dpy, &ev)) {
+ if(XFilterEvent(&ev, win))
+ continue;
switch(ev.type) {
case Expose:
if(ev.xexpose.count == 0)
XRaiseWindow(dc->dpy, win);
break;
}
+ }
}
void
int x, y, screen = DefaultScreen(dc->dpy);
Window root = RootWindow(dc->dpy, screen);
XSetWindowAttributes swa;
+ XIM xim;
#ifdef XINERAMA
int n;
XineramaScreenInfo *info;
DefaultVisual(dc->dpy, screen),
CWOverrideRedirect | CWBackPixmap | CWEventMask, &swa);
+ /* input methods */
+ xim = XOpenIM(dc->dpy, NULL, NULL, NULL);
+ xic = XCreateIC(xim, XNInputStyle, XIMPreeditNothing | XIMStatusNothing,
+ XNClientWindow, win, XNFocusWindow, win, NULL);
+
XMapRaised(dc->dpy, win);
resizedc(dc, mw, mh);
drawmenu();