utf8, utf8, win, CurrentTime);
return;
case XK_Left:
+ case XK_KP_Left:
movewordedge(-1);
goto draw;
case XK_Right:
+ case XK_KP_Right:
movewordedge(+1);
goto draw;
case XK_Return:
insert(buf, len);
break;
case XK_Delete:
+ case XK_KP_Delete:
if (text[cursor] == '\0')
return;
cursor = nextrune(+1);
insert(NULL, nextrune(-1) - cursor);
break;
case XK_End:
+ case XK_KP_End:
if (text[cursor] != '\0') {
cursor = strlen(text);
break;
cleanup();
exit(1);
case XK_Home:
+ case XK_KP_Home:
if (sel == matches) {
cursor = 0;
break;
calcoffsets();
break;
case XK_Left:
+ case XK_KP_Left:
if (cursor > 0 && (!sel || !sel->left || lines > 0)) {
cursor = nextrune(-1);
break;
return;
/* fallthrough */
case XK_Up:
+ case XK_KP_Up:
if (sel && sel->left && (sel = sel->left)->right == curr) {
curr = prev;
calcoffsets();
}
break;
case XK_Next:
+ case XK_KP_Next:
if (!next)
return;
sel = curr = next;
calcoffsets();
break;
case XK_Prior:
+ case XK_KP_Prior:
if (!prev)
return;
sel = curr = prev;
sel->out = 1;
break;
case XK_Right:
+ case XK_KP_Right:
if (text[cursor] != '\0') {
cursor = nextrune(+1);
break;
return;
/* fallthrough */
case XK_Down:
+ case XK_KP_Down:
if (sel && sel->right && (sel = sel->right) == next) {
curr = next;
calcoffsets();
XEvent ev;
while (!XNextEvent(dpy, &ev)) {
- if (XFilterEvent(&ev, None))
+ if (XFilterEvent(&ev, win))
continue;
switch(ev.type) {
case DestroyNotify:
/* input methods */
- if ((xim = XOpenIM(dpy, NULL, NULL, NULL)) == NULL) {
- XSetLocaleModifiers("@im=local");
- if ((xim = XOpenIM(dpy, NULL, NULL, NULL)) == NULL) {
- XSetLocaleModifiers("@im=");
- if ((xim = XOpenIM(dpy, NULL, NULL, NULL)) == NULL)
- die("XOpenIM failed: could not open input device");
- }
- }
+ if ((xim = XOpenIM(dpy, NULL, NULL, NULL)) == NULL)
+ die("XOpenIM failed: could not open input device");
xic = XCreateIC(xim, XNInputStyle, XIMPreeditNothing | XIMStatusNothing,
XNClientWindow, win, XNFocusWindow, win, NULL);
XMapRaised(dpy, win);
- XSetInputFocus(dpy, win, RevertToParent, CurrentTime);
if (embed) {
XSelectInput(dpy, parentwin, FocusChangeMask | SubstructureNotifyMask);
if (XQueryTree(dpy, parentwin, &dw, &w, &dws, &du) && dws) {
if (!setlocale(LC_CTYPE, "") || !XSupportsLocale())
fputs("warning: no locale support\n", stderr);
- if (!XSetLocaleModifiers(""))
- fputs("warning: no locale modifiers support\n", stderr);
if (!(dpy = XOpenDisplay(NULL)))
die("cannot open display");
screen = DefaultScreen(dpy);