dcmartin@CS.WISC.EDU ("David C. Martin") (12/01/89)
I am attempting to write a short program to set the pixmap for an xterm window. It doesn't seem to modify the hints. Any ideas? dcm ------- #include <stdio.h> #include <X11/X.h> #include <X11/Xlib.h> #include <X11/Xutil.h> extern XWMHints* XGetWMHints(); main(argc, argv) int argc; char** argv; { Display* display = XOpenDisplay(getenv("DISPLAY")); Window window = atoi(getenv("WINDOWID")); int screen = DefaultScreen(display); Window rw = RootWindow(display, screen); XWMHints* hints = (XWMHints*) NULL; int x, y, w, h; Pixmap bitmap; char* fn = (char*) NULL; if (argc == 2) { fn = argv[1]; if ((hints = XGetWMHints(display, window)) != (XWMHints*) NULL) { int status; hints->flags |= IconPixmapHint; status = XReadBitmapFile(display, rw, fn, &w, &h, &bitmap, &x, &y); if (status == BitmapSuccess) { hints->icon_pixmap = bitmap; status = XSetWMHints(display, window, hints); XFree(hints); if (status != BadAlloc && status != BadWindow) { exit(0); } } } } exit(1); }
swick@ATHENA.MIT.EDU (Ralph R. Swick) (12/01/89)
> It doesn't seem to modify the hints. Any ideas?
Sure, you'd better do an XCloseDisplay() before you exit
(or the equivalent XFlush() or XSync() if you want to
look for errors). And where did you get the idea that
XSetWMHints returns status?