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

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

Closed
jolmg opened this issue Apr 6, 2019 · 3 comments
Closed

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

jolmg opened this issue Apr 6, 2019 · 3 comments

Comments

@jolmg
Copy link

jolmg commented Apr 6, 2019

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

@geekosaur
Copy link
Contributor

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

@jolmg
Copy link
Author

jolmg commented Apr 9, 2019

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.

@jolmg jolmg closed this as completed Apr 9, 2019
@jolmg
Copy link
Author

jolmg commented Apr 9, 2019

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

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