binaryen icon indicating copy to clipboard operation
binaryen copied to clipboard

Firefox intercepts key event in glfw

Open warzes opened this issue 2 years ago • 0 comments

In firefox (latest version) when using the glfw library, when any character key is pressed, the browser intercepts the event and opens the search box. And generate event EMSCRIPTEN_EVENT_BLUR

Minimal code

#include <stdio.h>
#include <GLFW/glfw3.h>
#ifdef __EMSCRIPTEN__
#include <emscripten.h>
#include <emscripten/html5.h>
#endif
GLFWwindow *window;
void GLFWKeyCallback(GLFWwindow*, int key, int, int, int){
	printf("key %d", key);
	puts("keys");
}
void render() {}
int main() {
    glfwInit();
    window = glfwCreateWindow(640, 480, "test", NULL, NULL);
    glfwMakeContextCurrent(window);

    emscripten_set_main_loop(render, 0, 1);

    glfwTerminate();
    return 0;
}

warzes avatar Aug 21 '23 05:08 warzes