X-Git-Url: http://git.hungrycats.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=driver%2Flock.c;h=194752d1cf5e4404882a4b95ef725dc0b6a8f4f1;hb=72c1f4c1dc6ab07fe121a327ff1c30bf51ef74c1;hp=6d498b199fdf835ff38172ca05c0a1ac33edfe3c;hpb=5832fe184606766fef23369159306c0a5799aeb0;p=xscreensaver diff --git a/driver/lock.c b/driver/lock.c index 6d498b19..194752d1 100644 --- a/driver/lock.c +++ b/driver/lock.c @@ -17,13 +17,13 @@ # include "config.h" #endif -#ifndef NO_LOCKING /* whole file */ - #include #include /* for time() */ #include "xscreensaver.h" #include "resources.h" +#ifndef NO_LOCKING /* (mostly) whole file */ + #ifdef HAVE_SYSLOG # include #endif /* HAVE_SYSLOG */ @@ -1164,6 +1164,30 @@ passwd_event_loop (saver_info *si) } +static void +handle_typeahead (saver_info *si) +{ + passwd_dialog_data *pw = si->pw_data; + int i; + if (!si->unlock_typeahead) + return; + + i = strlen (si->unlock_typeahead); + if (i >= sizeof(pw->typed_passwd) - 1) + i = sizeof(pw->typed_passwd) - 1; + + memcpy (pw->typed_passwd, si->unlock_typeahead, i); + pw->typed_passwd [i] = 0; + + memset (si->unlock_typeahead, '*', strlen(si->unlock_typeahead)); + si->unlock_typeahead[i] = 0; + update_passwd_window (si, si->unlock_typeahead, pw->ratio); + + free (si->unlock_typeahead); + si->unlock_typeahead = 0; +} + + Bool unlock_p (saver_info *si) { @@ -1183,6 +1207,7 @@ unlock_p (saver_info *si) make_passwd_window (si); if (cmap) XInstallColormap (si->dpy, cmap); + handle_typeahead (si); passwd_event_loop (si); status = (si->pw_data->state == pw_ok); @@ -1209,6 +1234,8 @@ set_locked_p (saver_info *si, Bool locked_p) #ifdef HAVE_XF86VMODE xfree_lock_mode_switch (si, locked_p); /* turn off/on C-Alt-Plus */ #endif + + store_saver_status (si); /* store locked-p */ }