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

allow creation on remote (X11) displays #2547

Open
umlaeute opened this issue May 2, 2024 · 5 comments
Open

allow creation on remote (X11) displays #2547

umlaeute opened this issue May 2, 2024 · 5 comments
Labels
Linux Linux specific (any window system) X11

Comments

@umlaeute
Copy link

umlaeute commented May 2, 2024

with X11 it is possible to open a window on a remote display.

i have a some users who are using this, allowing them to display the control interface on one computer, and the openGL output window on another computer - all from within one application. and they might even decide to switch the target display during runtime (obviously destroying the window first, then re-creating it on another DISPLAY)

now that we have switched our default windowing backend from GLX to GLFW, this is no longer possible.

i did a quick check to see whether I could trick glfw by setting the DISPLAY variable before calling glfwCreateWindow(), but alas! this does not work (as glfw requests the display only once, during glfwInit(), which can only be called once).

would it be possible to add a (possibly X11 specific) Window creation hint (e.g. glfwWindowHintString(GLFW_DISPLAY, ":0")) to allow setting a target display?

i'm aware that currently glfw maintains a global display for all its windows....

@dougbinks
Copy link
Contributor

GLFW has a number of platform specific hints already, so a PR for this would likely be acceptable.

@umlaeute
Copy link
Author

umlaeute commented Jun 4, 2024

i'm aware that currently glfw maintains a global display for all its windows....

given the above, should a PR try to keep the current behavior (so selecting a display can only be done before the first window is created) or maintain a display for each window (which might get tricky if the different displays have different capabilities).

i tend towards the former, but then I think the proper function would be glfwInitHintString() (which does not exist yet!).

(note that i haven't checked the code recently, so i might have gotten things wrong)

@dougbinks
Copy link
Contributor

Out of interest can you rework the application to call init after changing the DISPLAY environment variable?

A change to add per window displays would be pretty large, since the GLFW init uses the display variable to initialize a large number of variables used by all the systems in GLFW. So if a change to add this as an init hint would work for your use case then I think this would be the best way to go.

@umlaeute
Copy link
Author

umlaeute commented Jun 6, 2024

Out of interest can you rework the application to call init after changing the DISPLAY environment variable?

probably.

so do I understand correctly, that a PR should add a new glfwInitHintString() function (because the existing glfwInitHint() cannot take strings and is therefore not sufficient)

@dougbinks
Copy link
Contributor

Yes, a new function glfwInitHintString(int hint, const char* value) similar to glfwWindowHintString(int hint, const char* value) looks like the way to do this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Linux Linux specific (any window system) X11
Projects
None yet
Development

No branches or pull requests

2 participants