Skip to content
This repository has been archived by the owner on Feb 11, 2021. It is now read-only.

Commit

Permalink
Initial support for fullscreen application modes.
Browse files Browse the repository at this point in the history
  • Loading branch information
llmike committed Oct 12, 2009
1 parent ad71657 commit a3015d7
Show file tree
Hide file tree
Showing 4 changed files with 53 additions and 1 deletion.
29 changes: 29 additions & 0 deletions src/video/photon/SDL_photon.c
Expand Up @@ -2456,6 +2456,35 @@ photon_pumpevents(_THIS)
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:
Expand Down
1 change: 1 addition & 0 deletions src/video/photon/SDL_photon.h
Expand Up @@ -83,6 +83,7 @@ typedef struct SDL_DisplayData
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 */
Expand Down
23 changes: 22 additions & 1 deletion src/video/photon/SDL_photon_render.c
Expand Up @@ -163,6 +163,9 @@ photon_createrenderer(SDL_Window * window, Uint32 flags)
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;
Expand All @@ -172,7 +175,16 @@ photon_createrenderer(SDL_Window * window, Uint32 flags)

/* 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;
}
Expand Down Expand Up @@ -600,6 +612,15 @@ photon_activaterenderer(SDL_Renderer * renderer)
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);
}

Expand Down
1 change: 1 addition & 0 deletions src/video/photon/SDL_photon_render.h
Expand Up @@ -48,6 +48,7 @@ typedef struct SDL_RenderData
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];
Expand Down

0 comments on commit a3015d7

Please sign in to comment.