add xim support
This commit is contained in:
parent
35d070b093
commit
d3f7be8978
28
dmenu.c
28
dmenu.c
|
@ -577,7 +577,7 @@ run(void)
|
||||||
XEvent ev;
|
XEvent ev;
|
||||||
|
|
||||||
while (!XNextEvent(dpy, &ev)) {
|
while (!XNextEvent(dpy, &ev)) {
|
||||||
if (XFilterEvent(&ev, win))
|
if (XFilterEvent(&ev, None))
|
||||||
continue;
|
continue;
|
||||||
switch(ev.type) {
|
switch(ev.type) {
|
||||||
case DestroyNotify:
|
case DestroyNotify:
|
||||||
|
@ -694,15 +694,29 @@ setup(void)
|
||||||
CWOverrideRedirect | CWBackPixel | CWEventMask, &swa);
|
CWOverrideRedirect | CWBackPixel | CWEventMask, &swa);
|
||||||
XSetClassHint(dpy, win, &ch);
|
XSetClassHint(dpy, win, &ch);
|
||||||
|
|
||||||
|
|
||||||
/* input methods */
|
/* input methods */
|
||||||
if ((xim = XOpenIM(dpy, NULL, NULL, NULL)) == NULL)
|
if ((xim = XOpenIM(dpy, NULL, NULL, NULL)) == NULL) {
|
||||||
die("XOpenIM failed: could not open input device");
|
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");
|
||||||
|
}
|
||||||
|
}
|
||||||
xic = XCreateIC(xim, XNInputStyle, XIMPreeditNothing | XIMStatusNothing,
|
xic = XCreateIC(xim, XNInputStyle, XIMPreeditNothing | XIMStatusNothing,
|
||||||
XNClientWindow, win, XNFocusWindow, win, NULL);
|
XNClientWindow, embed ? win : parentwin, XNFocusWindow, embed ? win : parentwin, NULL);
|
||||||
|
|
||||||
XMapRaised(dpy, win);
|
XMapRaised(dpy, win);
|
||||||
|
XVaNestedList preedit_attr;
|
||||||
|
XPoint spot;
|
||||||
|
|
||||||
|
spot.x = x;
|
||||||
|
spot.y = topbar ? y + mh: 0;
|
||||||
|
|
||||||
|
preedit_attr = XVaCreateNestedList(0, XNSpotLocation, &spot, NULL);
|
||||||
|
XSetICValues(xic, XNPreeditAttributes, preedit_attr, NULL);
|
||||||
|
XFree(preedit_attr);
|
||||||
|
|
||||||
if (embed) {
|
if (embed) {
|
||||||
XReparentWindow(dpy, win, parentwin, x, y);
|
XReparentWindow(dpy, win, parentwin, x, y);
|
||||||
XSelectInput(dpy, parentwin, FocusChangeMask | SubstructureNotifyMask);
|
XSelectInput(dpy, parentwin, FocusChangeMask | SubstructureNotifyMask);
|
||||||
|
@ -770,6 +784,8 @@ main(int argc, char *argv[])
|
||||||
|
|
||||||
if (!setlocale(LC_CTYPE, "") || !XSupportsLocale())
|
if (!setlocale(LC_CTYPE, "") || !XSupportsLocale())
|
||||||
fputs("warning: no locale support\n", stderr);
|
fputs("warning: no locale support\n", stderr);
|
||||||
|
if (!XSetLocaleModifiers(""))
|
||||||
|
fputs("warning: no locale modifiers support\n", stderr);
|
||||||
if (!(dpy = XOpenDisplay(NULL)))
|
if (!(dpy = XOpenDisplay(NULL)))
|
||||||
die("cannot open display");
|
die("cannot open display");
|
||||||
screen = DefaultScreen(dpy);
|
screen = DefaultScreen(dpy);
|
||||||
|
|
Loading…
Reference in New Issue