Custom icons per window class/name patch

Earle F. Philhower III earle@ziplabel.com
Sun May 18 19:30:00 GMT 2003


Howdy!
At 02:56 PM 5/18/2003 -0400, you wrote:
>Sorry to take this back to a discussion that you guys were having 
>earlier... but I remember that someone wrote something along the lines of, 
>"most window managers include their own set of icons for X apps since most 
>X apps do not set an icon to be shown on the upper-left hand corner of the 
>window".
>When taken in the context of standard X window managers, that sounds 
>plausible.  However, Exceed and XWin-32, if I recall correctly, seem to 
>display upper-left hand corner icons for most X apps.  I sort of doubt 
>that Exceed and XWin-32 come with a set of icons for common X apps, but I 
>could be wrong.
>Can anyone concretely prove to me that there is not a way to do app icons 
>without having a icon config file and a set of icon files for common X 
>apps?  I would really like to avoid the headaches of distributing icons 
>and a new config file, if at all possible.
>I am going to hold off on committing this patch until I am convinced that 
>it is the best way to go.

Yes, you're right for some apps (like the Qt ones Ralf mentioned) the icon is
included in the application itself, and it sets the WM_HINTS accordingly.  You
can then check for it in the winCreateWindow section and also in the WM_HINTS
property handler if it's changed later.  Others don't and then it's up to the
WM to give them one, either from a config file or some built-in defaults.  If
you do an xprop on a window and the WM_HINTS doesn't have a WM_ICON listed then
any icon you're seeing is a figment of the window manager. ;)

Quick check:  xload has an icon it specifies, xterm doesn't
$ xprop  (on xload)   icon only, no bitmask
...
WM_HINTS(WM_HINTS):
                 Client accepts input or input focus: False
                 Initial state is Normal State.
                 bitmap id # to use for icon: 0xa00001
...
$ xprop  (on xterm)  no icon
...
WM_HINTS(WM_HINTS):
                 Client accepts input or input focus: True
                 Initial state is Normal State.
...
$ xprop  (on xclock)  both icon and mask
...
WM_HINTS(WM_HINTS):
                 Client accepts input or input focus: False
                 Initial state is Normal State.
                 bitmap id # to use for icon: 0xc00001
                 bitmap id # of mask for icon: 0xc00003
...

So a full-fledged patch should take that bitmap ID and convert it from an
XBM to a icon resource in the wincreate() function, and give the default or
config file specified icon for xterm.

Also, I didn't intend the change to be an official patch.  Using a xwin.ini
file was just expedient.  The proper thing would be to do a ~/.xwinrc file
format, and not use .icos but XPMs.  Now that the ugly X server parts are
there I figure its easier for someone to put on the finishing touches...


-Earle F. Philhower, III
  earle@ziplabel.com
  cdrlabel - ZipLabel - FlpLabel
  http://www.cdrlabel.com



More information about the Cygwin-xfree mailing list