xmonad-contrib icon indicating copy to clipboard operation
xmonad-contrib copied to clipboard

X.L.SimplestFloat contains an unsafe `getWindowAttributes`

Open geekosaur opened this issue 1 year ago • 2 comments

getSize :: Rectangle -> Window -> X (Window,Rectangle)
getSize (Rectangle rx ry _ _) w = do
  d  <- asks display
  bw <- asks (borderWidth . config)
  wa <- io $ getWindowAttributes d w
  let x  =  max rx $ fi $ wa_x wa
      y  =  max ry $ fi $ wa_y wa
      wh = fi (wa_width  wa) + (bw * 2)
      ht = fi (wa_height wa) + (bw * 2)
  return (w, Rectangle x y wh ht)

I guess nobody actually uses this layout, or we'd have heard about layouts suddenly becoming Full because they'd thrown exceptions by now.

geekosaur avatar Oct 04 '24 01:10 geekosaur

Or getWindowAttributes never fails :)

slotThe avatar Oct 04 '24 06:10 slotThe

Pretty sure it does, and that's why safeGetWindowAttributes is in Prelude.hs. (I have certainly seen apps create and withdraw windows before we can manage them,)

geekosaur avatar Oct 04 '24 07:10 geekosaur