Skip to content

Commit

Permalink
debug icon source
Browse files Browse the repository at this point in the history
  • Loading branch information
sagb committed Mar 19, 2024
1 parent 58ed2eb commit 3093ea6
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 5 deletions.
3 changes: 3 additions & 0 deletions src/alttab.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 3 additions & 0 deletions src/gui.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
21 changes: 16 additions & 5 deletions src/win.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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;
}

//
Expand Down Expand Up @@ -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;
}
Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit 3093ea6

Please sign in to comment.