mirror of
https://github.com/gwm17/glfw.git
synced 2025-01-30 19:08:51 -05: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)
|
void _glfwPlatformSetRawMouseMotion(_GLFWwindow *window, GLFWbool enabled)
|
||||||
{
|
{
|
||||||
|
// This is handled in relativePointerHandleRelativeMotion
|
||||||
}
|
}
|
||||||
|
|
||||||
GLFWbool _glfwPlatformRawMouseMotionSupported(void)
|
GLFWbool _glfwPlatformRawMouseMotionSupported(void)
|
||||||
{
|
{
|
||||||
return GLFW_FALSE;
|
return GLFW_TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
void _glfwPlatformPollEvents(void)
|
void _glfwPlatformPollEvents(void)
|
||||||
|
@ -1446,13 +1447,24 @@ static void relativePointerHandleRelativeMotion(void* data,
|
||||||
wl_fixed_t dyUnaccel)
|
wl_fixed_t dyUnaccel)
|
||||||
{
|
{
|
||||||
_GLFWwindow* window = data;
|
_GLFWwindow* window = data;
|
||||||
|
double xpos = window->virtualCursorPosX;
|
||||||
|
double ypos = window->virtualCursorPosY;
|
||||||
|
|
||||||
if (window->cursorMode != GLFW_CURSOR_DISABLED)
|
if (window->cursorMode != GLFW_CURSOR_DISABLED)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
_glfwInputCursorPos(window,
|
if (window->rawMouseMotion)
|
||||||
window->virtualCursorPosX + wl_fixed_to_double(dxUnaccel),
|
{
|
||||||
window->virtualCursorPosY + wl_fixed_to_double(dyUnaccel));
|
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 = {
|
static const struct zwp_relative_pointer_v1_listener relativePointerListener = {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user