mirror of
https://github.com/xmonad/xmonad-contrib.git
synced 2025-08-07 23:41:52 -07:00
Prefer safe alternatives to getWindowAttributes
Whenever possible, prefer the safe wrappers withWindowAttributes or safeGetWindowAttributes to getWindowAttributes. Places where these are not applicable are limited to layouts, where there is not good "default value" to give back in case these calls fail. In these cases, we let the exception handling of the layout mechanism handle it and fall back to the Full layout. Fixes: https://github.com/xmonad/xmonad-contrib/issues/146
This commit is contained in:
@@ -23,7 +23,6 @@ import XMonad.Prelude
|
||||
|
||||
import Codec.Binary.UTF8.String (decodeString)
|
||||
import Control.Exception as E
|
||||
import Foreign
|
||||
import Foreign.C.String
|
||||
import Numeric (showHex)
|
||||
import System.Exit
|
||||
@@ -35,7 +34,7 @@ debugWindow :: Window -> X String
|
||||
debugWindow 0 = return "-no window-"
|
||||
debugWindow w = do
|
||||
let wx = pad 8 '0' $ showHex w ""
|
||||
w' <- withDisplay $ \d -> io (safeGetWindowAttributes d w)
|
||||
w' <- safeGetWindowAttributes w
|
||||
case w' of
|
||||
Nothing ->
|
||||
return $ "(deleted window " ++ wx ++ ")"
|
||||
|
Reference in New Issue
Block a user