st-flexipatch

My st-flexipatch configuration
git clone git://git.ethandl.dev/st-flexipatch
Log | Files | Refs | README | LICENSE

commit e22dab03910d62114fc76b0192f1af662f01743f
parent 7c7d16b843ec747f3ce7635e8ead45c38f50ac2d
Author: bakkeby <bakkeby@gmail.com>
Date:   Tue, 24 Mar 2020 15:36:22 +0100

x: do not instantiate a new nested list on each cursor move (b67c9b)

Diffstat:
Mx.c | 16++++++++++++----
1 file changed, 12 insertions(+), 4 deletions(-)

diff --git a/x.c b/x.c @@ -114,6 +114,8 @@ typedef struct { struct { XIM xim; XIC xic; + XPoint spot; + XVaNestedList spotlist; } ime; Draw draw; Visual *vis; @@ -989,6 +991,9 @@ ximopen(Display *dpy) XNClientWindow, xw.win, XNFocusWindow, xw.win, NULL); if (xw.ime.xic == NULL) die("XCreateIC failed. Could not obtain input method.\n"); + + xw.ime.spotlist = XVaCreateNestedList(0, XNSpotLocation, &xw.ime.spot, + NULL); } void @@ -997,6 +1002,7 @@ ximinstantiate(Display *dpy, XPointer client, XPointer call) ximopen(dpy); XUnregisterIMInstantiateCallback(xw.dpy, NULL, NULL, NULL, ximinstantiate, NULL); + XFree(xw.ime.spotlist); } void @@ -1927,11 +1933,13 @@ xfinishdraw(void) void xximspot(int x, int y) { - XPoint spot = { borderpx + x * win.cw, borderpx + (y + 1) * win.ch }; - XVaNestedList attr = XVaCreateNestedList(0, XNSpotLocation, &spot, NULL); + if (xw.ime.xic == NULL) + return; + + xw.ime.spot.x = borderpx + x * win.cw; + xw.ime.spot.y = borderpx + (y + 1) * win.ch; - XSetICValues(xw.ime.xic, XNPreeditAttributes, attr, NULL); - XFree(attr); + XSetICValues(xw.ime.xic, XNPreeditAttributes, xw.ime.spotlist, NULL); } void