X-Git-Url: http://git.hungrycats.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=hacks%2FxlockmoreI.h;h=75909784974fefa3e7bdf3cebce4839f4443b651;hb=6afd6db0ae9396cd7ff897ade597cd5483f49b0e;hp=2813c754a7c8b79587b157cae39a06ffcaf5c976;hpb=df7adbee81405e2849728a24b498ad2117784b1f;p=xscreensaver diff --git a/hacks/xlockmoreI.h b/hacks/xlockmoreI.h index 2813c754..75909784 100644 --- a/hacks/xlockmoreI.h +++ b/hacks/xlockmoreI.h @@ -1,5 +1,5 @@ /* xlockmore.h --- xscreensaver compatibility layer for xlockmore modules. - * xscreensaver, Copyright (c) 1997, 1998 Jamie Zawinski + * xscreensaver, Copyright (c) 1997-2012 Jamie Zawinski * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, provided that @@ -15,24 +15,67 @@ #ifndef __XLOCKMORE_INTERNAL_H__ #define __XLOCKMORE_INTERNAL_H__ -#include "screenhack.h" +#include + +#include "screenhackI.h" #ifdef HAVE_XSHM_EXTENSION # include "xshm.h" #endif /* HAVE_XSHM_EXTENSION */ +typedef struct ModeInfo ModeInfo; + +#ifdef USE_GL + /* I'm told that the Sun version of OpenGL needs to have the constant SUN_OGL_NO_VERTEX_MACROS defined in order for morph3d to compile (the number of arguments to the glNormal3f macro changes...) Verified with gcc 2.7.2.2 and Sun cc 4.2 with OpenGL 1.1.1 dev 4 on Solaris 2.5.1. */ -#ifndef HAVE_MESA_GL -# if defined(__sun) && defined(__SVR4) /* Solaris */ -# define SUN_OGL_NO_VERTEX_MACROS 1 -# endif /* Solaris */ -#endif /* !HAVE_MESA_GL */ +# ifndef HAVE_MESA_GL +# if defined(__sun) && defined(__SVR4) /* Solaris */ +# define SUN_OGL_NO_VERTEX_MACROS 1 +# endif /* Solaris */ +# endif /* !HAVE_MESA_GL */ + +# ifdef HAVE_COCOA +# ifndef USE_IPHONE +# include +# include +# endif +# else +# include +# include +# include +# endif + +# ifdef HAVE_JWZGLES +# include "jwzgles.h" +# endif /* HAVE_JWZGLES */ + + + extern GLXContext *init_GL (ModeInfo *); + extern void xlockmore_reset_gl_state(void); + extern void clear_gl_error (void); + extern void check_gl_error (const char *type); + + extern Visual *xlockmore_pick_gl_visual (Screen *); + extern Bool xlockmore_validate_gl_visual (Screen *, const char *, Visual *); + +#endif /* !USE_GL */ + +/* These are only used in GL mode, but I don't understand why XCode + isn't seeing the prototypes for them in glx/fps-gl.c... */ +extern void do_fps (ModeInfo *); +extern void xlockmore_gl_compute_fps (Display *, Window, fps_state *, void *); +extern void xlockmore_gl_draw_fps (ModeInfo *); +# define do_fps xlockmore_gl_draw_fps + + +extern void xlockmore_setup (struct xscreensaver_function_table *, void *); +extern void xlockmore_do_fps (Display *, Window, fps_state *, void *); /* Compatibility with the xlockmore RNG API @@ -44,10 +87,13 @@ #define SRAND(n) /* already seeded by screenhack.c */ -typedef struct ModeInfo { +struct ModeInfo { + struct xlockmore_function_table *xlmft; Display *dpy; Window window; Bool root_p; + int num_screens; + int screen_number; int npixels; unsigned long *pixels; XColor *colors; @@ -70,12 +116,17 @@ typedef struct ModeInfo { Bool wireframe_p; Bool is_drawn; + /* Used only by OpenGL programs, since FPS is tricky there. */ + fps_state *fpst; + Bool fps_p; + unsigned long polygon_count; /* These values are for -fps display only */ + double recursion_depth; + #ifdef HAVE_XSHM_EXTENSION Bool use_shm; XShmSegmentInfo shm_info; #endif - -} ModeInfo; +}; typedef enum { t_String, t_Float, t_Int, t_Bool } xlockmore_type; @@ -100,13 +151,22 @@ typedef struct { OptionStruct *desc; } ModeSpecOpt; -extern void xlockmore_screenhack (Display *dpy, Window window, - Bool want_writable_colors, - Bool want_uniform_colors, - Bool want_smooth_colors, - Bool want_bright_colors, - void (*hack_init) (ModeInfo *), - void (*hack_draw) (ModeInfo *), - void (*hack_free) (ModeInfo *)); +struct xlockmore_function_table { + const char *progclass; + const char *defaults; + Bool want_writable_colors; + enum { color_scheme_default, color_scheme_uniform, + color_scheme_smooth, color_scheme_bright } + desired_color_scheme; + void (*hack_init) (ModeInfo *); + void (*hack_draw) (ModeInfo *); + void (*hack_reshape) (ModeInfo *, int, int); + void (*hack_refresh) (ModeInfo *); + void (*hack_free) (ModeInfo *); + Bool (*hack_handle_events) (ModeInfo *, XEvent *); + ModeSpecOpt *opts; + + unsigned screen_count; /* Only used on the OS X and iOS ports. */ +}; #endif /* __XLOCKMORE_INTERNAL_H__ */