From 3093ea6404c86867b2b07a47afaaf480a8054e9e Mon Sep 17 00:00:00 2001 From: Alexander Kulak Date: Tue, 19 Mar 2024 12:23:54 +0300 Subject: [PATCH] debug icon source --- src/alttab.h | 3 +++ src/gui.c | 3 +++ src/win.c | 21 ++++++++++++++++----- 3 files changed, 22 insertions(+), 5 deletions(-) diff --git a/src/alttab.h b/src/alttab.h index e16e13b..b57916d 100644 --- a/src/alttab.h +++ b/src/alttab.h @@ -87,6 +87,9 @@ typedef struct { Pixmap icon_mask; unsigned int icon_w, icon_h; bool icon_allocated; // we must free icon, because we created it (placeholder or depth conversion) +#ifdef ICON_DEBUG + char icon_src[MAXNAMESZ]; +#endif Pixmap tile; // ready to display. w/h are all equal and defined in gui.c // this constant can't be 0, 1, -1, MAXINT, // because WMs set it to these values incoherently diff --git a/src/gui.c b/src/gui.c index 8292d66..c980de7 100644 --- a/src/gui.c +++ b/src/gui.c @@ -511,6 +511,9 @@ int uiShow(bool direction) g.winlist[i].id, g.winlist[i].reclevel, g.winlist[i].icon_drawable, g.winlist[i].icon_w, g.winlist[i].icon_h, g.winlist[i].name); +#ifdef ICON_DEBUG + msg(0, " %s\n", g.winlist[i].icon_src); +#endif } } // have winlist, now back to uiwin stuff diff --git a/src/win.c b/src/win.c index bd6de1a..5716985 100644 --- a/src/win.c +++ b/src/win.c @@ -265,6 +265,9 @@ int addIconFromProperty(WindowInfo * wi) wi->icon_allocated = true; wi->icon_w = best_w; wi->icon_h = best_h; +#ifdef ICON_DEBUG + snprintf(wi->icon_src, MAXNAMESZ, "from %s", NWI); +#endif XFree(img); free(image32); free(pro); @@ -305,13 +308,15 @@ int addIconFromHints(WindowInfo * wi) } else { msg(0, "no WM hints (%s)\n", wi->name); } + if (hicon == 0) + return 0; + wi->icon_drawable = hicon; if (hmask != 0) wi->icon_mask = hmask; - if (hicon != 0) { - wi->icon_drawable = hicon; - return 1; - } - return 0; +#ifdef ICON_DEBUG + strcpy(wi->icon_src, "from WM hints"); +#endif + return 1; } // @@ -361,6 +366,9 @@ int addIconFromFiles(WindowInfo * wi) } wi->icon_drawable = ic->drawable; wi->icon_mask = ic->mask; +#ifdef ICON_DEBUG + strncpy(wi->icon_src, ic->src_path, MAXNAMESZ); +#endif ret = 1; goto out; } @@ -421,6 +429,9 @@ int addWindowInfo(Window win, int reclevel, int wm_id, unsigned long desktop, WI.icon_w = WI.icon_h = 0; unsigned int icon_depth = 0; WI.icon_allocated = false; +#ifdef ICON_DEBUG + WI.icon_src[0] = '\0'; +#endif // search for icon in window properties, hints or file hash int opt = g.option_iconSrc;