mirror of
https://github.com/libsdl-org/SDL.git
synced 2026-04-10 02:43:37 +02:00
emscripten: Unify creation of Module['SDL3'] in at SDL_Init time.
(cherry picked from commit 7d093940a7)
This commit is contained in:
@@ -957,9 +957,6 @@ EMSCRIPTEN_KEEPALIVE void Emscripten_HandlePointerGeneric(SDL_WindowData *window
|
||||
static void Emscripten_prep_pointer_event_callbacks(void)
|
||||
{
|
||||
MAIN_THREAD_EM_ASM({
|
||||
if (typeof(Module['SDL3']) === 'undefined') {
|
||||
Module['SDL3'] = {};
|
||||
}
|
||||
var SDL3 = Module['SDL3'];
|
||||
|
||||
if (SDL3.makePointerEventCStruct === undefined) {
|
||||
@@ -1166,10 +1163,6 @@ static void Emscripten_set_drag_event_callbacks(SDL_WindowData *data)
|
||||
var target = document.querySelector(UTF8ToString($1));
|
||||
if (target) {
|
||||
var data = $0;
|
||||
|
||||
if (typeof(Module['SDL3']) === 'undefined') {
|
||||
Module['SDL3'] = {};
|
||||
}
|
||||
var SDL3 = Module['SDL3'];
|
||||
|
||||
var makeDropEventCStruct = function(event) {
|
||||
|
||||
@@ -75,7 +75,6 @@ bool Emscripten_UpdateWindowFramebuffer(SDL_VideoDevice *_this, SDL_Window *wind
|
||||
var canvas = document.querySelector(canvasId);
|
||||
|
||||
//TODO: this should store a context per canvas
|
||||
if (!Module['SDL3']) Module['SDL3'] = {};
|
||||
var SDL3 = Module['SDL3'];
|
||||
if (SDL3.ctxCanvas !== canvas) {
|
||||
SDL3.ctx = Browser.createContext(canvas, false, true);
|
||||
|
||||
@@ -228,9 +228,6 @@ void Emscripten_InitMouse(void)
|
||||
|
||||
// Add event listeners to track mouse events on the document
|
||||
MAIN_THREAD_EM_ASM({
|
||||
if (!Module['SDL3']) {
|
||||
Module['SDL3'] = {};
|
||||
}
|
||||
var SDL3 = Module['SDL3'];
|
||||
SDL3['mouse_x'] = 0;
|
||||
SDL3['mouse_y'] = 0;
|
||||
|
||||
@@ -101,10 +101,6 @@ static void Emscripten_ListenSystemTheme(void)
|
||||
{
|
||||
MAIN_THREAD_EM_ASM({
|
||||
if (window.matchMedia) {
|
||||
if (typeof(Module['SDL3']) === 'undefined') {
|
||||
Module['SDL3'] = {};
|
||||
}
|
||||
|
||||
var SDL3 = Module['SDL3'];
|
||||
|
||||
SDL3.eventHandlerThemeChanged = function(event) {
|
||||
|
||||
Reference in New Issue
Block a user