changeset 5283:a3bfe8657cde

merged
author Eric Wing <ewing . public |-at-| gmail . com>
date Sat, 12 Feb 2011 21:34:36 -0800
parents 15a71bec4a55 (current diff) 8e421890cdb8 (diff)
children 96a22141cf86
files
diffstat 8 files changed, 16 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/include/SDL_video.h	Sat Feb 12 19:16:09 2011 -0800
+++ b/include/SDL_video.h	Sat Feb 12 21:34:36 2011 -0800
@@ -140,7 +140,8 @@
                                          redrawn */
     SDL_WINDOWEVENT_MOVED,          /**< Window has been moved to data1, data2 
                                      */
-    SDL_WINDOWEVENT_RESIZED,        /**< Window size changed to data1xdata2 */
+    SDL_WINDOWEVENT_RESIZED,        /**< Window has been resized to data1xdata2 */
+    SDL_WINDOWEVENT_SIZE_CHANGED,   /**< The window size has changed, either as a result of an API call or through the system or user changing the window size. */
     SDL_WINDOWEVENT_MINIMIZED,      /**< Window has been minimized */
     SDL_WINDOWEVENT_MAXIMIZED,      /**< Window has been maximized */
     SDL_WINDOWEVENT_RESTORED,       /**< Window has been restored to normal size
--- a/src/events/SDL_windowevents.c	Sat Feb 12 19:16:09 2011 -0800
+++ b/src/events/SDL_windowevents.c	Sat Feb 12 21:34:36 2011 -0800
@@ -35,7 +35,8 @@
     SDL_Event *new_event = (SDL_Event *)userdata;
 
     if (event->type == SDL_WINDOWEVENT &&
-        event->window.event == SDL_WINDOWEVENT_RESIZED &&
+        (event->window.event == SDL_WINDOWEVENT_RESIZED ||
+         event->window.event == SDL_WINDOWEVENT_SIZE_CHANGED) &&
         event->window.windowID == new_event->window.windowID) {
         /* We're about to post a new size event, drop the old one */
         return 0;
--- a/src/render/opengl/SDL_render_gl.c	Sat Feb 12 19:16:09 2011 -0800
+++ b/src/render/opengl/SDL_render_gl.c	Sat Feb 12 21:34:36 2011 -0800
@@ -348,7 +348,7 @@
 {
     GL_RenderData *data = (GL_RenderData *) renderer->driverdata;
 
-    if (event->event == SDL_WINDOWEVENT_RESIZED) {
+    if (event->event == SDL_WINDOWEVENT_SIZE_CHANGED) {
         /* Rebind the context to the window area and update matrices */
         SDL_CurrentContext = NULL;
         data->updateSize = SDL_TRUE;
--- a/src/render/opengles/SDL_render_gles.c	Sat Feb 12 19:16:09 2011 -0800
+++ b/src/render/opengles/SDL_render_gles.c	Sat Feb 12 21:34:36 2011 -0800
@@ -261,7 +261,7 @@
 {
     GLES_RenderData *data = (GLES_RenderData *) renderer->driverdata;
 
-    if (event->event == SDL_WINDOWEVENT_RESIZED) {
+    if (event->event == SDL_WINDOWEVENT_SIZE_CHANGED) {
         /* Rebind the context to the window area and update matrices */
         SDL_CurrentContext = NULL;
         data->updateSize = SDL_TRUE;
--- a/src/render/opengles2/SDL_render_gles2.c	Sat Feb 12 19:16:09 2011 -0800
+++ b/src/render/opengles2/SDL_render_gles2.c	Sat Feb 12 21:34:36 2011 -0800
@@ -170,7 +170,7 @@
 {
     GLES2_DriverContext *rdata = (GLES2_DriverContext *)renderer->driverdata;
 
-    if (event->event == SDL_WINDOWEVENT_RESIZED) {
+    if (event->event == SDL_WINDOWEVENT_SIZE_CHANGED) {
         /* Rebind the context to the window area */
         SDL_CurrentContext = NULL;
         rdata->updateSize = SDL_TRUE;
--- a/src/render/software/SDL_render_sw.c	Sat Feb 12 19:16:09 2011 -0800
+++ b/src/render/software/SDL_render_sw.c	Sat Feb 12 21:34:36 2011 -0800
@@ -173,7 +173,7 @@
 {
     SW_RenderData *data = (SW_RenderData *) renderer->driverdata;
 
-    if (event->event == SDL_WINDOWEVENT_RESIZED) {
+    if (event->event == SDL_WINDOWEVENT_SIZE_CHANGED) {
         data->updateSize = SDL_TRUE;
     }
 }
--- a/src/video/SDL_video.c	Sat Feb 12 19:16:09 2011 -0800
+++ b/src/video/SDL_video.c	Sat Feb 12 21:34:36 2011 -0800
@@ -1431,10 +1431,15 @@
 
     /* FIXME: Should this change fullscreen modes? */
     if (!(window->flags & SDL_WINDOW_FULLSCREEN)) {
+        window->w = w;
+        window->h = h;
         if (_this->SetWindowSize) {
             _this->SetWindowSize(_this, window);
         }
-        SDL_SendWindowEvent(window, SDL_WINDOWEVENT_RESIZED, w, h);
+        if (window->w == w && window->h == h) {
+            /* We didn't get a SDL_WINDOWEVENT_RESIZED event (by design) */
+            SDL_OnWindowResized(window);
+        }
     }
 }
 
@@ -1706,6 +1711,7 @@
 SDL_OnWindowResized(SDL_Window * window)
 {
     window->surface_valid = SDL_FALSE;
+    SDL_SendWindowEvent(window, SDL_WINDOWEVENT_SIZE_CHANGED, window->w, window->h);
 }
 
 void
--- a/src/video/directfb/SDL_DirectFB_render.c	Sat Feb 12 19:16:09 2011 -0800
+++ b/src/video/directfb/SDL_DirectFB_render.c	Sat Feb 12 21:34:36 2011 -0800
@@ -279,7 +279,7 @@
 {
     SDL_DFB_RENDERERDATA(renderer);
 
-    if (event->event == SDL_WINDOWEVENT_RESIZED) {
+    if (event->event == SDL_WINDOWEVENT_SIZE_CHANGED) {
         /* Rebind the context to the window area and update matrices */
         //SDL_CurrentContext = NULL;
         //data->updateSize = SDL_TRUE;