From: gordon@madmax.uwaterloo.ca (Gordon R. Strachan)
Subject: Re: Xv library
Keywords: XvRegisterDragWindow XvRegisterDropCallback Xv
Organization: University of Waterloo
Date: Tue, 17 Nov 1992 16:51:11 GMT

In article <1992Nov16.172433.21589@bnr.ca> iankent@bnr.ca writes:
>  I am using Motif1.1/X11 R4/HP-UX 8.0 with HPVUE and am interested in
>using the following functions in the Xv library. The only documentation
>I have regarding these functions is that in the header file.  Could
>anyone out there send and/or direct me to some documentation/code
>regarding the use of these functions.
>
>/usr/include/Motif1.1/Xv/XvDrag.h
>....
>extern void XvRegisterDragWindow();
>extern void XvRegisterDropCallback();

Well, the last time I tried to play with this stuff I was told that it was
undocumented on purpose because HP plans to change it in the future.  So,
you really aren't supposed to play with it.  However, its really not that
had to figure out what you have to do, given the documentation in the
include file.  First you call XvInit to initialize the vue stuff.  Next
you install the handler with the XvRegisterDropCallback.  Then you call
XvRegisterDragWindow to make your window a valid drop window.  Most of the
parameters are pretty self explainatory with the exception of the
secondaryHotspot and primaryHotspot.  The include file tells you the valid
syntax of this string but doesn't tell you what it means.  These guys define
the areas within the window which data can be dropped into.  The difference
between the primary and secondary is that the primary is highlighted when
the drop cursor enters and the secondary isn't.  There may be other
differences but I am not sure.  So, the only thing left to figure out is
the type field for the hotspot.  Well, it is clear that this defines the
type of data that you are willing to accept, similar to the cut and paste
selection.  The question is then what is a valid data type.  It appears that
this can be any string.  But, you have to agree with the drop type that
the client who initialized the drop, at least I think so, it is not clear to
me who decides on what the type of the drop is.  Anyway, suppose we want to
be able to do a drop from the filemanager.  We then have to figure out what
kind of data it will drop on us.  Unfortunately this is undocumented so we
are kind of out of luck.  But, if we take an example of a program which does
accept drops, we can perhaps determine the correct types.  If we do a
"strings" on vuepad we find the line:
=%dx%d+%d+%d-FileEdit

so, we can make a good guess at the drop type as FileEdit.  This in fact,
seems to work well.  Further, if we look in the directory 
/usr/lib/X11/vue/types we find a number of files of the form *.drag  These
files seem to contain a mapping of file types to drop types for the
filemanager.  But, at the moment, this is all guessing on my part.  It is not
clear to me who reads the drag files.  I suspect it it read by the filemanager
to determine what kind of files correspond to a user defined drop type.
However, how flexible this is, I can't tell.  For example, could I define a
drop zone which is only defined for files ending in *.c

Anyway, I have managed to get something working.  If you like send me mail and
I can send you the code I used.

Gordon