+ENTRYPOINT Bool
+extrusion_handle_event (ModeInfo *mi, XEvent *event)
+{
+ extrusionstruct *gp = &Extrusion[MI_SCREEN(mi)];
+
+ if (event->xany.type == ButtonPress &&
+ (event->xbutton.button == Button4 ||
+ event->xbutton.button == Button5 ||
+ event->xbutton.button == Button6 ||
+ event->xbutton.button == Button7))
+ {
+ gltrackball_mousewheel (gp->trackball, event->xbutton.button, 10,
+ !!event->xbutton.state);
+ return True;
+ }
+ else if (event->xany.type == ButtonPress && /* rotate with left button */
+ !event->xbutton.state) /* if no modifier keys */
+ {
+ gp->button_down_p = True;
+ gltrackball_start (gp->trackball,
+ event->xbutton.x, event->xbutton.y,
+ MI_WIDTH (mi), MI_HEIGHT (mi));
+ return True;
+ }
+ else if (event->xany.type == ButtonPress) /* deform with other buttons */
+ { /* or with modifier keys */
+ gp->button2_down_p = True;
+ gp->mouse_start_x = gp->mouse_x = event->xbutton.x;
+ gp->mouse_start_y = gp->mouse_y = event->xbutton.y;
+ return True;
+ }
+ else if (event->xany.type == ButtonRelease)
+ {
+ gp->button_down_p = False;
+ gp->button2_down_p = False;
+ return True;
+ }
+ else if (event->xany.type == MotionNotify)
+ {
+ if (gp->button_down_p)
+ gltrackball_track (gp->trackball,
+ event->xmotion.x, event->xmotion.y,
+ MI_WIDTH (mi), MI_HEIGHT (mi));
+ if (gp->button2_down_p)
+ {
+ gp->mouse_x = event->xmotion.x;
+ gp->mouse_y = event->xmotion.y;
+ }
+ return True;
+ }
+
+ return False;
+}
+
+
+/* xextrusion initialization routine */
+ENTRYPOINT void
+init_extrusion (ModeInfo * mi)