mirror of
https://github.com/glfw/glfw.git
synced 2025-08-31 19:11:49 +00:00
X11: Prevent BadWindow when creating small windows
The glfwCreateWindow function ensures that the width and height are
at least greater or equal than zero, but on X11 it is invalid to
create a window with dimensions that equal zero, see [1].
This change ensures that the dimensions passed to XCreateWindow are
at least 1 by 1.
This issue was detected in [2], where a call to glfwCreateWindow
was done to request a 1x1 window, with a _glfw.x11.contentScaleX of
less than 1.0 (0.958333) this results in a request for a 0x0 window
which then causes an BadWindow error from X11.
[1]: e003f52661/specs/libX11/CH03.xml (L1333-1337)
[2]: https://github.com/WerWolv/ImHex/pull/2390
This commit is contained in:
parent
ac10768495
commit
1c4ab4fd56
@ -278,6 +278,7 @@ video tutorials.
|
|||||||
- Corentin Wallez
|
- Corentin Wallez
|
||||||
- Torsten Walluhn
|
- Torsten Walluhn
|
||||||
- Patrick Walton
|
- Patrick Walton
|
||||||
|
- Ivor Wanders
|
||||||
- Jim Wang
|
- Jim Wang
|
||||||
- Xo Wang
|
- Xo Wang
|
||||||
- Andre Weissflog
|
- Andre Weissflog
|
||||||
|
@ -139,6 +139,7 @@ information on what to include when reporting a bug.
|
|||||||
- [Null] Added EGL context creation on Mesa via `EGL_MESA_platform_surfaceless`
|
- [Null] Added EGL context creation on Mesa via `EGL_MESA_platform_surfaceless`
|
||||||
- [EGL] Allowed native access on Wayland with `GLFW_CONTEXT_CREATION_API` set to
|
- [EGL] Allowed native access on Wayland with `GLFW_CONTEXT_CREATION_API` set to
|
||||||
`GLFW_NATIVE_CONTEXT_API` (#2518)
|
`GLFW_NATIVE_CONTEXT_API` (#2518)
|
||||||
|
- [X11] Bugfix: Prevent BadWindow when creating small windows (#2754)
|
||||||
|
|
||||||
|
|
||||||
## Contact
|
## Contact
|
||||||
|
@ -576,6 +576,10 @@ static GLFWbool createNativeWindow(_GLFWwindow* window,
|
|||||||
height *= _glfw.x11.contentScaleY;
|
height *= _glfw.x11.contentScaleY;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// The dimensions must be nonzero, or a BadValue error results.
|
||||||
|
width = _glfw_max(1, width);
|
||||||
|
height = _glfw_max(1, height);
|
||||||
|
|
||||||
int xpos = 0, ypos = 0;
|
int xpos = 0, ypos = 0;
|
||||||
|
|
||||||
if (wndconfig->xpos != GLFW_ANY_POSITION && wndconfig->ypos != GLFW_ANY_POSITION)
|
if (wndconfig->xpos != GLFW_ANY_POSITION && wndconfig->ypos != GLFW_ANY_POSITION)
|
||||||
|
Loading…
Reference in New Issue
Block a user