summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSpencer Janssen <spencerjanssen@gmail.com>2008-10-22 00:00:59 +0200
committerSpencer Janssen <spencerjanssen@gmail.com>2008-10-22 00:00:59 +0200
commitc9a3ea8f5bf3c3aac20999809c8cf2b8fd236d0b (patch)
tree89ce03de9145c5bae69ab33d018ecf7401056077
parent9b546b17fe34912fcdf4ddb4239adbed8020db6d (diff)
downloadmetatile-c9a3ea8f5bf3c3aac20999809c8cf2b8fd236d0b.tar
metatile-c9a3ea8f5bf3c3aac20999809c8cf2b8fd236d0b.zip
Fix #192.
darcs-hash:20081021220059-25a6b-11b9b480bec9d902626f1c0c281333470e76e245
-rw-r--r--XMonad/Main.hsc19
1 files changed, 12 insertions, 7 deletions
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