X-Git-Url: http://git.hungrycats.org/cgi-bin/gitweb.cgi?p=xscreensaver;a=blobdiff_plain;f=hacks%2Fglx%2Frubik.c;h=bccacc7c134b891d691414a2409b1e8056dab9fb;hp=20ced9733cab4ca1d516fdee602e08f7e32cade0;hb=6afd6db0ae9396cd7ff897ade597cd5483f49b0e;hpb=dba664f31aa87285db4d76cf8c5e66335299703a diff --git a/hacks/glx/rubik.c b/hacks/glx/rubik.c index 20ced973..bccacc7c 100644 --- a/hacks/glx/rubik.c +++ b/hacks/glx/rubik.c @@ -1824,37 +1824,13 @@ rubik_handle_event (ModeInfo *mi, XEvent *event) { rubikstruct *rp = &rubik[MI_SCREEN(mi)]; - if (event->xany.type == ButtonPress && - event->xbutton.button == Button1) + if (gltrackball_event_handler (event, rp->trackball, + MI_WIDTH (mi), MI_HEIGHT (mi), + &rp->button_down_p)) + return True; + else if (screenhack_event_helper (MI_DISPLAY(mi), MI_WINDOW(mi), event)) { - rp->button_down_p = True; - gltrackball_start (rp->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) - { - rp->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 (rp->trackball, event->xbutton.button, 10, - !!event->xbutton.state); - return True; - } - else if (event->xany.type == MotionNotify && - rp->button_down_p) - { - gltrackball_track (rp->trackball, - event->xmotion.x, event->xmotion.y, - MI_WIDTH (mi), MI_HEIGHT (mi)); + rp->done = 1; return True; } @@ -1943,7 +1919,7 @@ init_rubik(ModeInfo * mi) rp->PX = ((float) LRAND() / (float) MAXRAND) * 2.0 - 1.0; rp->PY = ((float) LRAND() / (float) MAXRAND) * 2.0 - 1.0; - rp->trackball = gltrackball_init (); + rp->trackball = gltrackball_init (True); if ((rp->glx_context = init_GL(mi)) != NULL) { @@ -2031,10 +2007,7 @@ draw_rubik(ModeInfo * mi) glScalef(Scale4Iconic * rp->WindH / rp->WindW, Scale4Iconic, Scale4Iconic); } - /* Do it twice because we don't track the device's orientation. */ - glRotatef( current_device_rotation(), 0, 0, 1); gltrackball_rotate (rp->trackball); - glRotatef(-current_device_rotation(), 0, 0, 1); glRotatef(rp->step * 100, 1, 0, 0); glRotatef(rp->step * 95, 0, 1, 0);