mirror of
https://github.com/mintycube/st.git
synced 2024-10-22 14:05:49 +02:00
x: check we still have an XIC context before accessing it (ce060a)
This commit is contained in:
parent
e22dab0391
commit
2e2d10eca6
7
x.c
7
x.c
@ -1009,6 +1009,7 @@ void
|
|||||||
ximdestroy(XIM xim, XPointer client, XPointer call)
|
ximdestroy(XIM xim, XPointer client, XPointer call)
|
||||||
{
|
{
|
||||||
xw.ime.xim = NULL;
|
xw.ime.xim = NULL;
|
||||||
|
xw.ime.xic = NULL;
|
||||||
XRegisterIMInstantiateCallback(xw.dpy, NULL, NULL, NULL,
|
XRegisterIMInstantiateCallback(xw.dpy, NULL, NULL, NULL,
|
||||||
ximinstantiate, NULL);
|
ximinstantiate, NULL);
|
||||||
}
|
}
|
||||||
@ -2050,13 +2051,15 @@ focus(XEvent *ev)
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
if (ev->type == FocusIn) {
|
if (ev->type == FocusIn) {
|
||||||
XSetICFocus(xw.ime.xic);
|
if (xw.ime.xic)
|
||||||
|
XSetICFocus(xw.ime.xic);
|
||||||
win.mode |= MODE_FOCUSED;
|
win.mode |= MODE_FOCUSED;
|
||||||
xseturgency(0);
|
xseturgency(0);
|
||||||
if (IS_SET(MODE_FOCUS))
|
if (IS_SET(MODE_FOCUS))
|
||||||
ttywrite("\033[I", 3, 0);
|
ttywrite("\033[I", 3, 0);
|
||||||
} else {
|
} else {
|
||||||
XUnsetICFocus(xw.ime.xic);
|
if (xw.ime.xic)
|
||||||
|
XUnsetICFocus(xw.ime.xic);
|
||||||
win.mode &= ~MODE_FOCUSED;
|
win.mode &= ~MODE_FOCUSED;
|
||||||
if (IS_SET(MODE_FOCUS))
|
if (IS_SET(MODE_FOCUS))
|
||||||
ttywrite("\033[O", 3, 0);
|
ttywrite("\033[O", 3, 0);
|
||||||
|
Loading…
Reference in New Issue
Block a user