diff --git a/README.QNX b/README.QNX index 2ad9d7980..91a477837 100644 --- a/README.QNX +++ b/README.QNX @@ -1,5 +1,16 @@ README by Mike Gorchak , -Last changed at 12 Aug 2003. +Last changed at 30 Sep 2003. + +====================================================================== +Table of Contents: + +1. OpenGL. +2. Wheel and multi-button mouses. +3. CDROM handling issues. +4. Hardware video overlays. +5. Shared library building. +6. Some building issues. +7. Environment variables. ====================================================================== OpenGL: @@ -14,7 +25,7 @@ below 6.1.0 are not supported. cially selected (QSSL made acceleration only for Voodoo boards in fullscreen mode, sorry but I don't have this board to test OpenGL - maybe it works or maybe not :)). If you want acceleration - you can -remove one line in the source code: find the file SDL_ph_video.c and +remove one line in the source code: find the file SDL_ph_image.c and remove the following OGLAttrib[OGLargc++]=PHOGL_ATTRIB_FORCE_SW; @@ -50,7 +61,7 @@ can't do anything about that, /dev/cd0 has brw------- permissions and root:root rights. ====================================================================== -Video Overlays: +Hardware video overlays: Overlays can flicker during window movement, resizing, etc. It happens because the photon driver updates the real window contents be- @@ -77,8 +88,11 @@ Shared library building: script you must manually delete the libtool.m4 stuff from the acinclu- de.m4 file (it comes after the ESD detection code up to the end of the file), because the libtool stuff in the acinclude.m4 file is very old -and doesn't know anything about QNX. Just remove it, then run -"libtoolize --force --copy" and after that run the autogen.sh script. +in SDL distribution before the version 1.2.7 and doesn't know anything +about QNX. SDL 1.2.7 distribution contain the new libtool.m4 script, +but anyway it is broken :), Just remove it, then run "libtoolize +--force --copy", delete the file aclocal.m4 and after that run the +autogen.sh script. ====================================================================== Some building issues: @@ -107,3 +121,24 @@ x11 support, e.g.: ./configure --with-sdl-prefix=/usr \ --with-sdl-exec-prefix=/usr \ --prefix=/usr --without-x + +====================================================================== +Environment variables: + + Please note that the photon driver is sensible to the following +environmental variables: + + * SDL_VIDEO_WINDOW_POS - can be set in the "X,Y" format. If X and Y +coordinates are bigger than the current desktop resolution, then win- +dow positioning across virtual consoles is activated. If X and Y are +smaller than the desktop resolution then window positioning in the +current console is activated. The word "center" can be used instead of +coordinates, it produces the same behavior as SDL_VIDEO_CENTERED +environmental variable. + + * SDL_VIDEO_CENTERED - if this environmental variable exists then the +window centering is perfomed in the current virtual console. + + The SDL_VIDEO_CENTERED enviromental variable has greater priority +than the SDL_VIDEO_WINDOW_POS in case if both variables are supplied +to the application. diff --git a/SDL.qpg.in b/SDL.qpg.in index 19a279843..a0d8f770d 100644 --- a/SDL.qpg.in +++ b/SDL.qpg.in @@ -62,7 +62,7 @@ - SDL + Simple DirectMedia Layer (SDL) SDL slouken@libsdl.org public @@ -95,10 +95,11 @@ Software Development/Libraries and Extensions/C Libraries - SDL, audio, graphics, demos, games, emulators, media, layer + SDL, audio, graphics, demos, games, emulators, direct, media, layer qnx6 none Photon + Console Developer User diff --git a/configure.in b/configure.in index 03350a4ea..ca234b692 100644 --- a/configure.in +++ b/configure.in @@ -1582,7 +1582,9 @@ CheckDLOPEN() if test x$use_dlopen = xyes; then CFLAGS="$CFLAGS -DUSE_DLOPEN" - AC_CHECK_LIB(dl, dlopen, SYSTEM_LIBS="$SYSTEM_LIBS -ldl", AC_CHECK_LIB(ltdl, dlopen, SYSTEM_LIBS="$SYSTEM_LIBS -lltdl")) + AC_CHECK_LIB(c, dlopen, SYSTEM_LIBS="$SYSTEM_LIBS", + AC_CHECK_LIB(dl, dlopen, SYSTEM_LIBS="$SYSTEM_LIBS -ldl", + AC_CHECK_LIB(ltdl, dlopen, SYSTEM_LIBS="$SYSTEM_LIBS -lltdl"))) fi fi } diff --git a/src/video/photon/SDL_ph_events.c b/src/video/photon/SDL_ph_events.c index ed7f2643f..ee485e5bf 100644 --- a/src/video/photon/SDL_ph_events.c +++ b/src/video/photon/SDL_ph_events.c @@ -217,12 +217,12 @@ static int ph_DispatchEvent(_THIS) set_motion_sensitivity(this, -1); posted = SDL_PrivateAppActive(1, SDL_APPINPUTFOCUS); } - /* request to quit */ + /* quit request */ else if (winEvent->event_f==Ph_WM_CLOSE) { posted = SDL_PrivateQuit(); } - /* request to hide/unhide */ + /* hide/unhide request */ else if (winEvent->event_f==Ph_WM_HIDE) { if (currently_hided) @@ -241,7 +241,7 @@ static int ph_DispatchEvent(_THIS) /* request to resize */ else if (winEvent->event_f==Ph_WM_RESIZE) { - SDL_PrivateResize(winEvent->size.w, winEvent->size.h); + SDL_PrivateResize(winEvent->size.w+1, winEvent->size.h+1); } /* request to move */ else if (winEvent->event_f==Ph_WM_MOVE) @@ -250,6 +250,7 @@ static int ph_DispatchEvent(_THIS) { int lockedstate=current_overlay->hwdata->locked; int chromastate=current_overlay->hwdata->ischromakey; + int error; SDL_Rect target; current_overlay->hwdata->locked=1; @@ -258,20 +259,25 @@ static int ph_DispatchEvent(_THIS) target.w=current_overlay->hwdata->CurrentViewPort.size.w; target.h=current_overlay->hwdata->CurrentViewPort.size.h; current_overlay->hwdata->ischromakey=0; - ph_DisplayYUVOverlay(this, current_overlay, &target); - current_overlay->hwdata->ischromakey=chromastate; - current_overlay->hwdata->locked=lockedstate; + error=ph_DisplayYUVOverlay(this, current_overlay, &target); + if (!error) + { + current_overlay->hwdata->ischromakey=chromastate; + current_overlay->hwdata->locked=lockedstate; + } } } - /* request to maximize */ + /* maximize request */ else if (winEvent->event_f==Ph_WM_MAX) { /* window already moved and resized here */ - SDL_PrivateResize(winEvent->size.w-winEvent->pos.x, winEvent->size.h-winEvent->pos.y); + currently_maximized=1; } - /* request to restore */ + /* restore request */ else if (winEvent->event_f==Ph_WM_RESTORE) { + /* window already moved and resized here */ + currently_maximized=0; } } break; @@ -285,7 +291,7 @@ static int ph_DispatchEvent(_THIS) { rect = PhGetRects(event); - for(i=0;inum_rects;i++) + for(i=0; inum_rects; i++) { sdlrects[i].x = rect[i].ul.x; sdlrects[i].y = rect[i].ul.y; @@ -298,6 +304,7 @@ static int ph_DispatchEvent(_THIS) if (current_overlay!=NULL) { int lockedstate=current_overlay->hwdata->locked; + int error; SDL_Rect target; current_overlay->hwdata->locked=1; @@ -306,9 +313,12 @@ static int ph_DispatchEvent(_THIS) target.w=current_overlay->hwdata->CurrentViewPort.size.w; target.h=current_overlay->hwdata->CurrentViewPort.size.h; current_overlay->hwdata->forcedredraw=1; - ph_DisplayYUVOverlay(this, current_overlay, &target); - current_overlay->hwdata->forcedredraw=0; - current_overlay->hwdata->locked=lockedstate; + error=ph_DisplayYUVOverlay(this, current_overlay, &target); + if (!error) + { + current_overlay->hwdata->forcedredraw=0; + current_overlay->hwdata->locked=lockedstate; + } } } } @@ -355,6 +365,11 @@ static int ph_DispatchEvent(_THIS) } } break; + + case Ph_EV_INFO: + { + } + break; } return(posted); @@ -542,13 +557,20 @@ SDL_keysym *ph_TranslateKey(PhKeyEvent_t *key, SDL_keysym *keysym) switch (keysym->scancode) { + /* Esc key */ case 0x01: keysym->unicode = 27; break; + /* BackSpace key */ + case 0x0E: keysym->unicode = 127; + break; + /* Enter key */ + case 0x1C: keysym->unicode = 10; + break; default: utf8len = PhKeyToMb(utf8, key); if (utf8len > 0) { - utf8len = mbtowc(&unicode, utf8, utf8len); + utf8len = mbtowc(&unicode, utf8, utf8len); if (utf8len > 0) { keysym->unicode = unicode; diff --git a/src/video/photon/SDL_ph_video.c b/src/video/photon/SDL_ph_video.c index 022493ac3..49f45bcb7 100644 --- a/src/video/photon/SDL_ph_video.c +++ b/src/video/photon/SDL_ph_video.c @@ -186,7 +186,7 @@ static PtWidget_t *ph_CreateWindow(_THIS) { PtWidget_t *widget; - widget = PtCreateWidget(PtWindow, NULL, 0, 0); + widget = PtCreateWidget(PtWindow, NULL, 0, NULL); return widget; } @@ -195,20 +195,28 @@ static int ph_SetupWindow(_THIS, int w, int h, int flags) { PtArg_t args[32]; PhPoint_t pos = {0, 0}; + PhDim_t* olddim; PhDim_t dim = {w, h}; + PhRect_t desktopextent; int nargs = 0; const char* windowpos; const char* iscentered; int x, y; - PtSetArg(&args[nargs++], Pt_ARG_DIM, &dim, 0); + /* check if window size has been changed by Window Manager */ + PtGetResource(window, Pt_ARG_DIM, &olddim, 0); + if ((olddim->w!=w) || (olddim->h!=h)) + { + PtSetArg(&args[nargs++], Pt_ARG_DIM, &dim, 0); + } if ((flags & SDL_RESIZABLE) == SDL_RESIZABLE) { - PtSetArg(&args[nargs++], Pt_ARG_WINDOW_MANAGED_FLAGS, Pt_FALSE, Ph_WM_RESIZE | Ph_WM_CLOSE); - PtSetArg(&args[nargs++], Pt_ARG_WINDOW_MANAGED_FLAGS, Pt_TRUE, Ph_WM_MAX | Ph_WM_RESTORE); - PtSetArg(&args[nargs++], Pt_ARG_WINDOW_NOTIFY_FLAGS, Pt_TRUE, Ph_WM_RESIZE | Ph_WM_MOVE | Ph_WM_MAX | Ph_WM_RESTORE | Ph_WM_CLOSE); + PtSetArg(&args[nargs++], Pt_ARG_WINDOW_MANAGED_FLAGS, Pt_FALSE, Ph_WM_CLOSE); + PtSetArg(&args[nargs++], Pt_ARG_WINDOW_MANAGED_FLAGS, Pt_TRUE, Ph_WM_MAX | Ph_WM_RESTORE | Ph_WM_RESIZE); + PtSetArg(&args[nargs++], Pt_ARG_WINDOW_NOTIFY_FLAGS, Pt_TRUE, Ph_WM_RESIZE | Ph_WM_MOVE | Ph_WM_CLOSE | Ph_WM_MAX | Ph_WM_RESTORE); PtSetArg(&args[nargs++], Pt_ARG_WINDOW_RENDER_FLAGS, Pt_TRUE, Ph_WM_RENDER_RESIZE | Ph_WM_RENDER_MAX | Ph_WM_RENDER_COLLAPSE | Ph_WM_RENDER_RETURN); + PtSetArg(&args[nargs++], Pt_ARG_RESIZE_FLAGS, Pt_TRUE, Pt_RESIZE_XY_AS_REQUIRED); } else { @@ -216,6 +224,7 @@ static int ph_SetupWindow(_THIS, int w, int h, int flags) PtSetArg(&args[nargs++], Pt_ARG_WINDOW_NOTIFY_FLAGS, Pt_FALSE, Ph_WM_RESIZE | Ph_WM_MAX | Ph_WM_RESTORE); PtSetArg(&args[nargs++], Pt_ARG_WINDOW_NOTIFY_FLAGS, Pt_TRUE, Ph_WM_MOVE | Ph_WM_CLOSE); PtSetArg(&args[nargs++], Pt_ARG_WINDOW_RENDER_FLAGS, Pt_FALSE, Ph_WM_RENDER_RESIZE | Ph_WM_RENDER_MAX | Ph_WM_RENDER_COLLAPSE | Ph_WM_RENDER_RETURN); + PtSetArg(&args[nargs++], Pt_ARG_RESIZE_FLAGS, Pt_FALSE, Pt_RESIZE_XY_AS_REQUIRED); } if (((flags & SDL_NOFRAME)==SDL_NOFRAME) || ((flags & SDL_FULLSCREEN)==SDL_FULLSCREEN)) @@ -240,39 +249,71 @@ static int ph_SetupWindow(_THIS, int w, int h, int flags) { 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 | Ph_WM_TOFRONT | Ph_WM_CONSWITCH); 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 (!currently_maximized) + { + 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 ((iscentered) || ((windowpos) && (strcmp(windowpos, "center")==0))) { - if (sscanf(windowpos, "%d,%d", &x, &y) == 2 ) + PhWindowQueryVisible(Ph_QUERY_CONSOLE, 0, 0, &desktopextent); + if (desktop_mode.width>w) { - pos.x=x; - pos.y=y; - PtSetArg(&args[nargs++], Pt_ARG_POS, &pos, 0); + pos.x = (desktop_mode.width - w)/2; } - } + if (desktop_mode.height>h) + { + pos.y = (desktop_mode.height - h)/2; + } + + pos.x+=desktopextent.ul.x; + pos.y+=desktopextent.ul.y; + PtSetArg(&args[nargs++], Pt_ARG_POS, &pos, 0); + } + else + { + if (windowpos) + { + if (sscanf(windowpos, "%d,%d", &x, &y) == 2) + { + if ((xinfo.wm_available = 1; diff --git a/src/video/photon/SDL_ph_video.h b/src/video/photon/SDL_ph_video.h index 3b0e3d9d2..b6ca3fbee 100644 --- a/src/video/photon/SDL_ph_video.h +++ b/src/video/photon/SDL_ph_video.h @@ -62,7 +62,8 @@ struct ColourMasks }; /* Private display data */ -struct SDL_PrivateVideoData { +struct SDL_PrivateVideoData +{ PgDisplaySettings_t mode_settings; PtWidget_t *Window; /* used to handle input events */ PhImage_t *image; /* used to display image */ @@ -96,12 +97,13 @@ struct SDL_PrivateVideoData { int mouse_relative; WMcursor* BlankCursor; - Uint32 depth; /* current visual depth (not bpp) */ - Uint32 desktopbpp; /* bpp of desktop at the moment of start */ - Uint32 desktoppal; /* palette mode emulation or system */ + Uint32 depth; /* current visual depth (not bpp) */ + Uint32 desktopbpp; /* bpp of desktop at the moment of start */ + Uint32 desktoppal; /* palette mode emulation or system */ int currently_fullscreen; - int currently_hided; /* 1 - window hided (minimazed), 0 - normal */ + int currently_hided; /* 1 - window hided (minimazed), 0 - normal */ + int currently_maximized; /* 1 - window hided (minimazed), 0 - normal */ PhEvent_t* event; SDL_Overlay* overlay; @@ -120,6 +122,7 @@ struct SDL_PrivateVideoData { #define syspalph (this->hidden->syspalph) #define currently_fullscreen (this->hidden->currently_fullscreen) #define currently_hided (this->hidden->currently_hided) +#define currently_maximized (this->hidden->currently_maximized) #define event (this->hidden->event) #define current_overlay (this->hidden->overlay) #define desktop_mode (this->hidden->desktop_mode) diff --git a/src/video/photon/SDL_ph_wm.c b/src/video/photon/SDL_ph_wm.c index 979711bfa..cb9879f76 100644 --- a/src/video/photon/SDL_ph_wm.c +++ b/src/video/photon/SDL_ph_wm.c @@ -43,9 +43,6 @@ static char rcsid = #include "SDL_ph_modes_c.h" #include "SDL_ph_wm_c.h" -/* This is necessary for working properly with Enlightenment, etc. */ -#define USE_ICON_WINDOW - void ph_SetIcon(_THIS, SDL_Surface *icon, Uint8 *mask) { return; diff --git a/src/video/photon/SDL_phyuv.c b/src/video/photon/SDL_phyuv.c index 5822eab15..aec0948cd 100644 --- a/src/video/photon/SDL_phyuv.c +++ b/src/video/photon/SDL_phyuv.c @@ -182,7 +182,9 @@ SDL_Overlay* ph_CreateYUVOverlay(_THIS, int width, int height, Uint32 format, SD overlay->hwdata->props.src_dim.w = width; overlay->hwdata->props.src_dim.h = height; - overlay->hwdata->chromakey = PgGetOverlayChromaColor(); + /* overlay->hwdata->chromakey = PgGetOverlayChromaColor(); */ + overlay->hwdata->chromakey = PgRGB(12, 6, 12); /* very dark pink color */ + overlay->hwdata->props.color_key = overlay->hwdata->chromakey; PhAreaToRect(&overlay->hwdata->CurrentViewPort, &overlay->hwdata->props.viewport); @@ -191,6 +193,7 @@ SDL_Overlay* ph_CreateYUVOverlay(_THIS, int width, int height, Uint32 format, SD if ((overlay->hwdata->ischromakey)&&(overlay->hwdata->chromakey)) { overlay->hwdata->props.flags |= Pg_SCALER_PROP_CHROMA_ENABLE; + overlay->hwdata->props.flags |= Pg_SCALER_PROP_CHROMA_SPECIFY_KEY_MASK; } else { @@ -286,7 +289,7 @@ int ph_LockYUVOverlay(_THIS, SDL_Overlay* overlay) { if (overlay == NULL) { - return 0; + return -1; } overlay->hwdata->locked = 1; @@ -332,7 +335,7 @@ void ph_UnlockYUVOverlay(_THIS, SDL_Overlay* overlay) { if (overlay == NULL) { - return; + return; } overlay->hwdata->locked = 0; @@ -406,9 +409,9 @@ int ph_DisplayYUVOverlay(_THIS, SDL_Overlay* overlay, SDL_Rect* dstrect) switch(rtncode) { case -1: - SDL_SetError("PgConfigScalerChannel failed\n"); + SDL_SetError("PgConfigScalerChannel() function failed\n"); SDL_FreeYUVOverlay(overlay); - return (0); + return -1; case 1: grab_ptrs2(overlay->hwdata->channel, overlay->hwdata->FrameData0, overlay->hwdata->FrameData1); break; diff --git a/test/testoverlay2.c b/test/testoverlay2.c index 16d465a7a..3b94bf8a2 100644 --- a/test/testoverlay2.c +++ b/test/testoverlay2.c @@ -275,6 +275,7 @@ int main(int argc, char **argv) SDL_Event event; Uint32 lastftick; int paused=0; + int resized=0; int i; int fps=12; int fpsdelay; @@ -505,6 +506,10 @@ int main(int argc, char **argv) screen=SDL_SetVideoMode(event.resize.w, event.resize.h, 0, SDL_RESIZABLE | SDL_SWSURFACE); overlayrect.w=event.resize.w; overlayrect.h=event.resize.h; + if (paused) + { + resized=1; + } break; case SDL_KEYDOWN: if (event.key.keysym.sym == SDLK_SPACE) @@ -526,9 +531,9 @@ int main(int argc, char **argv) } } - if (!paused) + if ((!paused)||(resized)) { - if ((SDL_GetTicks()-lastftick)>fpsdelay) + if (((SDL_GetTicks()-lastftick)>fpsdelay)||(resized)) { lastftick=SDL_GetTicks(); @@ -552,10 +557,17 @@ int main(int argc, char **argv) } SDL_DisplayYUVOverlay(overlay, &overlayrect); - i++; - if (i==10) + if (!resized) { - i=0; + i++; + if (i==10) + { + i=0; + } + } + else + { + resized=0; } } } diff --git a/test/testsprite.c b/test/testsprite.c index aa839fa5b..cd2ba4180 100644 --- a/test/testsprite.c +++ b/test/testsprite.c @@ -4,6 +4,7 @@ #include #include #include +#include #include #include "SDL.h"