-/* dangerball, Copyright (c) 2001-2004 Jamie Zawinski <jwz@jwz.org>
+/* dangerball, Copyright (c) 2001-2008 Jamie Zawinski <jwz@jwz.org>
*
* Permission to use, copy, modify, distribute, and sell this software and its
* documentation for any purpose is hereby granted without fee, provided that
* implied warranty.
*/
-#include <X11/Intrinsic.h>
-
-extern XtAppContext app;
-
-#define PROGCLASS "DangerBall"
-#define HACK_INIT init_ball
-#define HACK_DRAW draw_ball
-#define HACK_RESHAPE reshape_ball
-#define HACK_HANDLE_EVENT ball_handle_event
-#define EVENT_MASK PointerMotionMask
-#define sws_opts xlockmore_opts
-
-#define DEF_SPIN "True"
-#define DEF_WANDER "True"
-#define DEF_SPEED "0.05"
-
#define DEFAULTS "*delay: 30000 \n" \
"*count: 30 \n" \
"*showFPS: False \n" \
"*wireframe: False \n" \
- "*speed: " DEF_SPEED " \n" \
- "*spin: " DEF_SPIN "\n" \
- "*wander: " DEF_WANDER "\n" \
-
-
-#define SPIKE_FACES 12 /* how densely to render spikes */
-#define SMOOTH_SPIKES True
-#define SPHERE_SLICES 32 /* how densely to render spheres */
-#define SPHERE_STACKS 16
-
+# define refresh_ball 0
+# define release_ball 0
#undef countof
#define countof(x) (sizeof((x))/sizeof((*x)))
#ifdef USE_GL /* whole file */
-#include <GL/glu.h>
+
+#define DEF_SPIN "True"
+#define DEF_WANDER "True"
+#define DEF_SPEED "0.05"
+
+#define SPIKE_FACES 12 /* how densely to render spikes */
+#define SMOOTH_SPIKES True
+#define SPHERE_SLICES 32 /* how densely to render spheres */
+#define SPHERE_STACKS 16
typedef struct {
GLXContext *glx_context;
{&speed, "speed", "Speed", DEF_SPEED, t_Float},
};
-ModeSpecOpt sws_opts = {countof(opts), opts, countof(vars), vars, NULL};
+ENTRYPOINT ModeSpecOpt ball_opts = {countof(opts), opts, countof(vars), vars, NULL};
/* Window management, etc
*/
-void
+ENTRYPOINT void
reshape_ball (ModeInfo *mi, int width, int height)
{
GLfloat h = (GLfloat) height / (GLfloat) width;
}
-Bool
+ENTRYPOINT Bool
ball_handle_event (ModeInfo *mi, XEvent *event)
{
ball_configuration *bp = &bps[MI_SCREEN(mi)];
}
else if (event->xany.type == ButtonPress &&
(event->xbutton.button == Button4 ||
- event->xbutton.button == Button5))
+ event->xbutton.button == Button5 ||
+ event->xbutton.button == Button6 ||
+ event->xbutton.button == Button7))
{
gltrackball_mousewheel (bp->trackball, event->xbutton.button, 10,
!!event->xbutton.state);
}
-void
+ENTRYPOINT void
init_ball (ModeInfo *mi)
{
ball_configuration *bp;
}
-void
+ENTRYPOINT void
draw_ball (ModeInfo *mi)
{
ball_configuration *bp = &bps[MI_SCREEN(mi)];
Window window = MI_WINDOW(mi);
int c2;
- static GLfloat bcolor[4] = {0.0, 0.0, 0.0, 1.0};
- static GLfloat scolor[4] = {0.0, 0.0, 0.0, 1.0};
- static GLfloat bspec[4] = {1.0, 1.0, 1.0, 1.0};
- static GLfloat sspec[4] = {0.0, 0.0, 0.0, 1.0};
- static GLfloat bshiny = 128.0;
- static GLfloat sshiny = 0.0;
+ static const GLfloat bspec[4] = {1.0, 1.0, 1.0, 1.0};
+ static const GLfloat sspec[4] = {0.0, 0.0, 0.0, 1.0};
+ static const GLfloat bshiny = 128.0;
+ static const GLfloat sshiny = 0.0;
+
+ GLfloat bcolor[4] = {0.0, 0.0, 0.0, 1.0};
+ GLfloat scolor[4] = {0.0, 0.0, 0.0, 1.0};
if (!bp->glx_context)
return;
+ glXMakeCurrent(MI_DISPLAY(mi), MI_WINDOW(mi), *(bp->glx_context));
+
glShadeModel(GL_SMOOTH);
glEnable(GL_DEPTH_TEST);
glXSwapBuffers(dpy, window);
}
+XSCREENSAVER_MODULE_2 ("DangerBall", dangerball, ball)
+
#endif /* USE_GL */