windows: input: activate US keyboard layout for scancode mapping (#975)

This commit is contained in:
Conn O'Griofa 2023-02-25 19:08:42 +00:00 committed by GitHub
parent 9e0c72e45d
commit 845749d525
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -177,6 +177,7 @@ struct input_raw_t {
vigem_t *vigem;
HKL keyboard_layout;
HKL active_layout;
};
input_t input() {
@ -197,6 +198,13 @@ input_t input() {
raw.keyboard_layout = NULL;
}
// Activate layout for current process only
raw.active_layout = ActivateKeyboardLayout(raw.keyboard_layout, KLF_SETFORPROCESS);
if(!raw.active_layout) {
BOOST_LOG(warning) << "Unable to activate US English keyboard layout for scancode translation. Keyboard input may not work in games."sv;
raw.keyboard_layout = NULL;
}
return result;
}