X-Git-Url: http://git.hungrycats.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=hacks%2Fglx%2Fglforestfire.c;h=e880cfa19b9cced70ae8ef939d88d2197db51250;hb=aa75c7476aeaa84cf3abc192b376a8b03c325213;hp=da237573398ad01550a234c5056e9e7bd37a901b;hpb=f8cf5ac7b2f53510f80a0eaf286a25298be17bfe;p=xscreensaver diff --git a/hacks/glx/glforestfire.c b/hacks/glx/glforestfire.c index da237573..e880cfa1 100644 --- a/hacks/glx/glforestfire.c +++ b/hacks/glx/glforestfire.c @@ -621,13 +621,15 @@ static Bool inittree(ModeInfo * mi) return False; } /* initialise positions */ - for(i=0;inum_trees;i++) - do { - fs->treepos[i].x =vrnd()*TREEOUTR*2.0-TREEOUTR; - fs->treepos[i].y =0.0; - fs->treepos[i].z =vrnd()*TREEOUTR*2.0-TREEOUTR; - dist=sqrt(fs->treepos[i].x *fs->treepos[i].x +fs->treepos[i].z *fs->treepos[i].z ); - } while((distTREEOUTR)); + for(i=0;inum_trees;i++) { + do { + fs->treepos[i].x =vrnd()*TREEOUTR*2.0-TREEOUTR; + fs->treepos[i].y =0.0; + fs->treepos[i].z =vrnd()*TREEOUTR*2.0-TREEOUTR; + dist = sqrt(fs->treepos[i].x * fs->treepos[i].x + + fs->treepos[i].z * fs->treepos[i].z); + } while((distTREEOUTR)); + } return True; } @@ -962,7 +964,7 @@ init_fire(ModeInfo * mi) else fs->num_trees = 0; - fs->trackball = gltrackball_init (); + fs->trackball = gltrackball_init (False); /* xlock GL stuff */ if ((fs->glx_context = init_GL(mi)) != NULL) { @@ -1064,43 +1066,10 @@ 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; - } + if (gltrackball_event_handler (event, fs->trackball, + MI_WIDTH (mi), MI_HEIGHT (mi), + &fs->button_down_p)) + return True; return False; }