Interactive NURBS editing

I wrote a sample program that displays a simple 2d NURBS curve on a Gtk_gl_area under Linux.

My control points have been overlayed with red dots for visibility.

Currently I can select the interior control points and display a message in stdout. However I can not select the endpoints.

M question is how do I enable dragging of the control points to modify the curve ? I needs to work on surfaces and I need to rotate and “zoom” the surface for greater detail.

TIA