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.38.tar.gz
[xscreensaver]
/
hacks
/
glx
/
engine.c
diff --git
a/hacks/glx/engine.c
b/hacks/glx/engine.c
index 753eff6679dd53b196c53fd15bf31d937288ed46..0f39b8da7af640d7308a7fb42ba032085832053d 100644
(file)
--- a/
hacks/glx/engine.c
+++ b/
hacks/glx/engine.c
@@
-27,7
+27,8
@@
"*suppressRotationAnimation: True\n" \
"*titleFont: -*-helvetica-medium-r-normal-*-*-180-*-*-*-*-*-*\n" \
"*suppressRotationAnimation: True\n" \
"*titleFont: -*-helvetica-medium-r-normal-*-*-180-*-*-*-*-*-*\n" \
-# define refresh_engine 0
+# define free_engine 0
+# define release_engine 0
# include "xlockmore.h" /* from the xscreensaver distribution */
#else /* !STANDALONE */
# include "xlock.h" /* from the xlockmore distribution */
# include "xlockmore.h" /* from the xscreensaver distribution */
#else /* !STANDALONE */
# include "xlock.h" /* from the xlockmore distribution */
@@
-78,7
+79,7
@@
ENTRYPOINT ModeSpecOpt engine_opts = {countof(opts), opts, countof(vars), vars,
#ifdef USE_MODULES
ModStruct engine_description =
#ifdef USE_MODULES
ModStruct engine_description =
-{"engine", "init_engine", "draw_engine",
"release_engine"
,
+{"engine", "init_engine", "draw_engine",
NULL
,
"draw_engine", "init_engine", NULL, &engine_opts,
1000, 1, 2, 1, 4, 1.0, "",
"A four stroke engine", 0, NULL};
"draw_engine", "init_engine", NULL, &engine_opts,
1000, 1, 2, 1, 4, 1.0, "",
"A four stroke engine", 0, NULL};
@@
-846,11
+847,19
@@
static int makeshaft (Engine *e)
ENTRYPOINT void reshape_engine(ModeInfo *mi, int width, int height)
{
Engine *e = &engine[MI_SCREEN(mi)];
ENTRYPOINT void reshape_engine(ModeInfo *mi, int width, int height)
{
Engine *e = &engine[MI_SCREEN(mi)];
- glViewport(0,0,(GLint)width, (GLint) height);
+ double h = (GLfloat) height / (GLfloat) width;
+ int y = 0;
+
+ if (width > height * 5) { /* tiny window: show middle */
+ height = width * 9/16;
+ y = -height/2;
+ h = height / (GLfloat) width;
+ }
+
+ glViewport(0, y, width, height);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
-/* glFrustum(-1.0,1.0,-1.0,1.0,1.5,70.0);*/
- gluPerspective(40.0,((GLdouble)width)/height,1.5,70.0);
+ gluPerspective(40, 1/h, 1.5, 70.0);
glMatrixMode(GL_MODELVIEW);
e->win_h = height;
e->win_w = width;
glMatrixMode(GL_MODELVIEW);
e->win_h = height;
e->win_w = width;
@@
-862,11
+871,7
@@
ENTRYPOINT void init_engine(ModeInfo *mi)
int screen = MI_SCREEN(mi);
Engine *e;
int screen = MI_SCREEN(mi);
Engine *e;
- if (engine == NULL) {
- if ((engine = (Engine *) calloc(MI_NUM_SCREENS(mi),
- sizeof(Engine))) == NULL)
- return;
- }
+ MI_INIT(mi, engine);
e = &engine[screen];
e->window = MI_WINDOW(mi);
e = &engine[screen];
e->window = MI_WINDOW(mi);
@@
-996,16
+1001,6
@@
ENTRYPOINT void draw_engine(ModeInfo *mi)
glXSwapBuffers(disp, w);
}
glXSwapBuffers(disp, w);
}
-ENTRYPOINT void
-release_engine(ModeInfo *mi)
-{
- if (engine != NULL) {
- (void) free((void *) engine);
- engine = NULL;
- }
- FreeAllGL(mi);
-}
-
XSCREENSAVER_MODULE ("Engine", engine)
#endif
XSCREENSAVER_MODULE ("Engine", engine)
#endif