# \[SDL2\]Strange behavior when switching from windowed to fullscreen

**URL:** <https://discourse.libsdl.org/t/sdl2-strange-behavior-when-switching-from-windowed-to-fullscreen/19445>\
**Category:** SDL Development\
**Created:** [March 14, 2013, 4:41pm UTC](https://discourse.libsdl.org/t/sdl2-strange-behavior-when-switching-from-windowed-to-fullscreen/19445 "2013-03-14T16:41:21Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Erick\_Sousa](https://discourse.libsdl.org/letter_avatar_proxy/v4/letter/e/9de053/32.png) [@Erick\_Sousa](https://discourse.libsdl.org/u/Erick_Sousa)\
**Post date:** [March 14, 2013, 4:41pm UTC](https://discourse.libsdl.org/t/sdl2-strange-behavior-when-switching-from-windowed-to-fullscreen/19445/1 "2013-03-14T16:41:21Z")

</div>

Hello everyone,

I’m not sure if this is intended or I’m misusing anything, but when I try  
to switch to fullscreen just after setting up the window and the renderer,  
I get a nice fullscreen window with the right scaling. If I switch to  
windowed mode and thereafter to fullscreen again, a non-scaled drawing  
region appears aligned to the center of the window. Again, by setting the  
window size(to the same values as before), the same pattern repeats. Over  
and over.

The window is created with 1024x768 and my desktop resolution is 1366x768.

Here’s my initialization code:

[http://pastebin.com/bWQcwrfv](http://pastebin.com/bWQcwrfv)

I’m on Ubuntu 12.04 LTS x64 using Unity 5.18.0.

Do I need to set the logical viewport after resizingswitching to fullscreen  
the window? The documentation says that the aspect ratio must be the same  
after resizing, otherwise the aforementioned centering will occur.

Thanks for your time,

Erick
