From 9be4b666462e7fbab8714be939a9d2a3051d409b Mon Sep 17 00:00:00 2001 From: Alon Zakai Date: Mon, 23 Jun 2014 16:21:08 -0700 Subject: do not trigger SDL resize events from SDL_SetVideoMode --- src/library_sdl.js | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/src/library_sdl.js b/src/library_sdl.js index eaa2b5bb..9f483d62 100644 --- a/src/library_sdl.js +++ b/src/library_sdl.js @@ -1325,16 +1325,20 @@ var LibrarySDL = { if (!SDL.addedResizeListener) { SDL.addedResizeListener = true; Browser.resizeListeners.push(function(w, h) { - SDL.receiveEvent({ - type: 'resize', - w: w, - h: h - }); + if (!SDL.settingVideoMode) { + SDL.receiveEvent({ + type: 'resize', + w: w, + h: h + }); + } }); } if (width !== canvas.width || height !== canvas.height) { + SDL.settingVideoMode = true; // SetVideoMode itself should not trigger resize events Browser.setCanvasSize(width, height); + SDL.settingVideoMode = false; } // Free the old surface first if there is one -- cgit v1.2.3-18-g5258