diff --git a/README.md b/README.md index 9bad25a0f..89aaaac95 100644 --- a/README.md +++ b/README.md @@ -146,6 +146,8 @@ information on what to include when reporting a bug. from a modal to the content area - [Wayland] Bugfix: free modules at end of terminate function to resolve potential segmentation fault (#2744) + - [Wayland] Bugfix: Confining or disabling the cursor could segfault on + compositors without `pointer-constraints-unstable-v1` - [X11] Bugfix: Running without a WM could trigger an assert (#2593,#2601,#2631) - [X11] Bugfix: Occasional crash when an idle display awakes (#2766) - [X11] Bugfix: Prevent BadWindow when creating small windows with a content scale diff --git a/src/wl_window.c b/src/wl_window.c index 4220d17e0..1bb32f5f0 100644 --- a/src/wl_window.c +++ b/src/wl_window.c @@ -2974,10 +2974,16 @@ static void lockPointer(_GLFWwindow* window) if (!_glfw.wl.relativePointerManager) { _glfwInputError(GLFW_FEATURE_UNAVAILABLE, - "Wayland: The compositor does not support pointer locking"); + "Wayland: The compositor does not support relative pointer motion"); return; } + if (!_glfw.wl.pointerConstraints) + { + _glfwInputError(GLFW_FEATURE_UNAVAILABLE, + "Wayland: The compositor does not support locking the pointer"); + } + window->wl.relativePointer = zwp_relative_pointer_manager_v1_get_relative_pointer( _glfw.wl.relativePointerManager, @@ -3025,6 +3031,12 @@ static const struct zwp_confined_pointer_v1_listener confinedPointerListener = static void confinePointer(_GLFWwindow* window) { + if (!_glfw.wl.pointerConstraints) + { + _glfwInputError(GLFW_FEATURE_UNAVAILABLE, + "Wayland: The compositor does not support confining the pointer"); + } + window->wl.confinedPointer = zwp_pointer_constraints_v1_confine_pointer( _glfw.wl.pointerConstraints,