Date: Thu, 4 Dec 2003 07:48:40 +0200
From: "Mike Gorchak" Subject: SDL/QNX6 new patch Here in attachment my patch for the SDL/QNX6 again :) It contain non-crtitical/cosmetic fixes: 1. Fixed window centering at other than the first consoles. 2. Fixed window centering algorithm in case when window height or width are greater than the desktop resolution. 3. Fixed window positioning on other than the first consoles. 4. Fixed occasional input focus lost when switching to fullscreen. 5. Removed the Photon's default chroma color for the overlays, added RGB(12, 6, 12) color instead (very dark pink). 6. Added more checks to the YUV overlay code (fixed crashes during resolution mode switches). 7. Added support for Enter/Backspace keys in unicode mode (used by Maelstrom and by other games). 8. Fixed window restore/maximize function. It works, finally. --HG-- extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%40754
This commit is contained in:
parent
1e6f6032b2
commit
d182a96b90
10 changed files with 183 additions and 66 deletions
45
README.QNX
45
README.QNX
|
@ -1,5 +1,16 @@
|
||||||
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 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:
|
OpenGL:
|
||||||
|
@ -14,7 +25,7 @@ below 6.1.0 are not supported.
|
||||||
cially selected (QSSL made acceleration only for Voodoo boards in
|
cially selected (QSSL made acceleration only for Voodoo boards in
|
||||||
fullscreen mode, sorry but I don't have this board to test OpenGL -
|
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
|
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
|
remove the following
|
||||||
|
|
||||||
OGLAttrib[OGLargc++]=PHOGL_ATTRIB_FORCE_SW;
|
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.
|
root:root rights.
|
||||||
|
|
||||||
======================================================================
|
======================================================================
|
||||||
Video Overlays:
|
Hardware video overlays:
|
||||||
|
|
||||||
Overlays can flicker during window movement, resizing, etc. It
|
Overlays can flicker during window movement, resizing, etc. It
|
||||||
happens because the photon driver updates the real window contents be-
|
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-
|
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
|
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
|
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
|
in SDL distribution before the version 1.2.7 and doesn't know anything
|
||||||
"libtoolize --force --copy" and after that run the autogen.sh script.
|
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:
|
Some building issues:
|
||||||
|
@ -107,3 +121,24 @@ x11 support, e.g.:
|
||||||
./configure --with-sdl-prefix=/usr \
|
./configure --with-sdl-prefix=/usr \
|
||||||
--with-sdl-exec-prefix=/usr \
|
--with-sdl-exec-prefix=/usr \
|
||||||
--prefix=/usr --without-x
|
--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.
|
||||||
|
|
|
@ -62,7 +62,7 @@
|
||||||
</QPM:PackageDescription>
|
</QPM:PackageDescription>
|
||||||
|
|
||||||
<QPM:ProductDescription>
|
<QPM:ProductDescription>
|
||||||
<QPM:ProductName>SDL</QPM:ProductName>
|
<QPM:ProductName>Simple DirectMedia Layer (SDL)</QPM:ProductName>
|
||||||
<QPM:ProductIdentifier>SDL</QPM:ProductIdentifier>
|
<QPM:ProductIdentifier>SDL</QPM:ProductIdentifier>
|
||||||
<QPM:ProductEmail>slouken@libsdl.org</QPM:ProductEmail>
|
<QPM:ProductEmail>slouken@libsdl.org</QPM:ProductEmail>
|
||||||
<QPM:VendorName>public</QPM:VendorName>
|
<QPM:VendorName>public</QPM:VendorName>
|
||||||
|
@ -95,10 +95,11 @@
|
||||||
|
|
||||||
<QPM:ContentDescription>
|
<QPM:ContentDescription>
|
||||||
<QPM:ContentTopic xmlmultiple="true">Software Development/Libraries and Extensions/C Libraries</QPM:ContentTopic>
|
<QPM:ContentTopic xmlmultiple="true">Software Development/Libraries and Extensions/C Libraries</QPM:ContentTopic>
|
||||||
<QPM:ContentKeyword>SDL, audio, graphics, demos, games, emulators, media, layer</QPM:ContentKeyword>
|
<QPM:ContentKeyword>SDL, audio, graphics, demos, games, emulators, direct, media, layer</QPM:ContentKeyword>
|
||||||
<QPM:TargetOS>qnx6</QPM:TargetOS>
|
<QPM:TargetOS>qnx6</QPM:TargetOS>
|
||||||
<QPM:HostOS>none</QPM:HostOS>
|
<QPM:HostOS>none</QPM:HostOS>
|
||||||
<QPM:DisplayEnvironment xmlmultiple="true">Photon</QPM:DisplayEnvironment>
|
<QPM:DisplayEnvironment xmlmultiple="true">Photon</QPM:DisplayEnvironment>
|
||||||
|
<QPM:DisplayEnvironment xmlmultiple="true">Console</QPM:DisplayEnvironment>
|
||||||
<QPM:TargetAudience xmlmultiple="true">Developer</QPM:TargetAudience>
|
<QPM:TargetAudience xmlmultiple="true">Developer</QPM:TargetAudience>
|
||||||
<QPM:TargetAudience xmlmultiple="true">User</QPM:TargetAudience>
|
<QPM:TargetAudience xmlmultiple="true">User</QPM:TargetAudience>
|
||||||
</QPM:ContentDescription>
|
</QPM:ContentDescription>
|
||||||
|
|
|
@ -1582,7 +1582,9 @@ CheckDLOPEN()
|
||||||
|
|
||||||
if test x$use_dlopen = xyes; then
|
if test x$use_dlopen = xyes; then
|
||||||
CFLAGS="$CFLAGS -DUSE_DLOPEN"
|
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
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
|
@ -217,12 +217,12 @@ static int ph_DispatchEvent(_THIS)
|
||||||
set_motion_sensitivity(this, -1);
|
set_motion_sensitivity(this, -1);
|
||||||
posted = SDL_PrivateAppActive(1, SDL_APPINPUTFOCUS);
|
posted = SDL_PrivateAppActive(1, SDL_APPINPUTFOCUS);
|
||||||
}
|
}
|
||||||
/* request to quit */
|
/* quit request */
|
||||||
else if (winEvent->event_f==Ph_WM_CLOSE)
|
else if (winEvent->event_f==Ph_WM_CLOSE)
|
||||||
{
|
{
|
||||||
posted = SDL_PrivateQuit();
|
posted = SDL_PrivateQuit();
|
||||||
}
|
}
|
||||||
/* request to hide/unhide */
|
/* hide/unhide request */
|
||||||
else if (winEvent->event_f==Ph_WM_HIDE)
|
else if (winEvent->event_f==Ph_WM_HIDE)
|
||||||
{
|
{
|
||||||
if (currently_hided)
|
if (currently_hided)
|
||||||
|
@ -241,7 +241,7 @@ static int ph_DispatchEvent(_THIS)
|
||||||
/* request to resize */
|
/* request to resize */
|
||||||
else if (winEvent->event_f==Ph_WM_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 */
|
/* request to move */
|
||||||
else if (winEvent->event_f==Ph_WM_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 lockedstate=current_overlay->hwdata->locked;
|
||||||
int chromastate=current_overlay->hwdata->ischromakey;
|
int chromastate=current_overlay->hwdata->ischromakey;
|
||||||
|
int error;
|
||||||
SDL_Rect target;
|
SDL_Rect target;
|
||||||
|
|
||||||
current_overlay->hwdata->locked=1;
|
current_overlay->hwdata->locked=1;
|
||||||
|
@ -258,20 +259,25 @@ static int ph_DispatchEvent(_THIS)
|
||||||
target.w=current_overlay->hwdata->CurrentViewPort.size.w;
|
target.w=current_overlay->hwdata->CurrentViewPort.size.w;
|
||||||
target.h=current_overlay->hwdata->CurrentViewPort.size.h;
|
target.h=current_overlay->hwdata->CurrentViewPort.size.h;
|
||||||
current_overlay->hwdata->ischromakey=0;
|
current_overlay->hwdata->ischromakey=0;
|
||||||
ph_DisplayYUVOverlay(this, current_overlay, &target);
|
error=ph_DisplayYUVOverlay(this, current_overlay, &target);
|
||||||
|
if (!error)
|
||||||
|
{
|
||||||
current_overlay->hwdata->ischromakey=chromastate;
|
current_overlay->hwdata->ischromakey=chromastate;
|
||||||
current_overlay->hwdata->locked=lockedstate;
|
current_overlay->hwdata->locked=lockedstate;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/* request to maximize */
|
}
|
||||||
|
/* maximize request */
|
||||||
else if (winEvent->event_f==Ph_WM_MAX)
|
else if (winEvent->event_f==Ph_WM_MAX)
|
||||||
{
|
{
|
||||||
/* window already moved and resized here */
|
/* 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)
|
else if (winEvent->event_f==Ph_WM_RESTORE)
|
||||||
{
|
{
|
||||||
|
/* window already moved and resized here */
|
||||||
|
currently_maximized=0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -285,7 +291,7 @@ static int ph_DispatchEvent(_THIS)
|
||||||
{
|
{
|
||||||
rect = PhGetRects(event);
|
rect = PhGetRects(event);
|
||||||
|
|
||||||
for(i=0;i<event->num_rects;i++)
|
for(i=0; i<event->num_rects; i++)
|
||||||
{
|
{
|
||||||
sdlrects[i].x = rect[i].ul.x;
|
sdlrects[i].x = rect[i].ul.x;
|
||||||
sdlrects[i].y = rect[i].ul.y;
|
sdlrects[i].y = rect[i].ul.y;
|
||||||
|
@ -298,6 +304,7 @@ static int ph_DispatchEvent(_THIS)
|
||||||
if (current_overlay!=NULL)
|
if (current_overlay!=NULL)
|
||||||
{
|
{
|
||||||
int lockedstate=current_overlay->hwdata->locked;
|
int lockedstate=current_overlay->hwdata->locked;
|
||||||
|
int error;
|
||||||
SDL_Rect target;
|
SDL_Rect target;
|
||||||
|
|
||||||
current_overlay->hwdata->locked=1;
|
current_overlay->hwdata->locked=1;
|
||||||
|
@ -306,13 +313,16 @@ static int ph_DispatchEvent(_THIS)
|
||||||
target.w=current_overlay->hwdata->CurrentViewPort.size.w;
|
target.w=current_overlay->hwdata->CurrentViewPort.size.w;
|
||||||
target.h=current_overlay->hwdata->CurrentViewPort.size.h;
|
target.h=current_overlay->hwdata->CurrentViewPort.size.h;
|
||||||
current_overlay->hwdata->forcedredraw=1;
|
current_overlay->hwdata->forcedredraw=1;
|
||||||
ph_DisplayYUVOverlay(this, current_overlay, &target);
|
error=ph_DisplayYUVOverlay(this, current_overlay, &target);
|
||||||
|
if (!error)
|
||||||
|
{
|
||||||
current_overlay->hwdata->forcedredraw=0;
|
current_overlay->hwdata->forcedredraw=0;
|
||||||
current_overlay->hwdata->locked=lockedstate;
|
current_overlay->hwdata->locked=lockedstate;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case Ph_EV_KEY:
|
case Ph_EV_KEY:
|
||||||
|
@ -355,6 +365,11 @@ static int ph_DispatchEvent(_THIS)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case Ph_EV_INFO:
|
||||||
|
{
|
||||||
|
}
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
return(posted);
|
return(posted);
|
||||||
|
@ -542,8 +557,15 @@ SDL_keysym *ph_TranslateKey(PhKeyEvent_t *key, SDL_keysym *keysym)
|
||||||
|
|
||||||
switch (keysym->scancode)
|
switch (keysym->scancode)
|
||||||
{
|
{
|
||||||
|
/* Esc key */
|
||||||
case 0x01: keysym->unicode = 27;
|
case 0x01: keysym->unicode = 27;
|
||||||
break;
|
break;
|
||||||
|
/* BackSpace key */
|
||||||
|
case 0x0E: keysym->unicode = 127;
|
||||||
|
break;
|
||||||
|
/* Enter key */
|
||||||
|
case 0x1C: keysym->unicode = 10;
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
utf8len = PhKeyToMb(utf8, key);
|
utf8len = PhKeyToMb(utf8, key);
|
||||||
if (utf8len > 0)
|
if (utf8len > 0)
|
||||||
|
|
|
@ -186,7 +186,7 @@ static PtWidget_t *ph_CreateWindow(_THIS)
|
||||||
{
|
{
|
||||||
PtWidget_t *widget;
|
PtWidget_t *widget;
|
||||||
|
|
||||||
widget = PtCreateWidget(PtWindow, NULL, 0, 0);
|
widget = PtCreateWidget(PtWindow, NULL, 0, NULL);
|
||||||
|
|
||||||
return widget;
|
return widget;
|
||||||
}
|
}
|
||||||
|
@ -195,20 +195,28 @@ static int ph_SetupWindow(_THIS, int w, int h, int flags)
|
||||||
{
|
{
|
||||||
PtArg_t args[32];
|
PtArg_t args[32];
|
||||||
PhPoint_t pos = {0, 0};
|
PhPoint_t pos = {0, 0};
|
||||||
|
PhDim_t* olddim;
|
||||||
PhDim_t dim = {w, h};
|
PhDim_t dim = {w, h};
|
||||||
|
PhRect_t desktopextent;
|
||||||
int nargs = 0;
|
int nargs = 0;
|
||||||
const char* windowpos;
|
const char* windowpos;
|
||||||
const char* iscentered;
|
const char* iscentered;
|
||||||
int x, y;
|
int x, y;
|
||||||
|
|
||||||
|
/* 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);
|
PtSetArg(&args[nargs++], Pt_ARG_DIM, &dim, 0);
|
||||||
|
}
|
||||||
|
|
||||||
if ((flags & SDL_RESIZABLE) == SDL_RESIZABLE)
|
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_FALSE, 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_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_MAX | Ph_WM_RESTORE | Ph_WM_CLOSE);
|
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_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
|
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_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_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_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))
|
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_POS, &pos, 0);
|
||||||
PtSetArg(&args[nargs++], Pt_ARG_BASIC_FLAGS, Pt_TRUE, Pt_BASIC_PREVENT_FILL);
|
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);
|
PtSetArg(&args[nargs++], Pt_ARG_WINDOW_STATE, Pt_TRUE, Ph_WM_STATE_ISFRONT | Ph_WM_STATE_ISFOCUS | Ph_WM_STATE_ISALTKEY);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
|
if (!currently_maximized)
|
||||||
{
|
{
|
||||||
windowpos = getenv("SDL_VIDEO_WINDOW_POS");
|
windowpos = getenv("SDL_VIDEO_WINDOW_POS");
|
||||||
iscentered = getenv("SDL_VIDEO_CENTERED");
|
iscentered = getenv("SDL_VIDEO_CENTERED");
|
||||||
|
|
||||||
if ((iscentered) || ((windowpos) && (strcmp(windowpos, "center")==0)))
|
if ((iscentered) || ((windowpos) && (strcmp(windowpos, "center")==0)))
|
||||||
|
{
|
||||||
|
PhWindowQueryVisible(Ph_QUERY_CONSOLE, 0, 0, &desktopextent);
|
||||||
|
if (desktop_mode.width>w)
|
||||||
{
|
{
|
||||||
pos.x = (desktop_mode.width - w)/2;
|
pos.x = (desktop_mode.width - w)/2;
|
||||||
|
}
|
||||||
|
if (desktop_mode.height>h)
|
||||||
|
{
|
||||||
pos.y = (desktop_mode.height - h)/2;
|
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);
|
PtSetArg(&args[nargs++], Pt_ARG_POS, &pos, 0);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (windowpos)
|
if (windowpos)
|
||||||
{
|
{
|
||||||
if (sscanf(windowpos, "%d,%d", &x, &y) == 2 )
|
if (sscanf(windowpos, "%d,%d", &x, &y) == 2)
|
||||||
{
|
{
|
||||||
pos.x=x;
|
if ((x<desktop_mode.width) && (y<desktop_mode.height))
|
||||||
pos.y=y;
|
{
|
||||||
|
PhWindowQueryVisible(Ph_QUERY_CONSOLE, 0, 0, &desktopextent);
|
||||||
|
pos.x=x+desktopextent.ul.x;
|
||||||
|
pos.y=y+desktopextent.ul.y;
|
||||||
|
}
|
||||||
PtSetArg(&args[nargs++], Pt_ARG_POS, &pos, 0);
|
PtSetArg(&args[nargs++], Pt_ARG_POS, &pos, 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
PtSetArg(&args[nargs++], Pt_ARG_FILL_COLOR, Pg_BLACK, 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);
|
|
||||||
|
/* if window is maximized render it as maximized */
|
||||||
|
if (currently_maximized)
|
||||||
|
{
|
||||||
|
PtSetArg(&args[nargs++], Pt_ARG_WINDOW_STATE, Pt_TRUE, Ph_WM_STATE_ISMAX);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
PtSetArg(&args[nargs++], Pt_ARG_WINDOW_STATE, Pt_FALSE, Ph_WM_STATE_ISMAX);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* do not grab the keyboard by default */
|
||||||
|
PtSetArg(&args[nargs++], Pt_ARG_WINDOW_STATE, Pt_FALSE, Ph_WM_STATE_ISALTKEY);
|
||||||
|
|
||||||
|
/* bring the focus to the window */
|
||||||
|
PtSetArg(&args[nargs++], Pt_ARG_WINDOW_STATE, Pt_TRUE, Ph_WM_STATE_ISFOCUS);
|
||||||
|
|
||||||
|
/* allow to catch hide events */
|
||||||
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);
|
||||||
PtSetArg(&args[nargs++], Pt_ARG_RESIZE_FLAGS, Pt_FALSE, Pt_RESIZE_XY_AS_REQUIRED);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
PtSetResources(window, nargs, args);
|
PtSetResources(window, nargs, args);
|
||||||
|
@ -386,6 +427,7 @@ static int ph_VideoInit(_THIS, SDL_PixelFormat *vformat)
|
||||||
|
|
||||||
currently_fullscreen = 0;
|
currently_fullscreen = 0;
|
||||||
currently_hided = 0;
|
currently_hided = 0;
|
||||||
|
currently_maximized = 0;
|
||||||
current_overlay = NULL;
|
current_overlay = NULL;
|
||||||
|
|
||||||
OCImage.direct_context = NULL;
|
OCImage.direct_context = NULL;
|
||||||
|
@ -396,7 +438,6 @@ static int ph_VideoInit(_THIS, SDL_PixelFormat *vformat)
|
||||||
OCImage.FrameData0 = NULL;
|
OCImage.FrameData0 = NULL;
|
||||||
OCImage.FrameData1 = NULL;
|
OCImage.FrameData1 = NULL;
|
||||||
|
|
||||||
|
|
||||||
this->info.wm_available = 1;
|
this->info.wm_available = 1;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
|
@ -62,7 +62,8 @@ struct ColourMasks
|
||||||
};
|
};
|
||||||
|
|
||||||
/* Private display data */
|
/* Private display data */
|
||||||
struct SDL_PrivateVideoData {
|
struct SDL_PrivateVideoData
|
||||||
|
{
|
||||||
PgDisplaySettings_t mode_settings;
|
PgDisplaySettings_t mode_settings;
|
||||||
PtWidget_t *Window; /* used to handle input events */
|
PtWidget_t *Window; /* used to handle input events */
|
||||||
PhImage_t *image; /* used to display image */
|
PhImage_t *image; /* used to display image */
|
||||||
|
@ -102,6 +103,7 @@ struct SDL_PrivateVideoData {
|
||||||
|
|
||||||
int currently_fullscreen;
|
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;
|
PhEvent_t* event;
|
||||||
SDL_Overlay* overlay;
|
SDL_Overlay* overlay;
|
||||||
|
@ -120,6 +122,7 @@ struct SDL_PrivateVideoData {
|
||||||
#define syspalph (this->hidden->syspalph)
|
#define syspalph (this->hidden->syspalph)
|
||||||
#define currently_fullscreen (this->hidden->currently_fullscreen)
|
#define currently_fullscreen (this->hidden->currently_fullscreen)
|
||||||
#define currently_hided (this->hidden->currently_hided)
|
#define currently_hided (this->hidden->currently_hided)
|
||||||
|
#define currently_maximized (this->hidden->currently_maximized)
|
||||||
#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)
|
#define desktop_mode (this->hidden->desktop_mode)
|
||||||
|
|
|
@ -43,9 +43,6 @@ static char rcsid =
|
||||||
#include "SDL_ph_modes_c.h"
|
#include "SDL_ph_modes_c.h"
|
||||||
#include "SDL_ph_wm_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)
|
void ph_SetIcon(_THIS, SDL_Surface *icon, Uint8 *mask)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -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.w = width;
|
||||||
overlay->hwdata->props.src_dim.h = height;
|
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);
|
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))
|
if ((overlay->hwdata->ischromakey)&&(overlay->hwdata->chromakey))
|
||||||
{
|
{
|
||||||
overlay->hwdata->props.flags |= Pg_SCALER_PROP_CHROMA_ENABLE;
|
overlay->hwdata->props.flags |= Pg_SCALER_PROP_CHROMA_ENABLE;
|
||||||
|
overlay->hwdata->props.flags |= Pg_SCALER_PROP_CHROMA_SPECIFY_KEY_MASK;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -286,7 +289,7 @@ int ph_LockYUVOverlay(_THIS, SDL_Overlay* overlay)
|
||||||
{
|
{
|
||||||
if (overlay == NULL)
|
if (overlay == NULL)
|
||||||
{
|
{
|
||||||
return 0;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
overlay->hwdata->locked = 1;
|
overlay->hwdata->locked = 1;
|
||||||
|
@ -406,9 +409,9 @@ int ph_DisplayYUVOverlay(_THIS, SDL_Overlay* overlay, SDL_Rect* dstrect)
|
||||||
switch(rtncode)
|
switch(rtncode)
|
||||||
{
|
{
|
||||||
case -1:
|
case -1:
|
||||||
SDL_SetError("PgConfigScalerChannel failed\n");
|
SDL_SetError("PgConfigScalerChannel() function failed\n");
|
||||||
SDL_FreeYUVOverlay(overlay);
|
SDL_FreeYUVOverlay(overlay);
|
||||||
return (0);
|
return -1;
|
||||||
case 1:
|
case 1:
|
||||||
grab_ptrs2(overlay->hwdata->channel, overlay->hwdata->FrameData0, overlay->hwdata->FrameData1);
|
grab_ptrs2(overlay->hwdata->channel, overlay->hwdata->FrameData0, overlay->hwdata->FrameData1);
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -275,6 +275,7 @@ int main(int argc, char **argv)
|
||||||
SDL_Event event;
|
SDL_Event event;
|
||||||
Uint32 lastftick;
|
Uint32 lastftick;
|
||||||
int paused=0;
|
int paused=0;
|
||||||
|
int resized=0;
|
||||||
int i;
|
int i;
|
||||||
int fps=12;
|
int fps=12;
|
||||||
int fpsdelay;
|
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);
|
screen=SDL_SetVideoMode(event.resize.w, event.resize.h, 0, SDL_RESIZABLE | SDL_SWSURFACE);
|
||||||
overlayrect.w=event.resize.w;
|
overlayrect.w=event.resize.w;
|
||||||
overlayrect.h=event.resize.h;
|
overlayrect.h=event.resize.h;
|
||||||
|
if (paused)
|
||||||
|
{
|
||||||
|
resized=1;
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case SDL_KEYDOWN:
|
case SDL_KEYDOWN:
|
||||||
if (event.key.keysym.sym == SDLK_SPACE)
|
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();
|
lastftick=SDL_GetTicks();
|
||||||
|
|
||||||
|
@ -552,12 +557,19 @@ int main(int argc, char **argv)
|
||||||
}
|
}
|
||||||
|
|
||||||
SDL_DisplayYUVOverlay(overlay, &overlayrect);
|
SDL_DisplayYUVOverlay(overlay, &overlayrect);
|
||||||
|
if (!resized)
|
||||||
|
{
|
||||||
i++;
|
i++;
|
||||||
if (i==10)
|
if (i==10)
|
||||||
{
|
{
|
||||||
i=0;
|
i=0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
resized=0;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
/* kind of timeslice to OS */
|
/* kind of timeslice to OS */
|
||||||
SDL_Delay(1);
|
SDL_Delay(1);
|
||||||
|
|
|
@ -4,6 +4,7 @@
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
|
#include <math.h>
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
|
|
||||||
#include "SDL.h"
|
#include "SDL.h"
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue