From http://www.jwz.org/xscreensaver/xscreensaver-5.35.tar.gz
[xscreensaver] / hacks / glx / mirrorblob.c
index d8b0915de1e563fcf08e992144825b7b1c748433..2fe9fc84ff15097b0f1b4156c963e13c9d583910 100644 (file)
                  "*useSHM:              True       \n"                      \
                  "*desktopGrabber:  xscreensaver-getimage -no-desktop %s\n" \
                  "*grabDesktopImages:   True  \n"                           \
-                 "*chooseRandomImages:  True  \n"
+                 "*chooseRandomImages:  True  \n"                           \
+                "*suppressRotationAnimation: True\n"                       \
 
 # define refresh_mirrorblob 0
-/*
-# define mirrorblob_handle_event 0
-*/
 # include "xlockmore.h"
 #else /* !STANDALONE */
 # include "xlock.h"        /* from the xlockmore distribution */
@@ -605,6 +603,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 +1121,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,7 +1416,7 @@ draw_blob (mirrorblobstruct *gp)
 
   glMatrixMode(GL_MODELVIEW);
   glLoadIdentity();
-  glRotatef(current_device_rotation(), 0, 0, 1);
+/*  glRotatef(current_device_rotation(), 0, 0, 1); */
 
   /* Move down the z-axis. */
   glTranslatef (0.0, 0.0, -4.0);
@@ -1469,13 +1473,15 @@ draw_background (ModeInfo *mi)
   glPushMatrix();
   glLoadIdentity();
 
-  glRotatef (rot, 0, 0, 1);
+  glRotatef (-rot, 0, 0, 1);
+/*
   if ((rot >  45 && rot <  135) ||
       (rot < -45 && rot > -135))
     {
       GLfloat s = MI_WIDTH(mi) / (GLfloat) MI_HEIGHT(mi);
       glScalef (s, 1/s, 1);
     }
+*/
 
   glOrtho(0.0, MI_WIDTH(mi), MI_HEIGHT(mi), 0.0, -1000.0, 1000.0);
 
@@ -1751,21 +1757,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 +1769,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 +1816,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;