X-Git-Url: http://git.hungrycats.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=driver%2Flock.c;h=4445c24eb8dd894ecf94f36a8118ec7c7534a04e;hb=39809ded547bdbb08207d3e514950425215b4410;hp=b0c4ec705daf932e15fcb9167bcafef13650ee5d;hpb=ff35d056d723c9a5ffe728dbba5f1c25e141be04;p=xscreensaver diff --git a/driver/lock.c b/driver/lock.c index b0c4ec70..4445c24e 100644 --- a/driver/lock.c +++ b/driver/lock.c @@ -1,5 +1,5 @@ /* lock.c --- handling the password dialog for locking-mode. - * xscreensaver, Copyright (c) 1993-2013 Jamie Zawinski + * xscreensaver, Copyright (c) 1993-2017 Jamie Zawinski * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, provided that @@ -200,7 +200,6 @@ new_passwd_window (saver_info *si) passwd_dialog_data *pw; Screen *screen; Colormap cmap; - char *f; saver_screen_info *ssi = &si->screens [mouse_screen (si)]; pw = (passwd_dialog_data *) calloc (1, sizeof(*pw)); @@ -277,40 +276,20 @@ new_passwd_window (saver_info *si) pw->passwd_string = strdup(""); - f = get_string_resource (si->dpy, "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 (si->dpy, "passwd.buttonFont", "Dialog.Font"); - pw->button_font = XLoadQueryFont (si->dpy, (f ? f : "fixed")); - if (!pw->button_font) pw->button_font = XLoadQueryFont (si->dpy, "fixed"); - if (f) free (f); - - f = get_string_resource(si->dpy, "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(si->dpy, "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(si->dpy, "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(si->dpy, "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); - - f = get_string_resource(si->dpy, "passwd.unameFont", "Dialog.Font"); - pw->uname_font = XLoadQueryFont (si->dpy, (f ? f : "fixed")); - if (!pw->uname_font) pw->uname_font = XLoadQueryFont (si->dpy, "fixed"); - if (f) free (f); + pw->heading_font = + splash_load_font (si->dpy, "passwd.headingFont", "Dialog.Font"); + pw->button_font = + splash_load_font (si->dpy, "passwd.buttonFont", "Dialog.Font"); + pw->body_font = + splash_load_font (si->dpy, "passwd.bodyFont", "Dialog.Font"); + pw->label_font = + splash_load_font (si->dpy, "passwd.labelFont", "Dialog.Font"); + pw->passwd_font = + splash_load_font (si->dpy, "passwd.passwdFont", "Dialog.Font"); + pw->date_font = + splash_load_font (si->dpy, "passwd.dateFont", "Dialog.Font"); + pw->uname_font = + splash_load_font (si->dpy, "passwd.unameFont", "Dialog.Font"); pw->show_uname_p = get_boolean_resource(si->dpy, "passwd.uname", "Boolean"); @@ -487,7 +466,7 @@ make_passwd_window (saver_info *si, * room for the dialog to grow without going off the edge of the screen. */ max_string_width_px *= 0.75; - if (!info_msg && senescent_p()) + if (!info_msg && decrepit_p()) info_msg = ("\n" "This version of XScreenSaver\n" "is very old! Please upgrade!\n"); @@ -534,7 +513,7 @@ make_passwd_window (saver_info *si, /* Measure the info_label. */ if (pw->info_label->overall_width > pw->width) pw->width = pw->info_label->overall_width; - h2 += pw->info_label->overall_height; + h2 += pw->info_label->overall_height; /* Measure the user string. */ XTextExtents (pw->passwd_font, @@ -1422,6 +1401,8 @@ destroy_passwd_window (saver_info *si) } +#if defined(HAVE_XF86MISCSETGRABKEYSSTATE) || defined(HAVE_XF86VMODE) + static Bool error_handler_hit_p = False; static int @@ -1431,6 +1412,8 @@ ignore_all_errors_ehandler (Display *dpy, XErrorEvent *error) return 0; } +#endif /* HAVE_XF86MISCSETGRABKEYSSTATE || HAVE_XF86VMODE */ + #ifdef HAVE_XHPDISABLERESET /* This function enables and disables the C-Sh-Reset hot-key, which @@ -1884,6 +1867,7 @@ passwd_event_loop (saver_info *si) } event; passwd_animate_timer ((XtPointer) si, 0); + reset_watchdog_timer (si, False); /* Disable watchdog while dialog up */ while (si->unlock_state == ul_read) { @@ -1976,6 +1960,8 @@ passwd_event_loop (saver_info *si) ; } } + + reset_watchdog_timer (si, True); /* Re-enable watchdog */ } @@ -2186,6 +2172,11 @@ auth_finished_cb (saver_info *si) s = buf; } si->unlock_failures = 0; + + /* ignore failures if they all were too recent */ + if (time((time_t *) 0) - si->unlock_failure_time + < si->prefs.auth_warning_slack) + goto END; } else /* good, with no failures, */ goto END; /* or timeout, or cancel. */