mirror of
https://github.com/xmonad/xmonad.git
synced 2025-05-19 08:30:21 -07:00
catch exceptions when calling user-written code.
This is a minimal approach that only catches error in actual user-written code.
This commit is contained in:
parent
07be5998c0
commit
1eaee82e85
2
Main.hs
2
Main.hs
@ -165,6 +165,7 @@ handle (KeyEvent {ev_event_type = t, ev_state = m, ev_keycode = code})
|
|||||||
| t == keyPress = withDisplay $ \dpy -> do
|
| t == keyPress = withDisplay $ \dpy -> do
|
||||||
s <- io $ keycodeToKeysym dpy code 0
|
s <- io $ keycodeToKeysym dpy code 0
|
||||||
whenJust (M.lookup (cleanMask m,s) keys) id
|
whenJust (M.lookup (cleanMask m,s) keys) id
|
||||||
|
`catchX` return ()
|
||||||
|
|
||||||
-- manage a new window
|
-- manage a new window
|
||||||
handle (MapRequestEvent {ev_window = w}) = withDisplay $ \dpy -> do
|
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.
|
-- grabbed in grabButtons. Otherwise, it's click-to-focus.
|
||||||
isr <- isRoot w
|
isr <- isRoot w
|
||||||
if isr then whenJust (M.lookup (cleanMask (ev_state e), b) mouseBindings) ($ ev_subwindow e)
|
if isr then whenJust (M.lookup (cleanMask (ev_state e), b) mouseBindings) ($ ev_subwindow e)
|
||||||
|
`catchX` return ()
|
||||||
else focus w
|
else focus w
|
||||||
sendMessage e -- Always send button events.
|
sendMessage e -- Always send button events.
|
||||||
|
|
||||||
|
@ -66,7 +66,7 @@ manage w = whenX (fmap not $ isClient w) $ withDisplay $ \d -> do
|
|||||||
|
|
||||||
n <- fmap (fromMaybe "") $ io $ fetchName d w
|
n <- fmap (fromMaybe "") $ io $ fetchName d w
|
||||||
(ClassHint rn rc) <- io $ getClassHint 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)
|
windows (g . f)
|
||||||
|
|
||||||
-- | unmanage. A window no longer exists, remove it from the window
|
-- | 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
|
whenJust (W.peek ws) $ \w -> io $ setWindowBorder d w fbc
|
||||||
setTopFocus
|
setTopFocus
|
||||||
logHook
|
logHook `catchX` return ()
|
||||||
-- io performGC -- really helps, but seems to trigger GC bugs?
|
-- io performGC -- really helps, but seems to trigger GC bugs?
|
||||||
|
|
||||||
-- hide every window that was potentially visible before, but is not
|
-- hide every window that was potentially visible before, but is not
|
||||||
|
Loading…
x
Reference in New Issue
Block a user