+ struct passwd *p = getpwuid (getuid ());
+ XSetWindowAttributes attrs;
+ unsigned long attrmask = 0;
+ passwd_dialog_data *pw = (passwd_dialog_data *) calloc (1, sizeof(*pw));
+ Screen *screen;
+ Colormap cmap;
+ char *f;
+
+ pw->prompt_screen = &si->screens [mouse_screen (si)];
+ if (si->prefs.verbose_p)
+ fprintf (stderr, "%s: %d: creating password dialog.\n",
+ blurb(), pw->prompt_screen->number);
+
+ screen = pw->prompt_screen->screen;
+ cmap = DefaultColormapOfScreen (screen);
+
+ pw->ratio = 1.0;
+
+ pw->heading_label = get_string_resource ("passwd.heading.label",
+ "Dialog.Label.Label");
+ pw->body_label = get_string_resource ("passwd.body.label",
+ "Dialog.Label.Label");
+ pw->user_label = get_string_resource ("passwd.user.label",
+ "Dialog.Label.Label");
+ pw->passwd_label = get_string_resource ("passwd.passwd.label",
+ "Dialog.Label.Label");
+ pw->date_label = get_string_resource ("dateFormat", "DateFormat");
+
+ if (!pw->heading_label)
+ pw->heading_label = strdup("ERROR: REESOURCES NOT INSTALLED CORRECTLY");
+ if (!pw->body_label)
+ pw->body_label = strdup("ERROR: REESOURCES NOT INSTALLED CORRECTLY");
+ if (!pw->user_label) pw->user_label = strdup("ERROR");
+ if (!pw->passwd_label) pw->passwd_label = strdup("ERROR");
+ if (!pw->date_label) pw->date_label = strdup("ERROR");
+
+ /* Put the version number in the label. */
+ {
+ char *s = (char *) malloc (strlen(pw->heading_label) + 20);
+ sprintf(s, pw->heading_label, si->version);
+ free (pw->heading_label);
+ pw->heading_label = s;
+ }
+
+ pw->user_string = (p && p->pw_name ? p->pw_name : "???");
+ pw->passwd_string = strdup("");
+
+ f = get_string_resource ("passwd.headingFont", "Dialog.Font");
+ pw->heading_font = XLoadQueryFont (si->dpy, (f ? f : "fixed"));
+ if (!pw->heading_font) pw->heading_font = XLoadQueryFont (si->dpy, "fixed");
+ if (f) free (f);
+
+ f = get_string_resource("passwd.bodyFont", "Dialog.Font");
+ pw->body_font = XLoadQueryFont (si->dpy, (f ? f : "fixed"));
+ if (!pw->body_font) pw->body_font = XLoadQueryFont (si->dpy, "fixed");
+ if (f) free (f);
+
+ f = get_string_resource("passwd.labelFont", "Dialog.Font");
+ pw->label_font = XLoadQueryFont (si->dpy, (f ? f : "fixed"));
+ if (!pw->label_font) pw->label_font = XLoadQueryFont (si->dpy, "fixed");
+ if (f) free (f);
+
+ f = get_string_resource("passwd.passwdFont", "Dialog.Font");
+ pw->passwd_font = XLoadQueryFont (si->dpy, (f ? f : "fixed"));
+ if (!pw->passwd_font) pw->passwd_font = XLoadQueryFont (si->dpy, "fixed");
+ if (f) free (f);
+
+ f = get_string_resource("passwd.dateFont", "Dialog.Font");
+ pw->date_font = XLoadQueryFont (si->dpy, (f ? f : "fixed"));
+ if (!pw->date_font) pw->date_font = XLoadQueryFont (si->dpy, "fixed");
+ if (f) free (f);
+
+ pw->foreground = get_pixel_resource ("passwd.foreground",
+ "Dialog.Foreground",
+ si->dpy, cmap);
+ pw->background = get_pixel_resource ("passwd.background",
+ "Dialog.Background",
+ si->dpy, cmap);
+
+ if (pw->foreground == pw->background)
+ {
+ /* Make sure the error messages show up. */
+ pw->foreground = BlackPixelOfScreen (screen);
+ pw->background = WhitePixelOfScreen (screen);
+ }
+
+ pw->passwd_foreground = get_pixel_resource ("passwd.text.foreground",
+ "Dialog.Text.Foreground",
+ si->dpy, cmap);
+ pw->passwd_background = get_pixel_resource ("passwd.text.background",
+ "Dialog.Text.Background",
+ si->dpy, cmap);
+ pw->thermo_foreground = get_pixel_resource ("passwd.thermometer.foreground",
+ "Dialog.Thermometer.Foreground",
+ si->dpy, cmap);
+ pw->thermo_background = get_pixel_resource ("passwd.thermometer.background",
+ "Dialog.Thermometer.Background",
+ si->dpy, cmap);
+ pw->shadow_top = get_pixel_resource ("passwd.topShadowColor",
+ "Dialog.Foreground",
+ si->dpy, cmap);
+ pw->shadow_bottom = get_pixel_resource ("passwd.bottomShadowColor",
+ "Dialog.Background",
+ si->dpy, cmap);
+
+ pw->logo_width = get_integer_resource ("passwd.logo.width",
+ "Dialog.Logo.Width");
+ pw->logo_height = get_integer_resource ("passwd.logo.height",
+ "Dialog.Logo.Height");
+ pw->thermo_width = get_integer_resource ("passwd.thermometer.width",
+ "Dialog.Thermometer.Width");
+ pw->internal_border = get_integer_resource ("passwd.internalBorderWidth",
+ "Dialog.InternalBorderWidth");
+ pw->shadow_width = get_integer_resource ("passwd.shadowThickness",
+ "Dialog.ShadowThickness");
+
+ if (pw->logo_width == 0) pw->logo_width = 150;
+ if (pw->logo_height == 0) pw->logo_height = 150;
+ if (pw->internal_border == 0) pw->internal_border = 15;
+ if (pw->shadow_width == 0) pw->shadow_width = 4;
+ if (pw->thermo_width == 0) pw->thermo_width = pw->shadow_width;