X-Git-Url: http://git.hungrycats.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=hacks%2Fglx%2Fglknots.c;h=3c0366efaaec98a2b0b7b0ccf12e097fc2412c95;hb=2d04c4f22466851aedb6ed0f2919d148f726b889;hp=ab514646646c18378f8c045dd0557fb903a3306f;hpb=6a1da724858673ac40aa13a9612340d8bed8c7b9;p=xscreensaver diff --git a/hacks/glx/glknots.c b/hacks/glx/glknots.c index ab514646..3c0366ef 100644 --- a/hacks/glx/glknots.c +++ b/hacks/glx/glknots.c @@ -1,4 +1,4 @@ -/* glknots, Copyright (c) 2003 Jamie Zawinski +/* glknots, Copyright (c) 2003, 2004 Jamie Zawinski * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, provided that @@ -80,7 +80,7 @@ static char *do_spin; static GLfloat speed; static Bool do_wander; static GLfloat thickness; -static int segments; +static unsigned int segments; static int duration; static XrmOptionDescRec opts[] = { @@ -95,12 +95,12 @@ static XrmOptionDescRec opts[] = { }; static argtype vars[] = { - {(caddr_t *) &do_spin, "spin", "Spin", DEF_SPIN, t_String}, - {(caddr_t *) &do_wander, "wander", "Wander", DEF_WANDER, t_Bool}, - {(caddr_t *) &speed, "speed", "Speed", DEF_SPEED, t_Float}, - {(caddr_t *) &thickness, "thickness", "Thickness", DEF_THICKNESS, t_Float}, - {(caddr_t *) &segments, "segments", "Segments", DEF_SEGMENTS, t_Int}, - {(caddr_t *) &duration, "duration", "Duration", DEF_DURATION, t_Int}, + {&do_spin, "spin", "Spin", DEF_SPIN, t_String}, + {&do_wander, "wander", "Wander", DEF_WANDER, t_Bool}, + {&speed, "speed", "Speed", DEF_SPEED, t_Float}, + {&thickness, "thickness", "Thickness", DEF_THICKNESS, t_Float}, + {&segments, "segments", "Segments", DEF_SEGMENTS, t_Int}, + {&duration, "duration", "Duration", DEF_DURATION, t_Int}, }; ModeSpecOpt sws_opts = {countof(opts), opts, countof(vars), vars, NULL}; @@ -114,7 +114,7 @@ make_knot (ModeInfo *mi) GLfloat diam = (4 * thickness); int faces = (wire ? 3 : 6); - int i; + unsigned int i; double x, y, z, ox=0, oy=0, oz=0; double mu; @@ -245,7 +245,7 @@ knot_handle_event (ModeInfo *mi, XEvent *event) knot_configuration *bp = &bps[MI_SCREEN(mi)]; if (event->xany.type == ButtonPress && - event->xbutton.button & Button1) + event->xbutton.button == Button1) { bp->button_down_p = True; gltrackball_start (bp->trackball, @@ -254,11 +254,19 @@ knot_handle_event (ModeInfo *mi, XEvent *event) return True; } else if (event->xany.type == ButtonRelease && - event->xbutton.button & Button1) + 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)) + { + gltrackball_mousewheel (bp->trackball, event->xbutton.button, 5, + !!event->xbutton.state); + return True; + } else if (event->xany.type == MotionNotify && bp->button_down_p) {