ftp://ftp.jp.xemacs.org/pub/NetBSD/packages/distfiles/xscreensaver-4.15.tar.gz
[xscreensaver] / driver / timers.c
index 04feb90c19e96dcd32a0f9a89bdbe55b4f3763f5..d36ff701f948a6045102dbe389d5be54a83f7a21 100644 (file)
@@ -264,8 +264,8 @@ cycle_timer (XtPointer closure, XtIntervalId *id)
   else
     {
       if (p->debug_p)
-        fprintf (stderr, "%s: not starting cycle_timer: how_long == %d\n",
-                 blurb(), how_long);
+        fprintf (stderr, "%s: not starting cycle_timer: how_long == %ld\n",
+                 blurb(), (unsigned long) how_long);
     }
 }
 
@@ -339,6 +339,8 @@ check_pointer_timer (XtPointer closure, XtIntervalId *id)
       int root_x, root_y, x, y;
       unsigned int mask;
 
+      if (!ssi->real_screen_p) continue;
+
       if (!XQueryPointer (si->dpy, ssi->screensaver_window, &root, &child,
                           &root_x, &root_y, &x, &y, &mask))
         {
@@ -450,7 +452,7 @@ check_for_clock_skew (saver_info *si)
       shift > (p->timeout / 1000))
     {
       if (p->verbose_p)
-        fprintf (stderr, "%s: wall clock has jumped by %d:%02d:%02d!\n",
+        fprintf (stderr, "%s: wall clock has jumped by %ld:%02ld:%02ld!\n",
                  blurb(),
                  (shift / (60 * 60)), ((shift / 60) % 60), (shift % 60));
 
@@ -738,8 +740,21 @@ sleep_until_idle (saver_info *si, Bool until_idle_p)
                 for (i = 0; i < si->nscreens; i++)
                   if (root == RootWindowOfScreen (si->screens[i].screen))
                     break;
-                fprintf (stderr,"%s: %d: %s on 0x%x",
+                fprintf (stderr,"%s: %d: %s on 0x%lx",
                          blurb(), i, type, (unsigned long) window);
+
+                /* Be careful never to do this unless in -debug mode, as
+                   this could expose characters from the unlock password. */
+                if (p->debug_p && event.xany.type == KeyPress)
+                  {
+                    KeySym keysym;
+                    char c = 0;
+                    XLookupString (&event.xkey, &c, 1, &keysym, 0);
+                    fprintf (stderr, " (%s%s)",
+                             (event.xkey.send_event ? "synthetic " : ""),
+                             XKeysymToString (keysym));
+                  }
+
                 if (x == -1)
                   fprintf (stderr, "\n");
                 else
@@ -1061,7 +1076,20 @@ proc_interrupts_activity_p (saver_info *si)
 
   while (fgets (new_line, sizeof(new_line)-1, f1))
     {
-      if (!checked_kbd && strstr (new_line, "keyboard"))
+      if (strchr (new_line, ','))
+        {
+          /* Ignore any line that has a comma on it: this is because
+             a setup like this:
+
+                 12:     930935          XT-PIC  usb-uhci, PS/2 Mouse
+
+             is really bad news.  It *looks* like we can note mouse
+             activity from that line, but really, that interrupt gets
+             fired any time any USB device has activity!  So we have
+             to ignore any shared IRQs.
+           */
+        }
+      else if (!checked_kbd && strstr (new_line, "keyboard"))
         {
           kbd_changed = (*last_kbd_line && !!strcmp (new_line, last_kbd_line));
           strcpy (last_kbd_line, new_line);