ftp://ftp.krokus.ru/pub/OpenBSD/distfiles/xscreensaver-4.22.tar.gz
[xscreensaver] / driver / lock.c
index 8d61981f9da4e1829e08032de66dea8a377b419a..169880b1b6a993f7ead31e3206406a7150241d00 100644 (file)
@@ -97,6 +97,9 @@ struct passwd_dialog_data {
   Dimension height;
   Dimension border_width;
 
+  Bool show_stars_p; /* "I regret that I have but one asterisk for my country."
+                        -- Nathan Hale, 1776. */
+
   char *heading_label;
   char *body_label;
   char *user_label;
@@ -191,6 +194,8 @@ make_passwd_window (saver_info *si)
 
   pw->ratio = 1.0;
 
+  pw->show_stars_p = get_boolean_resource("passwd.asterisks", "Boolean");
+  
   pw->heading_label = get_string_resource ("passwd.heading.label",
                                           "Dialog.Label.Label");
   pw->body_label = get_string_resource ("passwd.body.label",
@@ -1384,6 +1389,10 @@ handle_passwd_key (saver_info *si, XKeyEvent *event)
 
   s[1] = 0;
 
+  /* Add 10% to the time remaining every time a key is pressed. */
+  pw->ratio += 0.1;
+  if (pw->ratio > 1) pw->ratio = 1;
+
   switch (*s)
     {
     case '\010': case '\177':                          /* Backspace */
@@ -1426,12 +1435,19 @@ handle_passwd_key (saver_info *si, XKeyEvent *event)
       break;
     }
 
-  i = strlen(typed_passwd);
-  stars = (char *) malloc(i+1);
-  memset (stars, '*', i);
-  stars[i] = 0;
-  update_passwd_window (si, stars, pw->ratio);
-  free (stars);
+  if (pw->show_stars_p)
+    {
+      i = strlen(typed_passwd);
+      stars = (char *) malloc(i+1);
+      memset (stars, '*', i);
+      stars[i] = 0;
+      update_passwd_window (si, stars, pw->ratio);
+      free (stars);
+    }
+  else
+    {
+      update_passwd_window (si, "", pw->ratio);
+    }
 }