/* xlockmore.c --- xscreensaver compatibility layer for xlockmore modules.
- * xscreensaver, Copyright (c) 1997, 1998, 2001, 2002
+ * xscreensaver, Copyright (c) 1997, 1998, 2001, 2002, 2004
* Jamie Zawinski <jwz@jwz.org>
*
* Permission to use, copy, modify, distribute, and sell this software and its
#include <sys/time.h>
#include "screenhack.h"
#include "xlockmoreI.h"
+#include <X11/Intrinsic.h>
#define countof(x) (sizeof((x))/sizeof(*(x)))
#define MAX_COLORS (1L<<13)
+extern XtAppContext app;
extern ModeSpecOpt xlockmore_opts[];
extern const char *app_defaults;
/* Add extra args, if they're mentioned in the defaults... */
{
char *args[] = { "-count", "-cycles", "-delay", "-ncolors",
- "-size", "-wireframe", "-use3d", "-useSHM",
+ "-size", "-font", "-wireframe", "-use3d", "-useSHM",
"-showFPS" };
for (j = 0; j < countof(args); j++)
if (strstr(app_defaults, args[j]+1))
void (*reshape) (ModeInfo *, int, int),
Bool (*hook) (ModeInfo *, XEvent *))
{
+ if (XtAppPending (app) & (XtIMTimer|XtIMAlternateInput))
+ XtAppProcessEvent (app, XtIMTimer|XtIMAlternateInput);
+
while (XPending (mi->dpy))
{
XEvent event;
mi.pause = 100000000;
orig_pause = mi.pause;
+ /* If this hack uses fonts (meaning, mentioned "font" in DEFAULTS)
+ then load it. */
+ {
+ char *name = get_string_resource ("font", "Font");
+ if (name)
+ {
+ XFontStruct *f = XLoadQueryFont (dpy, name);
+ const char *def1 = "-*-times-bold-r-normal-*-180-*";
+ const char *def2 = "fixed";
+ if (!f)
+ {
+ fprintf (stderr, "%s: font %s does not exist, using %s\n",
+ progname, name, def1);
+ f = XLoadQueryFont (dpy, def1);
+ }
+ if (!f)
+ {
+ fprintf (stderr, "%s: font %s does not exist, using %s\n",
+ progname, def1, def2);
+ f = XLoadQueryFont (dpy, def2);
+ }
+ if (f) XSetFont (dpy, mi.gc, f->fid);
+ if (f) XFreeFont (dpy, f);
+ }
+ }
+
xlockmore_read_resources ();
XClearWindow (dpy, window);