+ if (pw->user_entry_pixmap)
+ {
+ XFreePixmap(si->dpy, pw->user_entry_pixmap);
+ pw->user_entry_pixmap = 0;
+ }
+}
+
+
+static void
+destroy_passwd_window (saver_info *si)
+{
+ saver_preferences *p = &si->prefs;
+ passwd_dialog_data *pw = si->pw_data;
+ saver_screen_info *ssi = pw->prompt_screen;
+ Colormap cmap = DefaultColormapOfScreen (ssi->screen);
+ Pixel black = BlackPixelOfScreen (ssi->screen);
+ Pixel white = WhitePixelOfScreen (ssi->screen);
+ XEvent event;
+
+ cleanup_passwd_window (si);
+
+ if (si->cached_passwd)
+ {
+ char *wipe = si->cached_passwd;
+
+ while (*wipe)
+ *wipe++ = '\0';
+
+ free(si->cached_passwd);
+ si->cached_passwd = NULL;
+ }
+
+ move_mouse_grab (si, RootWindowOfScreen (ssi->screen),
+ ssi->cursor, ssi->number);
+
+ if (pw->passwd_cursor)
+ XFreeCursor (si->dpy, pw->passwd_cursor);
+
+ if (p->verbose_p)
+ fprintf (stderr, "%s: %d: moving mouse back to %d,%d.\n",
+ blurb(), ssi->number,
+ pw->previous_mouse_x, pw->previous_mouse_y);
+
+ XWarpPointer (si->dpy, None, RootWindowOfScreen (ssi->screen),
+ 0, 0, 0, 0,
+ pw->previous_mouse_x, pw->previous_mouse_y);
+ XSync (si->dpy, False);
+
+ while (XCheckMaskEvent (si->dpy, PointerMotionMask, &event))
+ if (p->verbose_p)
+ fprintf (stderr, "%s: discarding MotionNotify event.\n", blurb());
+
+#ifdef HAVE_XINPUT
+ if (si->using_xinput_extension && si->xinput_DeviceMotionNotify)
+ while (XCheckTypedEvent (si->dpy, si->xinput_DeviceMotionNotify, &event))
+ if (p->verbose_p)
+ fprintf (stderr, "%s: discarding DeviceMotionNotify event.\n",
+ blurb());
+#endif
+
+ if (si->passwd_dialog)
+ {
+ if (si->prefs.verbose_p)
+ fprintf (stderr, "%s: %d: destroying password dialog.\n",
+ blurb(), pw->prompt_screen->number);
+
+ XDestroyWindow (si->dpy, si->passwd_dialog);
+ si->passwd_dialog = 0;
+ }
+
+ if (pw->save_under)
+ {
+ restore_background(si);
+ XFreePixmap (si->dpy, pw->save_under);
+ pw->save_under = 0;
+ }
+
+ if (pw->heading_label) free (pw->heading_label);
+ if (pw->body_label) free (pw->body_label);
+ if (pw->user_label) free (pw->user_label);
+ if (pw->date_label) free (pw->date_label);
+ if (pw->login_label) free (pw->login_label);
+ if (pw->unlock_label) free (pw->unlock_label);
+ if (pw->passwd_string) free (pw->passwd_string);
+ if (pw->uname_label) free (pw->uname_label);
+
+ if (pw->heading_font) XFreeFont (si->dpy, pw->heading_font);
+ if (pw->body_font) XFreeFont (si->dpy, pw->body_font);
+ if (pw->label_font) XFreeFont (si->dpy, pw->label_font);
+ if (pw->passwd_font) XFreeFont (si->dpy, pw->passwd_font);
+ if (pw->date_font) XFreeFont (si->dpy, pw->date_font);
+ if (pw->button_font) XFreeFont (si->dpy, pw->button_font);
+ if (pw->uname_font) XFreeFont (si->dpy, pw->uname_font);
+
+ if (pw->foreground != black && pw->foreground != white)
+ XFreeColors (si->dpy, cmap, &pw->foreground, 1, 0L);
+ if (pw->background != black && pw->background != white)
+ XFreeColors (si->dpy, cmap, &pw->background, 1, 0L);
+ if (!(pw->button_foreground == black || pw->button_foreground == white))
+ XFreeColors (si->dpy, cmap, &pw->button_foreground, 1, 0L);
+ if (!(pw->button_background == black || pw->button_background == white))
+ XFreeColors (si->dpy, cmap, &pw->button_background, 1, 0L);
+ if (pw->passwd_foreground != black && pw->passwd_foreground != white)
+ XFreeColors (si->dpy, cmap, &pw->passwd_foreground, 1, 0L);
+ if (pw->passwd_background != black && pw->passwd_background != white)