diff options
author | Quentin Rameau <quinq@fifth.space> | 2020-02-02 17:38:36 +0100 |
---|---|---|
committer | Hiltjo Posthuma <hiltjo@codemadness.org> | 2020-02-02 22:56:51 +0100 |
commit | cd785755f2e3e3305c7d2556a04423a40bce060a (patch) | |
tree | c8af8d67da007dbfe1e59423cfc556f914547d99 /x.c | |
parent | 2cb539142b97bd2a5c1a322fd7c063c6afb67c9b (diff) | |
download | st-patched-cd785755f2e3e3305c7d2556a04423a40bce060a.tar.bz2 st-patched-cd785755f2e3e3305c7d2556a04423a40bce060a.tar.xz st-patched-cd785755f2e3e3305c7d2556a04423a40bce060a.zip |
x: check we still have an XIC context before accessing it
Diffstat (limited to 'x.c')
-rw-r--r-- | x.c | 7 |
1 files changed, 5 insertions, 2 deletions
@@ -1061,6 +1061,7 @@ void | |||
1061 | ximdestroy(XIM xim, XPointer client, XPointer call) | 1061 | ximdestroy(XIM xim, XPointer client, XPointer call) |
1062 | { | 1062 | { |
1063 | xw.ime.xim = NULL; | 1063 | xw.ime.xim = NULL; |
1064 | xw.ime.xic = NULL; | ||
1064 | XRegisterIMInstantiateCallback(xw.dpy, NULL, NULL, NULL, | 1065 | XRegisterIMInstantiateCallback(xw.dpy, NULL, NULL, NULL, |
1065 | ximinstantiate, NULL); | 1066 | ximinstantiate, NULL); |
1066 | XFree(xw.ime.spotlist); | 1067 | XFree(xw.ime.spotlist); |
@@ -1692,13 +1693,15 @@ focus(XEvent *ev) | |||
1692 | return; | 1693 | return; |
1693 | 1694 | ||
1694 | if (ev->type == FocusIn) { | 1695 | if (ev->type == FocusIn) { |
1695 | XSetICFocus(xw.ime.xic); | 1696 | if (xw.ime.xic) |
1697 | XSetICFocus(xw.ime.xic); | ||
1696 | win.mode |= MODE_FOCUSED; | 1698 | win.mode |= MODE_FOCUSED; |
1697 | xseturgency(0); | 1699 | xseturgency(0); |
1698 | if (IS_SET(MODE_FOCUS)) | 1700 | if (IS_SET(MODE_FOCUS)) |
1699 | ttywrite("\033[I", 3, 0); | 1701 | ttywrite("\033[I", 3, 0); |
1700 | } else { | 1702 | } else { |
1701 | XUnsetICFocus(xw.ime.xic); | 1703 | if (xw.ime.xic) |
1704 | XUnsetICFocus(xw.ime.xic); | ||
1702 | win.mode &= ~MODE_FOCUSED; | 1705 | win.mode &= ~MODE_FOCUSED; |
1703 | if (IS_SET(MODE_FOCUS)) | 1706 | if (IS_SET(MODE_FOCUS)) |
1704 | ttywrite("\033[O", 3, 0); | 1707 | ttywrite("\033[O", 3, 0); |