+
+
+ /* Transfer the grabs from the old window to the new.
+ Actually I think none of this is necessary, since we always
+ hold our grabs on the root window, but I wrote this before
+ re-discovering that...
+ */
+
+
+ /* If we're destroying the window that holds our mouse grab,
+ transfer the grab to the new window. (Grab the server while
+ so doing, to avoid a race condition.)
+ */
+ if (old_w == si->mouse_grab_window)
+ {
+ XGrabServer (si->dpy); /* ############ DANGER! */
+ ungrab_mouse(si);
+ grab_mouse(si, ssi->screensaver_window,
+ (si->demo_mode_p ? 0 : ssi->cursor));
+ XUngrabServer (si->dpy);
+ XSync (si->dpy, False); /* ###### (danger over) */
+ }
+
+ /* If we're destroying the window that holds our keyboard grab,
+ transfer the grab to the new window. (Grab the server while
+ so doing, to avoid a race condition.)
+ */
+ if (old_w == si->keyboard_grab_window)
+ {
+ XGrabServer (si->dpy); /* ############ DANGER! */
+ ungrab_kbd(si);
+ grab_kbd(si, ssi->screensaver_window);
+ XUngrabServer (si->dpy);
+ XSync (si->dpy, False); /* ###### (danger over) */
+ }
+
+ /* Now we can destroy this window without horking our grabs. */
+