# HG changeset patch # User Mike Gorchak # Date 1255376821 0 # Node ID 05499ec8c02293690a15ad68a692fd58c7c7def7 # Parent fff074de967553897f03e84905eb840a4d4a7f6a Initial support for fullscreen application modes. diff -r fff074de9675 -r 05499ec8c022 src/video/photon/SDL_photon.c --- a/src/video/photon/SDL_photon.c Mon Oct 12 11:45:01 2009 +0000 +++ b/src/video/photon/SDL_photon.c Mon Oct 12 19:47:01 2009 +0000 @@ -2456,6 +2456,35 @@ break; case Ph_EV_INFO: { + switch (event->subtype) + { + case Ph_OFFSCREEN_INVALID: + { + uint32_t* type; + + type = PhGetData(event); + switch (*type) + { + case Pg_VIDEO_MODE_SWITCHED: + case Pg_ENTERED_DIRECT: + case Pg_EXITED_DIRECT: + case Pg_DRIVER_STARTED: + { + /* TODO: */ + /* We must tell the renderer, that it have */ + /* to recreate all surfaces */ + } + break; + default: + { + } + break; + } + } + break; + default: + break; + } } break; case Ph_EV_KEY: diff -r fff074de9675 -r 05499ec8c022 src/video/photon/SDL_photon.h --- a/src/video/photon/SDL_photon.h Mon Oct 12 11:45:01 2009 +0000 +++ b/src/video/photon/SDL_photon.h Mon Oct 12 19:47:01 2009 +0000 @@ -83,6 +83,7 @@ SDL_bool cursor_visible; /* SDL_TRUE if cursor visible */ uint32_t cursor_size; /* Cursor size in memory w/ structure */ uint32_t mode_2dcaps; /* Current video mode 2D capabilities */ + SDL_bool direct_mode; /* Direct mode state */ #if defined(SDL_VIDEO_OPENGL_ES) gf_display_t display; /* GF display handle */ gf_display_info_t display_info; /* GF display information */ diff -r fff074de9675 -r 05499ec8c022 src/video/photon/SDL_photon_render.c --- a/src/video/photon/SDL_photon_render.c Mon Oct 12 11:45:01 2009 +0000 +++ b/src/video/photon/SDL_photon_render.c Mon Oct 12 19:47:01 2009 +0000 @@ -163,6 +163,9 @@ renderer->window = window->id; renderer->driverdata = rdata; + /* Copy direct_mode status */ + rdata->direct_mode=didata->direct_mode; + /* Set render acceleration flag in case it is accelerated */ if ((didata->caps & SDL_PHOTON_ACCELERATED) == SDL_PHOTON_ACCELERATED) { renderer->info.flags = SDL_RENDERER_ACCELERATED; @@ -172,7 +175,16 @@ /* Check if upper level requested synchronization on vsync signal */ if ((flags & SDL_RENDERER_PRESENTVSYNC) == SDL_RENDERER_PRESENTVSYNC) { - rdata->enable_vsync = SDL_TRUE; + if (rdata->direct_mode==SDL_TRUE) + { + /* We can control vsync only in direct mode */ + rdata->enable_vsync = SDL_TRUE; + renderer->info.flags |= SDL_RENDERER_PRESENTVSYNC; + } + else + { + rdata->enable_vsync = SDL_FALSE; + } } else { rdata->enable_vsync = SDL_FALSE; } @@ -600,6 +612,15 @@ static int photon_displaymodechanged(SDL_Renderer * renderer) { + SDL_RenderData *rdata = (SDL_RenderData *) renderer->driverdata; + SDL_Window *window = SDL_GetWindowFromID(renderer->window); + SDL_VideoDisplay *display = SDL_GetDisplayFromWindow(window); + SDL_DisplayData *didata = (SDL_DisplayData *) display->driverdata; + + /* Copy direct_mode status */ + rdata->direct_mode=didata->direct_mode; + + /* Update the surfaces */ return _photon_recreate_surfaces(renderer); } diff -r fff074de9675 -r 05499ec8c022 src/video/photon/SDL_photon_render.h --- a/src/video/photon/SDL_photon_render.h Mon Oct 12 11:45:01 2009 +0000 +++ b/src/video/photon/SDL_photon_render.h Mon Oct 12 19:47:01 2009 +0000 @@ -48,6 +48,7 @@ uint32_t window_width; /* Last active window width */ uint32_t window_height; /* Last active window height */ PhGC_t* gc; /* Graphics context */ + SDL_bool direct_mode; /* Direct Mode state */ PdOffscreenContext_t* osurfaces[SDL_PHOTON_MAX_SURFACES]; PhImage_t* psurfaces[SDL_PHOTON_MAX_SURFACES]; PmMemoryContext_t* pcontexts[SDL_PHOTON_MAX_SURFACES];