+
+ 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);
+
+ {
+ Dimension w = WidthOfScreen(screen);
+ Dimension h = HeightOfScreen(screen);
+ if (si->prefs.debug_p) w /= 2;
+ x = ((w + sp->width) / 2) - sp->width;
+ y = ((h + sp->height) / 2) - sp->height;
+ if (x < 0) x = 0;
+ if (y < 0) y = 0;
+ }
+
+ bw = get_integer_resource ("splash.borderWidth", "Dialog.BorderWidth");
+
+ si->splash_dialog =
+ XCreateWindow (si->dpy,
+ RootWindowOfScreen(screen),
+ x, y, sp->width, sp->height, bw,
+ DefaultDepthOfScreen (screen), InputOutput,
+ DefaultVisualOfScreen(screen),
+ attrmask, &attrs);
+ XSetWindowBackground (si->dpy, si->splash_dialog, sp->background);
+
+ XMapRaised (si->dpy, si->splash_dialog);
+ XSync (si->dpy, False);
+
+ si->sp_data = sp;
+
+ sp->timer = XtAppAddTimeOut (si->app, si->prefs.splash_duration,
+ unsplash_timer, (XtPointer) si);
+
+ draw_splash_window (si);
+ XSync (si->dpy, False);