[hackers] [st] Adding error checks for XCreateIC and XOpenIM. || Christoph Lohmann

From: <git_AT_suckless.org>
Date: Tue, 11 Dec 2012 08:34:54 +0100

commit 3c6ec1995d8ec4d8d5da7ca81d15adfdb08086aa
Author: Christoph Lohmann <20h_AT_r-36.net>
Date: Tue Dec 11 08:32:08 2012 +0100

    Adding error checks for XCreateIC and XOpenIM.

diff --git a/TODO b/TODO
index b1af774..a4cfeee 100644
--- a/TODO
+++ b/TODO
_AT_@ -17,7 +17,6 @@ code & interface
 bugs
 ----
 
-* handle XOpenMI() errors
 * fix shift up/down (shift selection in emacs)
 * fix selection paste for xatom STRING
 * fix umlaut handling in settitle
diff --git a/st.c b/st.c
index 42061b9..da5f78d 100644
--- a/st.c
+++ b/st.c
_AT_@ -2431,9 +2431,13 @@ xinit(void) {
 
         /* input methods */
         xw.xim = XOpenIM(xw.dpy, NULL, NULL, NULL);
+ if(xw.xim == NULL)
+ die("XOpenIM failed. Could not open input device.
");
         xw.xic = XCreateIC(xw.xim, XNInputStyle, XIMPreeditNothing
                                            | XIMStatusNothing, XNClientWindow, xw.win,
                                            XNFocusWindow, xw.win, NULL);
+ if(xw.xic == NULL)
+ die("XCreateIC failed. Could not obtain input method.
");
 
         /* white cursor, black outline */
         cursor = XCreateFontCursor(xw.dpy, XC_xterm);
Received on Tue Dec 11 2012 - 08:34:54 CET

This archive was generated by hypermail 2.3.0 : Tue Dec 11 2012 - 08:36:07 CET