X-Git-Url: http://git.hungrycats.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=hacks%2Fglx%2Fflipscreen3d.c;h=8ae26becc842eb7c688f646c84aa3e4bca0f7c73;hb=aa75c7476aeaa84cf3abc192b376a8b03c325213;hp=6d5844a99fe5753227dfcbb5081440aa8d5414ec;hpb=5f9c47ca98dd43d8f59b7c27d3fde6edfde4fe21;p=xscreensaver diff --git a/hacks/glx/flipscreen3d.c b/hacks/glx/flipscreen3d.c index 6d5844a9..8ae26bec 100644 --- a/hacks/glx/flipscreen3d.c +++ b/hacks/glx/flipscreen3d.c @@ -18,7 +18,8 @@ #define DEFAULTS "*delay: 20000 \n" \ "*showFPS: False \n" \ "*wireframe: False \n" \ - "*useSHM: True \n" + "*useSHM: True \n" \ + "*suppressRotationAnimation: True\n" \ # define refresh_screenflip 0 # include "xlockmore.h" /* from the xscreensaver distribution */ @@ -119,43 +120,25 @@ static Screenflip *screenflip = NULL; static const GLfloat viewer[] = {0.0, 0.0, 15.0}; +static void getSnapshot (ModeInfo *); + + ENTRYPOINT Bool screenflip_handle_event (ModeInfo *mi, XEvent *event) { Screenflip *c = &screenflip[MI_SCREEN(mi)]; - if (event->xany.type == ButtonPress && - event->xbutton.button == Button1) - { - c->button_down_p = True; - gltrackball_start (c->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) - { - c->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)) + if (gltrackball_event_handler (event, c->trackball, + MI_WIDTH (mi), MI_HEIGHT (mi), + &c->button_down_p)) + return True; + else if (screenhack_event_helper (MI_DISPLAY(mi), MI_WINDOW(mi), event)) { - gltrackball_mousewheel (c->trackball, event->xbutton.button, 10, - !!event->xbutton.state); - return True; - } - else if (event->xany.type == MotionNotify && - c->button_down_p) - { - gltrackball_track (c->trackball, - event->xmotion.x, event->xmotion.y, - MI_WIDTH (mi), MI_HEIGHT (mi)); - return True; + if (!c->waiting_for_image_p) + { + getSnapshot (mi); + return True; + } } return False; @@ -322,12 +305,23 @@ static void drawgrid(void) static void display(Screenflip *c, int wire) { int frozen; +/* GLfloat rot = current_device_rotation();*/ glClear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT); glLoadIdentity(); gluLookAt(viewer[0], viewer[1], viewer[2], 0.0, 0.0, 0.0, 0.0, 1.0, 0.0); glPushMatrix(); +/* + glRotatef(rot, 0, 0, 1); + if ((rot > 45 && rot < 135) || + (rot < -45 && rot > -135)) + { + GLfloat s = c->winw / (GLfloat) c->winh; + glScalef (s, 1/s, 1); + } +*/ + if (inposition(c)) { frozen = 0; glTranslatef(5 * sin(c->theta), 5 * sin(c->rho), 10 * cos(c->gamma) - 10); @@ -340,7 +334,9 @@ static void display(Screenflip *c, int wire) if (random() % 2) c->dgamma = 1/60 - (float)(random() % 100)/3000; } +/* glRotatef(-rot, 0, 0, 1);*/ gltrackball_rotate (c->trackball); +/* glRotatef(rot, 0, 0, 1);*/ if (rotate) glRotatef(c->rot, c->rx, c->ry, c->rz); /* update variables with each frame */ if(!c->button_down_p && !c->fadetime) { @@ -450,7 +446,7 @@ ENTRYPOINT void init_screenflip(ModeInfo *mi) c = &screenflip[screen]; c->window = MI_WINDOW(mi); - c->trackball = gltrackball_init (); + c->trackball = gltrackball_init (False); if ((c->glx_context = init_GL(mi)) != NULL) { reshape_screenflip(mi, MI_WIDTH(mi), MI_HEIGHT(mi));