Fixed a crash due to an unhandled getWindowAttributes exception

This commit is contained in:
Felix Hirn 2017-02-09 22:28:57 +01:00
parent f18bda7dc7
commit 50eb1844eb

View File

@ -632,8 +632,12 @@ type D = (Dimension, Dimension)
mkAdjust :: Window -> X (D -> D)
mkAdjust w = withDisplay $ \d -> liftIO $ do
sh <- getWMNormalHints d w
bw <- fmap (fromIntegral . wa_border_width) $ getWindowAttributes d w
return $ applySizeHints bw sh
wa <- C.try $ getWindowAttributes d w
case wa of
Left err -> const (return id) (err :: C.SomeException)
Right wa' ->
let bw = fromIntegral $ wa_border_width wa'
in return $ applySizeHints bw sh
-- | Reduce the dimensions if needed to comply to the given SizeHints, taking
-- window borders into account.