sdl2 icon indicating copy to clipboard operation
sdl2 copied to clipboard

Missing windowMode StateVar

Open ekmett opened this issue 6 years ago • 9 comments

You have all the machinery to make a StateVar for WindowMode, but don't take the last step.

Right now to get at it you have to grab the whole WindowConfig and peel it out.

windowMode :: SDL.Window -> StateVar WindowMode
windowMode w@(Window rw) = StateVar getWindowMode (setWindowMode w) where
  getWindowMode = fromNumber <$> SDL.Raw.getWindowFlags rw

This could replace setWindowMode. (Deprecate it first?).

ekmett avatar Jun 11 '19 20:06 ekmett

Yep, probably just missed this in the initial StateVar work

ocharles avatar Jun 11 '19 20:06 ocharles

windowMode is going to clash with the windowMode field of WindowConfig. Any votes for other names?

ocharles avatar Jun 11 '19 21:06 ocharles

windowMode' ?

ekmett avatar Jun 11 '19 21:06 ekmett

or windowState or something?

ekmett avatar Jun 11 '19 21:06 ekmett

Possibly currentWindowMode. I don't like randomly sticking a ' for something completely different.

ocharles avatar Jun 11 '19 21:06 ocharles

I like currentWindowMode

ekmett avatar Jun 11 '19 21:06 ekmett

I'll have a think about this. It is a bit of a shame to have the API inconsistency of windowSize :: Window -> StateVar (V2 CInt) and currentWindowMode :: Window -> StateVar WindowMode. I'm half tempted to break the API - https://codesearch.aelve.com/haskell/search?query=windowMode&filter=import%20SDL&insensitive=off&space=off&precise=on&sources=on shows no uses other than in this library, but I'm not sure exactly how much code that searches.

ocharles avatar Jun 11 '19 21:06 ocharles

You're thinking currentWindowSize, etc?

ekmett avatar Jun 11 '19 21:06 ekmett

I think I'd prefer to

a. Rename all of WindowConfig's fields to have a windowConfig prefix (instead of window) b. Move WindowConfig to a separate module, maybe dropping the field prefix entirely and prefer a qualified import.

ocharles avatar Jun 11 '19 21:06 ocharles