3 * Found in Don Hopkin`s .plan file:
5 * The color situation is a total flying circus. The X approach to
6 * device independence is to treat everything like a MicroVax framebuffer
7 * on acid. A truely portable X application is required to act like the
8 * persistent customer in the Monty Python ``Cheese Shop'' sketch. Even
9 * the simplest applications must answer many difficult questions, like:
11 * WHAT IS YOUR DISPLAY?
12 * display = XOpenDisplay("unix:0");
14 * root = RootWindow(display, DefaultScreen(display));
15 * AND WHAT IS YOUR WINDOW?
16 * win = XCreateSimpleWindow(display, root, 0, 0, 256, 256, 1,
17 * BlackPixel(display, DefaultScreen(display)),
18 * WhitePixel(display, DefaultScreen(display)))
19 * OH ALL RIGHT, YOU CAN GO ON.
21 * WHAT IS YOUR DISPLAY?
22 * display = XOpenDisplay("unix:0");
23 * WHAT IS YOUR COLORMAP?
24 * cmap = DefaultColormap(display, DefaultScreen(display));
25 * AND WHAT IS YOUR FAVORITE COLOR?
26 * favorite_color = 0; /* Black. */
27 * /* Whoops! No, I mean: */
28 * favorite_color = BlackPixel(display, DefaultScreen(display));
29 * /* AAAYYYYEEEEE!! (client dumps core & falls into the chasm) */
31 * WHAT IS YOUR DISPLAY?
32 * display = XOpenDisplay("unix:0");
33 * WHAT IS YOUR VISUAL?
34 * struct XVisualInfo vinfo;
35 * if (XMatchVisualInfo(display, DefaultScreen(display),
36 * 8, PseudoColor, &vinfo) != 0)
37 * visual = vinfo.visual;
38 * AND WHAT IS THE NET SPEED VELOCITY OF AN XConfigureWindow REQUEST?
39 * /* Is that a SubStructureRedirectMask or a ResizeRedirectMask? */
40 * WHAT??! HOW AM I SUPPOSED TO KNOW THAT?
41 * AAAAUUUGGGHHH!!!! (server dumps core & falls into the chasm)
45 #ifndef _SCREENHACK_H_
46 #define _SCREENHACK_H_
53 #include <X11/Xresource.h>
58 extern char *progname;
59 extern char *progclass;
60 extern XrmDatabase db;
61 extern XrmOptionDescRec options [];
62 extern int options_size;
63 extern char *defaults [];
67 # define bcopy(from,to,size) memcpy((to),(from),(size))
68 # define bzero(addr,size) memset((addr),0,(size))
70 # if defined(SVR4) || defined(SYSV)
71 extern int rand (void);
72 extern void srand (unsigned int);
73 # define random() rand()
74 # define srandom(i) srand((unsigned int)(i))
75 # else /* !totally-losing-SYSV */
76 extern long random (void);
77 extern void srandom (int);
78 # endif /* !totally-losing-SYSV */
87 extern void screenhack P((Display*,Window));
89 #define usleep screenhack_usleep
91 extern void screenhack_usleep P((unsigned long));
92 extern char *get_string_resource P((char*,char*));
93 extern Bool get_boolean_resource P((char*,char*));
94 extern int get_integer_resource P((char*,char*));
95 extern double get_float_resource P((char*,char*));
96 extern unsigned int get_pixel_resource P((char*,char*,Display*,Colormap));
97 extern unsigned int get_minutes_resource P((char*,char*));
98 extern unsigned int get_seconds_resource P((char*,char*));
100 extern Visual *get_visual_resource P((Display *, char *, char *));
101 extern int get_visual_depth P((Display *, Visual *));
103 void hsv_to_rgb P((int,double,double,unsigned short*,
104 unsigned short*,unsigned short*));
105 void rgb_to_hsv P((unsigned short,unsigned short,unsigned short,
106 int*,double*,double*));
107 void cycle_hue P((XColor*,int));
109 void make_color_ramp P((int h1, double s1, double v1,
110 int h2, double s2, double v2,
111 XColor *pixels, int npixels));
113 static double _frand_tmp_;
115 (_frand_tmp_ = (((double) random()) / \
116 (((double) ((unsigned int)~0)) / ((double) (f+f)))), \
117 _frand_tmp_ < 0 ? -_frand_tmp_ : _frand_tmp_)
120 #endif /* _SCREENHACK_H_ */