Hi all,

I'm working on an application that creates a Motif OpenGL drawing area
widget using a non-default visual. When the user initiates a drag from
this widget, the code does this:

/* make sure the icon is in the correct colormap and depth */
XtVaGetValues(XmGetXmDisplay(XtDisplay(w)), XmNcolormap, &cmap,
XmNdepth, &depth, NULL);
/* XtVaGetValues(w, XmNcolormap, &cmap, XmNdepth, &depth, NULL); */
XtSetArg(args[i], XmNcolormap, cmap); ++i;
XtSetArg(args[i], XmNdepth, depth); ++i;

XtSetArg(args[i], XmNcursorBackground,
BlackPixelOfScreen(XtScreen(w))); ++i;
XtSetArg(args[i], XmNcursorForeground,
WhitePixelOfScreen(XtScreen(w))); ++i;

context = XmDragStart(w, event, args, i);

This results in an XError:
X Error: BadMatch (invalid parameter attributes) 8
Major opcode: 1
Minor opcode: 0
Resource id: 0x7200002

So I did some investigating and discovered that in the Motif code
(DragC.c, DragContextInitialize) the colormap was being copied from the
widget even though I set it to the same as the root window:
/* pixel values in drag context refer to the source widget's
colormap */
if (dc->drag.sourceWidget) {
Widget sw = dc->drag.sourceWidget;
dc->core.colormap = XmIsGadget(sw) ?
XtParent(sw)->core.colormap : sw->core.colormap;


Motif copies the colormap, but not the depth. If I comment out this
section of code and rebuild Motif, then my app behaves correctly.

Is this a bug? Why does Motif copy the colormap from the widget even
though I already set it in the arg list that was passed to XmDragStart?
If it copies the colormap, why doesn't it copy the depth? Am I doing
something wrong here?