-/* xscreensaver, Copyright (c) 1991-2006 Jamie Zawinski <jwz@netscape.com>
+/* xscreensaver, Copyright (c) 1991-2014 Jamie Zawinski <jwz@netscape.com>
*
* Permission to use, copy, modify, distribute, and sell this software and its
* documentation for any purpose is hereby granted without fee, provided that
char *heading_label;
char *body_label;
char *body2_label;
+ char *body3_label;
+ char *body4_label;
char *demo_label;
#ifdef PREFS_BUTTON
char *prefs_label;
Pixel foreground;
Pixel background;
+ Pixel border;
Pixel button_foreground;
Pixel button_background;
Pixel shadow_top;
void
make_splash_dialog (saver_info *si)
{
+ saver_preferences *p = &si->prefs;
int x, y, bw;
XSetWindowAttributes attrs;
unsigned long attrmask = 0;
Colormap cmap;
char *f;
+ Bool whine = senescent_p ();
+
+ if (whine)
+ {
+ /* If locking is not enabled, make sure they see the message. */
+ if (!p->lock_p)
+ {
+ si->prefs.splash_p = True;
+ if (si->prefs.splash_duration < 5000)
+ si->prefs.splash_duration = 5000;
+ }
+ si->prefs.splash_duration += 3000;
+ }
+
if (si->sp_data)
return;
if (!si->prefs.splash_p ||
return;
ssi = &si->screens[mouse_screen (si)];
+
+ if (!ssi || !ssi->screen)
+ return; /* WTF? Trying to splash while no screens connected? */
+
cmap = DefaultColormapOfScreen (ssi->screen);
sp = (splash_dialog_data *) calloc (1, sizeof(*sp));
"splash.help.label",
"Dialog.Button.Label");
+
+
+ if (whine)
+ {
+ sp->body3_label = strdup("WARNING: This version is very old!");
+ sp->body4_label = strdup("Please upgrade!");
+ }
+
if (!sp->heading_label)
sp->heading_label = strdup("ERROR: REESOURCES NOT INSTALLED CORRECTLY");
if (!sp->body_label)
sp->background = get_pixel_resource (si->dpy, cmap,
"splash.background",
"Dialog.Background");
+ sp->border = get_pixel_resource (si->dpy, cmap,
+ "splash.borderColor",
+ "Dialog.borderColor");
if (sp->foreground == sp->background)
{
if (overall.width > sp->width) sp->width = overall.width;
sp->height += ascent + descent;
+ /* Measure the optional body3_label. */
+ if (sp->body3_label)
+ {
+ XTextExtents (sp->heading_font,
+ sp->body3_label, strlen(sp->body3_label),
+ &direction, &ascent, &descent, &overall);
+ if (overall.width > sp->width) sp->width = overall.width;
+ XTextExtents (sp->heading_font,
+ sp->body4_label, strlen(sp->body4_label),
+ &direction, &ascent, &descent, &overall);
+ if (overall.width > sp->width) sp->width = overall.width;
+ sp->height += (ascent + descent) * 5;
+ }
+
{
Dimension w2 = 0, w3 = 0, w4 = 0;
Dimension h2 = 0, h3 = 0, h4 = 0;
attrs.event_mask = (ExposureMask | ButtonPressMask | ButtonReleaseMask);
{
- int sx, sy, w, h;
+ int sx = 0, sy = 0, w, h;
int mouse_x = 0, mouse_y = 0;
{
}
}
- get_screen_viewport (ssi, &sx, &sy, &w, &h, mouse_x, mouse_y, False);
+ x = ssi->x;
+ y = ssi->y;
+ w = ssi->width;
+ h = ssi->height;
if (si->prefs.debug_p) w /= 2;
x = sx + (((w + sp->width) / 2) - sp->width);
y = sy + (((h + sp->height) / 2) - sp->height);
DefaultVisualOfScreen(ssi->screen),
attrmask, &attrs);
XSetWindowBackground (si->dpy, si->splash_dialog, sp->background);
+ XSetWindowBorder (si->dpy, si->splash_dialog, sp->border);
+
- sp->logo_pixmap = xscreensaver_logo (ssi->screen, ssi->current_visual,
+ sp->logo_pixmap = xscreensaver_logo (ssi->screen,
+ /* same visual as si->splash_dialog */
+ DefaultVisualOfScreen (ssi->screen),
si->splash_dialog, cmap,
sp->background,
&sp->logo_pixels, &sp->logo_npixels,
sp->body2_label, strlen(sp->body2_label));
y1 += sp->body_font->descent;
+ if (sp->body3_label)
+ {
+ XSetFont (si->dpy, gc1, sp->heading_font->fid);
+ y1 += sp->heading_font->ascent + sp->heading_font->descent;
+ y1 += sp->heading_font->ascent;
+ sw = string_width (sp->heading_font, sp->body3_label);
+ x2 = (x1 + ((x3 - x1 - sw) / 2));
+ XDrawString (si->dpy, si->splash_dialog, gc1, x2, y1,
+ sp->body3_label, strlen(sp->body3_label));
+ y1 += sp->heading_font->descent + sp->heading_font->ascent;
+ sw = string_width (sp->heading_font, sp->body4_label);
+ x2 = (x1 + ((x3 - x1 - sw) / 2));
+ XDrawString (si->dpy, si->splash_dialog, gc1, x2, y1,
+ sp->body4_label, strlen(sp->body4_label));
+ y1 += sp->heading_font->descent;
+ XSetFont (si->dpy, gc1, sp->body_font->fid);
+ }
+
/* The buttons
*/
XSetForeground (si->dpy, gc1, sp->button_foreground);
if (sp->heading_label) free (sp->heading_label);
if (sp->body_label) free (sp->body_label);
if (sp->body2_label) free (sp->body2_label);
+ if (sp->body3_label) free (sp->body3_label);
+ if (sp->body4_label) free (sp->body4_label);
if (sp->demo_label) free (sp->demo_label);
#ifdef PREFS_BUTTON
if (sp->prefs_label) free (sp->prefs_label);
handle_splash_event (saver_info *si, XEvent *event)
{
splash_dialog_data *sp = si->sp_data;
- saver_screen_info *ssi = sp->prompt_screen;
+ saver_screen_info *ssi;
int which = 0;
if (!sp) return;
+ ssi = sp->prompt_screen;
switch (event->xany.type)
{