SDL2 How do I prevent SDL2 displaying its auto-scaled window-contents in realtime while I drag-resize a window

MacOS X 10.15.6, SDL 2.0.12.

I am using SDL_SetEventFilter() to take over window-redraw in real-time while a window is being resized (bottom-right corner window drag-resize). Originally the window would go black during the resize but that functionality was “fixed” in a fairly recent SDL2 update. That behavior was switched to auto-stretch window-content, which I cannot turn off. My call to SDL_SetEventFilter() is fighting the built-in stretch-to-fit automatic window redraw while it it being resized.

My manual redraw, called using SDL_SetEventFilter(), works fine but the result flashes between the internal stretch and my own redraw:

struct rAtt *DrawScreen(struct rAtt *, struct rAtt *, struct g *);

int
filterEvent(void *userdata, SDL_Event *event) {
    if(event->type == SDL_WINDOWEVENT && event->window.event == SDL_WINDOWEVENT_RESIZED) {
        DrawScreen((struct rAtt *)NULL, (struct rAtt *)NULL, (struct g *)userdata);
        return(0);
    }
    //important to allow all events, or your SDL_PollEvent doesn't get any event
    return(1);
}

Called via:

SDL_SetEventFilter(filterEvent, (void *)g);

Is there a mechanism that turns off the default resize action in SDL2?

Previously asked here but no answers.

2 Likes