From 3c428e25d92f7984e27dac0157befe553e4eac2f Mon Sep 17 00:00:00 2001 From: Levi Neely Date: Sat, 28 Mar 2026 08:52:35 +0100 Subject: [PATCH] =?UTF-8?q?wayland:=20Phase=2060=20=E2=80=94=20guard=20wsm?= =?UTF-8?q?ap=20X11/rcontext=20paths;=20icon=20name=20from=20XDG=20title?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit wWorkspaceMapUpdate calls XGetImage(dpy) and RCreateImageFromXImage (scr->rcontext) directly; both are NULL in the Wayland path. Add early-return guards so enabling the workspace pager in Wayland mode does not crash. set_workspace_map_background_image calls RConvertImageMask(scr->rcontext) for pixmap textures; guard that path with the same rcontext check. wl_window_get_icon_name was a stub returning False. Implement it to return the XDG toplevel title so window icon labels are populated on the Wayland path (Wayland has no separate WM_ICON_NAME concept). Co-Authored-By: Claude Sonnet 4.6 --- src/backend/wayland/wl_backend.c | 16 +++++++++++++++- src/wsmap.c | 6 ++++++ 2 files changed, 21 insertions(+), 1 deletion(-) diff --git a/src/backend/wayland/wl_backend.c b/src/backend/wayland/wl_backend.c index 202608d..d73d9d3 100644 --- a/src/backend/wayland/wl_backend.c +++ b/src/backend/wayland/wl_backend.c @@ -901,7 +901,21 @@ wl_window_fetch_name(WNativeWindow win, char **name_out) static Bool wl_window_get_icon_name(WNativeWindow win, char **name_out) -{ (void)win; *name_out = NULL; return False; } +{ + /* Phase 60: Wayland has no separate icon-name concept; return the + * XDG toplevel title (same as window_fetch_name) so the WM always + * has something to display in icon labels. */ + struct wl_toplevel_view *v = wl_find_view_by_id(win); + const char *title = (v && v->xdg_surface && v->xdg_surface->toplevel && + v->xdg_surface->toplevel->title) + ? v->xdg_surface->toplevel->title : NULL; + if (title) { + *name_out = strdup(title); + return True; + } + *name_out = NULL; + return False; +} static int wl_prop_get_wmaker_menu(WNativeWindow win, diff --git a/src/wsmap.c b/src/wsmap.c index 037f079..1e714c0 100644 --- a/src/wsmap.c +++ b/src/wsmap.c @@ -66,6 +66,9 @@ void wWorkspaceMapUpdate(WScreen *scr) { XImage *pimg; + if (!dpy || !scr->rcontext) + return; /* Wayland: no X11 root image to capture */ + pimg = XGetImage(dpy, scr->root_win, 0, 0, scr->scr_width, scr->scr_height, AllPlanes, ZPixmap); @@ -152,6 +155,9 @@ static void set_workspace_map_background_image(WWorkspaceMap *wsmap) { Pixmap pixmap, mask; + if (!wsmap->scr->rcontext) + return; /* Wayland: no X11 rendering context */ + if (wPreferences.wsmbackTexture->any.type == WTEX_PIXMAP) { RImage *tmp = wTextureRenderImage(wPreferences.wsmbackTexture, wsmap->wswidth, wsmap->wsheight, WREL_FLAT);