-/* xscreensaver, Copyright (c) 2003-2015 Jamie Zawinski <jwz@jwz.org>
+/* xscreensaver, Copyright (c) 2003-2016 Jamie Zawinski <jwz@jwz.org>
*
* Permission to use, copy, modify, distribute, and sell this software and its
* documentation for any purpose is hereby granted without fee, provided that
/* #define DEBUG */
#include <math.h>
+#include <time.h>
-#ifndef HAVE_COCOA
+#ifndef HAVE_JWXYZ
# include <X11/Intrinsic.h>
#endif
char pattern[1024];
char pattern2[1024];
-# ifndef HAVE_COCOA /* real Xlib */
+#ifndef HAVE_JWXYZ /* real Xlib */
char **names = 0;
char **names2 = 0;
XFontStruct *info = 0;
XFreeFontInfo (names2, info, count2);
XFreeFontNames (names);
-# else /* HAVE_COCOA */
+# else /* HAVE_JWXYZ */
if (s->font_override)
sprintf (pattern, "%.200s", s->font_override);
sprintf (pattern, "*-%s-%s-%s-*-*-*-%d-*", family, weight, slant, size);
}
ok = True;
-# endif /* HAVE_COCOA */
+# endif /* HAVE_JWXYZ */
if (! ok) return False;
}
strcpy (pattern2, pattern);
-# ifdef HAVE_COCOA
+# ifdef HAVE_JWXYZ
{
float s;
const char *n = jwxyz_nativeFontName (se->xftfont->xfont->fid, &s);
/* Returns a newly-allocated string with one word in it, or NULL if there
is no complete word available.
*/
-static const char *
+static char *
get_word_text (state *s)
{
const char *start = s->buf;
if (unread_word_text)
{
- start = unread_word_text;
+ result = unread_word_text;
unread_word_text = 0;
- return start;
+ return strdup (result);
}
/* Skip over whitespace at the beginning of the buffer,
while (!done)
{
- const char *txt = get_word_text (s);
+ char *txt = get_word_text (s);
word *w;
if (!txt)
{
}
w = new_word (s, se, txt, !se->move_chars_p);
+ free (txt);
+ txt = 0;
/* If we have a few words, let punctuation terminate the sentence:
stop gathering more words if the last word ends in a period, etc. */
y + se->xftfont->ascent + se->xftfont->descent > s->xgwa.height)
{
unread_word (s, w);
+ free (w);
/* done = True; */
break;
}
gc = XCreateGC (s->dpy, dest, 0, 0);
XSetFont (s->dpy, gc, s->metrics_font1->fid);
-# ifdef HAVE_COCOA
+# if defined(HAVE_JWXYZ)
jwxyz_XSetAntiAliasing (s->dpy, gc, False);
# endif
}
strcpy (fn2, fn);
-# ifdef HAVE_COCOA
+# ifdef HAVE_JWXYZ
{
float ss;
const char *n = jwxyz_nativeFontName (s->metrics_xftfont->xfont->fid, &ss);
s->xgwa.height - 5,
fn2, strlen(fn2));
-# ifdef HAVE_COCOA
+# ifdef HAVE_JWXYZ
{
char *name =
jwxyz_unicode_character_name (s->metrics_font1->fid, s->debug_metrics_p);
{
Pixmap p2;
GC gc2 = XCreateGC (s->dpy, p, 0, 0);
-# ifdef HAVE_COCOA
+# ifdef HAVE_JWXYZ
jwxyz_XSetAntiAliasing (s->dpy, gc2, False);
# endif
XSetFont (s->dpy, gc2, s->metrics_font1->fid);
XFillRectangle (s->dpy, p, gc2, 0, 0, pixw, pixh);
XSetForeground (s->dpy, gc, WhitePixelOfScreen (s->xgwa.screen));
XSetForeground (s->dpy, gc2, WhitePixelOfScreen (s->xgwa.screen));
-# ifdef HAVE_COCOA
+# ifdef HAVE_JWXYZ
jwxyz_XSetAntiAliasing (s->dpy, gc2,
s->debug_metrics_antialiasing_p);
# endif
{
XSetFont (s->dpy, gc, s->metrics_font1->fid);
XSetForeground (s->dpy, gc, WhitePixelOfScreen (s->xgwa.screen));
-# ifdef HAVE_COCOA
+# ifdef HAVE_JWXYZ
jwxyz_XSetAntiAliasing (s->dpy, gc, s->debug_metrics_antialiasing_p);
# endif
sprintf (txt2, "%s [XX%sXX] [%s%s%s%s]",
xoff + x/2 + (sc*cc.rbearing/2) - cc.rbearing/2,
ascent + 10,
txt2, strlen(txt2));
-# ifdef HAVE_COCOA
+# ifdef HAVE_JWXYZ
jwxyz_XSetAntiAliasing (s->dpy, gc, False);
# endif
XSetFont (s->dpy, gc, s->metrics_font2->fid);
txt2, strlen(txt2));
}
-# ifdef HAVE_COCOA
+# ifdef HAVE_JWXYZ
jwxyz_XSetAntiAliasing (s->dpy, gc, True);
# endif
xoff + x + sc*cc.rbearing, y - sc*ascent,
xoff + x + sc*cc.rbearing, y + sc*descent + 40);
- y += sc * (ascent + descent) * 2;
+ /* y += sc * (ascent + descent) * 2; */
}
}
? 199 : 0);
s->debug_scale = 6;
-# ifdef HAVE_COCOA
+# ifdef HAVE_JWXYZ
if (s->debug_metrics_p && !s->font_override)
s->font_override = "Helvetica Bold 16";
# endif
s->dbuf = get_boolean_resource (dpy, "doubleBuffer", "Boolean");
-# ifdef HAVE_COCOA /* Don't second-guess Quartz's double-buffering */
+# ifdef HAVE_JWXYZ /* Don't second-guess Quartz's double-buffering */
s->dbuf = False;
# endif