x: do not instantiate a new nested list on each cursor move (b67c9b)
This commit is contained in:
parent
7c7d16b843
commit
e22dab0391
16
x.c
16
x.c
|
@ -114,6 +114,8 @@ typedef struct {
|
||||||
struct {
|
struct {
|
||||||
XIM xim;
|
XIM xim;
|
||||||
XIC xic;
|
XIC xic;
|
||||||
|
XPoint spot;
|
||||||
|
XVaNestedList spotlist;
|
||||||
} ime;
|
} ime;
|
||||||
Draw draw;
|
Draw draw;
|
||||||
Visual *vis;
|
Visual *vis;
|
||||||
|
@ -989,6 +991,9 @@ ximopen(Display *dpy)
|
||||||
XNClientWindow, xw.win, XNFocusWindow, xw.win, NULL);
|
XNClientWindow, xw.win, XNFocusWindow, xw.win, NULL);
|
||||||
if (xw.ime.xic == NULL)
|
if (xw.ime.xic == NULL)
|
||||||
die("XCreateIC failed. Could not obtain input method.\n");
|
die("XCreateIC failed. Could not obtain input method.\n");
|
||||||
|
|
||||||
|
xw.ime.spotlist = XVaCreateNestedList(0, XNSpotLocation, &xw.ime.spot,
|
||||||
|
NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -997,6 +1002,7 @@ ximinstantiate(Display *dpy, XPointer client, XPointer call)
|
||||||
ximopen(dpy);
|
ximopen(dpy);
|
||||||
XUnregisterIMInstantiateCallback(xw.dpy, NULL, NULL, NULL,
|
XUnregisterIMInstantiateCallback(xw.dpy, NULL, NULL, NULL,
|
||||||
ximinstantiate, NULL);
|
ximinstantiate, NULL);
|
||||||
|
XFree(xw.ime.spotlist);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -1927,11 +1933,13 @@ xfinishdraw(void)
|
||||||
void
|
void
|
||||||
xximspot(int x, int y)
|
xximspot(int x, int y)
|
||||||
{
|
{
|
||||||
XPoint spot = { borderpx + x * win.cw, borderpx + (y + 1) * win.ch };
|
if (xw.ime.xic == NULL)
|
||||||
XVaNestedList attr = XVaCreateNestedList(0, XNSpotLocation, &spot, NULL);
|
return;
|
||||||
|
|
||||||
XSetICValues(xw.ime.xic, XNPreeditAttributes, attr, NULL);
|
xw.ime.spot.x = borderpx + x * win.cw;
|
||||||
XFree(attr);
|
xw.ime.spot.y = borderpx + (y + 1) * win.ch;
|
||||||
|
|
||||||
|
XSetICValues(xw.ime.xic, XNPreeditAttributes, xw.ime.spotlist, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|
Loading…
Reference in New Issue