From http://www.jwz.org/xscreensaver/xscreensaver-5.35.tar.gz
[xscreensaver] / hacks / glx / b_lockglue.c
index 22c723a338ac8daa82a6d3461bfd2f548f0aebab..90880d17fa9fe06ae52b5489342989c5df848fda 100644 (file)
@@ -34,16 +34,7 @@ struct glb_config glb_config =
        1.5,                    /* scale_factor */
        -4,                     /* screen_bottom */
        4,                      /* screen_top */
-#if 0
-       {0.1, 0.0, 0.4, 0.0},   /* bg_colour */
-#else
-       {0.0, 0.0, 0.0, 0.0},   /* bg_colour */
-#endif
-#if 0
-       {0.7, 0.7, 0.0, 0.3}    /* bubble_colour */
-#else
        {0.0, 0.0, 0.7, 0.3}    /* bubble_colour */
-#endif
 };
 
 #ifdef STANDALONE
@@ -62,7 +53,7 @@ struct glb_config glb_config =
 
 
 #define DEF_TRANSPARENT "True"
-#define DEF_COLOR "random"
+#define DEF_BUBBLECOLOR "random"
 
 static Bool transparent_p;
 static char *bubble_color_str;
@@ -73,12 +64,12 @@ static char *bubble_color_str;
 static XrmOptionDescRec opts[] = {
   { "-transparent",  ".transparent",   XrmoptionNoArg, "True" },
   { "+transparent",  ".transparent",   XrmoptionNoArg, "False" },
-  { "-color",    ".bubble3d.bubblecolor", XrmoptionSepArg, 0 },
+  { "-color",        ".bubblecolor",   XrmoptionSepArg, 0 },
 };
 
 static argtype vars[] = {
   {&transparent_p,   "transparent", "Transparent", DEF_TRANSPARENT, t_Bool},
-  {&bubble_color_str,        "bubblecolor", "BubbleColor", DEF_COLOR, t_String},
+  {&bubble_color_str,        "bubblecolor", "BubbleColor", DEF_BUBBLECOLOR, t_String},
 };
 
 ENTRYPOINT ModeSpecOpt bubble3d_opts = {countof(opts), opts, countof(vars), vars, NULL};
@@ -206,7 +197,20 @@ draw_bubble3d(ModeInfo * mi)
        glXMakeCurrent(display, window, *(c->glx_context));
 
         glb_config.polygon_count = 0;
+        glPushMatrix();
+
+# ifdef HAVE_MOBILE    /* Keep it the same relative size when rotated. */
+        {
+          GLfloat h = MI_HEIGHT(mi) / (GLfloat) MI_WIDTH(mi);
+          int o = (int) current_device_rotation();
+          if (o != 0 && o != 180 && o != -180)
+            glScalef (1/h, 1/h, 1/h);
+          glRotatef(o, 0, 0, 1);
+        }
+# endif
+
        do_display(c);
+        glPopMatrix();
         mi->polygon_count = glb_config.polygon_count;
 
         if (mi->fps_p) do_fps (mi);