wayland: Phase 10 — guard icon/appicon X11 rendering calls

Add !dpy guards to update_icon_pixmap, wIconPaint, wAppIconPaint,
paint_app_icon, and wAppIconMove so the app-icon creation path
(wApplicationCreate → create_appicon_for_application → wIconUpdate)
does not crash when dpy is NULL in Wayland mode.  X11 pixmap and
window-drawing operations are silently skipped; icon state is still
tracked for future Wayland rendering.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Levi Neely 2026-03-28 20:46:33 +01:00
parent f5cf71a28a
commit e020bba06b
2 changed files with 18 additions and 1 deletions

View File

@ -207,6 +207,10 @@ void paint_app_icon(WApplication *wapp)
if (!wapp || !wapp->app_icon || !wapp->main_window_desc)
return;
/* Phase 79: Wayland — no X11 window system for icon display */
if (!dpy)
return;
icon = wapp->app_icon->icon;
scr = wapp->main_window_desc->screen_ptr;
wapp->app_icon->main_window = wapp->main_window;
@ -369,7 +373,8 @@ static void drawCorner(WIcon * icon)
void wAppIconMove(WAppIcon * aicon, int x, int y)
{
XMoveWindow(dpy, aicon->icon->core->window, x, y);
if (dpy)
XMoveWindow(dpy, aicon->icon->core->window, x, y);
aicon->x_pos = x;
aicon->y_pos = y;
}
@ -404,6 +409,10 @@ void wAppIconPaint(WAppIcon *aicon)
else
wapp = NULL;
/* Phase 79: Wayland — wIconPaint and all X11 drawing are no-ops */
if (!dpy)
return;
wIconPaint(aicon->icon);
# ifdef WS_INDICATOR

View File

@ -660,6 +660,10 @@ void wIconUpdate(WIcon *icon)
void update_icon_pixmap(WIcon *icon)
{
/* Phase 79: Wayland — no X11 pixmap infrastructure; skip rendering */
if (!dpy)
return;
if (icon->pixmap != None)
XFreePixmap(dpy, icon->pixmap);
@ -823,6 +827,10 @@ void wIconPaint(WIcon *icon)
if (!icon || !icon->core || !icon->core->screen_ptr)
return;
/* Phase 79: Wayland — no X11 rendering surface for icon */
if (!dpy)
return;
WScreen *scr = icon->core->screen_ptr;
XClearWindow(dpy, icon->core->window);