
On Sat, Apr 14, 2007 at 09:52:33AM -0700, David Roundy wrote: [snip...defering to Stefan on cabal issues]
This brings up another minor issue: Right now, Graphics.X11.Xinerama exports:
XineramaScreenInfo data structure xineramaIsActive :: Display -> IO Bool xineramaQueryExtension :: Display -> IO (Maybe (CInt, CInt)) xineramaQueryVersion :: Display -> IO (Maybe (CInt, CInt)) xineramaQueryScreens :: Display -> IO (Maybe [XineramaScreenInfo]) getScreenInfo :: Display -> IO [Rectangle]
The xinerama* functions are as direct as possible wrappers around their C equivalents. getScreenInfo is a helpful wrapper around xineramaQueryScreens that fakes out a single display when Xinerama is not active. (That's right: Even if the X11 servers supports Xienrama, if it's not currently being used, all the Xinerama-functions fail. Yay.) [...] So if nobody objects, I'm going to continue to work on autoconfig magic to make a "getScreenInfo" that works even in the face of non-existent Xinerama.
This sounds great to me. But I imagine that at least xineramaIsActive ought to be very easy to deal with in the absense of Xinerama (always return True, or False?). And the others also seem like you could stub them out in such a way that the behavior of a Xinerama-aware program will be the same for a single screen either with or without Xinerama support compiled in. And I guess just returning Nothing for the rest will also be consistent? Why not export all of these in either case? Then developers could code once, and their code would behave in the same way, regardless of whether the Xinerama library isn't present or Xinerama itself isn't being used, but we don't lose any of the exported power. (Unless these functions are really useless, in which case there's no need to bother...)
Oh, that's a great idea. I should have thought of that. :) If we have xineramaIsActive return False, and all the others return Nothing, the interface will act just like Xinerama's there, but disabled. (As is the case when you only have one screen.) So I'll do it that way. I don't know whether they are "really useless" or not, but with your idea it's very easy to make them available. So I don't see any reason not to export them. I don't want to be in the position of telling people "sorry, you can't call that function; I didn't think you would need it." Jason Creighton