Hi, I cannot hide the mouse cursor on Ubuntu using glfwSetInputMode(window, GLFW_CURSOR, GLFW_CURSOR_HIDDEN);
It works fine on OSX though.
This is a known issue https://github.com/glfw/glfw/issues/309
And people say https://github.com/glfw/glfw/pull/431 can fix this issue.
The file that needs to be fixed is
src/x11_window.c but I can’t find this file anywhere under OF directory.
Can anyone teach me where to find the file so I can fix this issue?
What if you call
ofHideCursor()? That works for me on Linux…
Update: now I see in another post that this doesn’t work for you, right?
Answering your question, I see this: https://github.com/openframeworks/apothecary/blob/master/apothecary/formulas/glfw.sh which downloads the GLFW source code from GitHub. But at the top of that file it says “osx” “vs”, so maybe it doesn’t use it on Linux?
in linux we use glfw from the system, if you want to use your own version you would need to download the source for glfw, compile the library (or use apothecary adding linux64 to the line @hamoid poitns out) but patching that file before compiling
then in the OF makefiles or qbs files remove the exception that makes it ignore glfw in the libs folder
Thanks, I did the following to mimic hiding/showing the cursor on Linux.
to hide. (create a transparent cursor and set it)
unsigned char pixels[w * h * 4];
memset(pixels, 0x00, sizeof(pixels));
image.width = w;
image.height = h;
image.pixels = pixels;
glfwSetCursor(window, glfwCreateCursor(&image, 0, 0));
And to show. (unset the cursor)
It worked on both OSX and Linux.
I hope it is a safe solution.