--- guix11/guix11.c.orig	2003-10-21 06:32:26.000000000 +0400
+++ guix11/guix11.c	2004-03-27 01:35:32.000000000 +0400
@@ -80,6 +80,7 @@
 #if USE_PROTOTYPES
 static void beep(GUIWIN *gw);
 static int catchErrors(Display *disp, XErrorEvent *err);
+static int ignoreErrors(Display *disp, XErrorEvent *err);
 static void moveto(GUIWIN *gw, int column, int row);
 static ELVBOOL scroll(GUIWIN *gw, int qty, ELVBOOL notlast);
 static ELVBOOL shift(GUIWIN *gw, int qty, int rows);
@@ -771,7 +768,6 @@
 }
 
 
-#if 0
 /* dummy X11 error handler */
 static int ignoreErrors(disp, err)
 	Display		*disp;
@@ -779,7 +775,6 @@
 {
 	return 0;
 }
-#endif
 
 
 /* Test whether this GUI is available in this environment.
@@ -1546,10 +1545,6 @@
 		x_ta_drawcursor(hadfocus);
 	}
 
-	/* Explicitly change the focus */
-	XSetInputFocus(x_display, xw->win, RevertToParent, x_now);
-	x_hasfocus = xw;
-	x_didcmd = ElvTrue;
 	return ElvTrue;
 }
 
@@ -1719,6 +1720,7 @@
 	guicmd(NULL, "newtoolbar");
 
 	/* warp the cursor back to the original (non-Elvis) window */
+	XSetErrorHandler(ignoreErrors);
 	if (o_warpback && fromwin != root)
 	{
 		XGetInputFocus(x_display, &curfocus, &dummy);
