1 #ifndef DRIVER_H
2 #define DRIVER_H
3 
4 #include "config.h"
5 
6 #include <X11/Intrinsic.h>
7 
8 #ifdef HAVE_GETOPT_H
9 #include <getopt.h>
10 #else
11 #ifdef HAVE_GETOPT
12 #include <unistd.h>
13 #endif
14 #endif
15 
16 #ifdef __cplusplus
17 extern "C" {
18 #endif
19 
20 #define True 1
21 #define False 0
22 
23 typedef struct xstuff {
24 	char *commandLineName;
25 
26 	Display *display;
27 
28 	int screen_num;
29 
30 	Window rootWindow;
31 	Window window;
32 	Window existingWindow;
33 
34 	unsigned int windowWidth, windowHeight;	/* dimensions in pixels */
35 
36 	GC gc;			/* Graphics context. */
37 
38 	Colormap colourMap;
39 
40 	void *hackstuff;
41 } xstuff_t;
42 
43 #define DRIVER_OPTIONS_LONG {"root", 0, 0, 'r'}, {"maxfps", 1, 0, 'x'}, {"vsync", 1, 0, 'y'}, {"dpms", 1, 0, 'M'},
44 #define DRIVER_OPTIONS_SHORT "rx:y:M:"
45 #define DRIVER_OPTIONS_HELP "\t--root/-r\n" "\t--maxfps/-x <arg>\n" "\t--vsync/-y <arg>\n" "\t--dpms/-M <arg>\n"
46 #define DRIVER_OPTIONS_CASES case 'r': case 'x': case 'y': case 'M': handle_global_opts(c); break;
47 
48 void handle_global_opts (int c);
49 int strtol_minmaxdef(const char *optarg, const int base, const int min, const int max, const int type, const int def, const char *errmsg);
50 
51 void hack_handle_opts (int argc, char **argv);
52 void hack_init (xstuff_t *);
53 void hack_reshape (xstuff_t *);
54 void hack_draw (xstuff_t *, double, float);
55 void hack_cleanup (xstuff_t *);
56 
57 #ifdef __cplusplus
58 }
59 #endif
60 
61 extern int glewInitialized;
62 
63 #endif
64