Skip to content

Commit

Permalink
bind key events to canvas, not document
Browse files Browse the repository at this point in the history
This way focus means focus and we can have multiple RA instances in
one page.
  • Loading branch information
JoeOsborn committed Sep 13, 2023
1 parent 9a897e3 commit 1b93c25
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions input/drivers/rwebinput_input.c
Original file line number Diff line number Diff line change
Expand Up @@ -291,7 +291,7 @@ static void *rwebinput_input_init(const char *joypad_driver)
rwebinput_generate_lut();

r = emscripten_set_keydown_callback(
EMSCRIPTEN_EVENT_TARGET_DOCUMENT, rwebinput, false,
"!canvas", rwebinput, false,
rwebinput_keyboard_cb);
if (r != EMSCRIPTEN_RESULT_SUCCESS)
{
Expand All @@ -300,7 +300,7 @@ static void *rwebinput_input_init(const char *joypad_driver)
}

r = emscripten_set_keyup_callback(
EMSCRIPTEN_EVENT_TARGET_DOCUMENT, rwebinput, false,
"!canvas", rwebinput, false,
rwebinput_keyboard_cb);
if (r != EMSCRIPTEN_RESULT_SUCCESS)
{
Expand All @@ -309,7 +309,7 @@ static void *rwebinput_input_init(const char *joypad_driver)
}

r = emscripten_set_keypress_callback(
EMSCRIPTEN_EVENT_TARGET_DOCUMENT, rwebinput, false,
"!canvas", rwebinput, false,
rwebinput_keyboard_cb);
if (r != EMSCRIPTEN_RESULT_SUCCESS)
{
Expand Down Expand Up @@ -342,7 +342,7 @@ static void *rwebinput_input_init(const char *joypad_driver)
}

r = emscripten_set_wheel_callback(
EMSCRIPTEN_EVENT_TARGET_DOCUMENT, rwebinput, false,
"!canvas", rwebinput, false,
rwebinput_wheel_cb);
if (r != EMSCRIPTEN_RESULT_SUCCESS)
{
Expand Down

0 comments on commit 1b93c25

Please sign in to comment.