Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

X.L.SimplestFloat contains an unsafe getWindowAttributes #909

Open
geekosaur opened this issue Oct 4, 2024 · 2 comments
Open

X.L.SimplestFloat contains an unsafe getWindowAttributes #909

geekosaur opened this issue Oct 4, 2024 · 2 comments

Comments

@geekosaur
Copy link
Contributor

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.

@slotThe
Copy link
Member

slotThe commented Oct 4, 2024

Or getWindowAttributes never fails :)

@geekosaur
Copy link
Contributor Author

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,)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants