glfw icon indicating copy to clipboard operation
glfw copied to clipboard

Get caps lock state

Open deranjer opened this issue 5 years ago • 4 comments

Been using fyne and wanted to get the current state of the caps lock key. It appears that this may have been added in glfw 3.3: glfw/glfw#946

Has this been added to this repo as well? See the fyne ticket here: https://github.com/fyne-io/fyne/issues/1391

deranjer avatar Oct 12 '20 19:10 deranjer

From the issue you linked, the commit which closed it: https://github.com/glfw/glfw/commit/0e8c4ea7ce653cc7346bfe9fd5e5ab3933961934

See https://github.com/go-gl/glfw/search?q=GLFW_MOD_CAPS_LOCK

On the go side, it looks like: https://github.com/go-gl/glfw/blob/e5ec43523f6ff18bd5fc260244ea6ff9d5d6bc96/v3.3/glfw/input.go#L254

Hopefully that's enough for you to run with?

pwaller avatar Nov 01 '20 22:11 pwaller

Per the fyne people that allows them to detect if the caps lock key is hit, but does not allow getting the current caps lock state.

deranjer avatar Nov 01 '20 22:11 deranjer

getKeyMods https://github.com/go-gl/glfw/blob/eb749776b5d7c79f3dd276474e14bddadd6ae88e/v3.3/glfw/glfw/src/win32_window.c#L429-L447

myavchik avatar Nov 06 '20 07:11 myavchik

@myavchik that appears to be an implementation detail on win32 -- and doesn't amount to giving you the ability to test the key state for yourself with a glfw API. https://docs.microsoft.com/en-us/windows/win32/api/winuser/nf-winuser-getkeystate

I didn't find evidence that this is in upstream. Is it? If it is, please link to it, and patches are welcome to implement the downstream bit. For now, marking external.

pwaller avatar Nov 08 '20 20:11 pwaller