Unable to receive resize event when doing maximize/restore on initial window size

Hi,

I've discovered a weird behaviour on win32. Given this simple
example:

---------------8<---------------------
#include “SDL.h”

int main(int argc, char **argv) {

SDL_Surface *pSurface = NULL;
SDL_Event event;
int done = 0;

SDL_Init(SDL_INIT_VIDEO);

atexit(SDL_Quit);

pSurface = SDL_SetVideoMode(512, 512, 0, SDL_RESIZABLE);

while(!done) {
	if (SDL_PollEvent(&event)) {
		switch (event.type) {
			case SDL_VIDEORESIZE:
				fprintf(stderr, "resized to %dx%d\n", event.resize.w, event.resize.h);
				break;
			case SDL_QUIT:
				done = 1;
				break;
		}
	}
}

return 0;

}
---------------8<---------------------

After starting up and Maximizing the window, the resize event
is fired. But after restoring the original size, there's no
resize event fired. If I maximize again, it's again fired.

After I manually resized the window from it's initial size
and then triggered Maximize/Restore there were no problems to
receive all resize events.

I've tested 1.2.4 binaries from libsdl.org and current SDL12
from CVS on linux (but was using remote X window on win32,
not local).

- Markus-- 

Please always Cc to me when replying to me on the lists.
GnuPG Key: http://guru.josefine.at/~mfischer/C2272BD0.asc
"Mind if I MFH ?" “What QA did you do on it?” “the usual?” “ah… none :)”

Hi,

Anyone here who can reproduce this, either Windows or Linux
with this sample script?

thx,

    - Markus

On Sun, May 05, 2002 at 12:27:19PM +0200, Markus Fischer wrote :

---------------8<---------------------
#include “SDL.h”

int main(int argc, char **argv) {

SDL_Surface *pSurface = NULL;
SDL_Event event;
int done = 0;

SDL_Init(SDL_INIT_VIDEO);

atexit(SDL_Quit);

pSurface = SDL_SetVideoMode(512, 512, 0, SDL_RESIZABLE);

while(!done) {
if (SDL_PollEvent(&event)) {
switch (event.type) {
case SDL_VIDEORESIZE:
fprintf(stderr, “resized to %dx%d\n”, event.resize.w, event.resize.h);
break;
case SDL_QUIT:
done = 1;
break;
}
}
}

return 0;
}
---------------8<---------------------
[…]–
Please always Cc to me when replying to me on the lists.
GnuPG Key: http://guru.josefine.at/~mfischer/C2272BD0.asc
"I’m not stupid, you know? :)" - Jani Taskinen

Hi,

Anyone here who can reproduce this, either Windows or Linux
with this sample script?

yes, my system does exactly the same thing (Windows).

But you haven’t examined the “test” applications.
Try running “testwm -resize” switch and doing a
maximize/restore.

If you examine the code you will see that you have a missing
function call:

case SDL_VIDEORESIZE:
fprintf(stderr, “resized to %dx%d\n”, event.resize.w, event.resize.h);
pSurface = SDL_SetVideoMode(event.resize.w, event.resize.h, 0,
SDL_RESIZABLE);
break;

This code generates the sequence of events you are looking for.

Also mentioned in the documentation for SDL_SetVideoMode (and I quote):

“”"
SDL_RESIZABLE:

Create a resizable window. When the window is resized by the user a
SDL_VIDEORESIZE event is generated and SDL_SetVideoMode can be called again
with the new size.
"""

Have fun!

cheers,
John.> ----- Original Message -----

From: mfischer@guru.josefine.at (Markus Fischer)
To:
Sent: Wednesday, May 08, 2002 7:05 PM
Subject: Re: [SDL] Unable to receive resize event when doing
maximize/restore on initial window size

Hi,

Anyone here who can reproduce this, either Windows or Linux
with this sample script?

thx,

    - Markus

On Sun, May 05, 2002 at 12:27:19PM +0200, Markus Fischer wrote :

---------------8<---------------------
#include “SDL.h”

int main(int argc, char **argv) {

SDL_Surface *pSurface = NULL;
SDL_Event event;
int done = 0;

SDL_Init(SDL_INIT_VIDEO);

atexit(SDL_Quit);

pSurface = SDL_SetVideoMode(512, 512, 0, SDL_RESIZABLE);

while(!done) {
if (SDL_PollEvent(&event)) {
switch (event.type) {
case SDL_VIDEORESIZE:
fprintf(stderr, “resized to %dx%d\n”, event.resize.w, event.resize.h);
break;
case SDL_QUIT:
done = 1;
break;
}
}
}

return 0;
}
---------------8<---------------------
[…]


Please always Cc to me when replying to me on the lists.
GnuPG Key: http://guru.josefine.at/~mfischer/C2272BD0.asc
"I’m not stupid, you know? :)" - Jani Taskinen


SDL mailing list
SDL at libsdl.org
http://www.libsdl.org/mailman/listinfo/sdl

Hi,

Yes this really fixed it. Feeling like an idiot now :)

thanks,

    - Markus

On Wed, May 08, 2002 at 08:37:29PM +0100, John Popplewell wrote :> Hi,

Anyone here who can reproduce this, either Windows or Linux
with this sample script?

yes, my system does exactly the same thing (Windows).

But you haven’t examined the “test” applications.
Try running “testwm -resize” switch and doing a
maximize/restore.

If you examine the code you will see that you have a missing
function call:

case SDL_VIDEORESIZE:
fprintf(stderr, “resized to %dx%d\n”, event.resize.w, event.resize.h);
pSurface = SDL_SetVideoMode(event.resize.w, event.resize.h, 0,
SDL_RESIZABLE);
break;

This code generates the sequence of events you are looking for.

Also mentioned in the documentation for SDL_SetVideoMode (and I quote):

“”"
SDL_RESIZABLE:

Create a resizable window. When the window is resized by the user a
SDL_VIDEORESIZE event is generated and SDL_SetVideoMode can be called again
with the new size.
"""

Have fun!

cheers,
John.

----- Original Message -----
From: “Markus Fischer” <@Markus_Fischer>
To:
Sent: Wednesday, May 08, 2002 7:05 PM
Subject: Re: [SDL] Unable to receive resize event when doing
maximize/restore on initial window size

Hi,

Anyone here who can reproduce this, either Windows or Linux
with this sample script?

thx,

    - Markus

On Sun, May 05, 2002 at 12:27:19PM +0200, Markus Fischer wrote :

---------------8<---------------------
#include “SDL.h”

int main(int argc, char **argv) {

SDL_Surface *pSurface = NULL;
SDL_Event event;
int done = 0;

SDL_Init(SDL_INIT_VIDEO);

atexit(SDL_Quit);

pSurface = SDL_SetVideoMode(512, 512, 0, SDL_RESIZABLE);

while(!done) {
if (SDL_PollEvent(&event)) {
switch (event.type) {
case SDL_VIDEORESIZE:
fprintf(stderr, “resized to %dx%d\n”, event.resize.w, event.resize.h);
break;
case SDL_QUIT:
done = 1;
break;
}
}
}

return 0;
}
---------------8<---------------------
[…]


Please always Cc to me when replying to me on the lists.
GnuPG Key: http://guru.josefine.at/~mfischer/C2272BD0.asc
"I’m not stupid, you know? :)" - Jani Taskinen


SDL mailing list
SDL at libsdl.org
http://www.libsdl.org/mailman/listinfo/sdl


SDL mailing list
SDL at libsdl.org
http://www.libsdl.org/mailman/listinfo/sdl


Please always Cc to me when replying to me on the lists.
GnuPG Key: http://guru.josefine.at/~mfischer/C2272BD0.asc
"I’m not stupid, you know? :)" - Jani Taskinen