you register for events with mrg_listen(mrg,event_mask,x,y,width,height,cb,data1,data) which sets up a callbackfunction of type int cb (MrgEvent *event, void *data1, void *data2), if you need to free data when the callback is destroyed (Which it will be next time the ui is painted; and it isn't an active callback (due to drag)). A destroy notify for the callback with userdata, can be passed by using by mrg_listen_full.
by registering for MRG_DRAG, which is a union of the types MRG_DRAG_PRESS, MRG_DRAG_MOTION and MRG_DRAG_RELEASE; a closure handling the drag gesture event cycle will be registered.
The device_no is 1 for left mouse button 2 for middle mouse button and 3 for right mouse button. device_no 4 and above are multi touch touchpoints. By writing code that mostly doesn't care about the device_no the interface would end up being multi-touch capable.