X-Git-Url: http://git.hungrycats.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=hacks%2Fglx%2Fmirrorblob.c;h=825eb66a6f419356e340cdbe86ece57e6b588976;hb=6afd6db0ae9396cd7ff897ade597cd5483f49b0e;hp=d6fbdc1c8234a643d5655213add3f86b05792e88;hpb=f8cf5ac7b2f53510f80a0eaf286a25298be17bfe;p=xscreensaver diff --git a/hacks/glx/mirrorblob.c b/hacks/glx/mirrorblob.c index d6fbdc1c..825eb66a 100644 --- a/hacks/glx/mirrorblob.c +++ b/hacks/glx/mirrorblob.c @@ -44,9 +44,6 @@ "*chooseRandomImages: True \n" # define refresh_mirrorblob 0 -/* -# define mirrorblob_handle_event 0 -*/ # include "xlockmore.h" #else /* !STANDALONE */ # include "xlock.h" /* from the xlockmore distribution */ @@ -246,7 +243,7 @@ typedef struct #define PMM { sqrt_3, -sqrt_3, -sqrt_3 } /* +X, -Y, -Z */ /* Structure describing a tetrahedron */ -Vector3D tetrahedron[4][3] = { +static Vector3D tetrahedron[4][3] = { {PPP, MMP, MPM}, {PMM, MPM, MMP}, {PPP, MPM, PMM}, @@ -257,7 +254,7 @@ Vector3D tetrahedron[4][3] = { * Static blob data *****************************************************************************/ -const Vector3D zero_vector = { 0.0, 0.0, 0.0 }; +static const Vector3D zero_vector = { 0.0, 0.0, 0.0 }; /* Use 2 textures to allow a gradual fade between images */ #define NUM_TEXTURES 2 @@ -605,6 +602,10 @@ grab_texture(ModeInfo *mi, int texture_index) static void set_parameters(void) { +# ifdef HAVE_JWZGLES /* #### glPolygonMode other than GL_FILL unimplemented */ + wireframe = 0; +# endif + /* In wire frame mode do not draw a texture */ if (wireframe) { @@ -1119,11 +1120,13 @@ initialise_blob(mirrorblobstruct *gp, * * Return the magnitude of the given vector */ +#if 0 static inline double length (Vector3D u) { return sqrt (u.x * u.x + u.y * u.y + u.z * u.z); } +#endif /****************************************************************************** * @@ -1412,12 +1415,12 @@ draw_blob (mirrorblobstruct *gp) glMatrixMode(GL_MODELVIEW); glLoadIdentity(); + glRotatef(current_device_rotation(), 0, 0, 1); /* Move down the z-axis. */ glTranslatef (0.0, 0.0, -4.0); gltrackball_rotate (gp->trackball); - glRotatef(current_device_rotation(), 0, 0, 1); /* glColor4ub (255, 0, 0, 128); */ glBegin(GL_TRIANGLES); @@ -1751,21 +1754,7 @@ mirrorblob_handle_event (ModeInfo * mi, XEvent * event) mirrorblobstruct *gp = &Mirrorblob[MI_SCREEN (mi)]; if (event->xany.type == ButtonPress && - event->xbutton.button == Button1) - { - gp->button_down = 1; - gltrackball_start (gp->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) - { - gp->button_down = 0; - return True; - } - else if (event->xany.type == ButtonPress && - event->xbutton.button == Button4) + event->xbutton.button == Button4) { zoom *= 1.1; return True; @@ -1777,12 +1766,19 @@ mirrorblob_handle_event (ModeInfo * mi, XEvent * event) zoom *= 0.9; return True; } - else if (event->xany.type == MotionNotify && gp->button_down) + else if (gltrackball_event_handler (event, gp->trackball, + MI_WIDTH (mi), MI_HEIGHT (mi), + &gp->button_down)) { - gltrackball_track (gp->trackball, event->xmotion.x, - event->xmotion.y, MI_WIDTH (mi), MI_HEIGHT (mi)); return True; } + else if (screenhack_event_helper (MI_DISPLAY(mi), MI_WINDOW(mi), event)) + { + gp->state_start_time = 0; + gp->state = HOLDING; + return True; + } + return False; } @@ -1817,7 +1813,7 @@ init_mirrorblob(ModeInfo * mi) { MI_CLEARWINDOW(mi); } - gp->trackball = gltrackball_init(); + gp->trackball = gltrackball_init(False); initialise_blob(gp, MI_WIDTH(mi), MI_HEIGHT(mi), BUMP_ARRAY_SIZE); gp->state = INITIALISING;