From ee1e5b0f70c62b46e9610e9bb48aad3f81ecacf6 Mon Sep 17 00:00:00 2001 From: Window Maker Date: Sun, 24 May 2026 08:47:16 +0200 Subject: [PATCH] arch: move X11 locale init into X11 backend display_open MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit XSupportsLocale and XSetLocaleModifiers in main.c were the last direct Xlib calls in src/main.c. Move them into x11_display_open (guarded by I18N) where they naturally belong. The Wayland backend does not need them — locale handling for native Wayland clients is just standard libc, and XWayland clients still receive locale-aware input via the wmaker-attached XWayland server's own setup. main.c is now Xlib-free. --- src/backend/x11/x11_backend.c | 9 +++++++++ src/main.c | 8 -------- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/src/backend/x11/x11_backend.c b/src/backend/x11/x11_backend.c index e729b26..1c3ba3b 100644 --- a/src/backend/x11/x11_backend.c +++ b/src/backend/x11/x11_backend.c @@ -107,6 +107,15 @@ struct WBackendScreen { static void * x11_display_open(const char *name) { + /* Locale init must happen before XOpenDisplay so the X server-side + * input handling honors LC_CTYPE. Previously called from main.c. */ +#ifdef I18N + if (!XSupportsLocale()) + wwarning(_("X server does not support locale")); + if (XSetLocaleModifiers("") == NULL) + wwarning(_("cannot set locale modifiers")); +#endif + Display *d = XOpenDisplay(name); if (!d) return NULL; diff --git a/src/main.c b/src/main.c index 2ea4634..f233e6e 100644 --- a/src/main.c +++ b/src/main.c @@ -748,14 +748,6 @@ static int real_main(int argc, char **argv) bind_textdomain_codeset(MENU_TEXTDOMAIN, "UTF-8"); #endif textdomain("WindowMaker"); - - if (!XSupportsLocale()) { - wwarning(_("X server does not support locale")); - } - - if (XSetLocaleModifiers("") == NULL) { - wwarning(_("cannot set locale modifiers")); - } #endif if (w_global.locale) {