x: check we still have an XIC context before accessing it
This commit is contained in:
parent
2cb539142b
commit
cd785755f2
3
x.c
3
x.c
|
@ -1061,6 +1061,7 @@ void
|
|||
ximdestroy(XIM xim, XPointer client, XPointer call)
|
||||
{
|
||||
xw.ime.xim = NULL;
|
||||
xw.ime.xic = NULL;
|
||||
XRegisterIMInstantiateCallback(xw.dpy, NULL, NULL, NULL,
|
||||
ximinstantiate, NULL);
|
||||
XFree(xw.ime.spotlist);
|
||||
|
@ -1692,12 +1693,14 @@ focus(XEvent *ev)
|
|||
return;
|
||||
|
||||
if (ev->type == FocusIn) {
|
||||
if (xw.ime.xic)
|
||||
XSetICFocus(xw.ime.xic);
|
||||
win.mode |= MODE_FOCUSED;
|
||||
xseturgency(0);
|
||||
if (IS_SET(MODE_FOCUS))
|
||||
ttywrite("\033[I", 3, 0);
|
||||
} else {
|
||||
if (xw.ime.xic)
|
||||
XUnsetICFocus(xw.ime.xic);
|
||||
win.mode &= ~MODE_FOCUSED;
|
||||
if (IS_SET(MODE_FOCUS))
|
||||
|
|
Loading…
Reference in New Issue