xmonad / X11

A Haskell binding to the X11 graphics library.

Home Page:http://hackage.haskell.org/package/X11

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Shouldn't openDisplay take a Maybe String instead of a String?

jolmg opened this issue · comments

commented

XOpenDisplay is documented to accept a NULL argument to indicate it should use the DISPLAY environment variable value[1]. It seems like that'd be the most common way to use it, so I'm a little surprised that it's not supported in this binding.

[1] https://www.x.org/releases/X11R7.7/doc/libX11/libX11/libX11.html#XOpenDisplay

Technically yes, but for whatever reason the binding was written to treat an empty string that way instead. As issues with the Haskell X11 bindings go, this is one of the more minor itches.

(History note: we inherited the X11 binding, it predates xmonad. Which is also why so much stuff is crammed into an Extras module, which originally was a separate package of additional functionality xmonad needed. Ideally the whole thing would be redone properly, including moving the contents of the Extras module to their proper places.)

commented

I see. I hadn't tried it out. I only saw the definition and since (nullPtr ==) <$> withCString "" return is False, I thought it wouldn't work with an empty string. On trying to open a window, I see it works though.

I guess XOpenDisplay also uses DISPLAY when the given string is empty.

commented

Yup, I've confirmed XOpenDisplay("") acts like XOpenDisplay(NULL).