#ifdef STANDALONE
-# define PROGCLASS "Planet"
-# define HACK_INIT init_planet
-# define HACK_DRAW draw_planet
-# define HACK_RESHAPE reshape_planet
-# define HACK_HANDLE_EVENT planet_handle_event
-# define EVENT_MASK PointerMotionMask
-# define planet_opts xlockmore_opts
#define DEFAULTS "*delay: 20000 \n" \
"*showFPS: False \n" \
- "*rotate: True \n" \
- "*roll: True \n" \
- "*wander: True \n" \
"*wireframe: False \n" \
- "*light: True \n" \
- "*texture: True \n" \
- "*stars: True \n" \
- "*image: BUILTIN \n" \
"*imageForeground: Green \n" \
"*imageBackground: Blue \n"
-
+# define refresh_planet 0
# include "xlockmore.h" /* from the xscreensaver distribution */
#else /* !STANDALONE */
# include "xlock.h" /* from the xlockmore distribution */
# endif /* VMS */
#endif
-
-#include <GL/glu.h>
-
#define DEF_ROTATE "True"
#define DEF_ROLL "True"
#define DEF_WANDER "True"
{&resolution, "resolution","Resolution", DEF_RESOLUTION, t_Int},
};
-ModeSpecOpt planet_opts = {countof(opts), opts, countof(vars), vars, NULL};
+ENTRYPOINT ModeSpecOpt planet_opts = {countof(opts), opts, countof(vars), vars, NULL};
#ifdef USE_MODULES
ModStruct planet_description =
static planetstruct *planets = NULL;
-static inline void
-normalize(GLfloat v[3])
-{
- GLfloat d = (GLfloat) sqrt((double) (v[0] * v[0] +
- v[1] * v[1] +
- v[2] * v[2]));
- if (d != 0)
- {
- v[0] /= d;
- v[1] /= d;
- v[2] /= d;
- }
- else
- {
- v[0] = v[1] = v[2] = 0;
- }
-}
-
-
/* Set up and enable texturing on our object */
static void
setup_xpm_texture (ModeInfo *mi, char **xpm_data)
}
-void
+static void
init_stars (ModeInfo *mi)
{
int i, j;
}
-void
+static void
draw_stars (ModeInfo * mi)
{
int width = MI_WIDTH(mi);
#define RANDSIGN() ((random() & 1) ? 1 : -1)
-void
+ENTRYPOINT void
reshape_planet (ModeInfo *mi, int width, int height)
{
GLfloat h = (GLfloat) height / (GLfloat) width;
}
-Bool
+ENTRYPOINT Bool
planet_handle_event (ModeInfo *mi, XEvent *event)
{
planetstruct *gp = &planets[MI_SCREEN(mi)];
if (event->xany.type == ButtonPress &&
- event->xbutton.button & Button1)
+ event->xbutton.button == Button1)
{
gp->button_down_p = True;
gltrackball_start (gp->trackball,
return True;
}
else if (event->xany.type == ButtonRelease &&
- event->xbutton.button & Button1)
+ event->xbutton.button == Button1)
{
gp->button_down_p = False;
return True;
}
+ else if (event->xany.type == ButtonPress &&
+ (event->xbutton.button == Button4 ||
+ event->xbutton.button == Button5 ||
+ event->xbutton.button == Button6 ||
+ event->xbutton.button == Button7))
+ {
+ gltrackball_mousewheel (gp->trackball, event->xbutton.button, 10,
+ !!event->xbutton.state);
+ return True;
+ }
else if (event->xany.type == MotionNotify &&
gp->button_down_p)
{
}
-void
+ENTRYPOINT void
init_planet (ModeInfo * mi)
{
planetstruct *gp;
}
{
- char *f = get_string_resource("imageForeground", "Foreground");
- char *b = get_string_resource("imageBackground", "Background");
+ char *f = get_string_resource(mi->dpy, "imageForeground", "Foreground");
+ char *b = get_string_resource(mi->dpy, "imageBackground", "Background");
char *s;
if (!f) f = strdup("white");
if (!b) b = strdup("black");
glEndList();
}
-void
+ENTRYPOINT void
draw_planet (ModeInfo * mi)
{
planetstruct *gp = &planets[MI_SCREEN(mi)];
}
-void
+ENTRYPOINT void
release_planet (ModeInfo * mi)
{
if (planets != NULL) {
if (gp->glx_context) {
/* Display lists MUST be freed while their glXContext is current. */
- glXMakeCurrent(MI_DISPLAY(mi), gp->window, *(gp->glx_context));
+ /* but this gets a BadMatch error. -jwz */
+ /*glXMakeCurrent(MI_DISPLAY(mi), gp->window, *(gp->glx_context));*/
if (glIsList(gp->platelist))
glDeleteLists(gp->platelist, 1);
}
-#endif
+XSCREENSAVER_MODULE_2 ("GLPlanet", glplanet, planet)
+#endif