Commit b0204f40 authored by Sam Lantinga's avatar Sam Lantinga

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.

--HG--
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%40693
parent 0cc5681a
...@@ -142,7 +142,7 @@ EPOC: ...@@ -142,7 +142,7 @@ EPOC:
No console output screen. Printing to stdout do not have any effect. No console output screen. Printing to stdout do not have any effect.
QNX: QNX:
Fullscreen switch doesn't work correctly. Fullscreen switch doesn't work (disabled for now).
OpenBSD: -= NOT YET SUPPORTED =- OpenBSD: -= NOT YET SUPPORTED =-
......
README by Mike Gorchak <mike@malva.ua>, <lestat@i.com.ua> README by Mike Gorchak <mike@malva.ua>, <lestat@i.com.ua>
Last changed at 29 Jul 2003. Last changed at 12 Aug 2003.
========================================================================= ======================================================================
OpenGL: OpenGL:
OpenGL in window mode works well and stable, in fullscreen OpenGL works well and is stable, but fullscreen mode has not been
mode too, but fullscreen mode has not been heavily tested yet. heavily tested yet.
If you have QNX RtP version 6.1.0 and above you must download If you have QNX RtP version 6.1.0 or above you must download the
new Photon3D runtime from http://developers.qnx.com or install it Photon3D runtime from http://developers.qnx.com or install it from the
from public repository or from public CD, available with QNX. The public repository or the public CD, available with QNX. OS versions
versions of OS before 6.1.0 are not supported. below 6.1.0 are not supported.
While creating OpenGL context software renderer mode is When creating an OpenGL context, software renderer mode is artifi-
artificially selected (QSSL made acceleration only for Voodoo cially selected (QSSL made acceleration only for Voodoo boards in
boards in fullscreen mode, sorry but I don't have this board to fullscreen mode, sorry but I don't have this board to test OpenGL -
test OpenGL - maybe it work or maybe not :)). If you want accele- maybe it works or maybe not :)). If you want acceleration - you can
ration - you may remove some line in source code: find the file remove one line in the source code: find the file SDL_ph_video.c and
SDL_ph_video.c and remove the following remove the following
OGLAttrib[OGLargc++]=PHOGL_ATTRIB_FORCE_SW; OGLAttrib[OGLargc++]=PHOGL_ATTRIB_FORCE_SW;
line in the ph_SetupOpenGLContext() function or change argument line in the ph_SetupOpenGLContext() function or change the argument to
to the PHOGL_ATTRIB_FORCE_HW or PHOGL_ATTRIB_FAVOR_HW. PHOGL_ATTRIB_FORCE_HW or PHOGL_ATTRIB_FAVOR_HW.
========================================================================= ======================================================================
Wheel and multibutton mouses: Wheel and multi-button mouses:
Photon emitting keyboard events (key up and down) when moved Photon emits keyboard events (key up and down) when the mouse
mouse wheel. But key_scan field appears valid according to flags, wheel is moved. The key_scan field appears valid, and it contains zero.
and it contain zero. It is base method of detecting mouse wheel That is a basic method of detecting mouse wheel events under Photon.
events under photon. It looks like a hack, but it works for me :) It looks like a hack, but it works for me :) on various PC configura-
on different PC configurations. tions.
I'm tested it on: I've tested it on:
1. Genius Optical NetScroll/+ (1 wheel) 1. Genius Optical NetScroll/+ (1 wheel)
2. A4Tech Optical GreatEye WheelMouse, model: WOP-35. (2 wheels + 2. A4Tech Optical GreatEye WheelMouse, model: WOP-35. (2 wheels + 2
2 additional buttons). Wheel for vertical scrolling works as additional buttons). The wheel for vertical scrolling works as usu-
usual, but second wheel for horizontal scrolling emitting two al, but the second wheel for horizontal scrolling emits two sequen-
consequented events up or down, so it can provide more fast tial events up or down, so it can provide faster scrolling than the
scrolling then the first wheel. Additional buttons doesn't first wheel. Additional buttons don't emit any events, but it looks
emitting any events, but its look like handled by photon in like they're handled by photon in an unusual way - like click to
unusual way - like click to front, but works not with any win- front, but works not with any window, looks like bug-o-feature :).
dow, looks like bug-o-feature :).
======================================================================
=========================================================================
CDROM handling issues: CDROM handling issues:
Access to CDROM can be provided only with 'root' previleges. Access to CDROM can only be provided with 'root' privileges. I
I can't do anything with this fact. /dev/cd0 have the brw------- can't do anything about that, /dev/cd0 has brw------- permissions and
flags and root:root rights. root:root rights.
========================================================================= ======================================================================
Video Overlays: Video Overlays:
Overlays can flickering during the window movement, resizing, Overlays can flicker during window movement, resizing, etc. It
etc. It happens because photon driver updates the real window happens because the photon driver updates the real window contents be-
contents behind the overlay, then draws the temporary chroma key hind the overlay, then draws the temporary chroma key color over the
color over window contents. It can be done without the chroma key window contents. It can be done without using the chroma key but that
using but it cause overlay will be always on top. So flickering causes the overlay to always be on top. So flickering during window
during the movement much better in that case. movement is preferred instead.
Double buffering code temporary disabled in the photon driver Double buffering code is temporarily disabled in the photon driver
code, beacuse on my GF2-MX it cause accidently buffer switch, code, because on my GF2-MX it can accidentally cause a buffer switch,
which going to the old frame showing. S3 Savage3D have the same which causes the old frame to show. S3 Savage4 has the same problem,
problem, but ATI Rage 128 has not this problem. I think it can be but ATI Rage 128 doesn't. I think it can be fixed later. Current code
fixed later. Current code works very fine, so maybe double buffe- works very well, so maybe double buffering is not needed right now.
ring is not needed right now. Something strange happens when you try to move the window with the
Something strange appears when you tried to move window with overlay beyond the left border of the screen. The overlay tries to
overlay beyond the left border of the screen. Overlay trying to stay at position x=0, but when attempting to move it a bit more it
stay at position x=0, but when tried to move it a bit more it jumps to position x=-60 (on GF2-MX, on ATI Rage128 this value a bit
jumps at posituin x=-60. Really strange, looks like overlay smaller). It's really strange, looks like the overlay doesn't like
doesn't love the negotive coordinates. negative coordinates.
========================================================================= =======================================================================
Shared library building: Shared library building:
Shared library can be built, but before running autogen.sh A shared library can be built, but before running the autogen.sh
script you need manually delete the libtool m4 stuff from script you must manually delete the libtool.m4 stuff from the acinclu-
the acinclude.m4 file (it comes after ESD detection code up to de.m4 file (it comes after the ESD detection code up to the end of the
end of the file). Because libtool stuff in the acinclude.m4 file file), because the libtool stuff in the acinclude.m4 file is very old
very old and doesn't know anything about the QNX. Just remove it and doesn't know anything about QNX. Just remove it and run autogen.sh.
and run autogen.sh script.
========================================================================= ======================================================================
Some building issues: Some building issues:
Feel free to not pass --disable-shared option to configure, Feel free to not use the --disable-shared configure option if you'
if you read comment above about 'Shared library building'. Other- ve read the above comment about 'Shared library building'. Otherwise
wise this option is strongly recomended, because the sdl-config this option is strongly recommended, as without it the sdl-config
script will be unfunctional. script will be broken.
Run configure script without x11 support, e.g.: Run the configure script without x11 support, e.g.:
a) for OpenGL support: a) for OpenGL support:
./configure --prefix=/usr/local \ ./configure --prefix=/usr \
--disable-video-x11 \ --disable-video-x11 \
--disable-shared --disable-shared
b) without OpenGL support: b) without OpenGL support:
./configure --prefix=/usr/local \ ./configure --prefix=/usr \
--disable-video-x11 \ --disable-video-x11 \
--disable-shared \ --disable-shared \
--disable-video-opengl --disable-video-opengl
In test directory also run ./configure script without x11 In the test directory also run the ./configure script without
support, e.g.: x11 support, e.g.:
./configure --with-sdl-prefix=/usr/local \
--with-sdl-exec-prefix=/usr/local \
--prefix=/usr/local --without-x
./configure --with-sdl-prefix=/usr \
--with-sdl-exec-prefix=/usr \
--prefix=/usr --without-x
...@@ -267,6 +267,8 @@ int ph_SetupFullScreenImage(_THIS, SDL_Surface* screen) ...@@ -267,6 +267,8 @@ int ph_SetupFullScreenImage(_THIS, SDL_Surface* screen)
this->UpdateRects = ph_OCDCUpdate; this->UpdateRects = ph_OCDCUpdate;
PgFlush();
return 0; return 0;
} }
......
...@@ -297,13 +297,14 @@ int ph_EnterFullScreen(_THIS, SDL_Surface* screen) ...@@ -297,13 +297,14 @@ int ph_EnterFullScreen(_THIS, SDL_Surface* screen)
currently_fullscreen = 1; currently_fullscreen = 1;
} }
PgFlush();
return 1; return 1;
} }
int ph_LeaveFullScreen(_THIS) int ph_LeaveFullScreen(_THIS)
{ {
PgDisplaySettings_t mymode_settings; PgDisplaySettings_t oldmode_settings;
if (currently_fullscreen) if (currently_fullscreen)
{ {
...@@ -332,11 +333,11 @@ int ph_LeaveFullScreen(_THIS) ...@@ -332,11 +333,11 @@ int ph_LeaveFullScreen(_THIS)
/* Restore old video mode */ /* Restore old video mode */
if (old_video_mode != -1) if (old_video_mode != -1)
{ {
mymode_settings.mode = (unsigned short) old_video_mode; oldmode_settings.mode = (unsigned short) old_video_mode;
mymode_settings.refresh = (unsigned short) old_refresh_rate; oldmode_settings.refresh = (unsigned short) old_refresh_rate;
mymode_settings.flags = 0; oldmode_settings.flags = 0;
if (PgSetVideoMode(&mymode_settings) < 0) if (PgSetVideoMode(&oldmode_settings) < 0)
{ {
SDL_SetError("Ph_LeaveFullScreen(): PgSetVideoMode() function failed !\n"); SDL_SetError("Ph_LeaveFullScreen(): PgSetVideoMode() function failed !\n");
return 0; return 0;
......
...@@ -194,9 +194,11 @@ static int ph_SetupWindow(_THIS, int w, int h, int flags) ...@@ -194,9 +194,11 @@ static int ph_SetupWindow(_THIS, int w, int h, int flags)
PhPoint_t pos = {0, 0}; PhPoint_t pos = {0, 0};
PhDim_t dim = {w, h}; PhDim_t dim = {w, h};
int nargs = 0; 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_DIM, &dim, 0);
PtSetArg(&args[nargs++], Pt_ARG_FILL_COLOR, Pg_BLACK, 0);
if ((flags & SDL_RESIZABLE) == SDL_RESIZABLE) if ((flags & SDL_RESIZABLE) == SDL_RESIZABLE)
{ {
...@@ -234,12 +236,36 @@ static int ph_SetupWindow(_THIS, int w, int h, int flags) ...@@ -234,12 +236,36 @@ static int ph_SetupWindow(_THIS, int w, int h, int flags)
if ((flags & SDL_FULLSCREEN) == SDL_FULLSCREEN) if ((flags & SDL_FULLSCREEN) == SDL_FULLSCREEN)
{ {
PtSetArg(&args[nargs++], Pt_ARG_POS, &pos, 0); 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_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 | PtSetArg(&args[nargs++], Pt_ARG_WINDOW_STATE, Pt_TRUE, Ph_WM_STATE_ISFRONT | Ph_WM_STATE_ISFOCUS | Ph_WM_STATE_ISALTKEY);
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 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_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_MANAGED_FLAGS, Pt_TRUE, Ph_WM_HIDE);
PtSetArg(&args[nargs++], Pt_ARG_WINDOW_NOTIFY_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) ...@@ -248,6 +274,7 @@ static int ph_SetupWindow(_THIS, int w, int h, int flags)
PtSetResources(window, nargs, args); PtSetResources(window, nargs, args);
PtRealizeWidget(window); PtRealizeWidget(window);
PtWindowToFront(window);
return 0; return 0;
} }
...@@ -281,7 +308,6 @@ static const struct ColourMasks* ph_GetColourMasks(int bpp) ...@@ -281,7 +308,6 @@ static const struct ColourMasks* ph_GetColourMasks(int bpp)
static int ph_VideoInit(_THIS, SDL_PixelFormat *vformat) static int ph_VideoInit(_THIS, SDL_PixelFormat *vformat)
{ {
PgVideoModeInfo_t my_mode_info;
PgHWCaps_t my_hwcaps; PgHWCaps_t my_hwcaps;
int i; int i;
...@@ -325,7 +351,7 @@ static int ph_VideoInit(_THIS, SDL_PixelFormat *vformat) ...@@ -325,7 +351,7 @@ static int ph_VideoInit(_THIS, SDL_PixelFormat *vformat)
return -1; 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"); SDL_SetError("ph_VideoInit(): PgGetVideoModeInfo function failed !\n");
this->FreeWMCursor(this, SDL_BlankCursor); this->FreeWMCursor(this, SDL_BlankCursor);
...@@ -333,9 +359,9 @@ static int ph_VideoInit(_THIS, SDL_PixelFormat *vformat) ...@@ -333,9 +359,9 @@ static int ph_VideoInit(_THIS, SDL_PixelFormat *vformat)
} }
/* We need to return BytesPerPixel as it in used by CreateRGBsurface */ /* We need to return BytesPerPixel as it in used by CreateRGBsurface */
vformat->BitsPerPixel = my_mode_info.bits_per_pixel; vformat->BitsPerPixel = desktop_mode.bits_per_pixel;
vformat->BytesPerPixel = my_mode_info.bytes_per_scanline/my_mode_info.width; vformat->BytesPerPixel = desktop_mode.bytes_per_scanline/desktop_mode.width;
desktopbpp = my_mode_info.bits_per_pixel; desktopbpp = desktop_mode.bits_per_pixel;
/* save current palette */ /* save current palette */
if (desktopbpp==8) if (desktopbpp==8)
...@@ -434,6 +460,7 @@ static SDL_Surface *ph_SetVideoMode(_THIS, SDL_Surface *current, ...@@ -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_RESIZABLE; /* no resize for Direct Context */
current->flags |= SDL_HWSURFACE;
} }
else else
{ {
...@@ -488,6 +515,10 @@ static SDL_Surface *ph_SetVideoMode(_THIS, SDL_Surface *current, ...@@ -488,6 +515,10 @@ static SDL_Surface *ph_SetVideoMode(_THIS, SDL_Surface *current,
{ {
PtFlush(); PtFlush();
} }
else
{
PgFlush();
}
SDL_Unlock_EventThread(); SDL_Unlock_EventThread();
......
...@@ -72,7 +72,8 @@ struct SDL_PrivateVideoData { ...@@ -72,7 +72,8 @@ struct SDL_PrivateVideoData {
PgColor_t savedpal[_Pg_MAX_PALETTE]; PgColor_t savedpal[_Pg_MAX_PALETTE];
PgColor_t syspalph[_Pg_MAX_PALETTE]; PgColor_t syspalph[_Pg_MAX_PALETTE];
struct { struct
{
PdDirectContext_t* direct_context; PdDirectContext_t* direct_context;
PdOffscreenContext_t* offscreen_context; PdOffscreenContext_t* offscreen_context;
PdOffscreenContext_t* offscreen_backcontext; PdOffscreenContext_t* offscreen_backcontext;
...@@ -86,6 +87,7 @@ struct SDL_PrivateVideoData { ...@@ -86,6 +87,7 @@ struct SDL_PrivateVideoData {
} ocimage; } ocimage;
PgHWCaps_t graphics_card_caps; /* Graphics card caps at the moment of start */ 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_video_mode; /* Stored mode before fullscreen switch */
int old_refresh_rate; /* Stored refresh rate befor fullscreen switch */ int old_refresh_rate; /* Stored refresh rate befor fullscreen switch */
...@@ -119,6 +121,7 @@ struct SDL_PrivateVideoData { ...@@ -119,6 +121,7 @@ struct SDL_PrivateVideoData {
#define currently_hided (this->hidden->currently_hided) #define currently_hided (this->hidden->currently_hided)
#define event (this->hidden->event) #define event (this->hidden->event)
#define current_overlay (this->hidden->overlay) #define current_overlay (this->hidden->overlay)
#define desktop_mode (this->hidden->desktop_mode)
/* Old variable names */ /* Old variable names */
#define mouse_relative (this->hidden->mouse_relative) #define mouse_relative (this->hidden->mouse_relative)
......
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