diff --git a/CONTRIBUTORS.md b/CONTRIBUTORS.md index d8eb7aee..39be7f7d 100644 --- a/CONTRIBUTORS.md +++ b/CONTRIBUTORS.md @@ -280,6 +280,7 @@ video tutorials. - Corentin Wallez - Torsten Walluhn - Patrick Walton + - Ivor Wanders - Jim Wang - Xo Wang - Andre Weissflog diff --git a/README.md b/README.md index 6eb6b9bd..c74a56d9 100644 --- a/README.md +++ b/README.md @@ -148,6 +148,7 @@ information on what to include when reporting a bug. - [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 `GLFW_NATIVE_CONTEXT_API` (#2518) + - [X11] Bugfix: Prevent BadWindow when creating small windows (#2754) ## Contact diff --git a/src/x11_window.c b/src/x11_window.c index 322349f0..99dfdeb8 100644 --- a/src/x11_window.c +++ b/src/x11_window.c @@ -576,6 +576,10 @@ static GLFWbool createNativeWindow(_GLFWwindow* window, 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; if (wndconfig->xpos != GLFW_ANY_POSITION && wndconfig->ypos != GLFW_ANY_POSITION)