-/* xscreensaver, Copyright (c) 1991-1998 Jamie Zawinski <jwz@netscape.com>
+/* xscreensaver, Copyright (c) 1991-2001 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
Pixel background;
Pixel button_foreground;
Pixel button_background;
- Pixel logo_foreground;
- Pixel logo_background;
Pixel shadow_top;
Pixel shadow_bottom;
Dimension prefs_button_x, prefs_button_y;
Dimension help_button_x, help_button_y;
+ Pixmap logo_pixmap;
+ int logo_npixels;
+ unsigned long *logo_pixels;
+
int pressed;
};
if (si->sp_data)
return;
- if (si->prefs.splash_duration <= 0)
+ if (!si->prefs.splash_p ||
+ si->prefs.splash_duration <= 0)
return;
sp = (splash_dialog_data *) calloc (1, sizeof(*sp));
sp->button_background = get_pixel_resource ("splash.Button.background",
"Dialog.Button.Background",
si->dpy, cmap);
- sp->logo_foreground = get_pixel_resource ("splash.logo.foreground",
- "Dialog.Logo.Foreground",
- si->dpy, cmap);
- sp->logo_background = get_pixel_resource ("splash.logo.background",
- "Dialog.Logo.Background",
- si->dpy, cmap);
sp->shadow_top = get_pixel_resource ("splash.topShadowColor",
"Dialog.Foreground",
si->dpy, cmap);
attrmask, &attrs);
XSetWindowBackground (si->dpy, si->splash_dialog, sp->background);
+ sp->logo_pixmap = xscreensaver_logo (si->dpy, si->splash_dialog, cmap,
+ sp->background,
+ &sp->logo_pixels, &sp->logo_npixels,
+ 0, True);
+
XMapRaised (si->dpy, si->splash_dialog);
XSync (si->dpy, False);
XSync (si->dpy, False);
}
+
static void
draw_splash_window (saver_info *si)
{
sp->help_button_y = y1;
- /* the logo
+ /* The logo
*/
- XSetForeground (si->dpy, gc1, sp->logo_foreground);
- XSetForeground (si->dpy, gc2, sp->logo_background);
-
x1 = sp->shadow_width * 3;
y1 = sp->shadow_width * 3;
x2 = sp->logo_width - (sp->shadow_width * 6);
y2 = sp->logo_height - (sp->shadow_width * 6);
- XFillRectangle (si->dpy, si->splash_dialog, gc2, x1, y1, x2, y2);
- skull (si->dpy, si->splash_dialog, gc1, gc2,
- x1 + sp->shadow_width, y1 + sp->shadow_width,
- x2 - (sp->shadow_width * 2), y2 - (sp->shadow_width * 2));
+ if (sp->logo_pixmap)
+ {
+ Window root;
+ int x, y;
+ unsigned int w, h, bw, d;
+ XGetGeometry (si->dpy, sp->logo_pixmap, &root, &x, &y, &w, &h, &bw, &d);
+ XSetForeground (si->dpy, gc1, sp->foreground);
+ XSetBackground (si->dpy, gc1, sp->background);
+ if (d == 1)
+ XCopyPlane (si->dpy, sp->logo_pixmap, si->splash_dialog, gc1,
+ 0, 0, w, h,
+ x1 + ((x2 - (int)w) / 2),
+ y1 + ((y2 - (int)h) / 2),
+ 1);
+ else
+ XCopyArea (si->dpy, sp->logo_pixmap, si->splash_dialog, gc1,
+ 0, 0, w, h,
+ x1 + ((x2 - (int)w) / 2),
+ y1 + ((y2 - (int)h) / 2));
+ }
+ /* Solid border inside the logo box. */
+ XSetForeground (si->dpy, gc1, sp->foreground);
+ XDrawRectangle (si->dpy, si->splash_dialog, gc1, x1, y1, x2-1, y2-1);
/* The shadow around the logo
*/
XFreeColors (si->dpy, cmap, &sp->button_foreground, 1, 0L);
if (sp->button_background != black && sp->button_background != white)
XFreeColors (si->dpy, cmap, &sp->button_background, 1, 0L);
- if (sp->logo_foreground != black && sp->logo_foreground != white)
- XFreeColors (si->dpy, cmap, &sp->logo_foreground, 1, 0L);
- if (sp->logo_background != black && sp->logo_background != white)
- XFreeColors (si->dpy, cmap, &sp->logo_background, 1, 0L);
if (sp->shadow_top != black && sp->shadow_top != white)
XFreeColors (si->dpy, cmap, &sp->shadow_top, 1, 0L);
if (sp->shadow_bottom != black && sp->shadow_bottom != white)
XFreeColors (si->dpy, cmap, &sp->shadow_bottom, 1, 0L);
+ if (sp->logo_pixmap)
+ XFreePixmap (si->dpy, sp->logo_pixmap);
+ if (sp->logo_npixels && sp->logo_pixels)
+ XFreeColors (si->dpy, cmap, sp->logo_pixels, sp->logo_npixels, 0L);
+ if (sp->logo_pixels)
+ free (sp->logo_pixels);
+
memset (sp, 0, sizeof(*sp));
free (sp);