vizvi wrote on Friday, September 26, 2014:
I’m porting my application to Linux, specifically Bodhi linux through Oracle VirtualBox and using GLFW3 for my portable windowed system.
I’ve encountered an issue where i can’t update my cursor position through glfwSetCursorPos. Actually, i can see that cursor is changing (temporary) to 10,10 on Linux (i am using glfwGetCursorPos to get the current position), yet cursor is standing still and if i move it again it moves from previous position, not 10,10. The counter-func, glfwGetCursorPos works flawlessly in Win7,WinXP and Bodhi Linux so i think this is probably a GLFW issue. My window is focused at the time of execution and my code is the following (the relevant parts):
static void keyboard_callback(GLFWwindow* window, int key, int scancode, int action, int mods) {
// set cursor position on 'A'
if (key == GLFW_KEY_A && action == GLFW_PRESS) {
glfwSetCursorPos(window,10,10);
}
}
...
.. main entry point
GLFWwindow* window;
// Create a windowed mode window and its OpenGL context
window = glfwCreateWindow(640, 480, "Hello World", NULL, NULL);
...
glfwSetKeyCallback(window, keyboard_callback);
// Loop until the user closes the window
while (!glfwWindowShouldClose(window)) {
glfwSwapBuffers(window);
glfwPollEvents();
}
Anyone encountered this issue?
UPDATE
Just out of curiocity and for the heck of it, i decided to test also some X Lib code and xdotool:
// XLib
Display* dpy = XOpenDisplay(0);
Window root_window = XRootWindow(dpy, 0);
XWarpPointer(dpy, None, root_window, 0, 0, 0, 0, 10, 10);
XCloseDisplay(dpy);
// xdotool
system("xdotool mousemove --screen 0 10 10");
Results?
Exactly the same. It seems like nothing in the world can move that darn cursor and i don’t know what causes it, GLFW, Bodhi or my VirtualBox.
Thanx