palmer@MWSUN.MITRE.ORG (05/13/89)
Hello,
I've been trying, unsuccessfully, to create a window that has a round
icon of a globe (from Poskbitmaptars.) I'm using the following
code (error checking ommitted) :
Display *display ;
Window win, rwin;
int screen, status, x=0, y=0 ;
unsigned width, height ;
Pixmap globe_pixmap, globe_mask_pixmap ;
char *globe = "/usr/users/palmer/bitmaps/globes/globe" ;
char *globe_mask = "/usr/users/palmer/bitmaps/globes/globeMask" ;
XWMHints wm_hints, *ret_hints ;
screen = DefaultScreen(display);
rwin = RootWindow(display, screen) ;
status =
XReadBitmapFile(display, rwin, globe, &width, &height,
&globe_pixmap, &hotx, &hoty) ;
status =
XReadBitmapFile(display, rwin, globe_mask, &width, &height,
&globe_mask_pixmap, &hotx, &hoty) ;
win = XCreateSimpleWindow(display, rwin, x, y, width, height,
border_width, BlackPixel(display, screen),
WhitePixel(display, screen)) ;
wm_hints.flags = IconPixmapHint | IconMaskHint ;
wm_hints.icon_pixmap = globe_pixmap ;
wm_hints.icon_mask = globe_mask_pixmap ;
XSetWMHints(display, win, &wm_hints);
XMapWindow(display, win);
.
.
.
(event handling ommitted)
where "globe" is a bitmap of the globe and "globe_mask" is a bitmap of a
solid ball slightly larger than "globe". I get an icon with the globe,
but it is not masked (ie. it is square instead of round.) If I try :
xsetroot -cursor globe globeMask
I get a globe cursor that is correctly masked. Furthermore, when I add
the following to my code :
ret_hints = XGetWMHints(display, win) ;
XSetWindowBackgroundPixmap(display, win, ret_hints->icon_mask) ;
I get the solid ball in my window; so I know the pixmaps are correct.
If anyone has been able to mask an icon, would you please tell me what
I'm doing wrong?
Forrest Palmer
palmer@mwsun.mitre.org
palmer@mitre.orgrws@EXPO.LCS.MIT.EDU (05/16/89)
If anyone has been able to mask an icon, would you please tell me what
I'm doing wrong?
Probably you're using a window manager that ignores icon_mask.