Refreshing window content.(was SDL-1.2.0 Very strange...)

Hi, I’ve noticed that in X if SDL runs in windowed mode
it dosn’t keep the window content if it’s not refreshed…

Ehm, I’ll provide an example as my English is not that good…

SDL pseudo code:
/* (lost it’s contents) */
initialization;

load_a_bmp_onto_a_surface;

blit_the_bmp_onto_screen_surface;

wait_5_seconds;

quit;

/* this is ok */
initialization;

load_a_bmp_onto_a_surface;

blit_the_bmp_onto_screen_surface;

while_!_end_of_app
{
update_the_screen;

if_esc_is_pressed
break;

}

quit;--------

Ok, now at runtime if I drag another window
onto the SDL window this one lost it’s content.

Is this a normal ?

(If I remember, this was not happening with older SDL versions,
or maybe with older XFree versions).

Thanks,
G.Gabriele

Hi, I’ve noticed that in X if SDL runs in windowed mode
it dosn’t keep the window content if it’s not refreshed…

SDL will update the window with the contents of the back-buffer when
you call SDL_UpdateRects (or SDL_UpdateRect, SDL_Flip), and when
it receives an expose event (which happens right after the window is
mapped and whenever a portion of it needs redrawing for some reason).

For this to happen, you must events to be processed; either by checking
for events in your loop (PollEvents, PeepEvents or WaitEvent) or by
calling PumpEvents

SDL will request a backing store for the window which means that most
redrawing will happen automatically without expose events (unless
backing store is refused for some reason)

(If I remember, this was not happening with older SDL versions,
or maybe with older XFree versions).

my guess is that your new X server has backing-store switched off. Use
xdpyinfo to find out

<-- SNIP -->

(If I remember, this was not happening with older SDL versions,
or maybe with older XFree versions).

my guess is that your new X server has backing-store switched off. Use
xdpyinfo to find out

Good guess :slight_smile:

screen #0:

options: backing-store NO, save-unders NO

Thanks a million,
G.Gabriele