Setting the window icon (under Win32)



Martyn Russell writes:
 > I have managed to use the gdk_window_set_icon function successfully
 > using gtk 1.2.10 under Redhat 7.2.  However, when I check the same code
 > out to my WindowsNT box to see if it works correctly, it doesnt. 

Yep. gdkwindow-win32.c:gdk_window_set_icon() has this comment by me:

  /* Nothing to do, really. As we share window classes between windows
   * we can't have window-specific icons, sorry. Don't print any warning
   * either.
   */

(I wonder how much overhead a window class is? Would it be worth it to
have individual window classes for each top-level window just to have
the gdk_window_set_icon() functionality?)

gdk_window_set_icon_list() does have a comment by Hans Breuer
indicating that it might be possible to implement it even with shared
window classes:

  /* We could convert it to a hIcon and DrawIcon () it when getting
   * a WM_PAINT with IsIconic, but is it worth it ? Same probably
   * goes for gdk_window_set_icon (). Patches accepted :-)  --hb
   * Or do we only need to deliver the Icon on WM_GETICON ?
   */

However, if I understand the MS Platform SDK documentation right, the
WM_PAINT message is sent to paint a minimized (i.e., iconified) window
only if the window class icon is set to NULL. That would mean that in
order to implement gdk_window_set_icon(), GDK would have to paint
*all* icons manually, I think. (But if the code were there anyway, so
what.) I don't know what happens to the icons in the Alt-Tab task
switcher if the window class icon is NULL, maybe you get the default
(ugly) Windows icon there then? Or is there some other, more obscure,
API to paint that icon on demand?

Seems like there is a need for some experimentation and Google search
for sample code here. Some day.  The gdk_window_set_icon()
functionality is not *that* important, is it?

--tml




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]