X-Git-Url: http://git.hungrycats.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=driver%2Ftimers.c;h=aac16586da8717ef50f5bce66517fea4a3279de8;hb=9c9d475ff889ed8be02e8ce8c17da28b93278fca;hp=4b5b570f31abe9104dc562e37cd301fc663a24ed;hpb=6cee540bdbb571485cd5e519f89f389faebd0495;p=xscreensaver diff --git a/driver/timers.c b/driver/timers.c index 4b5b570f..aac16586 100644 --- a/driver/timers.c +++ b/driver/timers.c @@ -1,5 +1,5 @@ /* timers.c --- detecting when the user is idle, and other timer-related tasks. - * xscreensaver, Copyright (c) 1991-2002 Jamie Zawinski + * xscreensaver, Copyright (c) 1991-2004 Jamie Zawinski * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, provided that @@ -42,6 +42,10 @@ #include #endif /* HAVE_SGI_SAVER_EXTENSION */ +#ifdef HAVE_RANDR +#include +#endif /* HAVE_RANDR */ + #include "xscreensaver.h" #ifdef HAVE_PROC_INTERRUPTS @@ -339,6 +343,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)) { @@ -870,6 +876,42 @@ sleep_until_idle (saver_info *si, Bool until_idle_p) else #endif /* HAVE_SGI_SAVER_EXTENSION */ +#ifdef HAVE_RANDR + if (event.type == (si->randr_event_number + RRScreenChangeNotify)) + { + /* The Resize and Rotate extension sends an event when the + size, rotation, or refresh rate of the screen has changed. */ + + XRRScreenChangeNotifyEvent *xrr_event = + (XRRScreenChangeNotifyEvent *) &event; + int screen = XRRRootToScreen (si->dpy, xrr_event->window); + + if (p->verbose_p) + { + if (si->screens[screen].width == xrr_event->width && + si->screens[screen].height == xrr_event->height) + fprintf (stderr, + "%s: %d: no-op screen size change event (%dx%d)\n", + blurb(), screen, + xrr_event->width, xrr_event->height); + else + fprintf (stderr, + "%s: %d: screen size changed from %dx%d to %dx%d\n", + blurb(), screen, + si->screens[screen].width, + si->screens[screen].height, + xrr_event->width, xrr_event->height); + } + + /* Inform Xlib that it's ok to update its data structures. */ + XRRUpdateConfiguration (&event); + + /* Resize the existing xscreensaver windows and cached ssi data. */ + resize_screensaver_window (si); + } + else +#endif /* HAVE_RANDR */ + /* Just some random event. Let the Widgets handle it, if desired. */ dispatch_event (si, &event); } @@ -1074,7 +1116,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);