Date: Fri, 15 Aug 2003 09:13:59 +0300

From: "Mike Gorchak"
Subject: Patches for tests and QNX6

Here more fixes for the QNX6 in sdlqnx.diff file:

- Spellchecked README.QNX (thanks to Julian Kinraid)
- Fixed bugs in fullscreen mode: window region wasn't on top by default, so \
it caused some artifacts to be appeared on the screen, prevent window conten\
ts default filler in Photon while in fullscreen mode, it damages the screen.
- Added support for the SDL_VIDEO_WINDOW_POS, SDL_VIDEO_CENTERED env variabl\
es.
- Some minor code restructurization.
This commit is contained in:
Sam Lantinga
2003-08-23 23:20:21 +00:00
parent aedc2055b1
commit 97259dbe65
6 changed files with 129 additions and 96 deletions

View File

@@ -267,6 +267,8 @@ int ph_SetupFullScreenImage(_THIS, SDL_Surface* screen)
this->UpdateRects = ph_OCDCUpdate;
PgFlush();
return 0;
}

View File

@@ -297,13 +297,14 @@ int ph_EnterFullScreen(_THIS, SDL_Surface* screen)
currently_fullscreen = 1;
}
PgFlush();
return 1;
}
int ph_LeaveFullScreen(_THIS)
{
PgDisplaySettings_t mymode_settings;
PgDisplaySettings_t oldmode_settings;
if (currently_fullscreen)
{
@@ -332,11 +333,11 @@ int ph_LeaveFullScreen(_THIS)
/* Restore old video mode */
if (old_video_mode != -1)
{
mymode_settings.mode = (unsigned short) old_video_mode;
mymode_settings.refresh = (unsigned short) old_refresh_rate;
mymode_settings.flags = 0;
oldmode_settings.mode = (unsigned short) old_video_mode;
oldmode_settings.refresh = (unsigned short) old_refresh_rate;
oldmode_settings.flags = 0;
if (PgSetVideoMode(&mymode_settings) < 0)
if (PgSetVideoMode(&oldmode_settings) < 0)
{
SDL_SetError("Ph_LeaveFullScreen(): PgSetVideoMode() function failed !\n");
return 0;

View File

@@ -194,9 +194,11 @@ static int ph_SetupWindow(_THIS, int w, int h, int flags)
PhPoint_t pos = {0, 0};
PhDim_t dim = {w, h};
int nargs = 0;
const char* windowpos;
const char* iscentered;
int x, y;
PtSetArg(&args[nargs++], Pt_ARG_DIM, &dim, 0);
PtSetArg(&args[nargs++], Pt_ARG_FILL_COLOR, Pg_BLACK, 0);
if ((flags & SDL_RESIZABLE) == SDL_RESIZABLE)
{
@@ -234,12 +236,36 @@ static int ph_SetupWindow(_THIS, int w, int h, int flags)
if ((flags & SDL_FULLSCREEN) == SDL_FULLSCREEN)
{
PtSetArg(&args[nargs++], Pt_ARG_POS, &pos, 0);
PtSetArg(&args[nargs++], Pt_ARG_BASIC_FLAGS, Pt_TRUE, Pt_BASIC_PREVENT_FILL);
PtSetArg(&args[nargs++], Pt_ARG_WINDOW_MANAGED_FLAGS, Pt_TRUE, Ph_WM_FFRONT | Ph_WM_MAX);
PtSetArg(&args[nargs++], Pt_ARG_WINDOW_STATE, Pt_TRUE, Ph_WM_STATE_ISFRONT | Ph_WM_STATE_ISMAX |
Ph_WM_STATE_ISFOCUS | Ph_WM_STATE_ISALTKEY);
PtSetArg(&args[nargs++], Pt_ARG_WINDOW_STATE, Pt_TRUE, Ph_WM_STATE_ISFRONT | Ph_WM_STATE_ISFOCUS | Ph_WM_STATE_ISALTKEY);
}
else
{
windowpos = getenv("SDL_VIDEO_WINDOW_POS");
iscentered = getenv("SDL_VIDEO_CENTERED");
if ((iscentered) || ((windowpos) && (strcmp(windowpos, "center")==0)))
{
pos.x = (desktop_mode.width - w)/2;
pos.y = (desktop_mode.height - h)/2;
PtSetArg(&args[nargs++], Pt_ARG_POS, &pos, 0);
}
else
{
if (windowpos)
{
if (sscanf(windowpos, "%d,%d", &x, &y) == 2 )
{
pos.x=x;
pos.y=y;
PtSetArg(&args[nargs++], Pt_ARG_POS, &pos, 0);
}
}
}
PtSetArg(&args[nargs++], Pt_ARG_FILL_COLOR, Pg_BLACK, 0);
PtSetArg(&args[nargs++], Pt_ARG_WINDOW_STATE, Pt_FALSE, Ph_WM_STATE_ISFRONT | Ph_WM_STATE_ISMAX | Ph_WM_STATE_ISALTKEY);
PtSetArg(&args[nargs++], Pt_ARG_WINDOW_MANAGED_FLAGS, Pt_TRUE, Ph_WM_HIDE);
PtSetArg(&args[nargs++], Pt_ARG_WINDOW_NOTIFY_FLAGS, Pt_TRUE, Ph_WM_HIDE);
@@ -248,6 +274,7 @@ static int ph_SetupWindow(_THIS, int w, int h, int flags)
PtSetResources(window, nargs, args);
PtRealizeWidget(window);
PtWindowToFront(window);
return 0;
}
@@ -281,7 +308,6 @@ static const struct ColourMasks* ph_GetColourMasks(int bpp)
static int ph_VideoInit(_THIS, SDL_PixelFormat *vformat)
{
PgVideoModeInfo_t my_mode_info;
PgHWCaps_t my_hwcaps;
int i;
@@ -325,7 +351,7 @@ static int ph_VideoInit(_THIS, SDL_PixelFormat *vformat)
return -1;
}
if (PgGetVideoModeInfo(my_hwcaps.current_video_mode, &my_mode_info) < 0)
if (PgGetVideoModeInfo(my_hwcaps.current_video_mode, &desktop_mode) < 0)
{
SDL_SetError("ph_VideoInit(): PgGetVideoModeInfo function failed !\n");
this->FreeWMCursor(this, SDL_BlankCursor);
@@ -333,9 +359,9 @@ static int ph_VideoInit(_THIS, SDL_PixelFormat *vformat)
}
/* We need to return BytesPerPixel as it in used by CreateRGBsurface */
vformat->BitsPerPixel = my_mode_info.bits_per_pixel;
vformat->BytesPerPixel = my_mode_info.bytes_per_scanline/my_mode_info.width;
desktopbpp = my_mode_info.bits_per_pixel;
vformat->BitsPerPixel = desktop_mode.bits_per_pixel;
vformat->BytesPerPixel = desktop_mode.bytes_per_scanline/desktop_mode.width;
desktopbpp = desktop_mode.bits_per_pixel;
/* save current palette */
if (desktopbpp==8)
@@ -434,6 +460,7 @@ static SDL_Surface *ph_SetVideoMode(_THIS, SDL_Surface *current,
}
current->flags &= ~SDL_RESIZABLE; /* no resize for Direct Context */
current->flags |= SDL_HWSURFACE;
}
else
{
@@ -488,6 +515,10 @@ static SDL_Surface *ph_SetVideoMode(_THIS, SDL_Surface *current,
{
PtFlush();
}
else
{
PgFlush();
}
SDL_Unlock_EventThread();

View File

@@ -72,20 +72,22 @@ struct SDL_PrivateVideoData {
PgColor_t savedpal[_Pg_MAX_PALETTE];
PgColor_t syspalph[_Pg_MAX_PALETTE];
struct {
struct
{
PdDirectContext_t* direct_context;
PdOffscreenContext_t* offscreen_context;
PdOffscreenContext_t* offscreen_backcontext;
PhDrawContext_t* oldDC;
uint8_t* dc_ptr;
unsigned char* CurrentFrameData;
unsigned char* FrameData0;
unsigned char* FrameData1;
int current;
long flags;
unsigned char* CurrentFrameData;
unsigned char* FrameData0;
unsigned char* FrameData1;
int current;
long flags;
} ocimage;
PgHWCaps_t graphics_card_caps; /* Graphics card caps at the moment of start */
PgVideoModeInfo_t desktop_mode; /* Current desktop video mode information */
int old_video_mode; /* Stored mode before fullscreen switch */
int old_refresh_rate; /* Stored refresh rate befor fullscreen switch */
@@ -119,6 +121,7 @@ struct SDL_PrivateVideoData {
#define currently_hided (this->hidden->currently_hided)
#define event (this->hidden->event)
#define current_overlay (this->hidden->overlay)
#define desktop_mode (this->hidden->desktop_mode)
/* Old variable names */
#define mouse_relative (this->hidden->mouse_relative)