wayland: Implement glfwGetCursorPos

Closes #499.
master
Emmanuel Gil Peyrot ago%!(EXTRA string=10 years) committed by Camilla Berglund
parent 9021e52a6f
commit e253beaa2b
  1. 5
      src/wl_init.c
  2. 1
      src/wl_platform.h
  3. 6
      src/wl_window.c

@ -86,6 +86,11 @@ static void pointerHandleMotion(void* data,
"Wayland: GLFW_CURSOR_DISABLED not supported"); "Wayland: GLFW_CURSOR_DISABLED not supported");
return; return;
} }
else
{
window->wl.cursorPosX = wl_fixed_to_double(sx);
window->wl.cursorPosY = wl_fixed_to_double(sy);
}
_glfwInputCursorMotion(window, _glfwInputCursorMotion(window,
wl_fixed_to_double(sx), wl_fixed_to_double(sx),

@ -66,6 +66,7 @@ typedef struct _GLFWwindowWayland
struct wl_shell_surface* shell_surface; struct wl_shell_surface* shell_surface;
struct wl_callback* callback; struct wl_callback* callback;
_GLFWcursor* currentCursor; _GLFWcursor* currentCursor;
double cursorPosX, cursorPosY;
} _GLFWwindowWayland; } _GLFWwindowWayland;

@ -379,8 +379,10 @@ void _glfwPlatformPostEmptyEvent(void)
void _glfwPlatformGetCursorPos(_GLFWwindow* window, double* xpos, double* ypos) void _glfwPlatformGetCursorPos(_GLFWwindow* window, double* xpos, double* ypos)
{ {
// TODO if (xpos)
fprintf(stderr, "_glfwPlatformGetCursorPos not implemented yet\n"); *xpos = window->wl.cursorX;
if (ypos)
*ypos = window->wl.cursorY;
} }
void _glfwPlatformSetCursorPos(_GLFWwindow* window, double x, double y) void _glfwPlatformSetCursorPos(_GLFWwindow* window, double x, double y)

Loading…
Cancel
Save