From http://www.jwz.org/xscreensaver/xscreensaver-5.36.tar.gz
[xscreensaver] / hacks / glx / mirrorblob.c
index 67ee46d241d36cc1aaabce4e92937dd3884b7c48..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 */
@@ -1418,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);
@@ -1475,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);
 
@@ -1757,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;
@@ -1783,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;
 }
 
@@ -1823,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;