diff options
author | Sylvain Becker <sylvain.becker@gmail.com> | 2019-01-09 22:49:49 +0100 |
---|---|---|
committer | Sylvain Becker <sylvain.becker@gmail.com> | 2019-01-09 22:49:49 +0100 |
commit | 1e345acfd8f32dfec9e3785031fe4d8178251462 (patch) | |
tree | fc0db64ddc0a3df3cc8ba8360572ceb333cd3cd2 | |
parent | 57a9b45ad56947bd42c3cd11b60a7819060fff44 (diff) |
Android: add some SetError for Android_SetWindowFullscreen
First error could happen if Android_SetWindowFullscreen somehow gets
called between SurfaceDestroyed() and SurfaceCreated()
Second error should not happen has native_window validity is guaranteed.
(It would happens previously with error -19)
-rw-r--r-- | src/video/android/SDL_androidwindow.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/src/video/android/SDL_androidwindow.c b/src/video/android/SDL_androidwindow.c index 57731d39c8..638eef3c84 100644 --- a/src/video/android/SDL_androidwindow.c +++ b/src/video/android/SDL_androidwindow.c @@ -138,6 +138,9 @@ Android_SetWindowFullscreen(_THIS, SDL_Window *window, SDL_VideoDisplay *display SDL_WindowData *data = (SDL_WindowData *)window->driverdata; if (!data || !data->native_window) { + if (data && !data->native_window) { + SDL_SetError("Missing native window"); + } goto endfunction; } @@ -147,6 +150,10 @@ Android_SetWindowFullscreen(_THIS, SDL_Window *window, SDL_VideoDisplay *display int new_w = ANativeWindow_getWidth(data->native_window); int new_h = ANativeWindow_getHeight(data->native_window); + if (new_w < 0 || new_h < 0) { + SDL_SetError("ANativeWindow_getWidth/Height() fails"); + } + if (old_w != new_w || old_h != new_h) { SDL_SendWindowEvent(window, SDL_WINDOWEVENT_RESIZED, new_w, new_h); } |