Windows rearranged after exiting fullscreen in Windows

I posted about this previously, with no response. I’ve since come up with
a very simple test program that illustrates the problem.

The following code creates a window and then flips the screen every 10ms.
Switching to fullscreen mode and back to windowed (by pressing the 'f’
key) shows that all windows one the desktop move a certain amount.
Repeatedly doing this keeps moving the windows until they’re forced to the
lower-right area of the screen.

Can anyone describe what’s going on here?--------------------------------------------------------
#include <stdio.h>
#include <stdlib.h>

#include <SDL.h>

static SDL_Surface* screen;
static int state;

void toggleScreen()
{
Uint32 flags = SDL_SWSURFACE;
if(state) flags |= SDL_FULLSCREEN;

screen =SDL_SetVideoMode(640,480,32,flags);
if ( screen == NULL )
{
printf(“Unable to set 640x480 video: %s\n”, SDL_GetError());
exit(1);
}
state = !state;
}

int main(int argc, char *argv[])
{
if ( SDL_Init(SDL_INIT_AUDIO|SDL_INIT_VIDEO) < 0 )
{
printf(“Unable to init SDL: %s\n”, SDL_GetError());
exit(1);
}
atexit(SDL_Quit);

state = 0;
toggleScreen();

int done=0;
while(done == 0)
{
SDL_Event event;

while ( SDL_PollEvent(&event) )
{
  if ( event.type == SDL_QUIT )  {  done = 1;  }
  if ( event.type == SDL_KEYDOWN )
  {
    if ( event.key.keysym.sym == SDLK_ESCAPE ) { done = 1; }
    if ( event.key.keysym.sym == SDLK_f ) { toggleScreen(); }
  }
}

SDL_Delay(10);
SDL_Flip(screen);

}

return 0;
}

The windows don’t move on my system (CentOS 4.8). I switched back and forth
about a dozen times or more. How many times do you switch before movement
becomes noticeable? FWIW, it does seem to take several seconds for each
switch to complete.

JeffOn Sunday 30 January 2011 16:54, Stephen Anthony wrote:

I posted about this previously, with no response. I’ve since come up with
a very simple test program that illustrates the problem.

The following code creates a window and then flips the screen every 10ms.
Switching to fullscreen mode and back to windowed (by pressing the 'f’
key) shows that all windows one the desktop move a certain amount.
Repeatedly doing this keeps moving the windows until they’re forced to the
lower-right area of the screen.

Can anyone describe what’s going on here?

Sorry, I forgot to specify that this is for Windows only. I’ve tested in
many versions, and it happens in all of them (98, 2000, XP, Vista, 7). It
does not happen in any version of Linux I’ve tested, or in OSX either.

You can normally see it after one switch, but always after the second and
subsequent switches.

Thanks for the response,
SteveOn January 30, 2011 10:09:41 PM Jeff Post wrote:

On Sunday 30 January 2011 16:54, Stephen Anthony wrote:

I posted about this previously, with no response. I’ve since come up
with a very simple test program that illustrates the problem.

The following code creates a window and then flips the screen every
10ms. Switching to fullscreen mode and back to windowed (by pressing
the ‘f’ key) shows that all windows one the desktop move a certain
amount. Repeatedly doing this keeps moving the windows until they’re
forced to the lower-right area of the screen.

Can anyone describe what’s going on here?

The windows don’t move on my system (CentOS 4.8). I switched back and
forth about a dozen times or more. How many times do you switch before
movement becomes noticeable? FWIW, it does seem to take several
seconds for each switch to complete.

Do you have “Auto Arrange” on for your desktop Icons? Window will move them
around after a mode change if you have that set.> ----- Original Message -----

From: sdl-bounces@lists.libsdl.org [mailto:sdl-bounces at lists.libsdl.org] On
Behalf Of Stephen Anthony
Sent: Sunday, January 30, 2011 7:46 PM
To: SDL Development List
Subject: Re: [SDL] Windows rearranged after exiting fullscreen in Windows

On January 30, 2011 10:09:41 PM Jeff Post wrote:

On Sunday 30 January 2011 16:54, Stephen Anthony wrote:

I posted about this previously, with no response. I’ve since come up
with a very simple test program that illustrates the problem.

The following code creates a window and then flips the screen every
10ms. Switching to fullscreen mode and back to windowed (by pressing
the ‘f’ key) shows that all windows one the desktop move a certain
amount. Repeatedly doing this keeps moving the windows until they’re
forced to the lower-right area of the screen.

Can anyone describe what’s going on here?

The windows don’t move on my system (CentOS 4.8). I switched back and
forth about a dozen times or more. How many times do you switch before
movement becomes noticeable? FWIW, it does seem to take several
seconds for each switch to complete.

Sorry, I forgot to specify that this is for Windows only. I’ve tested in
many versions, and it happens in all of them (98, 2000, XP, Vista, 7). It
does not happen in any version of Linux I’ve tested, or in OSX either.

You can normally see it after one switch, but always after the second and
subsequent switches.

Thanks for the response,
Steve


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org

Do you have “Auto Arrange” on for your desktop Icons? Window will move
them around after a mode change if you have that set.

“Auto Arrange” is not enabled, and the icons do not move around. It’s the
windows themselves that are moving, being pushed to the bottom-right area
of the desktop.

SteveOn January 30, 2011 10:24:43 PM Ken Rogoway wrote:

-----Original Message-----
From: sdl-bounces at lists.libsdl.org
[mailto:sdl-bounces at lists.libsdl.org] On Behalf Of Stephen Anthony
Sent: Sunday, January 30, 2011 7:46 PM
To: SDL Development List
Subject: Re: [SDL] Windows rearranged after exiting fullscreen in
Windows

On January 30, 2011 10:09:41 PM Jeff Post wrote:

On Sunday 30 January 2011 16:54, Stephen Anthony wrote:

I posted about this previously, with no response. I’ve since come
up with a very simple test program that illustrates the problem.

The following code creates a window and then flips the screen every
10ms. Switching to fullscreen mode and back to windowed (by
pressing the ‘f’ key) shows that all windows one the desktop move
a certain amount. Repeatedly doing this keeps moving the windows
until they’re forced to the lower-right area of the screen.

Can anyone describe what’s going on here?

The windows don’t move on my system (CentOS 4.8). I switched back and
forth about a dozen times or more. How many times do you switch
before movement becomes noticeable? FWIW, it does seem to take
several seconds for each switch to complete.

Sorry, I forgot to specify that this is for Windows only. I’ve tested
in many versions, and it happens in all of them (98, 2000, XP, Vista,
7). It does not happen in any version of Linux I’ve tested, or in
OSX either.

You can normally see it after one switch, but always after the second
and subsequent switches.

Thanks for the response,
Steve


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org

This appears to be a common problem that happens with some mode switching
code. Apparently the mode switching code that is generated with the DirectX
8.1 AppWizard works correctly.

Sam, maybe we should look into handling this the same way for DX
implemenatiations.

http://www.gamedev.net/topic/132446-mode-change-moves-windows/> ----- Original Message -----

From: sdl-bounces@lists.libsdl.org [mailto:sdl-bounces at lists.libsdl.org] On
Behalf Of Stephen Anthony
Sent: Sunday, January 30, 2011 8:01 PM
To: SDL Development List
Subject: Re: [SDL] Windows rearranged after exiting fullscreen in Windows

On January 30, 2011 10:24:43 PM Ken Rogoway wrote:

Do you have “Auto Arrange” on for your desktop Icons? Window will move
them around after a mode change if you have that set.

“Auto Arrange” is not enabled, and the icons do not move around. It’s the
windows themselves that are moving, being pushed to the bottom-right area
of the desktop.

Steve

-----Original Message-----
From: sdl-bounces at lists.libsdl.org
[mailto:sdl-bounces at lists.libsdl.org] On Behalf Of Stephen Anthony
Sent: Sunday, January 30, 2011 7:46 PM
To: SDL Development List
Subject: Re: [SDL] Windows rearranged after exiting fullscreen in
Windows

On January 30, 2011 10:09:41 PM Jeff Post wrote:

On Sunday 30 January 2011 16:54, Stephen Anthony wrote:

I posted about this previously, with no response. I’ve since come
up with a very simple test program that illustrates the problem.

The following code creates a window and then flips the screen every
10ms. Switching to fullscreen mode and back to windowed (by
pressing the ‘f’ key) shows that all windows one the desktop move
a certain amount. Repeatedly doing this keeps moving the windows
until they’re forced to the lower-right area of the screen.

Can anyone describe what’s going on here?

The windows don’t move on my system (CentOS 4.8). I switched back and
forth about a dozen times or more. How many times do you switch
before movement becomes noticeable? FWIW, it does seem to take
several seconds for each switch to complete.

Sorry, I forgot to specify that this is for Windows only. I’ve tested
in many versions, and it happens in all of them (98, 2000, XP, Vista,
7). It does not happen in any version of Linux I’ve tested, or in
OSX either.

You can normally see it after one switch, but always after the second
and subsequent switches.

Thanks for the response,
Steve


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org

This appears to be a common problem that happens with some mode
switching code. Apparently the mode switching code that is generated
with the DirectX 8.1 AppWizard works correctly.

Sam, maybe we should look into handling this the same way for DX
implemenatiations.

http://www.gamedev.net/topic/132446-mode-change-moves-windows/

Thanks, this is the closest yet that I’ve come to an understanding (and
possible fix) for this problem.

I would be willing to modify SDL and ship a modified DLL with my
application, seeing how it’s a Windows-only issue and SDL 1.2 won’t be
getting any new releases. Do you have some advice on how to proceed, and
where to get the code generated by the “DirectX 8.1 AppWizard”?

Thanks,
SteveOn January 30, 2011 10:45:32 PM Ken Rogoway wrote:

-----Original Message-----
From: sdl-bounces at lists.libsdl.org
[mailto:sdl-bounces at lists.libsdl.org] On Behalf Of Stephen Anthony
Sent: Sunday, January 30, 2011 8:01 PM
To: SDL Development List
Subject: Re: [SDL] Windows rearranged after exiting fullscreen in
Windows

On January 30, 2011 10:24:43 PM Ken Rogoway wrote:

Do you have “Auto Arrange” on for your desktop Icons? Window will
move them around after a mode change if you have that set.

“Auto Arrange” is not enabled, and the icons do not move around. It’s
the windows themselves that are moving, being pushed to the
bottom-right area of the desktop.

Steve

-----Original Message-----
From: sdl-bounces at lists.libsdl.org
[mailto:sdl-bounces at lists.libsdl.org] On Behalf Of Stephen Anthony
Sent: Sunday, January 30, 2011 7:46 PM
To: SDL Development List
Subject: Re: [SDL] Windows rearranged after exiting fullscreen in
Windows

On January 30, 2011 10:09:41 PM Jeff Post wrote:

On Sunday 30 January 2011 16:54, Stephen Anthony wrote:

I posted about this previously, with no response. I’ve since
come up with a very simple test program that illustrates the
problem.

The following code creates a window and then flips the screen
every 10ms. Switching to fullscreen mode and back to windowed
(by pressing the ‘f’ key) shows that all windows one the desktop
move a certain amount. Repeatedly doing this keeps moving the
windows until they’re forced to the lower-right area of the
screen.

Can anyone describe what’s going on here?

The windows don’t move on my system (CentOS 4.8). I switched back
and forth about a dozen times or more. How many times do you
switch before movement becomes noticeable? FWIW, it does seem to
take several seconds for each switch to complete.

Sorry, I forgot to specify that this is for Windows only. I’ve
tested in many versions, and it happens in all of them (98, 2000,
XP, Vista, 7). It does not happen in any version of Linux I’ve
tested, or in OSX either.

You can normally see it after one switch, but always after the second
and subsequent switches.

Thanks for the response,
Steve


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org

I believe in the link I provided the person with the info on the fix emailed
it to the poster that requested a solution. Perhaps you can get them to
email I to you too.

As for a fix, if you are using SDL 1.3 then you can send Sam a patch file
and he will check it into the repository. If you are using SDL 1.2 then you
will have to do what you suggested and just modify your local version of SDL
1.2.14 since it is no longer getting any fixes.

Ken> ----- Original Message -----

From: sdl-bounces@lists.libsdl.org [mailto:sdl-bounces at lists.libsdl.org] On
Behalf Of Stephen Anthony
Sent: Sunday, January 30, 2011 8:45 PM
To: SDL Development List
Subject: Re: [SDL] Windows rearranged after exiting fullscreen in Windows

On January 30, 2011 10:45:32 PM Ken Rogoway wrote:

This appears to be a common problem that happens with some mode
switching code. Apparently the mode switching code that is generated
with the DirectX 8.1 AppWizard works correctly.

Sam, maybe we should look into handling this the same way for DX
implemenatiations.

http://www.gamedev.net/topic/132446-mode-change-moves-windows/

Thanks, this is the closest yet that I’ve come to an understanding (and
possible fix) for this problem.

I would be willing to modify SDL and ship a modified DLL with my
application, seeing how it’s a Windows-only issue and SDL 1.2 won’t be
getting any new releases. Do you have some advice on how to proceed, and
where to get the code generated by the “DirectX 8.1 AppWizard”?

Thanks,
Steve

-----Original Message-----
From: sdl-bounces at lists.libsdl.org
[mailto:sdl-bounces at lists.libsdl.org] On Behalf Of Stephen Anthony
Sent: Sunday, January 30, 2011 8:01 PM
To: SDL Development List
Subject: Re: [SDL] Windows rearranged after exiting fullscreen in
Windows

On January 30, 2011 10:24:43 PM Ken Rogoway wrote:

Do you have “Auto Arrange” on for your desktop Icons? Window will
move them around after a mode change if you have that set.

“Auto Arrange” is not enabled, and the icons do not move around. It’s
the windows themselves that are moving, being pushed to the
bottom-right area of the desktop.

Steve

-----Original Message-----
From: sdl-bounces at lists.libsdl.org
[mailto:sdl-bounces at lists.libsdl.org] On Behalf Of Stephen Anthony
Sent: Sunday, January 30, 2011 7:46 PM
To: SDL Development List
Subject: Re: [SDL] Windows rearranged after exiting fullscreen in
Windows

On January 30, 2011 10:09:41 PM Jeff Post wrote:

On Sunday 30 January 2011 16:54, Stephen Anthony wrote:

I posted about this previously, with no response. I’ve since
come up with a very simple test program that illustrates the
problem.

The following code creates a window and then flips the screen
every 10ms. Switching to fullscreen mode and back to windowed
(by pressing the ‘f’ key) shows that all windows one the desktop
move a certain amount. Repeatedly doing this keeps moving the
windows until they’re forced to the lower-right area of the
screen.

Can anyone describe what’s going on here?

The windows don’t move on my system (CentOS 4.8). I switched back
and forth about a dozen times or more. How many times do you
switch before movement becomes noticeable? FWIW, it does seem to
take several seconds for each switch to complete.

Sorry, I forgot to specify that this is for Windows only. I’ve
tested in many versions, and it happens in all of them (98, 2000,
XP, Vista, 7). It does not happen in any version of Linux I’ve
tested, or in OSX either.

You can normally see it after one switch, but always after the second
and subsequent switches.

Thanks for the response,
Steve


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org

OK, I can try contacting the person in the thread, but seeing how it was
posted in 2003, I don’t expect to get very far :slight_smile:

Beyond that, I’ll have to try to duplicate what they’re talking about, and
modify SDL 1.2.14 myself.

Thanks for the info,
SteveOn January 30, 2011 11:24:20 PM Ken Rogoway wrote:

I believe in the link I provided the person with the info on the fix
emailed it to the poster that requested a solution. Perhaps you can
get them to email I to you too.

As for a fix, if you are using SDL 1.3 then you can send Sam a patch
file and he will check it into the repository. If you are using SDL
1.2 then you will have to do what you suggested and just modify your
local version of SDL 1.2.14 since it is no longer getting any fixes.

Ken

I can test the DX version I have and see if it works properly. If it does I
can point you to the solution.> ----- Original Message -----

From: sdl-bounces@lists.libsdl.org [mailto:sdl-bounces at lists.libsdl.org] On
Behalf Of Stephen Anthony
Sent: Sunday, January 30, 2011 9:01 PM
To: SDL Development List
Subject: Re: [SDL] Windows rearranged after exiting fullscreen in Windows

On January 30, 2011 11:24:20 PM Ken Rogoway wrote:

I believe in the link I provided the person with the info on the fix
emailed it to the poster that requested a solution. Perhaps you can
get them to email I to you too.

As for a fix, if you are using SDL 1.3 then you can send Sam a patch
file and he will check it into the repository. If you are using SDL
1.2 then you will have to do what you suggested and just modify your
local version of SDL 1.2.14 since it is no longer getting any fixes.

Ken

OK, I can try contacting the person in the thread, but seeing how it was
posted in 2003, I don’t expect to get very far :slight_smile:

Beyond that, I’ll have to try to duplicate what they’re talking about, and
modify SDL 1.2.14 myself.

Thanks for the info,
Steve


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org

I’ve tested the SimpleSample10 that comes with the DirectX SDK and it looks
like it handles the mode toggle properly. I’ve sent the files to you at
your email address with my notes in the email. Hope that helps.

Ken> ----- Original Message -----

From: sdl-bounces@lists.libsdl.org [mailto:sdl-bounces at lists.libsdl.org] On
Behalf Of Stephen Anthony
Sent: Sunday, January 30, 2011 9:01 PM
To: SDL Development List
Subject: Re: [SDL] Windows rearranged after exiting fullscreen in Windows

On January 30, 2011 11:24:20 PM Ken Rogoway wrote:

I believe in the link I provided the person with the info on the fix
emailed it to the poster that requested a solution. Perhaps you can
get them to email I to you too.

As for a fix, if you are using SDL 1.3 then you can send Sam a patch
file and he will check it into the repository. If you are using SDL
1.2 then you will have to do what you suggested and just modify your
local version of SDL 1.2.14 since it is no longer getting any fixes.

Ken

OK, I can try contacting the person in the thread, but seeing how it was
posted in 2003, I don’t expect to get very far :slight_smile:

Beyond that, I’ll have to try to duplicate what they’re talking about, and
modify SDL 1.2.14 myself.

Thanks for the info,
Steve


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org