projects
/
xscreensaver
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
From http://www.jwz.org/xscreensaver/xscreensaver-5.35.tar.gz
[xscreensaver]
/
hacks
/
glx
/
photopile.c
diff --git
a/hacks/glx/photopile.c
b/hacks/glx/photopile.c
index aa52d162e5e816d3269b561a7e9101561e6b9aa4..d2ea5b402aed92a30f06fb294eba15212bfcbcf6 100644
(file)
--- a/
hacks/glx/photopile.c
+++ b/
hacks/glx/photopile.c
@@
-1,4
+1,4
@@
-/* photopile, Copyright (c) 2008-201
2
Jens Kilian <jjk@acm.org>
+/* photopile, Copyright (c) 2008-201
5
Jens Kilian <jjk@acm.org>
* Based on carousel, Copyright (c) 2005-2008 Jamie Zawinski <jwz@jwz.org>
* Loads a sequence of images and shuffles them into a pile.
*
* Based on carousel, Copyright (c) 2005-2008 Jamie Zawinski <jwz@jwz.org>
* Loads a sequence of images and shuffles them into a pile.
*
@@
-11,7
+11,7
@@
* implied warranty.
*/
* implied warranty.
*/
-#define DEF_FONT "-*-helvetica-bold-r-normal-*-
240
-*"
+#define DEF_FONT "-*-helvetica-bold-r-normal-*-
*-480-*-*-*-*-*
-*"
#define DEFAULTS "*count: 7 \n" \
"*delay: 10000 \n" \
"*wireframe: False \n" \
#define DEFAULTS "*count: 7 \n" \
"*delay: 10000 \n" \
"*wireframe: False \n" \
@@
-21,7
+21,8
@@
"*font: " DEF_FONT "\n" \
"*desktopGrabber: xscreensaver-getimage -no-desktop %s\n" \
"*grabDesktopImages: False \n" \
"*font: " DEF_FONT "\n" \
"*desktopGrabber: xscreensaver-getimage -no-desktop %s\n" \
"*grabDesktopImages: False \n" \
- "*chooseRandomImages: True \n"
+ "*chooseRandomImages: True \n" \
+ "*suppressRotationAnimation: True\n" \
# define refresh_photopile 0
# define release_photopile 0
# define refresh_photopile 0
# define release_photopile 0
@@
-30,7
+31,7
@@
#undef countof
#define countof(x) (sizeof((x))/sizeof((*x)))
#undef countof
#define countof(x) (sizeof((x))/sizeof((*x)))
-#ifndef HAVE_
COCOA
+#ifndef HAVE_
JWXYZ
# include <X11/Intrinsic.h> /* for XrmDatabase in -debug mode */
#endif
#include <math.h>
# include <X11/Intrinsic.h> /* for XrmDatabase in -debug mode */
#endif
#include <math.h>
@@
-353,7
+354,12
@@
loading_msg (ModeInfo *mi)
if (wire) return;
if (ss->loading_sw == 0) /* only do this once */
if (wire) return;
if (ss->loading_sw == 0) /* only do this once */
- ss->loading_sw = texture_string_width (ss->texfont, text, &ss->loading_sh);
+ {
+ XCharStruct e;
+ texture_string_metrics (ss->texfont, text, &e, 0, 0);
+ ss->loading_sw = e.width;
+ ss->loading_sh = e.ascent + e.descent;
+ }
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
@@
-428,6
+434,15
@@
reshape_photopile (ModeInfo *mi, int width, int height)
glLoadIdentity();
glOrtho(0, MI_WIDTH(mi), 0, MI_HEIGHT(mi), -1, 1);
glLoadIdentity();
glOrtho(0, MI_WIDTH(mi), 0, MI_HEIGHT(mi), -1, 1);
+# 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, h, 1);
+ }
+# endif
+
glClear(GL_COLOR_BUFFER_BIT);
}
glClear(GL_COLOR_BUFFER_BIT);
}
@@
-437,7
+452,7
@@
reshape_photopile (ModeInfo *mi, int width, int height)
static void
hack_resources (Display *dpy)
{
static void
hack_resources (Display *dpy)
{
-# ifndef HAVE_
COCOA
+# ifndef HAVE_
JWXYZ
char *res = "desktopGrabber";
char *val = get_string_resource (dpy, res, "DesktopGrabber");
char buf1[255];
char *res = "desktopGrabber";
char *val = get_string_resource (dpy, res, "DesktopGrabber");
char buf1[255];
@@
-449,7
+464,7
@@
hack_resources (Display *dpy)
value.addr = buf2;
value.size = strlen(buf2);
XrmPutResource (&db, buf1, "String", &value);
value.addr = buf2;
value.size = strlen(buf2);
XrmPutResource (&db, buf1, "String", &value);
-# endif /* !HAVE_
COCOA
*/
+# endif /* !HAVE_
JWXYZ
*/
}
}
@@
-629,18
+644,26
@@
draw_image (ModeInfo *mi, int i, GLfloat t, GLfloat s, GLfloat z)
*/
if (titles_p)
{
*/
if (titles_p)
{
- int sw, sh;
- GLfloat scale =
0.6
;
+ int sw, sh
, ascent, descent
;
+ GLfloat scale =
1
;
const char *title = frame->title ? frame->title : "(untitled)";
const char *title = frame->title ? frame->title : "(untitled)";
+ XCharStruct e;
/* #### Highly approximate, but doing real clipping is harder... */
int max = 35;
if (strlen(title) > max)
title += strlen(title) - max;
/* #### Highly approximate, but doing real clipping is harder... */
int max = 35;
if (strlen(title) > max)
title += strlen(title) - max;
- sw = texture_string_width (ss->texfont, title, &sh);
+ texture_string_metrics (ss->texfont, title, &e, &ascent, &descent);
+ sw = e.width;
+ sh = ascent + descent;
+
+ /* Scale the text to match the pixel size of the photo */
+ scale *= w / 300.0;
- glTranslatef (-sw*scale*0.5, -h - sh*scale, z);
+ /* Move to below photo */
+ glTranslatef (0, -h - sh * (polaroid_p ? 2.2 : 0.5), 0);
+ glTranslatef (-sw*scale/2, sh*scale/2, z);
glScalef (scale, scale, 1);
if (wire || !polaroid_p)
glScalef (scale, scale, 1);
if (wire || !polaroid_p)