[comp.sources.d] XIconifyWindow for calctool on X11R3

jv@mh.nl (Johan Vromans) (02/06/90)

The following routine implements iconifying calctool when running
under an ICCCM compliant X11R3 window manager:

#include <X11/Xlib.h>
#include <X11/Xutil.h>
int
XIconifyWindow(dpy, window, screen)
Display *dpy;
Window window;
Screen screen;
{
  XEvent event;
  event.xclient.type = ClientMessage;
  event.xclient.display = dpy;
  event.xclient.window = window;
  event.xclient.message_type = XInternAtom(dpy, "WM_CHANGE_STATE", False);
  event.xclient.format = 32;
  event.xclient.data.l[0] = IconicState;
  XSendEvent (dpy, DefaultRootWindow(dpy), False,
	      SubstructureRedirectMask|SubstructureNotifyMask,
	      &event);
  XFlush (dpy);
}
--
Johan Vromans				       jv@mh.nl via internet backbones
Multihouse Automatisering bv		       uucp: ..!{uunet,hp4nl}!mh.nl!jv
Doesburgweg 7, 2803 PL Gouda, The Netherlands  phone/fax: +31 1820 62944/62500
------------------------ "Arms are made for hugging" -------------------------