From 92d7fd5a58ef27216b416617001b73e7f5ce969e Mon Sep 17 00:00:00 2001 From: Spencer Janssen Date: Wed, 22 Oct 2008 00:00:59 +0200 Subject: Fix #192. darcs-hash:20081021220059-25a6b-11b9b480bec9d902626f1c0c281333470e76e245.gz --- XMonad/Main.hsc | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) (limited to 'XMonad') diff --git a/XMonad/Main.hsc b/XMonad/Main.hsc index 945c5ea..454a3e6 100644 --- a/XMonad/Main.hsc +++ b/XMonad/Main.hsc @@ -65,6 +65,18 @@ xmonad initxmc = do let dflt = defaultScreen dpy rootw <- rootWindow dpy dflt + + -- If another WM is running, a BadAccess error will be returned. The + -- default error handler will write the exception to stderr and exit with + -- an error. + selectInput dpy rootw $ substructureRedirectMask .|. substructureNotifyMask + .|. enterWindowMask .|. leaveWindowMask .|. structureNotifyMask + sync dpy False -- sync to ensure all outstanding errors are delivered + + -- turn off the default handler in favor of one that ignores all errors + -- (ugly, I know) + xSetErrorHandler -- in C, I'm too lazy to write the binding: dons + xinesc <- getCleanedScreenInfo dpy nbc <- do v <- initColor dpy $ normalBorderColor xmc ~(Just nbc_) <- initColor dpy $ normalBorderColor Default.defaultConfig @@ -107,13 +119,6 @@ xmonad initxmc = do , waitingUnmap = M.empty , dragging = Nothing } - xSetErrorHandler -- in C, I'm too lazy to write the binding: dons - - -- setup initial X environment - sync dpy False - selectInput dpy rootw $ substructureRedirectMask .|. substructureNotifyMask - .|. enterWindowMask .|. leaveWindowMask .|. structureNotifyMask - allocaXEvent $ \e -> runX cf st $ do -- cgit v1.2.3