mirror of
https://github.com/glfw/glfw.git
synced 2024-11-10 00:51:47 +00:00
Wayland: Implement raw mouse motion control
Related to #1400. Related to #1401.
This commit is contained in:
parent
1155c83013
commit
44af6bb936
@ -1320,11 +1320,12 @@ void _glfwPlatformSetWindowOpacity(_GLFWwindow* window, float opacity)
|
||||
|
||||
void _glfwPlatformSetRawMouseMotion(_GLFWwindow *window, GLFWbool enabled)
|
||||
{
|
||||
// This is handled in relativePointerHandleRelativeMotion
|
||||
}
|
||||
|
||||
GLFWbool _glfwPlatformRawMouseMotionSupported(void)
|
||||
{
|
||||
return GLFW_FALSE;
|
||||
return GLFW_TRUE;
|
||||
}
|
||||
|
||||
void _glfwPlatformPollEvents(void)
|
||||
@ -1446,13 +1447,24 @@ static void relativePointerHandleRelativeMotion(void* data,
|
||||
wl_fixed_t dyUnaccel)
|
||||
{
|
||||
_GLFWwindow* window = data;
|
||||
double xpos = window->virtualCursorPosX;
|
||||
double ypos = window->virtualCursorPosY;
|
||||
|
||||
if (window->cursorMode != GLFW_CURSOR_DISABLED)
|
||||
return;
|
||||
|
||||
_glfwInputCursorPos(window,
|
||||
window->virtualCursorPosX + wl_fixed_to_double(dxUnaccel),
|
||||
window->virtualCursorPosY + wl_fixed_to_double(dyUnaccel));
|
||||
if (window->rawMouseMotion)
|
||||
{
|
||||
xpos += wl_fixed_to_double(dxUnaccel);
|
||||
ypos += wl_fixed_to_double(dyUnaccel);
|
||||
}
|
||||
else
|
||||
{
|
||||
xpos += wl_fixed_to_double(dx);
|
||||
ypos += wl_fixed_to_double(dy);
|
||||
}
|
||||
|
||||
_glfwInputCursorPos(window, xpos, ypos);
|
||||
}
|
||||
|
||||
static const struct zwp_relative_pointer_v1_listener relativePointerListener = {
|
||||
|
Loading…
Reference in New Issue
Block a user