X-Git-Url: http://git.hungrycats.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=hacks%2Fglx%2Fgleidescope.c;h=184b4e82ae932314f3cd905ff570cd7e887a4f57;hb=d6b0217f2417bd19187f0ebc389d6c5c2233b11c;hp=54074e65f84a8eb792d0cb4a064fb2b4523225d1;hpb=5f9c47ca98dd43d8f59b7c27d3fde6edfde4fe21;p=xscreensaver diff --git a/hacks/glx/gleidescope.c b/hacks/glx/gleidescope.c index 54074e65..184b4e82 100644 --- a/hacks/glx/gleidescope.c +++ b/hacks/glx/gleidescope.c @@ -1,7 +1,7 @@ /* -*- Mode: C; tab-width: 4 -*- */ /* vim: set ai ts=4 sw=4: */ -#if !defined( lint ) && !defined( SABER ) +#if 0 /*static const char sccsid[] = "@(#)gleidescope.c 1.0 03/06/27 xlockmore";*/ #endif @@ -74,7 +74,8 @@ "*delay: 20000 \n" \ "*showFPS: False \n" \ "*size: 0 \n" \ - "*useSHM: True \n" + "*useSHM: True \n" \ + "*suppressRotationAnimation: True\n" \ # define refresh_gleidescope 0 # include "xlockmore.h" /* from the xscreensaver distribution */ @@ -471,10 +472,8 @@ gleidescope_handle_event(ModeInfo *mi, XEvent *event) printf("event:%d\n", event->xany.type); printf("button:%d\n", event->xbutton.button); */ - switch(event->xany.type) - { - case ButtonPress: - + if (event->xany.type == ButtonPress) + { if (event->xbutton.button == Button1 || event->xbutton.button == Button3) { @@ -498,10 +497,8 @@ gleidescope_handle_event(ModeInfo *mi, XEvent *event) return True; } #endif - break; - - case ButtonRelease: - + } else if (event->xany.type == ButtonRelease) + { if (event->xbutton.button == Button1 || event->xbutton.button == Button3) { @@ -509,10 +506,8 @@ gleidescope_handle_event(ModeInfo *mi, XEvent *event) gp->button_down_p = False; return True; } - break; - - case MotionNotify: - + } else if (event->xany.type == MotionNotify) + { if (gp->button_down_p) { /* update mouse position */ @@ -523,8 +518,13 @@ gleidescope_handle_event(ModeInfo *mi, XEvent *event) return True; } - break; - } + } + else if (screenhack_event_helper (MI_DISPLAY(mi), MI_WINDOW(mi), event)) + { + gp->start_time = -1; + gp->fade = 0; + return True; + } return False; } @@ -875,7 +875,7 @@ setup_random_texture (ModeInfo *mi, texture *texture) texture->start_time = time((time_t *)0); } -static void +static Bool setup_file_texture (ModeInfo *mi, char *filename, texture *texture) { Display *dpy = mi->dpy; @@ -884,6 +884,7 @@ setup_file_texture (ModeInfo *mi, char *filename, texture *texture) Colormap cmap = mi->xgwa.colormap; XImage *image = xpm_file_to_ximage (dpy, visual, cmap, filename); + if (!image) return False; #ifdef DEBUG printf("FileTexture\n"); @@ -916,6 +917,7 @@ setup_file_texture (ModeInfo *mi, char *filename, texture *texture) texture->min_ty = 0.0; texture->max_ty = 1.0; texture->start_time = time((time_t *)0); + return True; } static void @@ -924,6 +926,7 @@ setup_texture(ModeInfo * mi, texture *texture) gleidestruct *gp = &gleidescope[MI_SCREEN(mi)]; if (!image || !*image || !strcmp(image, "DEFAULT")) { + BUILTIN: /* no image specified - use system settings */ #ifdef DEBUG printf("SetupTexture: get_snapshot\n"); @@ -940,7 +943,8 @@ setup_texture(ModeInfo * mi, texture *texture) #ifdef DEBUG printf("SetupTexture: file_texture\n"); #endif - setup_file_texture(mi, image, texture); + if (! setup_file_texture(mi, image, texture)) + goto BUILTIN; } } /* copy start time from texture */ @@ -1118,15 +1122,9 @@ draw_hexagons(ModeInfo *mi, int translucency, texture *texture) { int polys = 0; int i; - GLfloat col[4]; vector2f t[3]; gleidestruct *gp = &gleidescope[MI_SCREEN(mi)]; - col[0] = 1.0; - col[1] = 1.0; - col[2] = 1.0; - col[3] = (float)translucency / MAX_FADE; - calculate_texture_coords(mi, texture, t); glColor4f(1.0, 1.0, 1.0, (float)translucency / MAX_FADE); @@ -1247,7 +1245,6 @@ draw(ModeInfo * mi) GLfloat x_angle, y_angle, z_angle; gleidestruct *gp = &gleidescope[MI_SCREEN(mi)]; vectorf v1; - GLfloat pos[4]; mi->polygon_count = 0; @@ -1329,11 +1326,14 @@ draw(ModeInfo * mi) 0.0); #endif - /* light position same as camera */ - pos[0] = v1.x; - pos[1] = v1.y; - pos[2] = v1.z; - pos[3] = 0; +# 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); + } +# endif if (gp->fade == 0) { @@ -1402,7 +1402,6 @@ ENTRYPOINT void reshape_gleidescope(ModeInfo *mi, int width, int height) glLoadIdentity(); gluPerspective(50.0, 1/h, 0.1, 2000.0); glMatrixMode (GL_MODELVIEW); - glLineWidth(1); glPointSize(1); }