mirror of
https://github.com/Ryujinx/SDL.git
synced 2025-06-08 10:16:16 +00:00
SDL emscripten port: preventDefault should not be called on mousedown. Otherwise mouseup will not be fired outside iframe in Chrome-based browsers
This commit is contained in:
parent
0eea92c8fc
commit
424bc4bcf7
|
@ -649,6 +649,7 @@ static EM_BOOL Emscripten_HandleMouseButton(int eventType, const EmscriptenMouse
|
||||||
Uint8 sdl_button_state;
|
Uint8 sdl_button_state;
|
||||||
SDL_EventType sdl_event_type;
|
SDL_EventType sdl_event_type;
|
||||||
double css_w, css_h;
|
double css_w, css_h;
|
||||||
|
SDL_bool prevent_default = SDL_FALSE; /* needed for iframe implementation in Chrome-based browsers. */
|
||||||
|
|
||||||
switch (mouseEvent->button) {
|
switch (mouseEvent->button) {
|
||||||
case 0:
|
case 0:
|
||||||
|
@ -673,6 +674,7 @@ static EM_BOOL Emscripten_HandleMouseButton(int eventType, const EmscriptenMouse
|
||||||
} else {
|
} else {
|
||||||
sdl_button_state = SDL_RELEASED;
|
sdl_button_state = SDL_RELEASED;
|
||||||
sdl_event_type = SDL_MOUSEBUTTONUP;
|
sdl_event_type = SDL_MOUSEBUTTONUP;
|
||||||
|
prevent_default = SDL_GetEventState(sdl_event_type) == SDL_ENABLE;
|
||||||
}
|
}
|
||||||
SDL_SendMouseButton(window_data->window, 0, sdl_button_state, sdl_button);
|
SDL_SendMouseButton(window_data->window, 0, sdl_button_state, sdl_button);
|
||||||
|
|
||||||
|
@ -683,7 +685,7 @@ static EM_BOOL Emscripten_HandleMouseButton(int eventType, const EmscriptenMouse
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
return SDL_GetEventState(sdl_event_type) == SDL_ENABLE;
|
return prevent_default;
|
||||||
}
|
}
|
||||||
|
|
||||||
static EM_BOOL Emscripten_HandleMouseFocus(int eventType, const EmscriptenMouseEvent *mouseEvent, void *userData)
|
static EM_BOOL Emscripten_HandleMouseFocus(int eventType, const EmscriptenMouseEvent *mouseEvent, void *userData)
|
||||||
|
|
Loading…
Reference in a new issue