xmonad / X11

A Haskell binding to the X11 graphics library.
http://hackage.haskell.org/package/X11
Other
105 stars 48 forks source link

Add `setWMNormalHints` #83

Closed n1essa closed 2 years ago

geekosaur commented 2 years ago

Do we really want this to go into Extras.hsc? If anything, I'd think it was time to start merging stuff where it belongs and making it a file of backward compatibility reexports. (Historically it was its own package, adding stuff we needed on top of the original X11 package.)

n1essa commented 2 years ago

I'm fine with moving it somewhere else. I put it in Extras.hsc because that's where the related function getWMNormalHints is.

geekosaur commented 2 years ago

Yeh, as I said, that's historical. This might not be the PR to start moving things around, though; I'm more interested in the other maintainers' opinions.

liskin commented 2 years ago

I'm not entirely sure if moving things around is a good use of anyone's time at this point of X11 developmentā€¦ Anyway, this PR adds it exactly where I'd expect it now, so until someone figures out how things should be (and again I don't think that's a pressing issue at this point), I'd just just leave it here.

n1essa commented 2 years ago

With this change to using XAllocSizeHints, I followed the pattern I saw elsewhere, but I'm wondering if we also need to handle XAllocSizeHints returning null

geekosaur commented 2 years ago

Technically yes, but if it returns NULL we'll find out soon enough anyway because everything else will fail too. :) Still, probably best to compare the Ptr against nullPtr (this may require a castPtr).

BTW, as it does an allocation it should really be safe instead of unsafe. (unsafe should only be used for X11 macros; pretty much everything else is potentially unsafe and should be properly protected by making a safe call.)

n1essa commented 2 years ago

Is this looking reasonable?

geekosaur commented 2 years ago

Yes, this looks reasonable.