mirror of
https://github.com/godotengine/godot.git
synced 2024-11-25 05:33:11 +00:00
[3.x] Release pressed events when the window is blurred on HTML5 platform
(cherry picked from commit c918b4d246
)
This commit is contained in:
parent
90022710ab
commit
c3541628c1
@ -123,6 +123,11 @@ EM_BOOL OS_JavaScript::fullscreen_change_callback(int p_event_type, const Emscri
|
||||
return false;
|
||||
}
|
||||
|
||||
EM_BOOL OS_JavaScript::blur_callback(int p_event_type, const EmscriptenFocusEvent *p_event, void *p_user_data) {
|
||||
get_singleton()->input->release_pressed_events();
|
||||
return false;
|
||||
}
|
||||
|
||||
void OS_JavaScript::set_video_mode(const VideoMode &p_video_mode, int p_screen) {
|
||||
|
||||
video_mode = p_video_mode;
|
||||
@ -875,6 +880,7 @@ Error OS_JavaScript::initialize(const VideoMode &p_desired, int p_video_driver,
|
||||
SET_EM_CALLBACK(canvas_id, mousedown, mouse_button_callback)
|
||||
SET_EM_WINDOW_CALLBACK(mousemove, mousemove_callback)
|
||||
SET_EM_WINDOW_CALLBACK(mouseup, mouse_button_callback)
|
||||
SET_EM_WINDOW_CALLBACK(blur, blur_callback)
|
||||
SET_EM_CALLBACK(canvas_id, wheel, wheel_callback)
|
||||
SET_EM_CALLBACK(canvas_id, touchstart, touch_press_callback)
|
||||
SET_EM_CALLBACK(canvas_id, touchmove, touchmove_callback)
|
||||
|
@ -72,6 +72,7 @@ private:
|
||||
|
||||
static Point2 compute_position_in_canvas(int x, int y);
|
||||
static EM_BOOL fullscreen_change_callback(int p_event_type, const EmscriptenFullscreenChangeEvent *p_event, void *p_user_data);
|
||||
static EM_BOOL blur_callback(int p_event_type, const EmscriptenFocusEvent *p_event, void *p_user_data);
|
||||
|
||||
static EM_BOOL keydown_callback(int p_event_type, const EmscriptenKeyboardEvent *p_event, void *p_user_data);
|
||||
static EM_BOOL keypress_callback(int p_event_type, const EmscriptenKeyboardEvent *p_event, void *p_user_data);
|
||||
|
Loading…
Reference in New Issue
Block a user