I am struggling to get keyboard input working properly. I have some input currently, standard keypresses come through (A-Z, 0-9, spacebar).
Unfortunately, all characters come through as capital, backspace does not work, nor does the shift key do anything yet. Attempting to press any other key comes through as a seemingly random character with an accent above it.
Obviously I need to account for the user pressing these special/system keys but am unsure how to properly use the CefKeyEvent to handle these special cases.
I am also not sure why every standard character comes through as capital..
int scancode: https://www.glfw.org/docs/3.3/group__keys.html
int mods: https://www.glfw.org/docs/3.3/group__mods.html
- Code: Select all
void Keyboard(int scancode, int action, int mods)
{
CefKeyEvent KeyEvent;
KeyEvent.windows_key_code = scancode;
KeyEvent.type = cef_key_event_type_t::KEYEVENT_CHAR;
KeyEvent.focus_on_editable_field = true;
KeyEvent.modifiers = cef_event_flags_t::EVENTFLAG_NONE;
KeyEvent.is_system_key = false;
browser->GetHost()->SendKeyEvent(KeyEvent);
}
(int scancode) appears to line up with what CefKeyEvent expects to see for windows_key_code, thankfully.
I'm not sure which approach to take moving forward, for example, I can check (int mods) to see if shift is currently being held, or capslock is turned on, but what do I need to change inside CefKeyEvent to let CEF know one of these keys are pressed?
I can also check (int scancode) to see if the key is non-standard (A-Z, 1-9, etc..) or the reverse and check to see if backspace was pressed, but for example, say backspace was pressed, what do I need to change inside CefKeyEvent to let CEF know?
Do I need to make a map of all the scancodes, and if its a standard key then use KEYEVENT_CHAR and if it's a non-standard key then use KEYEVENT_KEYDOWN and then set is_system_key=true? Perhaps something else..?
I have looked at cefclient project here as suggested in some other posts:
https://bitbucket.org/chromiumembedded/ ... win.cc-755
Unfortunately, I do not have access to the lparam or wparam from raw system events, nor does their usage of CefKeyEvent help me to understand what is actually happening..
I appreciate any input here.
Thank you.