/* timers.c --- detecting when the user is idle, and other timer-related tasks.
- * xscreensaver, Copyright (c) 1991-2012 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
XGetWindowAttributes (si->dpy, window, &attrs);
events = ((attrs.all_event_masks | attrs.do_not_propagate_mask)
- & KeyPressMask);
+ & (KeyPressMask | PropertyChangeMask));
/* Select for SubstructureNotify on all windows.
+ Select for PropertyNotify on all windows.
Select for KeyPress on all windows that already have it selected.
Note that we can't select for ButtonPress, because of X braindamage:
systems that have it. Oh, if it's a PS/2 mouse, not serial or USB.
This sucks!
*/
- XSelectInput (si->dpy, window, SubstructureNotifyMask | events);
+ XSelectInput (si->dpy, window,
+ SubstructureNotifyMask | PropertyChangeMask | events);
if (top_p && p->debug_p && (events & KeyPressMask))
{
shift > (p->timeout / 1000))
{
if (p->verbose_p)
- fprintf (stderr, "%s: wall clock has jumped by %ld:%02ld:%02ld!\n",
+ fprintf (stderr, "%s: wall clock has jumped by %ld:%02ld:%02ld%s\n",
blurb(),
- (shift / (60 * 60)), ((shift / 60) % 60), (shift % 60));
+ (shift / (60 * 60)), ((shift / 60) % 60), (shift % 60),
+ (p->mode == DONT_BLANK ? " while saver disabled" : ""));
- si->emergency_lock_p = True;
- idle_timer ((XtPointer) si, 0);
+ /* If the saver is entirely disabled, there's no need to do the
+ emergency-blank-and-lock thing.
+ */
+ if (p->mode != DONT_BLANK)
+ {
+ si->emergency_lock_p = True;
+ idle_timer ((XtPointer) si, 0);
+ }
}
si->last_wall_clock_time = now;
explicitly informed by SGI SCREEN_SAVER server event;
explicitly informed by MIT-SCREEN-SAVER server event;
select events on all windows, and note events on any of them;
+ note that a client updated their window's _NET_WM_USER_TIME property;
note that /proc/interrupts has changed;
deactivated by clientmessage.
break;
+ case PropertyNotify:
+
+ if (event.x_event.xproperty.state == PropertyNewValue &&
+ event.x_event.xproperty.atom == XA_NET_WM_USER_TIME)
+ {
+ /* Let's just assume that they only ever set USER_TIME to the
+ current time, and don't do something stupid like repeatedly
+ setting it to 20 minutes ago. */
+
+ why = "WM_USER_TIME";
+
+ if (p->debug_p)
+ {
+ Window w = event.x_event.xproperty.window;
+ XWindowAttributes xgwa;
+ int i;
+ XGetWindowAttributes (si->dpy, w, &xgwa);
+ for (i = 0; i < si->nscreens; i++)
+ if (xgwa.root == RootWindowOfScreen (si->screens[i].screen))
+ break;
+ fprintf (stderr,"%s: %d: %s on 0x%lx\n",
+ blurb(), i, why, (unsigned long) w);
+ }
+
+ if (until_idle_p)
+ reset_timers (si);
+ else
+ goto DONE;
+ }
+ break;
+
default:
#ifdef HAVE_MIT_SAVER_EXTENSION
sync_server_dpms_settings (si->dpy,
(p->dpms_enabled_p &&
p->mode != DONT_BLANK),
+ p->dpms_quickoff_p,
p->dpms_standby / 1000,
p->dpms_suspend / 1000,
p->dpms_off / 1000,