It looks like this is the place to make the change:
/*F*/static VOID doubleclick(GD gd)
{
UWORD qualifier;
WORD x, y;
/* get values from input-handler under protection */
Forbid();
qualifier = gd->gd_Event.ie_Qualifier;
x = gd->gd_Event.ie_X;
y = gd->gd_Event.ie_Y;
Permit();
/* the first click */
writemouseevent(gd, IECODE_LBUTTON, qualifier, x, y);
writemouseevent(gd, IECODE_LBUTTON | IECODE_UP_PREFIX, qualifier, x, y);
/* wait some time */
Delay(gd->gd_Speed);
/* and the first click */
writemouseevent(gd, IECODE_LBUTTON, qualifier, x, y);
writemouseevent(gd, IECODE_LBUTTON | IECODE_UP_PREFIX, qualifier, x, y);
}
It would be quite a hack but you might simply get away with removing the second click and injecting the desired qualifier keycode in "qualifier" like so:
qualifier = gd->gd_Event.ie_Qualifier | IEQUALIFIER_RCOMMAND;
Of course you'd need to change IECODE_LBUTTON to IECODE_RBUTTON too ;-)
Alas I don't currently have shapeshifter nor the time to mess about with it.
-edit-
This is pretty hacky, since you are setting the state of a InputEvent.ie_Qualifier that was never really set by a key down, so there could be some weirdness.
A cleaner way would be to inject an InputEvent for pressing the key, then the right mouse press, then the right mouse release and finally the key release.
That said, I think you'd get away with it on the grounds that applications often don't internally track such changes since each InputEvent generally comes complete with all the current qualifier keys in ie_Qualifier principally so you don't have to track them ;-)