SDL/src
Sam Lantinga dfac4af69a Reset the viewport when we reset the other D3D state.
From Sythical:

Hello, I've created a simple SDL2 application which draws a texture on the screen. The problem I'm having is that if I launch another program which loads the UAC popup or if I lock my PC and then login again, the application stops drawing the texture. I tried adding SDL_Delay(10000) after SDL_RenderPresent(renderer). This made the texture stay on the screen for a little bit but the texture wasn't drawn again after the delay. Here's my code:

#include "SDL.h"

int main(int argc, char *argv[])
{
    SDL_Renderer *renderer;
    SDL_Window *window;
    SDL_Surface *surface;
    SDL_Texture *rect_texture;
    SDL_Event main_event;
    SDL_Rect rect_data;
    int enable_vsync = 1;

    if(SDL_Init(SDL_INIT_VIDEO) < 0) return 1;

    window = SDL_CreateWindow("SDL2 Application", SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED, 600, 600, SDL_WINDOW_RESIZABLE);

    renderer = SDL_CreateRenderer(window, -1, enable_vsync ? SDL_RENDERER_ACCELERATED | SDL_RENDERER_PRESENTVSYNC : SDL_RENDERER_ACCELERATED);
    SDL_SetRenderDrawColor(renderer, 20, 20, 30, 255);

    surface = SDL_LoadBMP("icon.bmp");
    rect_texture = SDL_CreateTextureFromSurface(renderer, surface);

    rect_data.w = 32; rect_data.h = 32;
    rect_data.x = 300; rect_data.y = 300;

    while(main_event.type != SDL_QUIT)
    {
        SDL_PollEvent(&main_event);

        SDL_RenderClear(renderer);
        SDL_RenderCopy(renderer, rect_texture, NULL, &rect_data);
        SDL_RenderPresent(renderer);
    }

    SDL_DestroyTexture(rect_texture);
    SDL_DestroyRenderer(renderer);
    SDL_DestroyWindow(window);
    SDL_Quit();

    return 0;
}
2013-08-07 01:14:04 -07:00
..
atomic Added PowerPC and ARM versions of the memory barrier functions. 2013-07-10 20:17:20 -07:00
audio Workaround older libpulse that fails in pa_context_new() with a NULL appname. 2013-07-30 01:32:26 -04:00
core Added missing function prototype and changed its signature. 2013-08-04 23:38:25 +02:00
cpuinfo Happy New Year! 2013-02-15 08:47:44 -08:00
events Fixed a number of missing keys in the X11 keyboard mapping. 2013-08-06 18:19:34 -07:00
file Fixed implicit function declaration for SDL_AndroidGetInternalStoragePath(). 2013-06-02 14:13:21 +02:00
haptic Backed out hg changeset 7f26fd1df927; docs were wrong, not the code. 2013-07-27 13:13:57 -04:00
joystick Corrected internal documentation in source. 2013-07-22 22:54:00 +02:00
libm Fixed compiler warnings on Haiku. 2013-07-11 12:44:03 -04:00
loadso Happy New Year! 2013-02-15 08:47:44 -08:00
main Android: Removed all unnecessary dependencies on C++. 2013-07-22 02:51:45 -07:00
power File style cleanup for the SDL 2.0 release 2013-05-18 14:17:52 -07:00
render Reset the viewport when we reset the other D3D state. 2013-08-07 01:14:04 -07:00
stdlib Fixed SDL printf output for 0x%.8x 2013-07-23 12:44:14 -07:00
test More compiler warning fixes. 2013-07-20 19:58:17 -04:00
thread Add a timeout to the clipboard code to avoid hangs when using synergy. When a timeout is detected we set the clipboard so that we own it so that future timeouts are avoided. Testing has confirmed that this timeout and setting only occurs when the clipboard contains text from my Windows machine. 2013-07-23 12:59:29 -07:00
timer Added a hint to control the Windows timer resolution: SDL_HINT_TIMER_RESOLUTION 2013-07-13 03:13:41 -07:00
video Unify the SetWindowPos() calls so that they all set the window state based on SDL state. 2013-08-07 00:46:42 -07:00
SDL_assert_c.h Happy New Year! 2013-02-15 08:47:44 -08:00
SDL_assert.c Happy New Year! 2013-02-15 08:47:44 -08:00
SDL_error_c.h File style cleanup for the SDL 2.0 release 2013-05-18 14:17:52 -07:00
SDL_error.c File style cleanup for the SDL 2.0 release 2013-05-18 14:17:52 -07:00
SDL_fatal.c Removing old dangerous signal catching code. 2013-06-28 22:49:03 -07:00
SDL_fatal.h Happy New Year! 2013-02-15 08:47:44 -08:00
SDL_hints.c Added a hint to control the Windows timer resolution: SDL_HINT_TIMER_RESOLUTION 2013-07-13 03:13:41 -07:00
SDL_log.c No, there's no reason not to use fprintf 2013-07-05 21:37:27 -07:00
SDL.c Make it possible to use SDL events separately from the video subsystem. 2013-07-06 12:28:57 -07:00