diff options
| -rw-r--r-- | backends/platform/android/events.cpp | 36 | ||||
| -rw-r--r-- | backends/platform/android/gfx.cpp | 8 | 
2 files changed, 15 insertions, 29 deletions
diff --git a/backends/platform/android/events.cpp b/backends/platform/android/events.cpp index 2576287a83..ccb18dde89 100644 --- a/backends/platform/android/events.cpp +++ b/backends/platform/android/events.cpp @@ -696,35 +696,19 @@ bool OSystem_Android::pollEvent(Common::Event &event) {  	if (pthread_self() == _main_thread) {  		if (_screen_changeid != JNI::surface_changeid) {  			if (JNI::egl_surface_width > 0 && JNI::egl_surface_height > 0) { -				if (_egl_surface_width > 0 && _egl_surface_height > 0) { -					// surface still alive but changed -					_screen_changeid = JNI::surface_changeid; -					_egl_surface_width = JNI::egl_surface_width; -					_egl_surface_height = JNI::egl_surface_height; +				// surface changed +				JNI::deinitSurface(); +				initSurface(); +				initViewport(); +				updateScreenRect(); +				updateEventScale(); -					initViewport(); -					updateScreenRect(); -					updateEventScale(); +				// double buffered, flip twice +				clearScreen(kClearUpdate, 2); -					// double buffered, flip twice -					clearScreen(kClearUpdate, 2); +				event.type = Common::EVENT_SCREEN_CHANGED; -					event.type = Common::EVENT_SCREEN_CHANGED; - -					return true; -				} else { -					// new surface -					initSurface(); -					updateScreenRect(); -					updateEventScale(); - -					// double buffered, flip twice -					clearScreen(kClearUpdate, 2); - -					event.type = Common::EVENT_SCREEN_CHANGED; - -					return true; -				} +				return true;  			} else {  				// surface lost  				deinitSurface(); diff --git a/backends/platform/android/gfx.cpp b/backends/platform/android/gfx.cpp index ab7240e648..b2f5427f01 100644 --- a/backends/platform/android/gfx.cpp +++ b/backends/platform/android/gfx.cpp @@ -235,8 +235,10 @@ void OSystem_Android::initViewport() {  }  void OSystem_Android::initOverlay() { -	int overlay_width = _egl_surface_width; -	int overlay_height = _egl_surface_height; +	// minimum of 320x200 +	// (surface can get smaller when opening the virtual keyboard on *QVGA*) +	int overlay_width = MAX(_egl_surface_width, 320); +	int overlay_height = MAX(_egl_surface_height, 200);  	// the 'normal' theme layout uses a max height of 400 pixels. if the  	// surface is too big we use only a quarter of the size so that the widgets @@ -244,7 +246,7 @@ void OSystem_Android::initOverlay() {  	// enforces the 'lowres' layout, which will be scaled back up by factor 2x,  	// but this looks way better than the 'normal' layout scaled by some  	// calculated factors -	if (overlay_height > 480) { +	while (overlay_height > 480) {  		overlay_width /= 2;  		overlay_height /= 2;  	}  | 
