Skip to content
This repository has been archived by the owner. It is now read-only.
Permalink
Browse files

Fixed bug #1117

There's a new event that's always sent when the window changes size, and that event is what the renderers listen for to determine if they need to rebind their context.
  • Loading branch information
slouken committed Feb 13, 2011
1 parent 8d73f92 commit da42ee37cfd316c260665cf32499894d041f0693
@@ -140,7 +140,8 @@ typedef enum
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
@@ -35,7 +35,8 @@ RemovePendingSizeEvents(void * userdata, SDL_Event *event)
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;
@@ -348,7 +348,7 @@ GL_WindowEvent(SDL_Renderer * renderer, const SDL_WindowEvent *event)
{
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;
@@ -261,7 +261,7 @@ GLES_WindowEvent(SDL_Renderer * renderer, const SDL_WindowEvent *event)
{
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;
@@ -170,7 +170,7 @@ GLES2_WindowEvent(SDL_Renderer * renderer, const SDL_WindowEvent *event)
{
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;
@@ -173,7 +173,7 @@ SW_WindowEvent(SDL_Renderer * renderer, const SDL_WindowEvent *event)
{
SW_RenderData *data = (SW_RenderData *) renderer->driverdata;

if (event->event == SDL_WINDOWEVENT_RESIZED) {
if (event->event == SDL_WINDOWEVENT_SIZE_CHANGED) {
data->updateSize = SDL_TRUE;
}
}
@@ -1431,10 +1431,15 @@ SDL_SetWindowSize(SDL_Window * window, int w, int h)

/* 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 @@ void
SDL_OnWindowResized(SDL_Window * window)
{
window->surface_valid = SDL_FALSE;
SDL_SendWindowEvent(window, SDL_WINDOWEVENT_SIZE_CHANGED, window->w, window->h);
}

void
@@ -279,7 +279,7 @@ DirectFB_WindowEvent(SDL_Renderer * renderer, const SDL_WindowEvent *event)
{
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;

0 comments on commit da42ee3

Please sign in to comment.