1 /* xscreensaver, Copyright (c) 2000, 2002 by Jamie Zawinski <jwz@jwz.org>
3 * Permission to use, copy, modify, distribute, and sell this software and its
4 * documentation for any purpose is hereby granted without fee, provided that
5 * the above copyright notice appear in all copies and that both that
6 * copyright notice and this permission notice appear in supporting
7 * documentation. No representations are made about the suitability of this
8 * software for any purpose. It is provided "as is" without express or
12 /* xscreensaver-gl-helper -- prints the ID of the best visual to use
13 for GL programs on stdout.
23 char *progclass = "XScreenSaver";
26 main (int argc, char **argv)
31 char *d = getenv ("DISPLAY");
35 for (i = 1; i < argc; i++)
37 if (argv[i][0] == '-' && argv[i][1] == '-') argv[i]++;
38 if (strlen(argv[i]) >= 2 &&
39 !strncmp ("-display", argv[i], strlen(argv[i])))
41 if (i == argc-1) goto LOSE;
48 fprintf (stderr, "usage: %s [ -display host:dpy.screen ]\n",
51 "This program prints out the ID of the best "
52 "X visual for GL programs to use.\n");
57 dpy = XOpenDisplay (d);
60 fprintf (stderr, "%s: couldn't open display %s\n", progname,
65 screen = DefaultScreenOfDisplay (dpy);
66 visual = get_gl_visual (screen);
69 printf ("0x%x\n", (unsigned int) XVisualIDFromVisual (visual));