/*********************************************************************
 *
 *            EZFM---EZWGL based file manager for X11
 *
 *             Copyright (C) 1998  Maorong Zou
 *
 *
 *  This file is part of EZFM.
 *
 *  EZFM is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2, or (at your option)
 * any later version.
 *
 * EZFM is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with EZFM; see the file COPYING.  If not, write to
 * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. 
 *
 *************************************************************************/




#define _CLIENT_MESSAGE_C_
#include "ezfm.h"

/*----------------------------------------------------------
 *  What to do if one deletes a toplevel widget.
 *  There may be problems here when a transient dialogue
 *  is closed. -------later
 */
void clientMessageHandler(widget, data, etype, xev)
     EZ_Widget *widget; void *data; int etype; XEvent *xev;
{
  XClientMessageEvent *ev = (XClientMessageEvent *)xev;      
      
  if(ev->message_type == ezfmWMProtocolsAtom)
    {
      Atom c = (ev->data.l)[0];
      if(c == ezfmDeleteWindowAtom)
	{
	  if(widget == ezfmToolBox) EZ_HideWidget(widget);
	  else EZ_DestroyWidget(widget);
	  if(countNFolders() == 0) exitEzfm(NULL, NULL);
	}
    }
}
/*----------------------------------------------------------*/
#undef _CLIENT_MESSAGE_C_
