[comp.emacs] Trying to iconize X-emacs

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

Hi,

I'm trying to provide an emacs function which will have it iconized
when running under X. So I built the following function in x11fns.c:

DEFUN ("x-iconify-window", Fx_iconify_window, Sx_iconify_window,
  0, 0, 0,
  "Iconifies the X window.")
  ()
{

  if (WindowMapped) {
    XEvent evt;
    evt.xclient.type = ClientMessage;
    evt.xclient.display = XXdisplay;
    evt.xclient.window = XXwindow;
    evt.xclient.message_type = 
      XInternAtom (XXdisplay, "WM_CHANGE_STATE", False);
    evt.xclient.format = 32;
    evt.xclient.data.l[0] = IconicState;
    XSendEvent (XXdisplay,
		XDefaultRootWindow (XXdisplay),
		False,
		(SubstructureRedirectMask | SubstructureNotifyMask),
		&evt);
    XFlush(XXdisplay);
  }
  return Qnil;
}

However, when I call x-iconify-window, the emacs process exits without
warning on the 'XSendEvent' call.
This iconify function is known to work well in other programs, though.

Any help?

Johan
-- 
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" -------------------------