From 3219b6acd541ce2438f5dad50a90f7d32636d912 Mon Sep 17 00:00:00 2001 From: Emmanuel Gil Peyrot Date: Wed, 15 Apr 2015 18:18:42 +0200 Subject: [PATCH] wayland: Implement glfwGetCursorPos --- src/input.c | 5 +++++ src/wl_window.c | 6 ++++-- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/src/input.c b/src/input.c index e899e715d3..c3452d4ca3 100644 --- a/src/input.c +++ b/src/input.c @@ -205,6 +205,11 @@ void _glfwInputCursorMotion(_GLFWwindow* window, double x, double y) x = window->cursorPosX; y = window->cursorPosY; } + else + { + window->cursorPosX = x; + window->cursorPosY = y; + } if (window->callbacks.cursorPos) window->callbacks.cursorPos((GLFWwindow*) window, x, y); diff --git a/src/wl_window.c b/src/wl_window.c index 3492aed512..dbc7afed86 100644 --- a/src/wl_window.c +++ b/src/wl_window.c @@ -379,8 +379,10 @@ void _glfwPlatformPostEmptyEvent(void) void _glfwPlatformGetCursorPos(_GLFWwindow* window, double* xpos, double* ypos) { - // TODO - fprintf(stderr, "_glfwPlatformGetCursorPos not implemented yet\n"); + if (xpos) + *xpos = window->cursorPosX; + if (ypos) + *ypos = window->cursorPosY; } void _glfwPlatformSetCursorPos(_GLFWwindow* window, double x, double y)