
Example 19-1. Sourcing a drag (continued)
if (dragging && drag_pixels++ == 5) {
xv_set(frame, FRAME_LEFT_FOOTER, "Drag and Drop:", 0);
switch (dnd_send_drop(dnd)) {
case XV_OK:
xv_set(frame, FRAME_LEFT_FOOTER,
"Drag and Drop: Began", 0);
break;
case DND_TIMEOUT:
xv_set(frame, FRAME_LEFT_FOOTER,
"Drag and Drop: Timed Out",0);
break;
case DND_ILLEGAL_TARGET:
xv_set(frame, FRAME_LEFT_FOOTER,
"Drag and Drop: Illegal Target",0);
break;
case DND_SELECTION:
xv_set(frame, FRAME_LEFT_FOOTER,
"Drag and Drop: Bad Selection",0);
break;
case DND_ROOT:
xv_set(frame, FRAME_LEFT_FOOTER,
"Drag and Drop: Root Window",0);
break;
case XV_ERROR:
xv_set(frame, FRAME_LEFT_FOOTER,
"Drag and Drop: Failed",0);
break;
}
drag_pixels = 0;
}
}
break;
}
}
PaintObject(object, win, dpy)
DragObject object;
Window win;
Display *dpy;
{
static GC gc;
static int gcCreated = False;
if (!gcCreated) {
XGCValues gcv;
gcv.stipple = (Pixmap) xv_get(object.image, XV_XID);
gcv.fill_style = FillStippled;
gc = XCreateGC(dpy, win, GCStipple|GCForeground|GCBackground|
GCFillStyle, &gcv);
XSetForeground(dpy, gc, BlackPixel(dpy, XDefaultScreen(dpy)));
XSetBackground(dpy, gc, WhitePixel(dpy, XDefaultScreen(dpy)));
}
if (object.inverted) {
XSetFillStyle(dpy, gc, FillSolid);
448 XView Programming Manual