Commit 9b315c4c authored by Sam Lantinga's avatar Sam Lantinga

Date: Sat, 2 Aug 2003 16:22:51 +0300

From: "Mike Gorchak"
Subject: New patches for QNX6

Here my patches for the SDL/QNX:

QNXSDL.diff - diff to non-QNX related sources:

- updated BUGS file, I think QNX6 is now will be officially supported
- configure.in - added shared library support for QNX, and removed dependency between the ALSA and QNX6.
- SDL_audio.c - added QNX NTO sound bootstrap insted of ALSA's.
- SDL_sysaudio.h - the same.
- SDL_nto_audio.c - the same.
- SDL_video.c - right now, QNX doesn't offer any method to obtain pointers to the OpenGL functions by function name, so they must be hardcoded in library, otherwise OpenGL will not be supported.
- testsprite.c - fixed: do not draw vertical red line if we are in non-double-buffered mode.

sdlqnxph.tar.gz - archive of the ./src/video/photon/* . Too many changes in code to make diffs :) :

+ Added stub for support hide/unhide window event
+ Added full YUV overlays support.
+ Added window maximize support.
+ Added mouse wheel events.
+ Added support for some specific key codes in Unicode mode (like ESC).
+ Added more checks to the all memory allocation code.
+ Added SDL_DOUBLEBUF support in all fullscreen modes.
+ Added fallback to window mode, if desired fullscreen mode is not supported.
+ Added stub support for the GL_LoadLibrary and GL_GetProcAddress functions.
+ Added resizable window support without caption.
! Fixed bug in the Ph_EV_EXPOSE event handler, when rectangles to update is 0 and when width or height of the rectangle is 0.
! Fixed bug in the event handler code. Events has not been passed to the window widget handler.
! Fixed codes for Win keys (Super/Hyper/Menu).
! Fixed memory leak, when deallocation palette.
! Fixed palette emulation code bugs.
! Fixed fullscreen and hwsurface handling.
! Fixed CLOSE button bug. First event was passed to the handler, but second terminated the application. Now all events passed to the application correctly.
- Removed all printfs in code, now SDL_SetError used instead of them.
- Disabled ToggleFullScreen function.

README.QNX - updated README.QNX file. Added much more issues.

--HG--
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%40664
parent 21c236f4
...@@ -141,6 +141,10 @@ EPOC: ...@@ -141,6 +141,10 @@ 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:
Fullscreen switch doesn't work correctly.
OpenBSD: -= NOT YET SUPPORTED =- OpenBSD: -= NOT YET SUPPORTED =-
This is reported to work, but I haven't verified this. This is reported to work, but I haven't verified this.
...@@ -183,13 +187,6 @@ AIX: -= NOT YET SUPPORTED =- ...@@ -183,13 +187,6 @@ AIX: -= NOT YET SUPPORTED =-
More information on this port is available at: More information on this port is available at:
http://www.kom.e-technik.tu-darmstadt.de/~griff/SDL/ http://www.kom.e-technik.tu-darmstadt.de/~griff/SDL/
QNX: -= NOT YET SUPPORTED =-
Only static libraries are being made, no shared ones.
The only hardware surface is the primary view surface.
Fullscreen doesn't display correctly.
AmigaOS: -= NOT YET SUPPORTED =- AmigaOS: -= NOT YET SUPPORTED =-
The OpenGL support isn't implemented yet. The OpenGL support isn't implemented yet.
......
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.
=========================================================================
OpenGL:
OpenGL in window mode works well and stable, in fullscreen OpenGL in window mode works well and stable, in fullscreen
mode too, but fullscreen mode has not been heavily tested. mode too, but fullscreen mode has not been heavily tested yet.
If you have QNX RtP 6.1.0 w/ or w/o Patch A you must download If you have QNX RtP version 6.1.0 and above you must download
new Photon3D runtime from http://developers.qnx.com. The versions new Photon3D runtime from http://developers.qnx.com or install it
of OS before 6.1.0 are not supported. from public repository or from public CD, available with QNX. The
versions of OS before 6.1.0 are not supported.
Problems: While creating OpenGL context software renderer mode is
1. While creating OpenGL context software renderer mode is artificially selected (QSSL made acceleration only for Voodoo
artificially selected (QSSL made acceleration only for Voodoo boards in fullscreen mode, sorry but I don't have this board to
boards in fullscreen mode, sorry but I don't have this board, test OpenGL - maybe it work or maybe not :)). If you want accele-
if you want acceleration - you may remove some line in source ration - you may remove some line in source code: find the file
code). SDL_ph_video.c and remove the following
2. Photon has some errors in detecting how much bits per pixel
videomode has. OGLAttrib[OGLargc++]=PHOGL_ATTRIB_FORCE_SW;
3. No shared libraries yet. We need manually set flag to
'configure' --disable-shared. line in the ph_SetupOpenGLContext() function or change argument
4. Due to Photon API limitation, flag SDL_HWSURFACE supported on- to the PHOGL_ATTRIB_FORCE_HW or PHOGL_ATTRIB_FAVOR_HW.
ly in case of desktop bpp is equal requested bpp in window mo-
de. =========================================================================
Wheel and multibutton mouses:
Photon emitting keyboard events (key up and down) when moved
mouse wheel. But key_scan field appears valid according to flags,
and it contain zero. It is base method of detecting mouse wheel
events under photon. It looks like a hack, but it works for me :)
on different PC configurations.
I'm tested it on:
1. Genius Optical NetScroll/+ (1 wheel)
2. A4Tech Optical GreatEye WheelMouse, model: WOP-35. (2 wheels +
2 additional buttons). Wheel for vertical scrolling works as
usual, but second wheel for horizontal scrolling emitting two
consequented events up or down, so it can provide more fast
scrolling then the first wheel. Additional buttons doesn't
emitting any events, but its look like handled by photon in
unusual way - like click to front, but works not with any win-
dow, looks like bug-o-feature :).
=========================================================================
CDROM handling issues:
Access to CDROM can be provided only with 'root' previleges.
I can't do anything with this fact. /dev/cd0 have the brw-------
flags and root:root rights.
=========================================================================
Video Overlays:
Overlays can flickering during the window movement, resizing,
etc. It happens because photon driver updates the real window
contents behind the overlay, then draws the temporary chroma key
color over window contents. It can be done without the chroma key
using but it cause overlay will be always on top. So flickering
during the movement much better in that case.
Double buffering code temporary disabled in the photon driver
code, beacuse on my GF2-MX it cause accidently buffer switch,
which going to the old frame showing. S3 Savage3D have the same
problem, but ATI Rage 128 has not this problem. I think it can be
fixed later. Current code works very fine, so maybe double buffe-
ring is not needed right now.
Something strange appears when you tried to move window with
overlay beyond the left border of the screen. Overlay trying to
stay at position x=0, but when tried to move it a bit more it
jumps at posituin x=-60. Really strange, looks like overlay
doesn't love the negotive coordinates.
=========================================================================
Shared library building:
Shared library can be built, but before running autogen.sh
script you need manually delete the libtool m4 stuff from
the acinclude.m4 file (it comes after ESD detection code up to
end of the file). Because libtool stuff in the acinclude.m4 file
very old and doesn't know anything about the QNX. Just remove it
and run autogen.sh script.
=========================================================================
Some building issues: Some building issues:
Feel free to not pass --disable-shared option to configure,
if you read comment above about 'Shared library building'. Other-
wise this option is strongly recomended, because the sdl-config
script will be unfunctional.
Run configure script without x11 support, e.g.: Run configure script without x11 support, e.g.:
a) for OpenGL support: a) for OpenGL support:
...@@ -42,3 +109,4 @@ support, e.g.: ...@@ -42,3 +109,4 @@ support, e.g.:
--with-sdl-exec-prefix=/usr/local \ --with-sdl-exec-prefix=/usr/local \
--prefix=/usr/local --without-x --prefix=/usr/local --without-x
...@@ -2531,6 +2531,9 @@ case "$ARCH" in ...@@ -2531,6 +2531,9 @@ case "$ARCH" in
openbsd | netbsd | bsdi) openbsd | netbsd | bsdi)
SHARED_SYSTEM_LIBS="$SYSTEM_LIBS" SHARED_SYSTEM_LIBS="$SYSTEM_LIBS"
;; ;;
qnx)
SHARED_SYSTEM_LIBS="$SYSTEM_LIBS"
;;
macosx) macosx)
SHARED_SYSTEM_LIBS="-framework Cocoa" SHARED_SYSTEM_LIBS="-framework Cocoa"
if test x$enable_video = xyes -a x$enable_video_opengl = xyes; then if test x$enable_video = xyes -a x$enable_video_opengl = xyes; then
......
...@@ -50,6 +50,9 @@ static AudioBootStrap *bootstrap[] = { ...@@ -50,6 +50,9 @@ static AudioBootStrap *bootstrap[] = {
#ifdef ALSA_SUPPORT #ifdef ALSA_SUPPORT
&ALSA_bootstrap, &ALSA_bootstrap,
#endif #endif
#ifdef QNXNTOAUDIO_SUPPORT
&QNXNTOAUDIO_bootstrap,
#endif
#ifdef SUNAUDIO_SUPPORT #ifdef SUNAUDIO_SUPPORT
&SUNAUDIO_bootstrap, &SUNAUDIO_bootstrap,
#endif #endif
......
...@@ -114,6 +114,9 @@ extern AudioBootStrap DMA_bootstrap; ...@@ -114,6 +114,9 @@ extern AudioBootStrap DMA_bootstrap;
#ifdef ALSA_SUPPORT #ifdef ALSA_SUPPORT
extern AudioBootStrap ALSA_bootstrap; extern AudioBootStrap ALSA_bootstrap;
#endif #endif
#ifdef QNXNTOAUDIO_SUPPORT
extern AudioBootStrap QNXNTOAUDIO_bootstrap;
#endif
#ifdef SUNAUDIO_SUPPORT #ifdef SUNAUDIO_SUPPORT
extern AudioBootStrap SUNAUDIO_bootstrap; extern AudioBootStrap SUNAUDIO_bootstrap;
#endif #endif
......
...@@ -163,9 +163,8 @@ static SDL_AudioDevice *Audio_CreateDevice(int devindex) ...@@ -163,9 +163,8 @@ static SDL_AudioDevice *Audio_CreateDevice(int devindex)
return this; return this;
} }
/* Don't change the name from "ALSA_bootstrap" - that's how it's called */ AudioBootStrap QNXNTOAUDIO_bootstrap = {
AudioBootStrap ALSA_bootstrap = { DRIVER_NAME, "QNX6 NTO PCM audio",
DRIVER_NAME, "Neutrino PCM audio",
Audio_Available, Audio_CreateDevice Audio_Available, Audio_CreateDevice
}; };
...@@ -489,4 +488,3 @@ static int NTO_OpenAudio(_THIS, SDL_AudioSpec *spec) ...@@ -489,4 +488,3 @@ static int NTO_OpenAudio(_THIS, SDL_AudioSpec *spec)
/* We're ready to rock and roll. :-) */ /* We're ready to rock and roll. :-) */
return(0); return(0);
} }
...@@ -727,6 +727,7 @@ SDL_Surface * SDL_SetVideoMode (int width, int height, int bpp, Uint32 flags) ...@@ -727,6 +727,7 @@ SDL_Surface * SDL_SetVideoMode (int width, int height, int bpp, Uint32 flags)
#ifdef HAVE_OPENGL #ifdef HAVE_OPENGL
/* Load GL symbols (before MakeCurrent, where we need glGetString). */ /* Load GL symbols (before MakeCurrent, where we need glGetString). */
if ( flags & (SDL_OPENGL | SDL_OPENGLBLIT) ) { if ( flags & (SDL_OPENGL | SDL_OPENGLBLIT) ) {
#ifndef __QNXNTO__
#define SDL_PROC(ret,func,params) \ #define SDL_PROC(ret,func,params) \
do { \ do { \
video->func = SDL_GL_GetProcAddress(#func); \ video->func = SDL_GL_GetProcAddress(#func); \
...@@ -735,6 +736,9 @@ do { \ ...@@ -735,6 +736,9 @@ do { \
return(NULL); \ return(NULL); \
} \ } \
} while ( 0 ); } while ( 0 );
#else
#define SDL_PROC(ret,func,params) video->func=func;
#endif /* __QNXNTO__ */
#include "SDL_glfuncs.h" #include "SDL_glfuncs.h"
#undef SDL_PROC #undef SDL_PROC
} }
......
...@@ -29,12 +29,13 @@ static char rcsid = ...@@ -29,12 +29,13 @@ static char rcsid =
#define DISABLE_X11 #define DISABLE_X11
#include <Ph.h>
#include <stdio.h> #include <stdio.h>
#include <setjmp.h> #include <setjmp.h>
#include <photon/PkKeyDef.h>
#include <sys/time.h> #include <sys/time.h>
#include <Ph.h>
#include <photon/PkKeyDef.h>
#include "SDL.h" #include "SDL.h"
#include "SDL_syswm.h" #include "SDL_syswm.h"
#include "SDL_sysevents.h" #include "SDL_sysevents.h"
...@@ -44,6 +45,8 @@ static char rcsid = ...@@ -44,6 +45,8 @@ static char rcsid =
#include "SDL_ph_modes_c.h" #include "SDL_ph_modes_c.h"
#include "SDL_ph_image_c.h" #include "SDL_ph_image_c.h"
#include "SDL_ph_events_c.h" #include "SDL_ph_events_c.h"
#include "SDL_phyuv_c.h"
/* The translation tables from a photon keysym to a SDL keysym */ /* The translation tables from a photon keysym to a SDL keysym */
...@@ -90,8 +93,8 @@ static void set_motion_sensitivity(_THIS, unsigned int flags) ...@@ -90,8 +93,8 @@ static void set_motion_sensitivity(_THIS, unsigned int flags)
if( window ) if( window )
{ {
rid = PtWidgetRid( window ); rid = PtWidgetRid(window);
if( rid != 0 && PhRegionQuery( rid, &region, NULL, NULL, 0 ) == 0 ) if( rid != 0 && PhRegionQuery(rid, &region, NULL, NULL, 0) == 0 )
{ {
region.events_sense=(region.events_sense & ~fields)|(flags & fields); region.events_sense=(region.events_sense & ~fields)|(flags & fields);
PhRegionChange(Ph_REGION_EV_SENSE, 0, &region, NULL, NULL); PhRegionChange(Ph_REGION_EV_SENSE, 0, &region, NULL, NULL);
...@@ -114,6 +117,8 @@ static Uint8 ph2sdl_mousebutton(unsigned short button_state) ...@@ -114,6 +117,8 @@ static Uint8 ph2sdl_mousebutton(unsigned short button_state)
return (mouse_button); return (mouse_button);
} }
// void* PtAppCreateContext();
static int ph_DispatchEvent(_THIS) static int ph_DispatchEvent(_THIS)
{ {
int posted; int posted;
...@@ -217,21 +222,64 @@ static int ph_DispatchEvent(_THIS) ...@@ -217,21 +222,64 @@ static int ph_DispatchEvent(_THIS)
{ {
posted = SDL_PrivateQuit(); posted = SDL_PrivateQuit();
} }
/* request to hide/unhide */
else if (winEvent->event_f==Ph_WM_HIDE)
{
if (currently_hided)
{
/* got unhide window event */
/* TODO: restore application's palette if in palette mode */
currently_hided=0;
}
else
{
/* got hide window event */
/* TODO: restore original palette if in palette mode */
currently_hided=1;
}
}
/* 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, winEvent->size.h);
} }
/* request to move */
else if (winEvent->event_f==Ph_WM_MOVE)
{
if (current_overlay!=NULL)
{
int lockedstate=current_overlay->hwdata->locked;
int chromastate=current_overlay->hwdata->ischromakey;
SDL_Rect target;
current_overlay->hwdata->locked=1;
target.x=current_overlay->hwdata->CurrentViewPort.pos.x;
target.y=current_overlay->hwdata->CurrentViewPort.pos.y;
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;
}
}
/* request to maximize */ /* request to maximize */
else if (winEvent->event_f==Ph_WM_MAX) else if (winEvent->event_f==Ph_WM_MAX)
{ {
/* TODO: get screen resolution, set window pos to 0, 0 and resize it ! */ /* window already moved and resized here */
SDL_PrivateResize(winEvent->size.w-winEvent->pos.x, winEvent->size.h-winEvent->pos.y);
}
/* request to restore */
else if (winEvent->event_f==Ph_WM_RESTORE)
{
} }
} }
break; break;
/* window has been resized, moved or removed */ /* window has been resized, moved or removed */
case Ph_EV_EXPOSE: case Ph_EV_EXPOSE:
{
if (event->num_rects!=0)
{ {
if (SDL_VideoSurface) if (SDL_VideoSurface)
{ {
...@@ -246,6 +294,23 @@ static int ph_DispatchEvent(_THIS) ...@@ -246,6 +294,23 @@ static int ph_DispatchEvent(_THIS)
} }
this->UpdateRects(this, event->num_rects, sdlrects); this->UpdateRects(this, event->num_rects, sdlrects);
if (current_overlay!=NULL)
{
int lockedstate=current_overlay->hwdata->locked;
SDL_Rect target;
current_overlay->hwdata->locked=1;
target.x=current_overlay->hwdata->CurrentViewPort.pos.x;
target.y=current_overlay->hwdata->CurrentViewPort.pos.y;
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;
}
}
} }
} }
break; break;
...@@ -260,13 +325,32 @@ static int ph_DispatchEvent(_THIS) ...@@ -260,13 +325,32 @@ static int ph_DispatchEvent(_THIS)
if (Pk_KF_Key_Down & keyEvent->key_flags) if (Pk_KF_Key_Down & keyEvent->key_flags)
{ {
/* split the wheel events from real key events */
if ((keyEvent->key_cap==Pk_Up) && (keyEvent->key_scan==0) && ((keyEvent->key_flags & Pk_KF_Scan_Valid)==Pk_KF_Scan_Valid))
{
posted = SDL_PrivateMouseButton(SDL_PRESSED, SDL_BUTTON_WHEELUP, 0, 0);
break;
}
if ((keyEvent->key_cap==Pk_Down) && (keyEvent->key_scan==0) && ((keyEvent->key_flags & Pk_KF_Scan_Valid)==Pk_KF_Scan_Valid))
{
posted = SDL_PrivateMouseButton(SDL_PRESSED, SDL_BUTTON_WHEELDOWN, 0, 0);
break;
}
posted = SDL_PrivateKeyboard(SDL_PRESSED, ph_TranslateKey(keyEvent, &keysym)); posted = SDL_PrivateKeyboard(SDL_PRESSED, ph_TranslateKey(keyEvent, &keysym));
} }
else /* must be key release */ else /* must be key release */
{ {
/* Ignore repeated key release events */ /* split the wheel events from real key events */
/* if (! Pk_KF_Key_Repeat & keyEvent->key_flags ) */ if ((keyEvent->key_cap==Pk_Up) && (keyEvent->key_scan==0) && ((keyEvent->key_flags & Pk_KF_Scan_Valid)==Pk_KF_Scan_Valid))
{
posted = SDL_PrivateMouseButton(SDL_RELEASED, SDL_BUTTON_WHEELUP, 0, 0);
break;
}
if ((keyEvent->key_cap==Pk_Down) && (keyEvent->key_scan==0) && ((keyEvent->key_flags & Pk_KF_Scan_Valid)==Pk_KF_Scan_Valid))
{
posted = SDL_PrivateMouseButton(SDL_RELEASED, SDL_BUTTON_WHEELDOWN, 0, 0);
break;
}
posted = SDL_PrivateKeyboard(SDL_RELEASED, ph_TranslateKey( keyEvent, &keysym)); posted = SDL_PrivateKeyboard(SDL_RELEASED, ph_TranslateKey( keyEvent, &keysym));
} }
} }
...@@ -282,9 +366,9 @@ int ph_Pending(_THIS) ...@@ -282,9 +366,9 @@ int ph_Pending(_THIS)
/* Flush the display connection and look to see if events are queued */ /* Flush the display connection and look to see if events are queued */
PgFlush(); PgFlush();
while( 1 ) while (1)
{ /* note this is a non-blocking call */ {
switch( PhEventPeek( event, EVENT_SIZE ) ) switch(PhEventPeek(event, EVENT_SIZE))
{ {
case Ph_EVENT_MSG: case Ph_EVENT_MSG:
return 1; return 1;
...@@ -308,6 +392,7 @@ void ph_PumpEvents(_THIS) ...@@ -308,6 +392,7 @@ void ph_PumpEvents(_THIS)
while (ph_Pending(this)) while (ph_Pending(this))
{ {
PtEventHandler(event);
ph_DispatchEvent(this); ph_DispatchEvent(this);
} }
} }
...@@ -318,11 +403,15 @@ void ph_InitKeymap(void) ...@@ -318,11 +403,15 @@ void ph_InitKeymap(void)
/* Odd keys used in international keyboards */ /* Odd keys used in international keyboards */
for (i=0; i<SDL_TABLESIZE(ODD_keymap); ++i) for (i=0; i<SDL_TABLESIZE(ODD_keymap); ++i)
{
ODD_keymap[i] = SDLK_UNKNOWN; ODD_keymap[i] = SDLK_UNKNOWN;
}
/* Map the miscellaneous keys */ /* Map the miscellaneous keys */
for (i=0; i<SDL_TABLESIZE(MISC_keymap); ++i) for (i=0; i<SDL_TABLESIZE(MISC_keymap); ++i)
{
MISC_keymap[i] = SDLK_UNKNOWN; MISC_keymap[i] = SDLK_UNKNOWN;
}
MISC_keymap[Pk_BackSpace&0xFF] = SDLK_BACKSPACE; MISC_keymap[Pk_BackSpace&0xFF] = SDLK_BACKSPACE;
MISC_keymap[Pk_Tab&0xFF] = SDLK_TAB; MISC_keymap[Pk_Tab&0xFF] = SDLK_TAB;
...@@ -388,15 +477,19 @@ void ph_InitKeymap(void) ...@@ -388,15 +477,19 @@ void ph_InitKeymap(void)
MISC_keymap[Pk_Alt_L&0xFF] = SDLK_LALT; MISC_keymap[Pk_Alt_L&0xFF] = SDLK_LALT;
MISC_keymap[Pk_Meta_R&0xFF] = SDLK_RMETA; MISC_keymap[Pk_Meta_R&0xFF] = SDLK_RMETA;
MISC_keymap[Pk_Meta_L&0xFF] = SDLK_LMETA; MISC_keymap[Pk_Meta_L&0xFF] = SDLK_LMETA;
MISC_keymap[Pk_Super_L&0xFF] = SDLK_LSUPER; /* Left "Windows" */ MISC_keymap[Pk_Super_L&0xFF] = SDLK_LSUPER;
MISC_keymap[Pk_Super_R&0xFF] = SDLK_RSUPER; /* Right "Windows" */ MISC_keymap[Pk_Super_R&0xFF] = SDLK_RSUPER;
MISC_keymap[Pk_Mode_switch&0xFF] = SDLK_MODE; /* "Alt Gr" key */ MISC_keymap[Pk_Mode_switch&0xFF] = SDLK_MODE; /* "Alt Gr" key */
MISC_keymap[Pk_Help&0xFF] = SDLK_HELP; MISC_keymap[Pk_Help&0xFF] = SDLK_HELP;
MISC_keymap[Pk_Print&0xFF] = SDLK_PRINT; MISC_keymap[Pk_Print&0xFF] = SDLK_PRINT;
MISC_keymap[Pk_Break&0xFF] = SDLK_BREAK; MISC_keymap[Pk_Break&0xFF] = SDLK_BREAK;
MISC_keymap[Pk_Menu&0xFF] = SDLK_MENU; MISC_keymap[Pk_Menu&0xFF] = SDLK_MENU; /* Windows "Menu" key */
MISC_keymap[Pk_Hyper_R&0xFF] = SDLK_MENU; /* Windows "Menu" key */
MISC_keymap[Pk_Hyper_R&0xFF] = SDLK_RSUPER; /* Right "Windows" */
/* Left "Windows" key, but it can't be catched by application */
MISC_keymap[Pk_Hyper_L&0xFF] = SDLK_LSUPER;
} }
static unsigned long cap; static unsigned long cap;
...@@ -447,14 +540,24 @@ SDL_keysym *ph_TranslateKey(PhKeyEvent_t *key, SDL_keysym *keysym) ...@@ -447,14 +540,24 @@ SDL_keysym *ph_TranslateKey(PhKeyEvent_t *key, SDL_keysym *keysym)
int utf8len; int utf8len;
wchar_t unicode; wchar_t unicode;
switch (keysym->scancode)
{
case 0x01: keysym->unicode = 27;
break;
default:
utf8len = PhKeyToMb(utf8, key); utf8len = PhKeyToMb(utf8, key);
if (utf8len > 0) if (utf8len > 0)
{ {
utf8len = mbtowc(&unicode, utf8, utf8len); utf8len = mbtowc(&unicode, utf8, utf8len);
if (utf8len > 0) if (utf8len > 0)
{
keysym->unicode = unicode; keysym->unicode = unicode;
} }
} }
break;
}
}
return (keysym); return (keysym);
} }
......
This diff is collapsed.
...@@ -39,4 +39,5 @@ extern int ph_FlipHWSurface(_THIS, SDL_Surface *surface); ...@@ -39,4 +39,5 @@ extern int ph_FlipHWSurface(_THIS, SDL_Surface *surface);
extern void ph_NormalUpdate(_THIS, int numrects, SDL_Rect *rects); extern void ph_NormalUpdate(_THIS, int numrects, SDL_Rect *rects);
extern void ph_OCUpdate(_THIS, int numrects, SDL_Rect *rects); extern void ph_OCUpdate(_THIS, int numrects, SDL_Rect *rects);
extern void ph_OCDCUpdate(_THIS, int numrects, SDL_Rect *rects);
extern void ph_OpenGLUpdate(_THIS, int numrects, SDL_Rect *rects); extern void ph_OpenGLUpdate(_THIS, int numrects, SDL_Rect *rects);
...@@ -25,6 +25,7 @@ static char rcsid = ...@@ -25,6 +25,7 @@ static char rcsid =
"@(#) $Id$"; "@(#) $Id$";
#endif #endif
#include "SDL_error.h"
#include "SDL_ph_modes_c.h" #include "SDL_ph_modes_c.h"
static unsigned long key1, key2; static unsigned long key1, key2;
...@@ -39,8 +40,6 @@ static int compare_modes_by_res(const void* mode1, const void* mode2) ...@@ -39,8 +40,6 @@ static int compare_modes_by_res(const void* mode1, const void* mode2)
{ {
if (PgGetVideoModeInfo(*(unsigned short*)mode1, &mode_info) < 0) if (PgGetVideoModeInfo(*(unsigned short*)mode1, &mode_info) < 0)
{ {
fprintf(stderr,"error: In compare_modes_by_res PgGetVideoModeInfo failed on mode: 0x%x\n",
*(unsigned short*)mode1);
return 0; return 0;
} }
...@@ -48,19 +47,26 @@ static int compare_modes_by_res(const void* mode1, const void* mode2) ...@@ -48,19 +47,26 @@ static int compare_modes_by_res(const void* mode1, const void* mode2)
if (PgGetVideoModeInfo(*(unsigned short*)mode2, &mode_info) < 0) if (PgGetVideoModeInfo(*(unsigned short*)mode2, &mode_info) < 0)
{ {
fprintf(stderr,"error: In compare_modes_by_res PgGetVideoModeInfo failed on mode: 0x%x\n",
*(unsigned short*)mode2);
return 0; return 0;
} }
key2 = mode_info.width * mode_info.height; key2 = mode_info.width * mode_info.height;
if (key1 > key2) if (key1 > key2)
{
return 1; return 1;
else if (key1 == key2) }
else
{
if (key1 == key2)
{
return 0; return 0;
}
else else
{
return -1; return -1;
}
}
} }
SDL_Rect **ph_ListModes(_THIS, SDL_PixelFormat *format, Uint32 flags) SDL_Rect **ph_ListModes(_THIS, SDL_PixelFormat *format, Uint32 flags)
...@@ -76,7 +82,7 @@ SDL_Rect **ph_ListModes(_THIS, SDL_PixelFormat *format, Uint32 flags) ...@@ -76,7 +82,7 @@ SDL_Rect **ph_ListModes(_THIS, SDL_PixelFormat *format, Uint32 flags)
if (PgGetVideoModeList( &mode_list ) < 0) if (PgGetVideoModeList( &mode_list ) < 0)
{ {
fprintf(stderr,"error: PgGetVideoModeList failed\n"); SDL_SetError("ph_ListModes(): PgGetVideoModeList() function failed !\n");
return NULL; return NULL;
} }
...@@ -86,7 +92,7 @@ SDL_Rect **ph_ListModes(_THIS, SDL_PixelFormat *format, Uint32 flags) ...@@ -86,7 +92,7 @@ SDL_Rect **ph_ListModes(_THIS, SDL_PixelFormat *format, Uint32 flags)
{ {
if (PgGetVideoModeInfo(mode_list.modes[i], &mode_info) < 0) if (PgGetVideoModeInfo(mode_list.modes[i], &mode_info) < 0)
{ {
fprintf(stderr,"error: PgGetVideoModeInfo failed on mode: 0x%x\n", mode_list.modes[i]); SDL_SetError("ph_ListModes(): PgGetVideoModeInfo() function failed on mode: 0x%X.\n", mode_list.modes[i]);
return NULL; return NULL;
} }
if(mode_info.bits_per_pixel == format->BitsPerPixel) if(mode_info.bits_per_pixel == format->BitsPerPixel)
...@@ -120,22 +126,12 @@ void ph_FreeVideoModes(_THIS) ...@@ -120,22 +126,12 @@ void ph_FreeVideoModes(_THIS)
/* return the mode associated with width, height and bpp */ /* return the mode associated with width, height and bpp */
/* if there is no mode then zero is returned */ /* if there is no mode then zero is returned */
int get_mode(int width, int height, int bpp) int ph_GetVideoMode(int width, int height, int bpp)
{ {
int i; int i;
if(width<640)
{
width=640;
}
if(height<480)
{
height=480;
}
if (PgGetVideoModeList(&mode_list) < 0) if (PgGetVideoModeList(&mode_list) < 0)
{ {
fprintf(stderr,"error: PgGetVideoModeList failed\n");
return -1; return -1;
} }
...@@ -144,7 +140,6 @@ int get_mode(int width, int height, int bpp) ...@@ -144,7 +140,6 @@ int get_mode(int width, int height, int bpp)
{ {
if (PgGetVideoModeInfo(mode_list.modes[i], &mode_info) < 0) if (PgGetVideoModeInfo(mode_list.modes[i], &mode_info) < 0)
{ {
fprintf(stderr,"error: PgGetVideoModeInfo failed\n");
return 0; return 0;
} }
...@@ -159,50 +154,56 @@ int get_mode(int width, int height, int bpp) ...@@ -159,50 +154,56 @@ int get_mode(int width, int height, int bpp)
return (i == mode_list.num_modes) ? 0 : mode_list.modes[i]; return (i == mode_list.num_modes) ? 0 : mode_list.modes[i];
} }
int get_mode_any_format(int width, int height, int bpp)
/* return the mode associated with width, height and bpp */ /* return the mode associated with width, height and bpp */
/* if requested bpp is not found the mode with closest bpp is returned */ /* if requested bpp is not found the mode with closest bpp is returned */
int get_mode_any_format(int width, int height, int bpp)
{ {
int i, closest, delta, min_delta; int i, closest, delta, min_delta;
if (PgGetVideoModeList( &mode_list ) < 0) if (PgGetVideoModeList(&mode_list) < 0)
{ {
fprintf(stderr,"error: PgGetVideoModeList failed\n");
return -1; return -1;
} }
qsort(mode_list.modes, mode_list.num_modes, sizeof(unsigned short), compare_modes_by_res); qsort(mode_list.modes, mode_list.num_modes, sizeof(unsigned short), compare_modes_by_res);
for(i=0;i<mode_list.num_modes;i++) for(i=0;i<mode_list.num_modes;i++)
{ {
if (PgGetVideoModeInfo(mode_list.modes[i], &mode_info) < 0) if (PgGetVideoModeInfo(mode_list.modes[i], &mode_info) < 0)
{ {
fprintf(stderr,"error: PgGetVideoModeInfo failed\n");
return 0; return 0;
} }
if ((mode_info.width == width) && if ((mode_info.width == width) && (mode_info.height == height))
(mode_info.height == height)) {
break; break;
} }
}
if (i<mode_list.num_modes) if (i<mode_list.num_modes)
{ {
/* get closest bpp */ /* get closest bpp */
closest = i++; closest = i++;
if (mode_info.bits_per_pixel == bpp) if (mode_info.bits_per_pixel == bpp)
{
return mode_list.modes[closest]; return mode_list.modes[closest];
}
min_delta = abs(mode_info.bits_per_pixel - bpp); min_delta = abs(mode_info.bits_per_pixel - bpp);
while(1) while(1)
{ {
if (PgGetVideoModeInfo(mode_list.modes[i], &mode_info) < 0) if (PgGetVideoModeInfo(mode_list.modes[i], &mode_info) < 0)
{ {
fprintf(stderr,"error: PgGetVideoModeInfo failed\n");
return 0; return 0;
} }
if ((mode_info.width != width) || if ((mode_info.width != width) || (mode_info.height != height))
(mode_info.height != height)) {
break; break;
else if (mode_info.bits_per_pixel == bpp) }
else
{
if (mode_info.bits_per_pixel == bpp)
{ {
closest = i; closest = i;
break; break;
...@@ -218,30 +219,59 @@ int get_mode_any_format(int width, int height, int bpp) ...@@ -218,30 +219,59 @@ int get_mode_any_format(int width, int height, int bpp)
i++; i++;
} }
} }
}
return mode_list.modes[closest]; return mode_list.modes[closest];
} }
else
return 0; return 0;
} }
int ph_ToggleFullScreen(_THIS, int on) int ph_ToggleFullScreen(_THIS, int on)
{ {
if (currently_fullscreen) return -1;
}
int ph_EnterFullScreen(_THIS, SDL_Surface* screen)
{
PgDisplaySettings_t settings;
int mode;
if (!currently_fullscreen)
{ {
return ph_LeaveFullScreen(this); /* Get the video mode and set it */
if (screen->flags & SDL_ANYFORMAT)
{
if ((mode = get_mode_any_format(screen->w, screen->h, screen->format->BitsPerPixel)) == 0)
{
SDL_SetError("ph_EnterFullScreen(): can't find appropriate video mode !\n");
return 0;
}
} }
else else
{ {
return ph_EnterFullScreen(this); if ((mode = ph_GetVideoMode(screen->w, screen->h, screen->format->BitsPerPixel)) == 0)
{
SDL_SetError("ph_EnterFullScreen(): can't find appropriate video mode !\n");
return 0;
}
} }
return 0; /* save old video mode caps */
} PgGetVideoMode(&settings);
old_video_mode=settings.mode;
old_refresh_rate=settings.refresh;
int ph_EnterFullScreen(_THIS) /* setup new video mode */
{ settings.mode = mode;
if (!currently_fullscreen) settings.refresh = 0;
settings.flags = 0;
if (PgSetVideoMode(&settings) < 0)
{ {
SDL_SetError("ph_EnterFullScreen(): PgSetVideoMode() call failed !\n");
return 0;
}
if (this->screen) if (this->screen)
{ {
if ((this->screen->flags & SDL_OPENGL)==SDL_OPENGL) if ((this->screen->flags & SDL_OPENGL)==SDL_OPENGL)
...@@ -255,13 +285,13 @@ int ph_EnterFullScreen(_THIS) ...@@ -255,13 +285,13 @@ int ph_EnterFullScreen(_THIS)
if (OCImage.direct_context==NULL) if (OCImage.direct_context==NULL)
{ {
OCImage.direct_context=(PdDirectContext_t*)PdCreateDirectContext(); OCImage.direct_context=(PdDirectContext_t*)PdCreateDirectContext();
}
if (!OCImage.direct_context) if (!OCImage.direct_context)
{ {
fprintf(stderr, "ph_EnterFullScreen(): Can't create direct context !\n"); SDL_SetError("ph_EnterFullScreen(): Can't create direct context !\n");
ph_LeaveFullScreen(this);
return 0; return 0;
} }
}
OCImage.oldDC=PdDirectStart(OCImage.direct_context); OCImage.oldDC=PdDirectStart(OCImage.direct_context);
...@@ -277,30 +307,38 @@ int ph_LeaveFullScreen(_THIS) ...@@ -277,30 +307,38 @@ int ph_LeaveFullScreen(_THIS)
if (currently_fullscreen) if (currently_fullscreen)
{ {
if ((this->screen->flags & SDL_OPENGL)==SDL_OPENGL) if ((this->screen) && ((this->screen->flags & SDL_OPENGL)==SDL_OPENGL))
{ {
#ifdef HAVE_OPENGL #ifdef HAVE_OPENGL
#endif /* HAVE_OPENGL */ #endif /* HAVE_OPENGL */
return 0; return 0;
} }
else else
{
if (OCImage.direct_context)
{ {
PdDirectStop(OCImage.direct_context); PdDirectStop(OCImage.direct_context);
PdReleaseDirectContext(OCImage.direct_context); PdReleaseDirectContext(OCImage.direct_context);
OCImage.direct_context=NULL;
}
if (OCImage.oldDC)
{
PhDCSetCurrent(OCImage.oldDC); PhDCSetCurrent(OCImage.oldDC);
OCImage.oldDC=NULL;
}
currently_fullscreen=0; currently_fullscreen=0;
/* 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; mymode_settings.mode = (unsigned short) old_video_mode;
mymode_settings.refresh= (unsigned short) old_refresh_rate; mymode_settings.refresh = (unsigned short) old_refresh_rate;
mymode_settings.flags= 0; mymode_settings.flags = 0;
if (PgSetVideoMode(&mymode_settings) < 0) if (PgSetVideoMode(&mymode_settings) < 0)
{ {
fprintf(stderr, "Ph_LeaveFullScreen(): PgSetVideoMode failed !\n"); SDL_SetError("Ph_LeaveFullScreen(): PgSetVideoMode() function failed !\n");
return 0; return 0;
} }
} }
...@@ -308,7 +346,6 @@ int ph_LeaveFullScreen(_THIS) ...@@ -308,7 +346,6 @@ int ph_LeaveFullScreen(_THIS)
old_video_mode=-1; old_video_mode=-1;
old_refresh_rate=-1; old_refresh_rate=-1;
} }
} }
return 1; return 1;
} }
...@@ -36,9 +36,9 @@ static char rcsid = ...@@ -36,9 +36,9 @@ static char rcsid =
extern SDL_Rect **ph_ListModes(_THIS,SDL_PixelFormat *format, Uint32 flags); extern SDL_Rect **ph_ListModes(_THIS,SDL_PixelFormat *format, Uint32 flags);
extern void ph_FreeVideoModes(_THIS); extern void ph_FreeVideoModes(_THIS);
extern int ph_ResizeFullScreen(_THIS); extern int ph_ResizeFullScreen(_THIS);
extern int ph_EnterFullScreen(_THIS); extern int ph_EnterFullScreen(_THIS, SDL_Surface* screen);
extern int ph_LeaveFullScreen(_THIS); extern int ph_LeaveFullScreen(_THIS);
extern int get_mode(int width, int height, int bpp); extern int ph_GetVideoMode(int width, int height, int bpp);
extern int get_mode_any_format(int width, int height, int bpp); extern int get_mode_any_format(int width, int height, int bpp);
extern int ph_ToggleFullScreen(_THIS, int on); extern int ph_ToggleFullScreen(_THIS, int on);
......
...@@ -46,19 +46,18 @@ void ph_FreeWMCursor(_THIS, WMcursor *cursor) ...@@ -46,19 +46,18 @@ void ph_FreeWMCursor(_THIS, WMcursor *cursor)
{ {
SDL_Lock_EventThread(); SDL_Lock_EventThread();
if (PtSetResource( window, Pt_ARG_CURSOR_TYPE, Ph_CURSOR_INHERIT, 0) < 0) if (PtSetResource(window, Pt_ARG_CURSOR_TYPE, Ph_CURSOR_INHERIT, 0) < 0)
{ {
/* TODO: output error msg */ /* TODO: output error msg */
} }
SDL_Unlock_EventThread(); SDL_Unlock_EventThread();
} }
/* free(cursor->ph_cursor.images); */
free(cursor); free(cursor);
} }
WMcursor *ph_CreateWMCursor(_THIS, WMcursor *ph_CreateWMCursor(_THIS, Uint8 *data, Uint8 *mask, int w, int h, int hot_x, int hot_y)
Uint8 *data, Uint8 *mask, int w, int h, int hot_x, int hot_y)
{ {
WMcursor* cursor; WMcursor* cursor;
int clen, i; int clen, i;
...@@ -73,8 +72,12 @@ WMcursor *ph_CreateWMCursor(_THIS, ...@@ -73,8 +72,12 @@ WMcursor *ph_CreateWMCursor(_THIS,
memset(cursor,0,sizeof(WMcursor)); memset(cursor,0,sizeof(WMcursor));
cursor->ph_cursor = (PhCursorDef_t *) malloc(sizeof(PhCursorDef_t) + 32*4*2); cursor->ph_cursor = (PhCursorDef_t *) malloc(sizeof(PhCursorDef_t) + 32*4*2);
if (cursor->ph_cursor == NULL) if (cursor->ph_cursor == NULL)
printf("cursor malloc failed\n"); {
SDL_SetError("ph_CreateWMCursor(): cursor malloc failed !\n");
return NULL;
}
memset(cursor->ph_cursor,0,(sizeof(PhCursorDef_t) + 32*4*2)); memset(cursor->ph_cursor,0,(sizeof(PhCursorDef_t) + 32*4*2));
...@@ -137,7 +140,7 @@ int ph_ShowWMCursor(_THIS, WMcursor *cursor) ...@@ -137,7 +140,7 @@ int ph_ShowWMCursor(_THIS, WMcursor *cursor)
return (0); return (0);
} }
/* Set the photon cursor cursor, or blank if cursor is NULL */ /* Set the photon cursor, or blank if cursor is NULL */
if (cursor!=NULL) if (cursor!=NULL)
{ {
PtSetArg(&args[0], Pt_ARG_CURSOR_TYPE, Ph_CURSOR_BITMAP, 0); PtSetArg(&args[0], Pt_ARG_CURSOR_TYPE, Ph_CURSOR_BITMAP, 0);
...@@ -148,7 +151,7 @@ int ph_ShowWMCursor(_THIS, WMcursor *cursor) ...@@ -148,7 +151,7 @@ int ph_ShowWMCursor(_THIS, WMcursor *cursor)
} }
else /* Ph_CURSOR_NONE */ else /* Ph_CURSOR_NONE */
{ {
PtSetArg( &args[0], Pt_ARG_CURSOR_TYPE, Ph_CURSOR_NONE, 0); PtSetArg(&args[0], Pt_ARG_CURSOR_TYPE, Ph_CURSOR_NONE, 0);
nargs = 1; nargs = 1;
} }
......
This diff is collapsed.
...@@ -20,22 +20,23 @@ ...@@ -20,22 +20,23 @@
slouken@libsdl.org slouken@libsdl.org
*/ */
#ifndef _SDL_ph_video_h #ifndef __SDL_PH_VIDEO_H__
#define _SDL_ph_video_h #define __SDL_PH_VIDEO_H__
#include "SDL_mouse.h" #include "SDL_mouse.h"
#include "SDL_sysvideo.h" #include "SDL_sysvideo.h"
#include "Ph.h" #include <Ph.h>
#include "Pt.h" #include <Pt.h>
#include <photon/Pg.h> #include <photon/Pg.h>
#include <photon/PdDirect.h> #include <photon/PdDirect.h>
#ifdef HAVE_OPENGL #ifdef HAVE_OPENGL
#include <photon/PdGL.h> #include <photon/PdGL.h>
#endif /* HAVE_OPENGL */ #endif /* HAVE_OPENGL */
/* Hidden "this" pointer for the video functions */ /* Hidden "this" pointer for the video functions */
#define _THIS SDL_VideoDevice *this #define _THIS SDL_VideoDevice* this
#define PH_OGL_MAX_ATTRIBS 32 #define PH_OGL_MAX_ATTRIBS 32
...@@ -43,18 +44,23 @@ ...@@ -43,18 +44,23 @@
#define SDLPH_PAL_EMULATE 0x00000001L #define SDLPH_PAL_EMULATE 0x00000001L
#define SDLPH_PAL_SYSTEM 0x00000002L #define SDLPH_PAL_SYSTEM 0x00000002L
typedef union vidptr{ typedef struct
uint8_t* volatile ptr8; {
uint16_t* volatile ptr16;
uint32_t* volatile ptr32;
} VidPtr_t;
typedef struct {
unsigned char* Y; unsigned char* Y;
unsigned char* V; unsigned char* V;
unsigned char* U; unsigned char* U;
} FRAMEDATA; } FRAMEDATA;
/* Mask values for SDL_ReallocFormat() */
struct ColourMasks
{
Uint32 red;
Uint32 green;
Uint32 blue;
Uint32 alpha;
Uint32 bpp;
};
/* Private display data */ /* Private display data */
struct SDL_PrivateVideoData { struct SDL_PrivateVideoData {
PgDisplaySettings_t mode_settings; PgDisplaySettings_t mode_settings;
...@@ -69,8 +75,9 @@ struct SDL_PrivateVideoData { ...@@ -69,8 +75,9 @@ struct SDL_PrivateVideoData {
struct { struct {
PdDirectContext_t* direct_context; PdDirectContext_t* direct_context;
PdOffscreenContext_t* offscreen_context; PdOffscreenContext_t* offscreen_context;
PdOffscreenContext_t* offscreen_backcontext;
PhDrawContext_t* oldDC; PhDrawContext_t* oldDC;
VidPtr_t dc_ptr; uint8_t* dc_ptr;
unsigned char* CurrentFrameData; unsigned char* CurrentFrameData;
unsigned char* FrameData0; unsigned char* FrameData0;
unsigned char* FrameData1; unsigned char* FrameData1;
...@@ -90,8 +97,10 @@ struct SDL_PrivateVideoData { ...@@ -90,8 +97,10 @@ struct SDL_PrivateVideoData {
int desktoppal; /* palette mode emulation or system */ int desktoppal; /* palette mode emulation or system */
int currently_fullscreen; int currently_fullscreen;
int currently_hided; /* 1 - window hided (minimazed), 0 - normal */
PhEvent_t* event; PhEvent_t* event;
SDL_Overlay* overlay;
}; };
#define mode_settings (this->hidden->mode_settings) #define mode_settings (this->hidden->mode_settings)
...@@ -106,11 +115,13 @@ struct SDL_PrivateVideoData { ...@@ -106,11 +115,13 @@ struct SDL_PrivateVideoData {
#define desktoppal (this->hidden->desktoppal) #define desktoppal (this->hidden->desktoppal)
#define savedpal (this->hidden->savedpal) #define savedpal (this->hidden->savedpal)
#define syspalph (this->hidden->syspalph) #define syspalph (this->hidden->syspalph)
#define currently_fullscreen (this->hidden->currently_fullscreen)
#define currently_hided (this->hidden->currently_hided)
#define event (this->hidden->event)
#define current_overlay (this->hidden->overlay)
/* Old variable names */ /* Old variable names */
#define mouse_relative (this->hidden->mouse_relative) #define mouse_relative (this->hidden->mouse_relative)
#define currently_fullscreen (this->hidden->currently_fullscreen)
#define event (this->hidden->event)
#define SDL_BlankCursor (this->hidden->BlankCursor) #define SDL_BlankCursor (this->hidden->BlankCursor)
#endif /* _SDL_x11video_h */ #endif /* __SDL_PH_VIDEO_H__ */
...@@ -75,8 +75,9 @@ int ph_IconifyWindow(_THIS) ...@@ -75,8 +75,9 @@ int ph_IconifyWindow(_THIS)
memset( &windowevent, 0, sizeof (event) ); memset( &windowevent, 0, sizeof (event) );
windowevent.event_f = Ph_WM_HIDE; windowevent.event_f = Ph_WM_HIDE;
windowevent.event_state = Ph_WM_EVSTATE_HIDE; windowevent.event_state = Ph_WM_EVSTATE_HIDE;
windowevent.rid = PtWidgetRid( window ); windowevent.rid = PtWidgetRid(window);
PtForwardWindowEvent( &windowevent ); PtForwardWindowEvent(&windowevent);
SDL_Unlock_EventThread(); SDL_Unlock_EventThread();
return 0; return 0;
......
This diff is collapsed.
...@@ -25,13 +25,37 @@ static char rcsid = ...@@ -25,13 +25,37 @@ static char rcsid =
"@(#) $Id$"; "@(#) $Id$";
#endif #endif
/* This is the XFree86 Xv extension implementation of YUV video overlays */ /* This is the photon implementation of YUV video overlays */
#include "SDL_video.h" #include "SDL_video.h"
#include "SDL_ph_video.h" #include "SDL_ph_video.h"
extern SDL_Overlay *ph_CreateYUVOverlay(_THIS, int width, int height, Uint32 format, SDL_Surface *display); struct private_yuvhwdata
extern int ph_LockYUVOverlay(_THIS, SDL_Overlay *overlay); {
extern void ph_UnlockYUVOverlay(_THIS, SDL_Overlay *overlay); FRAMEDATA* CurrentFrameData;
extern int ph_DisplayYUVOverlay(_THIS, SDL_Overlay *overlay, SDL_Rect *dstrect); FRAMEDATA* FrameData0;
extern void ph_FreeYUVOverlay(_THIS, SDL_Overlay *overlay); FRAMEDATA* FrameData1;
PgScalerProps_t props;
PgScalerCaps_t caps;
PgVideoChannel_t* channel;
PhArea_t CurrentViewPort;
PhPoint_t CurrentWindowPos;
long format;
int scaler_on;
int current;
long YStride;
long VStride;
long UStride;
int ischromakey;
long chromakey;
int forcedredraw;
unsigned long State;
long flags;
int locked;
};
extern SDL_Overlay* ph_CreateYUVOverlay(_THIS, int width, int height, Uint32 format, SDL_Surface* display);
extern int ph_LockYUVOverlay(_THIS, SDL_Overlay* overlay);
extern void ph_UnlockYUVOverlay(_THIS, SDL_Overlay* overlay);
extern int ph_DisplayYUVOverlay(_THIS, SDL_Overlay* overlay, SDL_Rect* dstrect);
extern void ph_FreeYUVOverlay(_THIS, SDL_Overlay* overlay);
...@@ -54,10 +54,6 @@ int LoadSprite(SDL_Surface *screen, char *file) ...@@ -54,10 +54,6 @@ int LoadSprite(SDL_Surface *screen, char *file)
void MoveSprites(SDL_Surface *screen, Uint32 background) void MoveSprites(SDL_Surface *screen, Uint32 background)
{ {
#if DEBUG_FLIP
static int t = 0;
#endif
int i, nupdates; int i, nupdates;
SDL_Rect area, *position, *velocity; SDL_Rect area, *position, *velocity;
...@@ -90,6 +86,9 @@ void MoveSprites(SDL_Surface *screen, Uint32 background) ...@@ -90,6 +86,9 @@ void MoveSprites(SDL_Surface *screen, Uint32 background)
#if DEBUG_FLIP #if DEBUG_FLIP
{ {
if ( (screen->flags & SDL_DOUBLEBUF) == SDL_DOUBLEBUF ) {
static int t = 0;
Uint32 color = SDL_MapRGB (screen->format, 255, 0, 0); Uint32 color = SDL_MapRGB (screen->format, 255, 0, 0);
SDL_Rect r; SDL_Rect r;
r.x = (sin((float)t * 2 * 3.1459) + 1.0) / 2.0 * (screen->w-20); r.x = (sin((float)t * 2 * 3.1459) + 1.0) / 2.0 * (screen->w-20);
...@@ -100,6 +99,7 @@ void MoveSprites(SDL_Surface *screen, Uint32 background) ...@@ -100,6 +99,7 @@ void MoveSprites(SDL_Surface *screen, Uint32 background)
SDL_FillRect (screen, &r, color); SDL_FillRect (screen, &r, color);
t+=2; t+=2;
} }
}
#endif #endif
/* Update the screen! */ /* Update the screen! */
......
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