+ sp = (splash_dialog_data *) calloc (1, sizeof(*sp));
+
+ sp->heading_label = get_string_resource ("splash.heading.label",
+ "Dialog.Label.Label");
+ sp->body_label = get_string_resource ("splash.body.label",
+ "Dialog.Label.Label");
+ sp->body2_label = get_string_resource ("splash.body2.label",
+ "Dialog.Label.Label");
+ sp->demo_label = get_string_resource ("splash.demo.label",
+ "Dialog.Button.Label");
+ sp->prefs_label = get_string_resource ("splash.prefs.label",
+ "Dialog.Button.Label");
+ sp->help_label = get_string_resource ("splash.help.label",
+ "Dialog.Button.Label");
+
+ if (!sp->heading_label)
+ sp->heading_label = strdup("ERROR: REESOURCES NOT INSTALLED CORRECTLY");
+ if (!sp->body_label)
+ sp->body_label = strdup("ERROR: REESOURCES NOT INSTALLED CORRECTLY");
+ if (!sp->body2_label)
+ sp->body2_label = strdup("ERROR: REESOURCES NOT INSTALLED CORRECTLY");
+ if (!sp->demo_label) sp->demo_label = strdup("ERROR");
+ if (!sp->prefs_label) sp->prefs_label = strdup("ERROR");
+ if (!sp->help_label) sp->help_label = strdup("ERROR");
+
+ /* Put the version number in the label. */
+ {
+ char *s = (char *) malloc (strlen(sp->heading_label) + 20);
+ sprintf(s, sp->heading_label, si->version);
+ free (sp->heading_label);
+ sp->heading_label = s;
+ }
+
+ f = get_string_resource ("splash.headingFont", "Dialog.Font");
+ sp->heading_font = XLoadQueryFont (si->dpy, (f ? f : "fixed"));
+ if (!sp->heading_font) sp->heading_font = XLoadQueryFont (si->dpy, "fixed");
+ if (f) free (f);
+
+ f = get_string_resource("splash.bodyFont", "Dialog.Font");
+ sp->body_font = XLoadQueryFont (si->dpy, (f ? f : "fixed"));
+ if (!sp->body_font) sp->body_font = XLoadQueryFont (si->dpy, "fixed");
+ if (f) free (f);
+
+ f = get_string_resource("splash.buttonFont", "Dialog.Font");
+ sp->button_font = XLoadQueryFont (si->dpy, (f ? f : "fixed"));
+ if (!sp->button_font) sp->button_font = XLoadQueryFont (si->dpy, "fixed");
+ if (f) free (f);
+
+ sp->foreground = get_pixel_resource ("splash.foreground",
+ "Dialog.Foreground",
+ si->dpy, cmap);
+ sp->background = get_pixel_resource ("splash.background",
+ "Dialog.Background",
+ si->dpy, cmap);
+
+ if (sp->foreground == sp->background)
+ {
+ /* Make sure the error messages show up. */
+ sp->foreground = BlackPixelOfScreen (screen);
+ sp->background = WhitePixelOfScreen (screen);
+ }
+
+ sp->button_foreground = get_pixel_resource ("splash.Button.foreground",
+ "Dialog.Button.Foreground",
+ si->dpy, cmap);
+ 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);
+ sp->shadow_bottom = get_pixel_resource ("splash.bottomShadowColor",
+ "Dialog.Background",
+ si->dpy, cmap);
+
+ sp->logo_width = get_integer_resource ("splash.logo.width",
+ "Dialog.Logo.Width");
+ sp->logo_height = get_integer_resource ("splash.logo.height",
+ "Dialog.Logo.Height");
+ sp->internal_border = get_integer_resource ("splash.internalBorderWidth",
+ "Dialog.InternalBorderWidth");
+ sp->shadow_width = get_integer_resource ("splash.shadowThickness",
+ "Dialog.ShadowThickness");
+
+ if (sp->logo_width == 0) sp->logo_width = 150;
+ if (sp->logo_height == 0) sp->logo_height = 150;
+ if (sp->internal_border == 0) sp->internal_border = 15;
+ if (sp->shadow_width == 0) sp->shadow_width = 4;
+
+ {
+ int direction, ascent, descent;
+ XCharStruct overall;
+
+ sp->width = 0;
+ sp->height = 0;
+
+ /* Measure the heading_label. */
+ XTextExtents (sp->heading_font,
+ sp->heading_label, strlen(sp->heading_label),
+ &direction, &ascent, &descent, &overall);
+ if (overall.width > sp->width) sp->width = overall.width;
+ sp->height += ascent + descent;
+
+ /* Measure the body_label. */
+ XTextExtents (sp->body_font,
+ sp->body_label, strlen(sp->body_label),
+ &direction, &ascent, &descent, &overall);
+ if (overall.width > sp->width) sp->width = overall.width;
+ sp->height += ascent + descent;
+
+ /* Measure the body2_label. */
+ XTextExtents (sp->body_font,
+ sp->body2_label, strlen(sp->body2_label),
+ &direction, &ascent, &descent, &overall);
+ if (overall.width > sp->width) sp->width = overall.width;
+ sp->height += ascent + descent;
+
+ {
+ Dimension w2 = 0, w3 = 0, w4 = 0;
+ Dimension h2 = 0, h3 = 0, h4 = 0;
+
+ /* Measure the Demo button. */
+ XTextExtents (sp->button_font,
+ sp->demo_label, strlen(sp->demo_label),
+ &direction, &ascent, &descent, &overall);
+ w2 = overall.width;
+ h2 = ascent + descent;
+
+ /* Measure the Prefs button. */
+ XTextExtents (sp->button_font,
+ sp->prefs_label, strlen(sp->prefs_label),
+ &direction, &ascent, &descent, &overall);
+ w3 = overall.width;
+ h3 = ascent + descent;
+
+ /* Measure the Help button. */
+ XTextExtents (sp->button_font,
+ sp->help_label, strlen(sp->help_label),
+ &direction, &ascent, &descent, &overall);
+ w4 = overall.width;
+ h4 = ascent + descent;
+
+ w2 = MAX(w2, w3); w2 = MAX(w2, w4);
+ h2 = MAX(h2, h3); h2 = MAX(h2, h4);
+
+ w2 += ((ascent + descent) / 2) + (sp->shadow_width * 2);
+ h2 += ((ascent + descent) / 2) + (sp->shadow_width * 2);
+
+ sp->button_width = w2;
+ sp->button_height = h2;
+
+ w2 *= 3;
+
+ w2 += ((ascent + descent) * 2); /* for space between buttons */
+
+ if (w2 > sp->width) sp->width = w2;
+ sp->height += h2;
+ }
+
+ sp->width += (sp->internal_border * 2);
+ sp->height += (sp->internal_border * 3);
+
+ if (sp->logo_height > sp->height)
+ sp->height = sp->logo_height;
+ else if (sp->height > sp->logo_height)
+ sp->logo_height = sp->height;
+
+ sp->logo_width = sp->logo_height;
+
+ sp->width += sp->logo_width;
+ }
+
+ attrmask |= CWOverrideRedirect; attrs.override_redirect = True;
+ attrmask |= CWEventMask;
+ attrs.event_mask = (ExposureMask | ButtonPressMask | ButtonReleaseMask);