aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Roundy <droundy@darcs.net>2007-10-12 03:33:05 +0200
committerDavid Roundy <droundy@darcs.net>2007-10-12 03:33:05 +0200
commita7cbcbd85bc6153b87318b78c64a28488350001a (patch)
treeb6d41c396f2011264466f9f77652ea6c6fbd269e
parentbbdea6e8563054b0e44aa75ba578df173b731329 (diff)
downloadxmonad-a7cbcbd85bc6153b87318b78c64a28488350001a.tar.gz
xmonad-a7cbcbd85bc6153b87318b78c64a28488350001a.tar.xz
xmonad-a7cbcbd85bc6153b87318b78c64a28488350001a.zip
catch exceptions when calling user-written code.
This is a minimal approach that only catches error in actual user-written code. darcs-hash:20071012013305-72aca-ab7d36fa77fb3c4fda4abbc7421ba7ba13d9b21a.gz
-rw-r--r--Main.hs2
-rw-r--r--Operations.hs4
2 files changed, 4 insertions, 2 deletions
diff --git a/Main.hs b/Main.hs
index 7748b40..8a99a53 100644
--- a/Main.hs
+++ b/Main.hs
@@ -165,6 +165,7 @@ handle (KeyEvent {ev_event_type = t, ev_state = m, ev_keycode = code})
| t == keyPress = withDisplay $ \dpy -> do
s <- io $ keycodeToKeysym dpy code 0
whenJust (M.lookup (cleanMask m,s) keys) id
+ `catchX` return ()
-- manage a new window
handle (MapRequestEvent {ev_window = w}) = withDisplay $ \dpy -> do
@@ -213,6 +214,7 @@ handle e@(ButtonEvent {ev_window = w,ev_event_type = t,ev_button = b })
-- grabbed in grabButtons. Otherwise, it's click-to-focus.
isr <- isRoot w
if isr then whenJust (M.lookup (cleanMask (ev_state e), b) mouseBindings) ($ ev_subwindow e)
+ `catchX` return ()
else focus w
sendMessage e -- Always send button events.
diff --git a/Operations.hs b/Operations.hs
index 03aef7c..d153d43 100644
--- a/Operations.hs
+++ b/Operations.hs
@@ -66,7 +66,7 @@ manage w = whenX (fmap not $ isClient w) $ withDisplay $ \d -> do
n <- fmap (fromMaybe "") $ io $ fetchName d w
(ClassHint rn rc) <- io $ getClassHint d w
- g <- manageHook w n rn rc
+ g <- manageHook w n rn rc `catchX` return id
windows (g . f)
-- | unmanage. A window no longer exists, remove it from the window
@@ -169,7 +169,7 @@ windows f = do
whenJust (W.peek ws) $ \w -> io $ setWindowBorder d w fbc
setTopFocus
- logHook
+ logHook `catchX` return ()
-- io performGC -- really helps, but seems to trigger GC bugs?
-- hide every window that was potentially visible before, but is not