X-Git-Url: http://git.hungrycats.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=hacks%2Fbsod.c;h=2fd27c0eee092c20a18ca61111ad93103a716fe4;hb=59ac4e9a0de290e4275a7bbb890ad16abd09d68f;hp=3f3cd346fb69de8f803e41174e2ddbe5ac1963b2;hpb=c31d10b6605cd8dc1a7b61fef4256f06198767e5;p=xscreensaver diff --git a/hacks/bsod.c b/hacks/bsod.c index 3f3cd346..2fd27c0e 100644 --- a/hacks/bsod.c +++ b/hacks/bsod.c @@ -157,18 +157,25 @@ double_pixmap(Display *dpy, GC gc, Visual *visual, int depth, Pixmap pixmap, static Bool bsod_sleep(Display *dpy, int seconds) { - XEvent event; int q = seconds * 4; - int mask = KeyPressMask|ButtonPressMask; do { XSync(dpy, False); - if (XCheckMaskEvent(dpy, mask, &event)) - { - while (XCheckMaskEvent(dpy, mask, &event)) - ; - return True; - } + while (XPending (dpy)) + { + XEvent event; + XNextEvent (dpy, &event); + if (event.xany.type == KeyPress) + { + KeySym keysym; + char c = 0; + XLookupString (&event.xkey, &c, 1, &keysym, 0); + if (c == ' ' || c == '\t' || c == '\r' || c == '\n') + return True; + } + screenhack_handle_event (dpy, &event); + } + if (q > 0) { q--; @@ -467,7 +474,7 @@ amiga (Display *dpy, Window window, int delay) int height; unsigned long fg, bg, bg2; Pixmap pixmap = 0; - int pix_w, pix_h; + int pix_w = 0, pix_h = 0; const char *string = ("_Software failure. Press left mouse button to continue.\n" @@ -1031,7 +1038,12 @@ screenhack (Display *dpy, Window window) if (delay < 3) delay = 3; if (!get_boolean_resource ("root", "Boolean")) - XSelectInput(dpy, window, KeyPressMask|ButtonPressMask); + { + XWindowAttributes xgwa; + XGetWindowAttributes (dpy, window, &xgwa); + XSelectInput (dpy, window, + xgwa.your_event_mask | KeyPressMask | ButtonPressMask); + } while (1) { @@ -1053,7 +1065,7 @@ screenhack (Display *dpy, Window window) if (loop > 100) j = -1; if (loop > 200) exit(-1); if (!did) continue; - XSync (dpy, True); + XSync (dpy, False); j = i; loop = 0; }