#include <X11/Shell.h>
#include <X11/StringDefs.h>
#include <X11/Xutil.h>
+#include <X11/keysym.h>
#ifdef __sgi
# include <X11/SGIScheme.h> /* for SgiUseSchemes() */
char *progname;
XrmDatabase db;
+XtAppContext app;
Bool mono_p;
static XrmOptionDescRec default_options [] = {
}
-#ifdef USE_GL
-extern Visual *get_gl_visual (Screen *, const char *, const char *);
-#endif
-
#ifdef XLOCKMORE
extern void pre_merge_options (void);
#endif
c == 3 || /* ^C */
c == 27) /* ESC */
exit (0);
+ else if (! (keysym >= XK_Shift_L && keysym <= XK_Hyper_R))
+ XBell (dpy, 0); /* beep for non-chord keys */
}
+ break;
case ButtonPress:
XBell (dpy, 0);
break;
}
+static Visual *
+pick_visual (Screen *screen)
+{
+#ifdef USE_GL
+ /* If we're linking against GL (that is, this is the version of screenhack.o
+ that the GL hacks will use, which is different from the one that the
+ non-GL hacks will use) then try to pick the "best" visual by interrogating
+ the GL library instead of by asking Xlib. GL knows better.
+ */
+ Visual *v = 0;
+ char *string = get_string_resource ("visualID", "VisualID");
+
+ if (!string || !*string ||
+ !strcmp (string, "gl") ||
+ !strcmp (string, "best") ||
+ !strcmp (string, "color") ||
+ !strcmp (string, "default"))
+ v = get_gl_visual (screen); /* from ../utils/visual-gl.c */
+
+ if (string)
+ free (string);
+ if (v)
+ return v;
+#endif /* USE_GL */
+
+ return get_visual_resource (screen, "visualID", "VisualID", False);
+}
+
int
main (int argc, char **argv)
{
- XtAppContext app;
Widget toplevel;
Display *dpy;
Window window;
{
Boolean def_visual_p;
Screen *screen = XtScreen (toplevel);
-
-#ifdef USE_GL
- visual = get_gl_visual (screen, "visualID", "VisualID");
-#else
- visual = get_visual_resource (screen, "visualID", "VisualID", False);
-#endif
+ visual = pick_visual (screen);
if (toplevel->core.width <= 0)
toplevel->core.width = 600;