| Summary: | X11: crash if window size too large, SW rend | ||
|---|---|---|---|
| Product: | SDL | Reporter: | Stas Sergeev <stsp2> |
| Component: | video | Assignee: | Ryan C. Gordon <icculus> |
| Status: | ASSIGNED --- | QA Contact: | Sam Lantinga <slouken> |
| Severity: | normal | ||
| Priority: | P2 | CC: | sylvain.becker |
| Version: | 2.0.12 | Keywords: | target-2.0.14 |
| Hardware: | x86_64 | ||
| OS: | Linux | ||
| Attachments: |
the fix
alternative |
||
No sure if this is related to the issue, but I noticed: https://hg.libsdl.org/SDL/file/02f670c66eed/src/video/x11/SDL_x11window.c#l545 If your window is created with flags SDL_WINDOW_RESIZABLE, X11 clips the user w/h with screen size. So the window size ends up not being the requested w/h. Created attachment 4613 [details]
the fix
This fixes the crash part.
The most important thing is to call
SDL_OnWindowResized(window);
The remaining part:
window->windowed.w = w;
window->windowed.h = h;
may not be needed, at least it doesn't
make any obvious difference.
Created attachment 4614 [details]
alternative
Alternatively (or additionally, at your
opinion) you can do this.
It would just ignore the fact that the
WM have resized the window.
Please consider what fix would you prefer.
|
I am getting this crash: --- X Error of failed request: BadValue (integer parameter out of range for operation) Major opcode of failed request: 130 (MIT-SHM) Minor opcode of failed request: 3 (X_ShmPutImage) Value in failed request: 0x500 Serial number of failed request: 579 Current serial number in output stream: 580 --- It is specific to software renderer. All you need to do is to set the window size to your desktop size (but not making it full-screen!), then do SDL_RenderClear(renderer); SDL_RenderPresent(renderer); After some debugging, I've found that somehow the window decorations are taken into account, so if I have the desktop res 1280x1024 and do SDL_SetWindowSize(window, 1280, 1024); then subsequent SDL_GetWindowSize() will only return 1280x960. This is a bug by itself: other apps have no problems setting window size larger than the desktop res, in which case the part of the window is invisible (but you can drag it with the mouse). But SDL seems to be limited to the visible area size only. Now, it seems that the window is in an inconsistent state after such operation. I think it still has the surface of the size 1280x1024, so the rendering attempt crashes. So the work-around it to do SDL_SetWindowSize() the second time, now with the values obtained from SDL_GetWindowSize(). This seems to bring the internals back in sync, and I can render after that. So the work-around looks like this: SDL_SetWindowSize(window, w_x_res, w_y_res); SDL_GetWindowSize(window, &w_x_res, &w_y_res); SDL_SetWindowSize(window, w_x_res, w_y_res); Please fix 2 bugs: - Make it possible to create windows larger than the desktop itself (in my case - only by the size of the decorators, as I am trying to set the same res as my desktop has) - in SDL_x11window.c:970 you have: if ((attrs.width != orig_w) || (attrs.height != orig_h)) { window->w = attrs.width; window->h = attrs.height; which is obviously not enough and leaves the window in an inconsistent state. Please make the new size to propagate properly, so that the user doesn't have to call SDL_SetWindowSize() twice.