/*********************************************************************
 *
 *            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 _DNDR_C_
#include "ezfm.h"

int  ezfmDropOnRootWin MY_ANSIARGS((EZ_Item *item, void *data, char **message,
				    int *length, int *needFree));

/*================================================================
 *
 * What to do if an item is droped onto the root window.
 * This is not really DnD since there is no data transaction
 * between clients. This procedure is registered to each item
 * in a Folder.
 *
 *===============================================================*/

int ezfmDropOnRootWin(item, data, message_ret, length_ret, needFree)
     EZ_Item *item;  void *data; char **message_ret; int *length_ret; int *needFree;
{
  FileInfo  *finfo = (FileInfo *)data;

  if(finfo)
    {
      EZ_Widget *icon;
      int       x, y, rx, ry, w, h;

      EZ_GetDnDDropLocation( &x,&y, &rx, &ry);
      EZ_GetDnDDragSrcXYOffset(&x,&y);
      EZ_GetItemDimension(item, &w, &h);
      icon = getCreateIcon(finfo->pathname, rx-x,ry-y);
      EZ_DisplayWidget(icon);
      return(EZ_DND_SUCCESS);
    }
  return(EZ_DND_FAILURE);
}
/******************************************************************/
#undef _DNDR_C_
