From http://www.jwz.org/xscreensaver/xscreensaver-5.35.tar.gz
[xscreensaver] / driver / windows.c
index 44cce89faca0141b68fabdfd3b6bf2a754cf2210..1a9701aa52121f23ebc9a7269830d5472572fb54 100644 (file)
@@ -1,5 +1,5 @@
 /* windows.c --- turning the screen black; dealing with visuals, virtual roots.
- * xscreensaver, Copyright (c) 1991-2008 Jamie Zawinski <jwz@jwz.org>
+ * xscreensaver, Copyright (c) 1991-2014 Jamie Zawinski <jwz@jwz.org>
  *
  * Permission to use, copy, modify, distribute, and sell this software and its
  * documentation for any purpose is hereby granted without fee, provided that
@@ -74,10 +74,10 @@ typedef long PROP32;
 extern int kill (pid_t, int);          /* signal() is in sys/signal.h... */
 
 Atom XA_VROOT, XA_XSETROOT_ID, XA_ESETROOT_PMAP_ID, XA_XROOTPMAP_ID;
+Atom XA_NET_WM_USER_TIME;
 Atom XA_SCREENSAVER, XA_SCREENSAVER_VERSION, XA_SCREENSAVER_ID;
 Atom XA_SCREENSAVER_STATUS;
 
-
 extern saver_info *global_si_kludge;   /* I hate C so much... */
 
 static void maybe_transfer_grabs (saver_screen_info *ssi,
@@ -286,16 +286,27 @@ grab_keyboard_and_mouse (saver_info *si, Window window, Cursor cursor,
 
 
   /* When should we allow blanking to proceed?  The current theory
-     is that a keyboard grab is manditory; a mouse grab is optional.
+     is that a keyboard grab is mandatory; a mouse grab is optional.
 
      - If we don't have a keyboard grab, then we won't be able to
-       read a password to unlock, so the kbd grab is manditory.
+       read a password to unlock, so the kbd grab is mandatory.
        (We can't conditionalize this on locked_p, because someone
        might run "xscreensaver-command -lock" at any time.)
 
      - If we don't have a mouse grab, then we might not see mouse
        clicks as a signal to unblank -- but we will still see kbd
        activity, so that's not a disaster.
+
+     It has been suggested that we should allow blanking if locking
+     is disabled, and we have a mouse grab but no keyboard grab
+     (that is: kstatus != GrabSuccess &&
+               mstatus == GrabSuccess && 
+               si->locking_disabled_p)
+     That would allow screen blanking (but not locking) while the gdm
+     login screen had the keyboard grabbed, but one would have to use
+     the mouse to unblank.  Keyboard characters would go to the gdm
+     login field without unblanking.  I have not made this change
+     because I'm not completely convinced it is a safe thing to do.
    */
 
   if (kstatus != GrabSuccess)  /* Do not blank without a kbd grab.   */
@@ -385,10 +396,10 @@ ensure_no_screensaver_running (Display *dpy, Screen *screen)
          && type != None)
        {
          unsigned char *id;
-         if (!XGetWindowProperty (dpy, kids[i], XA_SCREENSAVER_ID, 0, 512,
+         if (XGetWindowProperty (dpy, kids[i], XA_SCREENSAVER_ID, 0, 512,
                                   False, XA_STRING, &type, &format, &nitems,
                                   &bytesafter, &id)
-             == Success
+             != Success
              || type == None)
            id = (unsigned char *) "???";
 
@@ -886,7 +897,7 @@ saver_exit (saver_info *si, int status, const char *dump_core_reason)
 
       if (bugp)
        fprintf(real_stderr,
-               "%s: see http://www.jwz.org/xscreensaver/bugs.html\n"
+               "%s: see https://www.jwz.org/xscreensaver/bugs.html\n"
                "\t\t\tfor bug reporting information.\n\n",
                blurb());
 
@@ -997,7 +1008,7 @@ store_saver_status (saver_info *si)
 
   status = (PROP32 *) calloc (size, sizeof(PROP32));
 
-  status[0] = (PROP32) (si->screen_blanked_p
+  status[0] = (PROP32) (si->screen_blanked_p || si->locked_p
                         ? (si->locked_p ? XA_LOCK : XA_BLANK)
                         : 0);
   status[1] = (PROP32) si->blank_time;
@@ -1442,8 +1453,8 @@ resize_screensaver_window (saver_info *si)
             int x, y;
             unsigned int mask;
             XQueryPointer (si->dpy, ssi->screensaver_window, &root, &child,
-                           &ssi->poll_mouse_last_root_x,
-                           &ssi->poll_mouse_last_root_y,
+                           &ssi->last_poll_mouse.root_x,
+                           &ssi->last_poll_mouse.root_y,
                            &x, &y, &mask);
           }
         }
@@ -1670,7 +1681,7 @@ blank_screen (saver_info *si)
   raise_window (si, False, False, False);
 
   si->screen_blanked_p = True;
-  si->blank_time = time ((time_t) 0);
+  si->blank_time = time ((time_t *) 0);
   si->last_wall_clock_time = 0;
 
   store_saver_status (si);  /* store blank time */
@@ -1686,7 +1697,7 @@ unblank_screen (saver_info *si)
   Bool unfade_p = (si->fading_possible_p && p->unfade_p);
   int i;
 
-  monitor_power_on (si);
+  monitor_power_on (si, True);
   reset_watchdog_timer (si, False);
 
   if (si->demoing_p)
@@ -1792,7 +1803,7 @@ unblank_screen (saver_info *si)
     XUnmapWindow (si->dpy, si->screens[i].screensaver_window);
 
   si->screen_blanked_p = False;
-  si->blank_time = time ((time_t) 0);
+  si->blank_time = time ((time_t *) 0);
   si->last_wall_clock_time = 0;
 
   store_saver_status (si);  /* store unblank time */