wayland: Phase 60 — guard wsmap X11/rcontext paths; icon name from XDG title

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 <noreply@anthropic.com>
This commit is contained in:
Levi Neely 2026-03-28 08:52:35 +01:00
parent e82bb279ab
commit 3c428e25d9
2 changed files with 21 additions and 1 deletions

View File

@ -901,7 +901,21 @@ wl_window_fetch_name(WNativeWindow win, char **name_out)
static Bool static Bool
wl_window_get_icon_name(WNativeWindow win, char **name_out) 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 static int
wl_prop_get_wmaker_menu(WNativeWindow win, wl_prop_get_wmaker_menu(WNativeWindow win,

View File

@ -66,6 +66,9 @@ void wWorkspaceMapUpdate(WScreen *scr)
{ {
XImage *pimg; XImage *pimg;
if (!dpy || !scr->rcontext)
return; /* Wayland: no X11 root image to capture */
pimg = XGetImage(dpy, scr->root_win, 0, 0, pimg = XGetImage(dpy, scr->root_win, 0, 0,
scr->scr_width, scr->scr_height, scr->scr_width, scr->scr_height,
AllPlanes, ZPixmap); AllPlanes, ZPixmap);
@ -152,6 +155,9 @@ static void set_workspace_map_background_image(WWorkspaceMap *wsmap)
{ {
Pixmap pixmap, mask; Pixmap pixmap, mask;
if (!wsmap->scr->rcontext)
return; /* Wayland: no X11 rendering context */
if (wPreferences.wsmbackTexture->any.type == WTEX_PIXMAP) { if (wPreferences.wsmbackTexture->any.type == WTEX_PIXMAP) {
RImage *tmp = wTextureRenderImage(wPreferences.wsmbackTexture, wsmap->wswidth, wsmap->wsheight, WREL_FLAT); RImage *tmp = wTextureRenderImage(wPreferences.wsmbackTexture, wsmap->wswidth, wsmap->wsheight, WREL_FLAT);