/*Compile with: gcc -pedantic -Wall -Wstrict-prototypes -Wnested-externs -Wmissing-prototypes -Wno-overlength-strings -Wdeclaration-after-statement -std=c89 -U__STRICT_ANSI__ -I../../utils -I../ -I../../ -DSTANDALONE -DUSE_GL -DHAVE_CONFIG_H -g base.c ../fps.c fps-gl.c ../../utils/resources.c ../../utils/visual.c ../../utils/visual-gl.c ../../utils/usleep.c ../../utils/yarandom.c ../../utils/hsv.c ../../utils/colors.c ../../utils/async_netdb.c ../../utils/aligned_malloc.c ../../utils/thread_util.c ../../utils/utf8wc.c ../screenhack.c ../xlockmore.c xlock-gl-utils.c texfont.c -o base -lGL -lGLU -lXxf86vm -lpthread -lSM -lICE -lXft -lXt -lX11 -lXmu -lXext -lm `freetype-config --libs --cflags` Assuming the current working directory is /hacks/glx and base.c is stored there.*/ #define DEFAULTS "*delay: 30000\n"\ "*showFPS: False\n" #include "xlockmore.h" #ifdef USE_GL typedef struct { GLXContext *glx_context; } base_configuration; static base_configuration *confs = NULL; /*static XrmOptionDescRec opts[] = {};*/ /*static argtype vars[] = {};*/ ENTRYPOINT ModeSpecOpt base_opts = {/*sizeof(opts)/sizeof(XrmOptionDescRec), opts,*/ /*sizeof(vars)/sizeof(argtype), vars,*/ 0, NULL, 0, NULL, NULL}; ENTRYPOINT void reshape_base(ModeInfo *mi, int width, int height) { base_configuration* conf = confs + MI_SCREEN(mi); } ENTRYPOINT void refresh_base(ModeInfo *mi) { base_configuration* conf = confs + MI_SCREEN(mi); } ENTRYPOINT void release_base(ModeInfo *mi) { base_configuration* conf = confs + MI_SCREEN(mi); } ENTRYPOINT Bool base_handle_event(ModeInfo *mi, XEvent *event) { base_configuration* conf = confs + MI_SCREEN(mi); return False; /*The event was not handled*/ } ENTRYPOINT void init_base(ModeInfo *mi) { base_configuration* conf; if (!confs) confs = malloc(MI_NUM_SCREENS(mi)*sizeof(base_configuration)); if (!confs) { fprintf(stderr, "%s: out of memory\n", progname); exit(1); } conf = confs + MI_SCREEN(mi); conf->glx_context = init_GL(mi); reshape_base(mi, MI_WIDTH(mi), MI_HEIGHT(mi)); } ENTRYPOINT void draw_base(ModeInfo *mi) { base_configuration* conf = confs + MI_SCREEN(mi); Display* dpy = MI_DISPLAY(mi); Window window = MI_WINDOW(mi); if (!conf->glx_context) return; glXMakeCurrent(MI_DISPLAY(mi), MI_WINDOW(mi), *(conf->glx_context)); glClearColor(1.0f, 0.5f, 0.5f, 1.0f); glClear(GL_COLOR_BUFFER_BIT); if (mi->fps_p) do_fps(mi); glFinish(); glXSwapBuffers(dpy, window); } XSCREENSAVER_MODULE("Base", base) #endif