Android: add some SetError for Android_SetWindowFullscreen
authorSylvain Becker <sylvain.becker@gmail.com>
Wed, 09 Jan 2019 22:49:49 +0100
changeset 125148034efde00c5
parent 12513 efddb8c5e161
child 12515 5cd74fbb01d7
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)
src/video/android/SDL_androidwindow.c
     1.1 --- a/src/video/android/SDL_androidwindow.c	Wed Jan 09 22:41:52 2019 +0100
     1.2 +++ b/src/video/android/SDL_androidwindow.c	Wed Jan 09 22:49:49 2019 +0100
     1.3 @@ -138,6 +138,9 @@
     1.4          SDL_WindowData *data = (SDL_WindowData *)window->driverdata;
     1.5  
     1.6          if (!data || !data->native_window) {
     1.7 +            if (data && !data->native_window) {
     1.8 +                SDL_SetError("Missing native window");
     1.9 +            }
    1.10              goto endfunction;
    1.11          }
    1.12  
    1.13 @@ -147,6 +150,10 @@
    1.14          int new_w = ANativeWindow_getWidth(data->native_window);
    1.15          int new_h = ANativeWindow_getHeight(data->native_window);
    1.16  
    1.17 +        if (new_w < 0 || new_h < 0) {
    1.18 +            SDL_SetError("ANativeWindow_getWidth/Height() fails");
    1.19 +        }
    1.20 +
    1.21          if (old_w != new_w || old_h != new_h) {
    1.22              SDL_SendWindowEvent(window, SDL_WINDOWEVENT_RESIZED, new_w, new_h);
    1.23          }