wprefs: route through WMOpenScreen for Wayland-client autodetect

WPrefs.app/main.c was opening the display directly via XOpenDisplay /
WMCreateScreen.  Replaced with WMOpenScreen, which autodetects
Wayland mode from WAYLAND_DISPLAY / DISPLAY env and dispatches to
W_WLClientInit in WINGs (Wayland) or W_X11OpenDisplay
(widgets_x11.c) accordingly.

The XSupportsLocale / XSetLocaleModifiers calls are now skipped in
Wayland mode (they're X11-only).  This is just startup plumbing; WPrefs's
many tab modules still have direct Xlib calls that won't work as a
pure Wayland client until each is ported through WINGs vtables.  This
commit gets us a minimal Wayland-aware launch path; further work
required to actually run native.
This commit is contained in:
Window Maker 2026-05-24 11:38:55 +02:00
parent ef06f5ad8e
commit 5417d3cbbd
1 changed files with 13 additions and 12 deletions

View File

@ -81,7 +81,6 @@ void AddDeadChildHandler(pid_t pid, void (*handler) (void *), void *data)
int main(int argc, char **argv)
{
Display *dpy;
WMScreen *scr;
char *path;
int i;
@ -136,20 +135,22 @@ int main(int argc, char **argv)
bind_textdomain_codeset("WPrefs", "UTF-8");
textdomain("WPrefs");
if (!XSupportsLocale()) {
wwarning(_("X server does not support locale"));
}
if (XSetLocaleModifiers("") == NULL) {
wwarning(_("cannot set locale modifiers"));
/* X11 locale checks only meaningful in X11 mode. In Wayland mode
* locale handling is delegated to xkbcommon / glib. */
if (!getenv("WAYLAND_DISPLAY") || getenv("DISPLAY")) {
if (!XSupportsLocale()) {
wwarning(_("X server does not support locale"));
}
if (XSetLocaleModifiers("") == NULL) {
wwarning(_("cannot set locale modifiers"));
}
}
#endif
dpy = XOpenDisplay(display_name);
if (!dpy) {
wfatal(_("could not open display %s"), XDisplayName(display_name));
exit(0);
}
scr = WMCreateScreen(dpy, DefaultScreen(dpy));
/* WMOpenScreen autodetects Wayland-client mode (WAYLAND_DISPLAY set
* and DISPLAY unset, or display string starts with "wayland").
* In X11 mode it transparently does XOpenDisplay + WMCreateScreen. */
scr = WMOpenScreen(display_name);
if (!scr) {
wfatal(_("could not initialize application"));
exit(0);