src/video/android/SDL_androidwindow.c
changeset 12017 d8a165136edf
parent 12012 6de756c9975a
child 12255 d2e5d4520677
equal deleted inserted replaced
12016:f3d8b8456e7b 12017:d8a165136edf
    24 
    24 
    25 #include "SDL_syswm.h"
    25 #include "SDL_syswm.h"
    26 #include "../SDL_sysvideo.h"
    26 #include "../SDL_sysvideo.h"
    27 #include "../../events/SDL_keyboard_c.h"
    27 #include "../../events/SDL_keyboard_c.h"
    28 #include "../../events/SDL_mouse_c.h"
    28 #include "../../events/SDL_mouse_c.h"
       
    29 #include "../../events/SDL_windowevents_c.h"
    29 
    30 
    30 #include "SDL_androidvideo.h"
    31 #include "SDL_androidvideo.h"
    31 #include "SDL_androidwindow.h"
    32 #include "SDL_androidwindow.h"
    32 #include "SDL_hints.h"
    33 #include "SDL_hints.h"
    33 
    34 
    99 
   100 
   100 void
   101 void
   101 Android_SetWindowFullscreen(_THIS, SDL_Window * window, SDL_VideoDisplay * display, SDL_bool fullscreen)
   102 Android_SetWindowFullscreen(_THIS, SDL_Window * window, SDL_VideoDisplay * display, SDL_bool fullscreen)
   102 {
   103 {
   103     Android_JNI_SetWindowStyle(fullscreen);
   104     Android_JNI_SetWindowStyle(fullscreen);
       
   105 
       
   106     // Ensure our size matches reality after we've executed the window style change.
       
   107     //
       
   108     // It is possible that we've set width and height to the full-size display, but on
       
   109     // Samsung DeX or Chromebooks or other windowed Android environemtns, our window may 
       
   110     // still not be the full display size.
       
   111     //
       
   112     SDL_WindowData * data = (SDL_WindowData *)window->driverdata;
       
   113 
       
   114     if (!data || !data->native_window) {
       
   115         return;
       
   116     }
       
   117 
       
   118     int old_w = window->w;
       
   119     int old_h = window->h;
       
   120 
       
   121     int new_w = ANativeWindow_getWidth(data->native_window);
       
   122     int new_h = ANativeWindow_getHeight(data->native_window);
       
   123 
       
   124     if (old_w != new_w || old_h != new_h) {
       
   125         SDL_SendWindowEvent(window, SDL_WINDOWEVENT_RESIZED, new_w, new_h);
       
   126     }
   104 }
   127 }
   105 
   128 
   106 void
   129 void
   107 Android_DestroyWindow(_THIS, SDL_Window * window)
   130 Android_DestroyWindow(_THIS, SDL_Window * window)
   108 {
   131 {