# No updateting in Windowmode!

**URL:** <https://discourse.libsdl.org/t/no-updateting-in-windowmode/5601>\
**Category:** SDL Development\
**Created:** [December 12, 2001, 8:28am UTC](https://discourse.libsdl.org/t/no-updateting-in-windowmode/5601 "2001-12-12T08:28:00Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Stefan\_C\_Ionescu](https://discourse.libsdl.org/letter_avatar_proxy/v4/letter/s/aca169/32.png) [@Stefan\_C\_Ionescu](https://discourse.libsdl.org/u/Stefan_C_Ionescu)\
**Post date:** [December 12, 2001, 8:28am UTC](https://discourse.libsdl.org/t/no-updateting-in-windowmode/5601/1 "2001-12-12T08:28:00Z")

</div>

I start writing a very simple test program setting up a windowmode using:  
screen = SDL\_SetVideoMode(640, 480, 0, 0);

when i’m then blitting an image to “screen” and performing an  
SDL\_updateRect(), nothing is to see just an black window!

but when i’m swtching to fullscreen or using from start fullscreen, it works.  
when switching back to windowmode it works on.

very suspicious is that in an other programm from it works in windowmode  
after i created an SDL-thread in wich the “SDL\_WaitEvent(…)” function is  
called. After that SDL\_updateRect() allwais does what it schould.

I reduced both programms just to this to things and i do not see whats  
wrong!!!

PLEASE if anybody knows help…

thanks, stefan\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_  
**/\_THE\_END** \_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_/\_

---

<div class="post-metadata">

**Author:** ![Gabriele\_Greco](https://discourse.libsdl.org/letter_avatar_proxy/v4/letter/g/8edcca/32.png) [@Gabriele\_Greco](https://discourse.libsdl.org/u/Gabriele_Greco)\
**Post date:** [December 12, 2001, 9:35am UTC](https://discourse.libsdl.org/t/no-updateting-in-windowmode/5601/2 "2001-12-12T09:35:02Z")

</div>

At 17.30 12/12/01 +0100, you wrote:

> I start writing a very simple test program setting up a windowmode using:  
> screen = SDL\_SetVideoMode(640, 480, 0, 0);  
> when i’m then blitting an image to “screen” and performing an  
> SDL\_updateRect(), nothing is to see just an black window!

Are you sure that the image you are blitting is in the same format of the  
window?

With depth=0 you cannot make any assumption on the bitsperpixel of the  
allocated surface.

> very suspicious is that in an other programm from it works in windowmode  
> after i created an SDL-thread in wich the “SDL\_WaitEvent(…)” function is  
> called. After that SDL\_updateRect() allwais does what it schould.

You should ALWAYS run the event handling code in the same thread where you  
opened the window with SetVideoMode!

Bye,  
Gabry (gabrielegreco at tin.it)

---

<div class="post-metadata">

**Author:** ![Stefan\_C\_Ionescu](https://discourse.libsdl.org/letter_avatar_proxy/v4/letter/s/aca169/32.png) [@Stefan\_C\_Ionescu](https://discourse.libsdl.org/u/Stefan_C_Ionescu)\
**Post date:** [December 13, 2001, 9:09am UTC](https://discourse.libsdl.org/t/no-updateting-in-windowmode/5601/3 "2001-12-13T09:09:00Z")

</div>

> At 17.30 12/12/01 +0100, you wrote:
> 
> > I start writing a very simple test program setting up a windowmode using:  
> > screen = SDL\_SetVideoMode(640, 480, 0, 0);  
> > when i’m then blitting an image to “screen” and performing an  
> > SDL\_updateRect(), nothing is to see just an black window!
> 
> Are you sure that the image you are blitting is in the same format of the  
> window?

YES! i’m using the transformation showen in the examples wich works.  
an other curios thing is that when switching to fullscreen with the toggle  
function directly after the vidmode setting up and then imeditly switching  
back to windowmode, it seems to work as a dirty workaround cause then it  
works: everytime i’m using updaterect it does waht opposed to do!

> With depth=0 you cannot make any assumption on the bitsperpixel of the  
> allocated surface.
> 
> > very suspicious is that in an other programm from it works in windowmode  
> > after i created an SDL-thread in wich the “SDL\_WaitEvent(…)” function is  
> > called. After that SDL\_updateRect() allwais does what it schould.
> 
> You should ALWAYS run the event handling code in the same thread where you  
> opened the window with SetVideoMode!

why this?

> Bye,  
> Gabry (gabrielegreco at tin.it)

thanks, Stefan

p.s. i’m using SDL v1.2.2On Wed, 12 Dec 2001, Gabriele Greco wrote:

> * * *
> 
> SDL mailing list  
> SDL at [libsdl.org](http://libsdl.org)  
> [http://www.libsdl.org/mailman/listinfo/sdl](http://www.libsdl.org/mailman/listinfo/sdl)
