X-Git-Url: http://git.hungrycats.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=hacks%2Fglx%2Funknownpleasures.c;h=236fd8e6bd5ddcd57694a52731409c4f4a1c32e1;hb=aa75c7476aeaa84cf3abc192b376a8b03c325213;hp=b59cff68a3ea7de7278c2151b4826f737cb1aa96;hpb=4ade52359b6eba3621566dac79793a33aa4c915f;p=xscreensaver diff --git a/hacks/glx/unknownpleasures.c b/hacks/glx/unknownpleasures.c index b59cff68..236fd8e6 100644 --- a/hacks/glx/unknownpleasures.c +++ b/hacks/glx/unknownpleasures.c @@ -1,4 +1,4 @@ -/* unknownpleasures, Copyright (c) 2013 Jamie Zawinski +/* unknownpleasures, Copyright (c) 2013-2014 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 @@ -13,7 +13,7 @@ * * Interestingly, the original image is copyright-free: * http://adamcap.com/2011/05/19/history-of-joy-division-unknown-pleasures-album-art/ - * http://en.wikipedia.org/wiki/Unknown_Pleasures + * https://en.wikipedia.org/wiki/Unknown_Pleasures * * TODO: * @@ -135,25 +135,10 @@ unk_handle_event (ModeInfo *mi, XEvent *event) unk_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)) + (event->xbutton.button == Button4 || + event->xbutton.button == Button5 || + event->xbutton.button == Button6 || + event->xbutton.button == Button7)) { int b = event->xbutton.button; int speed = 1; @@ -169,27 +154,16 @@ unk_handle_event (ModeInfo *mi, XEvent *event) gltrackball_mousewheel (bp->trackball, b, speed, !!event->xbutton.state); return True; } - else if (event->xany.type == MotionNotify && - bp->button_down_p) + else if (gltrackball_event_handler (event, bp->trackball, + MI_WIDTH (mi), MI_HEIGHT (mi), + &bp->button_down_p)) + return True; + else if (screenhack_event_helper (MI_DISPLAY(mi), MI_WINDOW(mi), event)) { - gltrackball_track (bp->trackball, - event->xmotion.x, event->xmotion.y, - MI_WIDTH (mi), MI_HEIGHT (mi)); + bp->orthop = !bp->orthop; + reshape_unk (mi, 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 == ' ') - { - bp->orthop = !bp->orthop; - reshape_unk (mi, MI_WIDTH(mi), MI_HEIGHT(mi)); - return True; - } - return False; - } return False; } @@ -225,7 +199,7 @@ init_unk (ModeInfo *mi) bp->count = MI_COUNT(mi); if (bp->count < 1) bp->count = 1; - bp->trackball = gltrackball_init (); + bp->trackball = gltrackball_init (False); if (MI_COUNT(mi) < 1) MI_COUNT(mi) = 1; @@ -391,7 +365,7 @@ draw_unk (ModeInfo *mi) xinc *= 3; } -# ifdef USE_IPHONE +# ifdef HAVE_MOBILE /* Lower it even further for iPhone 3 */ if (mi->xgwa.width <= 480 || mi->xgwa.height <= 480) { @@ -405,7 +379,7 @@ draw_unk (ModeInfo *mi) xinc *= 2; */ -# endif /* USE_IPHONE */ +# endif /* USE_MOBILE */ /* Make the image fill the screen a little more fully */