From 6ac86b97604a6248e2e26d6bed1d046d0ff06709 Mon Sep 17 00:00:00 2001 From: Max Horn Date: Sat, 6 Sep 2003 20:21:54 +0000 Subject: added EVENT_SCREEN_CHANGED; small tweak to the way quit is handled in NewGui svn-id: r10047 --- backends/sdl/sdl-common.cpp | 9 ++++++++- backends/sdl/sdl-common.h | 1 + backends/sdl/sdl.cpp | 5 ++++- backends/sdl/sdl_gl.cpp | 5 ++++- 4 files changed, 17 insertions(+), 3 deletions(-) (limited to 'backends/sdl') diff --git a/backends/sdl/sdl-common.cpp b/backends/sdl/sdl-common.cpp index a6b1a785aa..1a453bb697 100644 --- a/backends/sdl/sdl-common.cpp +++ b/backends/sdl/sdl-common.cpp @@ -91,7 +91,7 @@ void OSystem_SDL_Common::set_timer(int timer, int (*callback)(int)) { OSystem_SDL_Common::OSystem_SDL_Common() : _screen(0), _screenWidth(0), _screenHeight(0), _tmpscreen(0), _tmpScreenWidth(0), _overlayVisible(false), - _cdrom(0), _dirty_checksums(0), + _cdrom(0), _modeChanged(false), _dirty_checksums(0), _mouseVisible(false), _mouseDrawn(false), _mouseData(0), _mouseHotspotX(0), _mouseHotspotY(0), _currentShakePos(0), _newShakePos(0), @@ -536,6 +536,13 @@ bool OSystem_SDL_Common::poll_event(Event *event) { byte b = 0; kbd_mouse(); + + // If the screen mode changed, send an EVENT_SCREEN_CHANGED + if (_modeChanged) { + _modeChanged = false; + event->event_code = EVENT_SCREEN_CHANGED; + return true; + } while(SDL_PollEvent(&ev)) { switch(ev.type) { diff --git a/backends/sdl/sdl-common.h b/backends/sdl/sdl-common.h index 9b378e8bb1..90586225d3 100644 --- a/backends/sdl/sdl-common.h +++ b/backends/sdl/sdl-common.h @@ -160,6 +160,7 @@ protected: int _mode; bool _full_screen; uint32 _mode_flags; + bool _modeChanged; enum { NUM_DIRTY_RECT = 100, diff --git a/backends/sdl/sdl.cpp b/backends/sdl/sdl.cpp index af2d30ad5a..b888bcf253 100644 --- a/backends/sdl/sdl.cpp +++ b/backends/sdl/sdl.cpp @@ -204,8 +204,11 @@ void OSystem_SDL::hotswap_gfx_mode() { free(old_tmpscreen->pixels); SDL_FreeSurface(old_tmpscreen); - // Finally, blit everything to the screen + // Blit everything to the screen update_screen(); + + // Make sure that an EVENT_SCREEN_CHANGED gets sent later + _modeChanged = true; } void OSystem_SDL::update_screen() { diff --git a/backends/sdl/sdl_gl.cpp b/backends/sdl/sdl_gl.cpp index 15e45c875c..5df8440713 100644 --- a/backends/sdl/sdl_gl.cpp +++ b/backends/sdl/sdl_gl.cpp @@ -343,8 +343,11 @@ void OSystem_SDL_OpenGL::hotswap_gfx_mode() { free(old_tmpscreen->pixels); SDL_FreeSurface(old_tmpscreen); - // Finally, blit everything to the screen + // Blit everything to the screen update_screen(); + + // Make sure that an EVENT_SCREEN_CHANGED gets sent later + _modeChanged = true; } void OSystem_SDL_OpenGL::update_screen() { -- cgit v1.2.3