[hackers] [st][PATCH] fix deadkeys handling with XSetLocaleModifiers

From: Jean-Baptiste Poittevin <jb.poittevin_AT_gmail.com>
Date: Tue, 29 Dec 2020 16:38:55 +0100

Giving "_AT_im=none" to XSetLocaleModifiers instead of an empty string
permits wc.ime.xic to be set, and thus enable usage of XmbLookupString
instead of XLookupString in kpress function.

With XmbLookupString, usage of deadkeys has now expected behaviour: for
example, with a french keyboard layout, typing '^' then 'e' gives "ê"
instead of "^e".
---
 x.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/x.c b/x.c
index 120e495..23162ec 100644
--- a/x.c
+++ b/x.c
_AT_@ -1160,6 +1160,11 @@ xinit(int cols, int rows)
 	xw.draw = XftDrawCreate(xw.dpy, xw.buf, xw.vis, xw.cmap);
 
 	/* input methods */
+	if (!XSetLocaleModifiers("_AT_im=none")) {
+		fprintf(stderr, "XSetLocaleModifiers: "
+				"Could not set _AT_im=none.\n");
+	}
+
 	if (!ximopen(xw.dpy)) {
 		XRegisterIMInstantiateCallback(xw.dpy, NULL, NULL, NULL,
 	                                       ximinstantiate, NULL);
_AT_@ -2050,7 +2055,6 @@ run:
 		opt_title = (opt_line || !opt_cmd) ? "st" : opt_cmd[0];
 
 	setlocale(LC_CTYPE, "");
-	XSetLocaleModifiers("");
 	cols = MAX(cols, 1);
 	rows = MAX(rows, 1);
 	tnew(cols, rows);
-- 
2.26.2
Received on Tue Dec 29 2020 - 16:38:55 CET

This archive was generated by hypermail 2.3.0 : Tue Dec 29 2020 - 16:48:34 CET