Currently, for many applications the generic Wine icon or a class default icon is used in window manager caption or taskbar instead of the application icon set with WM_SETICON. See, for instance, Bug 3370.
What actually happens is this: the application icon is correctly set when processing WM_SETICON, but a bit later, when window is mapped, X11DRV_set_wm_hints resets it back to class default (or to none, leading to Wine icon).
It seems that X11DRV_set_wm_hints has been designed to be called only when creating a window: it alocates WM hints -- XAllocWMHints() -- instead of checking for existing ones with XGetWMHints(...), and sets class default icon, instead of checking whether another icon has been set in the meantime.
However, calls to X11DRV_set_wm_hints have been added at mapping a window and changing window style (see x11drv/winpos.c). Thus, Wine currently allocates WM hints anew and resets icon at every mapping and style change of a window.
I attach a patch to X11DRV_set_wm_hints correcting this issue: 1) it checks for existing WM hints before allocating new ones, 2) it resets icon to class default only if no icon hint has been set earlier.
Please, let me know if you see anything wrong with this patch.
Cheers, Juris