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
Crashes when $DISPLAY isn't :0.0 #724
Comments
Yes, SFML currently provides no support for multi-monitor setups... This is something we plan to improve in a future version. Concerning this specific X11 error, I'm not sure what the exact reason why it fails is.
An error message is output, see #508. Please make sure you use the latest GitHub revision when reporting problems, it doesn't make to investigate things that have been fixed meanwhile :) |
I've no idea how X11 works, but even if SFML doesn't provide an API to define where to open window, shouldn't it work if you define it directly with the WM settings? I probably misunderstand what |
I don't think any program should crash just because it doesn't handle potential multi-monitor setups. So sounds like X11's fault, unless SFML is indeed doing something wrong somewhere. It doesn't really matter whether SFML respects that setting, it should at least work. :) |
@pubby Can you please provide more information? Otherwise I'll have to close this issue. |
@eXpl0it3r The problem is that even if you define what display to use directly SFML crashes if its not the zero-th display. This is how you do that:
|
I managed to reproduce this using Xephyr by running I had a small look at this and I think that @pubby My multi monitor setup using RandR (which seems to be what most WMs are using these days) works fine with SFML. Is there a good reason for using the old multiple xorg screens way which I can't see? |
The XCB branch has been merged, as such this issue could be reinvestigated. |
@pubby, can you try latest master? |
Bump. @pubby can you confirm that this is still an issue with the xcb changes? If not, then there is no point in keeping this issue open. |
I couldn't reproduce this on master, even when running multiple TTYs using If no connection to the X server can be established, an error message is emitted and the application aborts as expected. I'm closing this issue for now. If you have more information that can help us reproduce the issue, feel free to provide it here. |
On an X set-up with multiple monitors running separate X screens (as opposed to merging them into one large X screen using Xinerama), the selected X visual needs to be one for the screen where the colormap, window, and other X resources are created. In fact, all these need to match, and the GL context as well. Most of the SFML windowing and graphics code uses (X)DefaultScreen() for that, which is fine. Combined with XOpenDisplay(NULL), this will create the window on the screen (and monitor) selected by the DISPLAY enviroment variable. :0.0 will be the first monitor, :0.1 the second, etc. However, XGetVisualInfo() will return visuals for *all* screens, not just the default one. They seem to be ordered by screen number, but I don't think the standard makes any guarantees there. If the visual doesn't match up with the screen, this will abort with an X error. BadMatch, in many cases. This means that in addition to other filtering, GlxContext::selectBestVisual() needs to filter the visuals by screen number, otherwise SFML won't work at all on any screens but the first. This fixes issue SFML#724.
When I try to run a SFML program from a different X screen (DISPLAY=:0.1) I get this error:
This means I can only run SFML programs on one monitor of my multi-monitor setup.
Also, when I try to run a SFML program when $DISPLAY is blank (such as from a tmux session not connected to X) I get a segfault. This isn't a huge issue, but I'd much prefer it to exit gracefully with an error rather than crashing.
Backtrace:
The text was updated successfully, but these errors were encountered: