Пример #1
0
	ENTRYPOINT Bool antinspect_handle_event (ModeInfo *mi, XEvent *event) 
	{
	  antinspectstruct *mp = &antinspect[MI_SCREEN(mi)];
	  
	  if(event->xany.type == ButtonPress && event->xbutton.button == Button1) {
		mp->button_down_p = True;
		gltrackball_start(mp->trackball,
						  event->xbutton.x, event->xbutton.y,
						  MI_WIDTH (mi), MI_HEIGHT (mi));
		return True;
	  }
	  else if(event->xany.type == ButtonRelease && 
			  event->xbutton.button == Button1) {
		mp->button_down_p = False;
		return True;
	  }
	  else if (event->xany.type == ButtonPress &&
			   (event->xbutton.button == Button4 ||
				event->xbutton.button == Button5 ||
				event->xbutton.button == Button6 ||
				event->xbutton.button == Button7))
		{
		  gltrackball_mousewheel (mp->trackball, event->xbutton.button, 5,
								  !event->xbutton.state);
		  return True;
		}
	  else if(event->xany.type == MotionNotify && mp->button_down_p) {
		gltrackball_track (mp->trackball,
						   event->xmotion.x, event->xmotion.y,
						   MI_WIDTH (mi), MI_HEIGHT (mi));
		return True;
	  }
	  
	  return False;
	}
Пример #2
0
/** handle X event (trackball) */
ENTRYPOINT Bool chess_handle_event (ModeInfo *mi, XEvent *event) 
{
  Chesscreen *cs = &qs[MI_SCREEN(mi)];

  if(event->xany.type == ButtonPress && event->xbutton.button == Button1) {
    cs->button_down_p = True;
    gltrackball_start (cs->trackball,
		       event->xbutton.x, event->xbutton.y,
		       MI_WIDTH (mi), MI_HEIGHT (mi));
    return True;
  }
  else if(event->xany.type == ButtonRelease 
	  && event->xbutton.button == Button1) {
    cs->button_down_p = False;
    return True;
  }
  else if (event->xany.type == ButtonPress &&
           (event->xbutton.button == Button4 ||
            event->xbutton.button == Button5 ||
            event->xbutton.button == Button6 ||
            event->xbutton.button == Button7))
    {
      gltrackball_mousewheel (cs->trackball, event->xbutton.button, 5,
                              !event->xbutton.state);
      return True;
    }
  else if(event->xany.type == MotionNotify && cs->button_down_p) {
    gltrackball_track (cs->trackball,
		       event->xmotion.x, event->xmotion.y,
		       MI_WIDTH (mi), MI_HEIGHT (mi));
    return True;
  }
  
  return False;
}
Пример #3
0
ENTRYPOINT Bool jigglypuff_handle_event(ModeInfo *mi, XEvent *event)
{
    jigglystruct *js = &jss[MI_SCREEN(mi)];

    if(event->xany.type == ButtonPress &&
            event->xbutton.button == Button1) {
        js->button_down = 1;
        gltrackball_start(js->trackball, event->xbutton.x, event->xbutton.y,
                          MI_WIDTH(mi), MI_HEIGHT(mi));
        return True;
    }
    else if(event->xany.type == ButtonRelease &&
            event->xbutton.button == Button1) {
        js->button_down = 0;
        return True;
    }
    else if (event->xany.type == ButtonPress &&
             (event->xbutton.button == Button4 ||
              event->xbutton.button == Button5 ||
              event->xbutton.button == Button6 ||
              event->xbutton.button == Button7))
    {
        gltrackball_mousewheel (js->trackball, event->xbutton.button, 10,
                                !!event->xbutton.state);
        return True;
    }
    else if(event->xany.type == MotionNotify && js->button_down) {
        gltrackball_track(js->trackball, event->xmotion.x, event->xmotion.y,
                          MI_WIDTH(mi), MI_HEIGHT(mi));
        return True;
    }
    return False;
}
Пример #4
0
	ENTRYPOINT Bool
	rubikblocks_handle_event (ModeInfo *mi, XEvent *event)
	{
	  rubikblocks_conf *cp = &rubikblocks[MI_SCREEN(mi)];
	  if(event->xany.type == ButtonPress && event->xbutton.button == Button1)
	  {
	    cp->button_down = True;
	    gltrackball_start(cp->trackball, event->xbutton.x, event->xbutton.y,
	        MI_WIDTH(mi), MI_HEIGHT(mi));
	    return True;
	  }
	  else if(event->xany.type == ButtonRelease && event->xbutton.button == Button1)
	  {
	    cp->button_down = False;
	    return True;
	  }
	  else if(event->xany.type == ButtonPress &&
	      (event->xbutton.button == Button4 || event->xbutton.button == Button5 ||
	       event->xbutton.button == Button6 || event->xbutton.button == Button7))
	  {
	    gltrackball_mousewheel(cp->trackball,
	        event->xbutton.button, 5, !!event->xbutton.state);
	    return True;
	  }
	  else if(event->xany.type == MotionNotify && cp->button_down)
	  {
	    gltrackball_track(cp->trackball, event->xmotion.x, event->xmotion.y,
	        MI_WIDTH (mi), MI_HEIGHT (mi));
	    return True;
	  }
	  return False;
	}
Пример #5
0
ENTRYPOINT Bool
cube_handle_event (ModeInfo *mi, XEvent *event)
{
  cube_configuration *bp = &bps[MI_SCREEN(mi)];

  if (event->xany.type == ButtonPress &&
      event->xbutton.button == Button1)
    {
      bp->button_down_p = True;
      gltrackball_start (bp->trackball,
                         event->xbutton.x, event->xbutton.y,
                         MI_WIDTH (mi), MI_HEIGHT (mi));
      return True;
    }
  else if (event->xany.type == ButtonRelease &&
           event->xbutton.button == Button1)
    {
      bp->button_down_p = False;
      return True;
    }
  else if (event->xany.type == ButtonPress &&
           (event->xbutton.button == Button4 ||
            event->xbutton.button == Button5 ||
            event->xbutton.button == Button6 ||
            event->xbutton.button == Button7))
    {
      gltrackball_mousewheel (bp->trackball, event->xbutton.button, 10,
                              !!event->xbutton.state);
      return True;
    }
  else if (event->xany.type == MotionNotify &&
           bp->button_down_p)
    {
      gltrackball_track (bp->trackball,
                         event->xmotion.x, event->xmotion.y,
                         MI_WIDTH (mi), MI_HEIGHT (mi));
      return True;
    }
  else if (event->xany.type == KeyPress)
    {
      KeySym keysym;
      char c = 0;
      XLookupString (&event->xkey, &c, 1, &keysym, 0);
      if (c == ' ')
        {
          glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
          return True;
        }
      else if (c == '\r' || c == '\n')
        {
          new_cube_colors (mi);
          return True;
        }
    }
  return False;
}
Пример #6
0
ENTRYPOINT Bool
molecule_handle_event (ModeInfo *mi, XEvent *event)
{
  molecule_configuration *mc = &mcs[MI_SCREEN(mi)];

  if (event->xany.type == ButtonPress &&
      event->xbutton.button == Button1)
    {
      mc->button_down_p = True;
      gltrackball_start (mc->trackball,
                         event->xbutton.x, event->xbutton.y,
                         MI_WIDTH (mi), MI_HEIGHT (mi));
      return True;
    }
  else if (event->xany.type == ButtonRelease &&
           event->xbutton.button == Button1)
    {
      mc->button_down_p = False;
      return True;
    }
  else if (event->xany.type == ButtonPress &&
           (event->xbutton.button == Button4 ||
            event->xbutton.button == Button5 ||
            event->xbutton.button == Button6 ||
            event->xbutton.button == Button7))
    {
      gltrackball_mousewheel (mc->trackball, event->xbutton.button, 10,
                              !!event->xbutton.state);
      return True;
    }
  else if (event->xany.type == KeyPress)
    {
      KeySym keysym;
      char c = 0;
      XLookupString (&event->xkey, &c, 1, &keysym, 0);

      if (c == ' ' || c == '\t' || c == '\r' || c == '\n')
        {
          GLfloat speed = 4.0;
          mc->mode = 1;
          mc->mode_tick = 10 * speed;
          return True;
        }
    }
  else if (event->xany.type == MotionNotify &&
           mc->button_down_p)
    {
      gltrackball_track (mc->trackball,
                         event->xmotion.x, event->xmotion.y,
                         MI_WIDTH (mi), MI_HEIGHT (mi));
      return True;
    }

  return False;
}
Пример #7
0
ENTRYPOINT Bool
carousel_handle_event (ModeInfo *mi, XEvent *event)
{
  carousel_state *ss = &sss[MI_SCREEN(mi)];

  if (event->xany.type == ButtonPress &&
      event->xbutton.button == Button1)
    {
      if (! ss->button_down_p)
        ss->button_down_time = time((time_t *) 0);
      ss->button_down_p = True;
      gltrackball_start (ss->trackball,
                         event->xbutton.x, event->xbutton.y,
                         MI_WIDTH (mi), MI_HEIGHT (mi));
      return True;
    }
  else if (event->xany.type == ButtonRelease &&
           event->xbutton.button == Button1)
    {
      if (ss->button_down_p)
        {
          /* Add the time the mouse was held to the expire times of all
             frames, so that mouse-dragging doesn't count against
             image expiration.
           */
          int secs = time((time_t *) 0) - ss->button_down_time;
          int i;
          for (i = 0; i < ss->nframes; i++)
            ss->frames[i]->expires += secs;
        }
      ss->button_down_p = False;
      return True;
    }
  else if (event->xany.type == ButtonPress &&
           (event->xbutton.button == Button4 ||
            event->xbutton.button == Button5 ||
            event->xbutton.button == Button6 ||
            event->xbutton.button == Button7))
    {
      gltrackball_mousewheel (ss->trackball, event->xbutton.button, 5,
                              !event->xbutton.state);
      return True;
    }
  else if (event->xany.type == MotionNotify &&
           ss->button_down_p)
    {
      gltrackball_track (ss->trackball,
                         event->xmotion.x, event->xmotion.y,
                         MI_WIDTH (mi), MI_HEIGHT (mi));
      return True;
    }

  return False;
}
Пример #8
0
	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;
	}
Пример #9
0
ENTRYPOINT Bool
pinion_handle_event (ModeInfo *mi, XEvent *event)
{
  pinion_configuration *pp = &pps[MI_SCREEN(mi)];

  if (event->xany.type == ButtonPress &&
      event->xbutton.button == Button1)
    {
      pp->button_down_p = True;
      gltrackball_start (pp->trackball,
                         event->xbutton.x, event->xbutton.y,
                         MI_WIDTH (mi), MI_HEIGHT (mi));
      return True;
    }
  else if (event->xany.type == ButtonRelease &&
           event->xbutton.button == Button1)
    {
      pp->button_down_p = False;
      return True;
    }
  else if (event->xany.type == ButtonPress &&
           (event->xbutton.button == Button4 ||
            event->xbutton.button == Button5 ||
            event->xbutton.button == Button6 ||
            event->xbutton.button == Button7))
    {
      gltrackball_mousewheel (pp->trackball, event->xbutton.button, 5,
                              !!event->xbutton.state);
      return True;
    }
  else if (event->xany.type == MotionNotify &&
           pp->button_down_p)
    {
      gltrackball_track (pp->trackball,
                         event->xmotion.x, event->xmotion.y,
                         MI_WIDTH (mi), MI_HEIGHT (mi));
      return True;
    }
  else if (event->xany.type == KeyPress)
    {
      KeySym keysym;
      char c = 0;
      XLookupString (&event->xkey, &c, 1, &keysym, 0);
      if (c == ' ' && debug_one_gear_p && pp->ngears)
        {
          delete_gear (mi, pp->gears[0]);
          return True;
        }
    }

  return False;
}
Пример #10
0
ENTRYPOINT Bool
stairs_handle_event (ModeInfo *mi, XEvent *event)
{
  stairsstruct *sp = &stairs[MI_SCREEN(mi)];

  if (event->xany.type == ButtonPress &&
      event->xbutton.button == Button1)
    {
      sp->button_down_p = True;
      gltrackball_start (sp->trackball,
                         event->xbutton.x, event->xbutton.y,
                         MI_WIDTH (mi), MI_HEIGHT (mi));
      return True;
    }
  else if (event->xany.type == ButtonRelease &&
           event->xbutton.button == Button1)
    {
      sp->button_down_p = False;
      return True;
    }
  else if (event->xany.type == ButtonPress &&
           (event->xbutton.button == Button4 ||
            event->xbutton.button == Button5 ||
            event->xbutton.button == Button6 ||
            event->xbutton.button == Button7))
    {
      gltrackball_mousewheel (sp->trackball, event->xbutton.button, 10,
                              !!event->xbutton.state);
      return True;
    }
  else if (event->xany.type == MotionNotify &&
           sp->button_down_p)
    {
      gltrackball_track (sp->trackball,
                         event->xmotion.x, event->xmotion.y,
                         MI_WIDTH (mi), MI_HEIGHT (mi));
      return True;
    }
  else if (event->xany.type == KeyPress)
    {
      KeySym keysym;
      char c = 0;
      XLookupString (&event->xkey, &c, 1, &keysym, 0);
      if (c == ' ')
        {
          gltrackball_reset (sp->trackball);
          return True;
        }
    }

  return False;
}
Пример #11
0
ENTRYPOINT Bool
bit_handle_event (ModeInfo *mi, XEvent *event)
{
  bit_configuration *bp = &bps[MI_SCREEN(mi)];

  if (event->xany.type == ButtonPress &&
      event->xbutton.button == Button1)
    {
      bp->button_down_p = True;
      gltrackball_start (bp->trackball,
                         event->xbutton.x, event->xbutton.y,
                         MI_WIDTH (mi), MI_HEIGHT (mi));
      return True;
    }
  else if (event->xany.type == ButtonRelease &&
           event->xbutton.button == Button1)
    {
      bp->button_down_p = False;
      return True;
    }
  else if (event->xany.type == ButtonPress &&
           (event->xbutton.button == Button4 ||
            event->xbutton.button == Button5 ||
            event->xbutton.button == Button6 ||
            event->xbutton.button == Button7))
    {
      gltrackball_mousewheel (bp->trackball, event->xbutton.button, 3,
                              !!event->xbutton.state);
      return True;
    }
  else if (event->xany.type == MotionNotify &&
           bp->button_down_p)
    {
      gltrackball_track (bp->trackball,
                         event->xmotion.x, event->xmotion.y,
                         MI_WIDTH (mi), MI_HEIGHT (mi));
      return True;
    }
  else if (event->xany.type == KeyPress)
    {
      KeySym keysym;
      char c = 0;
      XLookupString (&event->xkey, &c, 1, &keysym, 0);
      if (c == ' ' || c == '1' || c == '0')
        {
          bp->kbd = c;
          return True;
        }
    }

  return False;
}
Пример #12
0
ENTRYPOINT Bool
fire_handle_event (ModeInfo *mi, XEvent *event)
{
  firestruct *fs = &fire[MI_SCREEN(mi)];

  if (event->xany.type == ButtonPress &&
      event->xbutton.button == Button1)
    {
      fs->button_down_p = True;
      event->xbutton.x = MI_WIDTH(mi)  - event->xbutton.x; /* kludge! */
      event->xbutton.y = MI_HEIGHT(mi) - event->xbutton.y;
      gltrackball_start (fs->trackball,
                         event->xbutton.x, event->xbutton.y,
                         MI_WIDTH (mi), MI_HEIGHT (mi));
      return True;
    }
  else if (event->xany.type == ButtonRelease &&
           event->xbutton.button == Button1)
    {
      fs->button_down_p = False;
      return True;
    }
  else if (event->xany.type == ButtonPress &&
           (event->xbutton.button == Button4 ||
            event->xbutton.button == Button5 ||
            event->xbutton.button == Button6 ||
            event->xbutton.button == Button7))
    {
      gltrackball_mousewheel (fs->trackball, event->xbutton.button, 5,
                              !!event->xbutton.state);
      return True;
    }
  else if (event->xany.type == MotionNotify &&
           fs->button_down_p)
    {
      event->xmotion.x = MI_WIDTH(mi)  - event->xmotion.x; /* kludge! */
      event->xmotion.y = MI_HEIGHT(mi) - event->xmotion.y;
      gltrackball_track (fs->trackball,
                         event->xmotion.x, event->xmotion.y,
                         MI_WIDTH (mi), MI_HEIGHT (mi));
      return True;
    }

  return False;
}
Пример #13
0
/* A utility function for event-handler functions:
   Handles the various motion and click events related to trackballs.
   Returns True if the event was handled.
 */
Bool
gltrackball_event_handler (XEvent *event,
                           trackball_state *ts,
                           int window_width, int window_height,
                           Bool *button_down_p)
{
  if (event->xany.type == ButtonPress &&
      event->xbutton.button == Button1)
    {
      *button_down_p = True;
      gltrackball_start (ts,
                         event->xbutton.x, event->xbutton.y,
                         window_width, window_height);
      return True;
    }
  else if (event->xany.type == ButtonRelease &&
           event->xbutton.button == Button1)
    {
      *button_down_p = False;
      gltrackball_stop (ts);
      return True;
    }
  else if (event->xany.type == ButtonPress &&
           (event->xbutton.button == Button4 ||
            event->xbutton.button == Button5 ||
            event->xbutton.button == Button6 ||
            event->xbutton.button == Button7))
    {
      gltrackball_mousewheel (ts, event->xbutton.button, 10,
                              !!event->xbutton.state);
      return True;
    }
  else if (event->xany.type == MotionNotify &&
           *button_down_p)
    {
      gltrackball_track (ts,
                         event->xmotion.x, event->xmotion.y,
                         window_width, window_height);
      return True;
    }

  return False;
}
Пример #14
0
ENTRYPOINT Bool
toasters_handle_event (ModeInfo *mi, XEvent *event)
{
  toaster_configuration *bp = &bps[MI_SCREEN(mi)];

  if (event->xany.type == ButtonPress &&
      event->xbutton.button == Button1)
    {
      bp->button_down_p = True;
      gltrackball_start (bp->user_trackball,
                         event->xbutton.x, event->xbutton.y,
                         MI_WIDTH (mi), MI_HEIGHT (mi));
      return True;
    }
  else if (event->xany.type == ButtonRelease &&
           event->xbutton.button == Button1)
    {
      bp->button_down_p = False;
      return True;
    }
  else if (event->xany.type == ButtonPress &&
           (event->xbutton.button == Button4 ||
            event->xbutton.button == Button5 ||
            event->xbutton.button == Button6 ||
            event->xbutton.button == Button7))
    {
      gltrackball_mousewheel (bp->user_trackball, event->xbutton.button, 5,
                              !event->xbutton.state);
      return True;
    }
  else if (event->xany.type == MotionNotify &&
           bp->button_down_p)
    {
      gltrackball_track (bp->user_trackball,
                         event->xmotion.x, event->xmotion.y,
                         MI_WIDTH (mi), MI_HEIGHT (mi));
      return True;
    }

  return False;
}
Пример #15
0
	ENTRYPOINT Bool
	gflux_handle_event (ModeInfo *mi, XEvent *event)
	{
	  gfluxstruct *gp = &gfluxes[MI_SCREEN(mi)];

	  if (event->xany.type == ButtonPress &&
	      event->xbutton.button == Button1)
	    {
	      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 == ButtonRelease &&
	           event->xbutton.button == Button1)
	    {
	      gp->button_down_p = False;
	      return True;
	    }
	  else 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 == MotionNotify &&
	           gp->button_down_p)
	    {
	      gltrackball_track (gp->trackball,
	                         event->xmotion.x, event->xmotion.y,
	                         MI_WIDTH (mi), MI_HEIGHT (mi));
	      return True;
	    }

	  return False;
	}
Пример #16
0
ENTRYPOINT Bool
logo_handle_event (ModeInfo *mi, XEvent *event)
{
  logo_configuration *dc = &dcs[MI_SCREEN(mi)];

  if (event->xany.type == ButtonPress &&
      event->xbutton.button == Button1)
    {
      dc->button_down_p = True;
      gltrackball_start (dc->trackball,
                         event->xbutton.x, event->xbutton.y,
                         MI_WIDTH (mi), MI_HEIGHT (mi));
      return True;
    }
  else if (event->xany.type == ButtonRelease &&
           event->xbutton.button == Button1)
    {
      dc->button_down_p = False;
      return True;
    }
  else if (event->xany.type == ButtonPress &&
           (event->xbutton.button == Button4 ||
            event->xbutton.button == Button5 ||
            event->xbutton.button == Button6 ||
            event->xbutton.button == Button7))
    {
      gltrackball_mousewheel (dc->trackball, event->xbutton.button, 10,
                              !!event->xbutton.state);
      return True;
    }
  else if (event->xany.type == MotionNotify &&
           dc->button_down_p)
    {
      gltrackball_track (dc->trackball,
                         event->xmotion.x, event->xmotion.y,
                         MI_WIDTH (mi), MI_HEIGHT (mi));
      return True;
    }

  return False;
}
Пример #17
0
	/* handle input events or not if daemon running the show */
	ENTRYPOINT Bool 
	topBlock_handle_event (ModeInfo *mi, XEvent *event)
	{
	  topBlockSTATE *tb = &tbs[MI_SCREEN(mi)];
		if (event->xany.type == KeyPress)    {
	    KeySym keysym;
	    char c = 0;
	    XLookupString (&event->xkey, &c, 1, &keysym, 0);
	    if (c == 'a') {
				tb->eyeX++;
				return True;
			} else if (c == 'z') {
				tb->eyeX--;
				return True;
			} else if (c == 's') {
				tb->eyeY--;
				return True;
			} else if (c == 'x') {
				tb->eyeY++;
				return True;
			} else if (c == 'd') {
				tb->eyeZ++;
				return True;
			} else if (c == 'c') {
				tb->eyeZ--;
				return True;
			} else if (c == 'f') {
				camX++;
				return True;
			} else if (c == 'v') {
				camX--;
				return True;
			} else if (c == 'g') {
				camY++;
				return True;
			} else if (c == 'b') {
				camY--;
				return True;
			} else if (c == 'h') {
				camZ++;
				return True;
			} else if (c == 'n') {
				camZ--;
				return True;
			} else if (c == 'r') {
				tb->rotation++;
				return True;
			}
		}
	  if (event->xany.type == ButtonPress &&
	      event->xbutton.button == Button1)
	    {
	      tb->button_down_p = True;
	      gltrackball_start (tb->trackball,
	                         event->xbutton.x, event->xbutton.y,
	                         MI_WIDTH (mi), MI_HEIGHT (mi));
	      return True;
	    }
	  else if (event->xany.type == ButtonRelease &&
	           event->xbutton.button == Button1)
	    {
	      tb->button_down_p = False;
	      return True;
	    }
	  else if (event->xany.type == ButtonPress &&
	           (event->xbutton.button == Button4 ||
	            event->xbutton.button == Button5 ||
	            event->xbutton.button == Button6 ||
	            event->xbutton.button == Button7))
	    {
	      gltrackball_mousewheel (tb->trackball, event->xbutton.button, 10,
	                              !!event->xbutton.state);
	      return True;
	    }
	  else if (event->xany.type == MotionNotify &&
	           tb->button_down_p)
	    {
	      gltrackball_track (tb->trackball,
	                         event->xmotion.x, event->xmotion.y,
	                         MI_WIDTH (mi), MI_HEIGHT (mi));
	      return True;
	    }
		return False;
	}