Commit f617baee authored by Mike Gorchak's avatar Mike Gorchak

Initial support for fullscreen application modes.

--HG--
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%404063
parent d023c50f
...@@ -2456,6 +2456,35 @@ photon_pumpevents(_THIS) ...@@ -2456,6 +2456,35 @@ photon_pumpevents(_THIS)
break; break;
case Ph_EV_INFO: 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; break;
case Ph_EV_KEY: case Ph_EV_KEY:
......
...@@ -83,6 +83,7 @@ typedef struct SDL_DisplayData ...@@ -83,6 +83,7 @@ typedef struct SDL_DisplayData
SDL_bool cursor_visible; /* SDL_TRUE if cursor visible */ SDL_bool cursor_visible; /* SDL_TRUE if cursor visible */
uint32_t cursor_size; /* Cursor size in memory w/ structure */ uint32_t cursor_size; /* Cursor size in memory w/ structure */
uint32_t mode_2dcaps; /* Current video mode 2D capabilities */ uint32_t mode_2dcaps; /* Current video mode 2D capabilities */
SDL_bool direct_mode; /* Direct mode state */
#if defined(SDL_VIDEO_OPENGL_ES) #if defined(SDL_VIDEO_OPENGL_ES)
gf_display_t display; /* GF display handle */ gf_display_t display; /* GF display handle */
gf_display_info_t display_info; /* GF display information */ gf_display_info_t display_info; /* GF display information */
......
...@@ -163,6 +163,9 @@ photon_createrenderer(SDL_Window * window, Uint32 flags) ...@@ -163,6 +163,9 @@ photon_createrenderer(SDL_Window * window, Uint32 flags)
renderer->window = window->id; renderer->window = window->id;
renderer->driverdata = rdata; renderer->driverdata = rdata;
/* Copy direct_mode status */
rdata->direct_mode=didata->direct_mode;
/* Set render acceleration flag in case it is accelerated */ /* Set render acceleration flag in case it is accelerated */
if ((didata->caps & SDL_PHOTON_ACCELERATED) == SDL_PHOTON_ACCELERATED) { if ((didata->caps & SDL_PHOTON_ACCELERATED) == SDL_PHOTON_ACCELERATED) {
renderer->info.flags = SDL_RENDERER_ACCELERATED; renderer->info.flags = SDL_RENDERER_ACCELERATED;
...@@ -172,7 +175,16 @@ photon_createrenderer(SDL_Window * window, Uint32 flags) ...@@ -172,7 +175,16 @@ photon_createrenderer(SDL_Window * window, Uint32 flags)
/* Check if upper level requested synchronization on vsync signal */ /* Check if upper level requested synchronization on vsync signal */
if ((flags & SDL_RENDERER_PRESENTVSYNC) == SDL_RENDERER_PRESENTVSYNC) { 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 { } else {
rdata->enable_vsync = SDL_FALSE; rdata->enable_vsync = SDL_FALSE;
} }
...@@ -600,6 +612,15 @@ photon_activaterenderer(SDL_Renderer * renderer) ...@@ -600,6 +612,15 @@ photon_activaterenderer(SDL_Renderer * renderer)
static int static int
photon_displaymodechanged(SDL_Renderer * renderer) 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); return _photon_recreate_surfaces(renderer);
} }
......
...@@ -48,6 +48,7 @@ typedef struct SDL_RenderData ...@@ -48,6 +48,7 @@ typedef struct SDL_RenderData
uint32_t window_width; /* Last active window width */ uint32_t window_width; /* Last active window width */
uint32_t window_height; /* Last active window height */ uint32_t window_height; /* Last active window height */
PhGC_t* gc; /* Graphics context */ PhGC_t* gc; /* Graphics context */
SDL_bool direct_mode; /* Direct Mode state */
PdOffscreenContext_t* osurfaces[SDL_PHOTON_MAX_SURFACES]; PdOffscreenContext_t* osurfaces[SDL_PHOTON_MAX_SURFACES];
PhImage_t* psurfaces[SDL_PHOTON_MAX_SURFACES]; PhImage_t* psurfaces[SDL_PHOTON_MAX_SURFACES];
PmMemoryContext_t* pcontexts[SDL_PHOTON_MAX_SURFACES]; PmMemoryContext_t* pcontexts[SDL_PHOTON_MAX_SURFACES];
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment