deno-windowing / dwm

Deno Window Manager: Cross-platform window creation and management
https://deno.land/x/dwm
Apache License 2.0
138 stars 10 forks source link

Keyboard Issue #6

Closed nhrones closed 1 year ago

nhrones commented 1 year ago

I'm coding a TextBox canvas widget and having input issues.

The keydown, keyup events produce very raw key, keycode values. Although the shift keys produce a shiftKey flag, the condition of capslock is not provided.
All alpha keys are coded as capital-chars (as if shifted), and then number keys produce numbers (unshifted).

I've written a basic keyboard module that tries to correct this, but I wonder if you know of any lib that already handles GLFW keys correctly! Also, I'm working on Windows, will my code have issues with Mac keyboard?

nhrones commented 1 year ago

Reading about GLFW3, I found this;

The key input facility was never meant for text input, although using it that way worked     
slightly better in GLFW 2. If you were using it to input text, you should be using the     
character callback instead, on both GLFW 2 and 3. This will give you the characters     
being input, as opposed to the keys being pressed.

Do you know what the character callback they mention is?
Can DWM use that to provide a cleaner text input?

DjDeveloperr commented 1 year ago

You can listen for input event which has data parameter that corresponds to the text input.

nhrones commented 1 year ago

I'm converting a scaled down copy of my Surface framework to a Deno lib specifically for use in skia-canvas, I'll let you know when its ready for consumption.

nhrones commented 1 year ago

Works great! Thanks.