glfw: add glfw.rawMouseMotionSupported

Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
This commit is contained in:
Stephen Gutekanst 2021-10-22 00:18:08 -07:00 committed by Stephen Gutekanst
parent 0f6efa4bc0
commit 9d95c18d4c

View file

@ -246,32 +246,33 @@ pub inline fn postEmptyEvent() Error!void {
try getError(); try getError();
} }
// TODO(mouse) /// Returns whether raw mouse motion is supported.
// /// Returns whether raw mouse motion is supported. ///
// /// /// This function returns whether raw mouse motion is supported on the current system. This status
// /// This function returns whether raw mouse motion is supported on the current /// does not change after GLFW has been initialized so you only need to check this once. If you
// /// system. This status does not change after GLFW has been initialized so you /// attempt to enable raw motion on a system that does not support it, glfw.Error.PlatformError will
// /// only need to check this once. If you attempt to enable raw motion on /// be emitted.
// /// a system that does not support it, glfw.Error.PlatformError will be emitted. ///
// /// /// Raw mouse motion is closer to the actual motion of the mouse across a surface. It is not
// /// Raw mouse motion is closer to the actual motion of the mouse across /// affected by the scaling and acceleration applied to the motion of the desktop cursor. That
// /// a surface. It is not affected by the scaling and acceleration applied to /// processing is suitable for a cursor while raw motion is better for controlling for example a 3D
// /// the motion of the desktop cursor. That processing is suitable for a cursor /// camera. Because of this, raw mouse motion is only provided when the cursor is disabled.
// /// while raw motion is better for controlling for example a 3D camera. Because ///
// /// of this, raw mouse motion is only provided when the cursor is disabled. /// @return `true` if raw mouse motion is supported on the current machine, or `false` otherwise.
// /// ///
// /// @return `true` if raw mouse motion is supported on the current machine, /// @thread_safety This function must only be called from the main thread.
// /// or `false` otherwise. ///
// /// /// see also: raw_mouse_motion, glfw.setInputMode
// /// Possible errors include glfw.Error.NotInitialized. pub inline fn rawMouseMotionSupported() bool {
// /// const supported = c.glfwRawMouseMotionSupported();
// /// @thread_safety This function must only be called from the main thread.
// /// // The only error this could return would be glfw.Error.NotInitialized, which should
// /// see also: raw_mouse_motion, glfw.setInputMode // definitely have occurred before calls to this. Returning an error here makes the API
// /// // awkward to use, so we discard it instead.
// /// getError() catch {};
// /// @ingroup input
// GLFWAPI int glfwRawMouseMotionSupported(void); return supported == c.GLFW_TRUE;
}
pub fn basicTest() !void { pub fn basicTest() !void {
try init(); try init();
@ -327,6 +328,13 @@ test "postEmptyEvent_and_waitEvents" {
try waitEvents(); try waitEvents();
} }
test "rawMouseMotionSupported" {
try init();
defer terminate();
_ = rawMouseMotionSupported();
}
test "basic" { test "basic" {
try basicTest(); try basicTest();
} }