diff --git a/README.QNX b/README.QNX
index 6bd64a711..8997c0699 100644
--- a/README.QNX
+++ b/README.QNX
@@ -77,7 +77,8 @@ 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 and run autogen.sh.
+and doesn't know anything about QNX. Just remove it, then run
+"libtoolize --force --copy" and after that run autogen.sh.
======================================================================
Some building issues:
diff --git a/SDL.qpg.in b/SDL.qpg.in
index 831e9e780..dc29b1207 100644
--- a/SDL.qpg.in
+++ b/SDL.qpg.in
@@ -30,6 +30,7 @@
+
diff --git a/src/video/photon/SDL_ph_events_c.h b/src/video/photon/SDL_ph_events_c.h
index 46f339722..fedd87dea 100644
--- a/src/video/photon/SDL_ph_events_c.h
+++ b/src/video/photon/SDL_ph_events_c.h
@@ -20,10 +20,13 @@
slouken@libsdl.org
*/
+#ifndef __SDL_PH_EVENTS_H__
+#define __SDL_PH_EVENTS_H__
+
#ifdef SAVE_RCSID
static char rcsid =
"@(#) $Id$";
-#endif
+#endif /* SAVE_RCSID */
#include "SDL_ph_video.h"
@@ -32,3 +35,5 @@ static char rcsid =
/* Functions to be exported */
extern void ph_InitOSKeymap(_THIS);
extern void ph_PumpEvents(_THIS);
+
+#endif /* __SDL_PH_EVENTS_H__ */
diff --git a/src/video/photon/SDL_ph_image.c b/src/video/photon/SDL_ph_image.c
index 0a2977eea..26604402a 100644
--- a/src/video/photon/SDL_ph_image.c
+++ b/src/video/photon/SDL_ph_image.c
@@ -186,13 +186,6 @@ int ph_SetupOCImage(_THIS, SDL_Surface *screen)
return 0;
}
-int ph_SetupOpenGLImage(_THIS, SDL_Surface* screen)
-{
- this->UpdateRects = ph_OpenGLUpdate;
-
- return 0;
-}
-
int ph_SetupFullScreenImage(_THIS, SDL_Surface* screen)
{
OCImage.flags = screen->flags;
@@ -210,7 +203,7 @@ int ph_SetupFullScreenImage(_THIS, SDL_Surface* screen)
PgGetPalette(syspalph);
}
- OCImage.offscreen_context = PdCreateOffscreenContext(0, 0, 0, Pg_OSC_MAIN_DISPLAY);
+ OCImage.offscreen_context = PdCreateOffscreenContext(0, 0, 0, Pg_OSC_MAIN_DISPLAY | Pg_OSC_MEM_PAGE_ALIGN | Pg_OSC_CRTC_SAFE);
if (OCImage.offscreen_context == NULL)
{
SDL_SetError("ph_SetupFullScreenImage(): PdCreateOffscreenContext() function failed !\n");
@@ -219,7 +212,7 @@ int ph_SetupFullScreenImage(_THIS, SDL_Surface* screen)
if ((screen->flags & SDL_DOUBLEBUF) == SDL_DOUBLEBUF)
{
- OCImage.offscreen_backcontext = PdDupOffscreenContext(OCImage.offscreen_context, Pg_OSC_CRTC_SAFE);
+ OCImage.offscreen_backcontext = PdDupOffscreenContext(OCImage.offscreen_context, Pg_OSC_CRTC_SAFE | Pg_OSC_MEM_PAGE_ALIGN);
if (OCImage.offscreen_backcontext == NULL)
{
SDL_SetError("ph_SetupFullScreenImage(): PdCreateOffscreenContext(back) function failed !\n");
@@ -272,8 +265,122 @@ int ph_SetupFullScreenImage(_THIS, SDL_Surface* screen)
return 0;
}
-void ph_DestroyImage(_THIS, SDL_Surface *screen)
+#ifdef HAVE_OPENGL
+
+static int ph_SetupOpenGLContext(_THIS, int width, int height, int bpp, Uint32 flags)
{
+ PhDim_t dim;
+ uint64_t OGLAttrib[PH_OGL_MAX_ATTRIBS];
+ int exposepost=0;
+ int OGLargc;
+
+ dim.w=width;
+ dim.h=height;
+
+ if ((oglctx!=NULL) && (oglflags==flags) && (oglbpp==bpp))
+ {
+ PdOpenGLContextResize(oglctx, &dim);
+ PhDCSetCurrent(oglctx);
+ return 0;
+ }
+ else
+ {
+ if (oglctx!=NULL)
+ {
+ PhDCSetCurrent(NULL);
+ PhDCRelease(oglctx);
+ oglctx=NULL;
+ exposepost=1;
+ }
+ }
+
+ OGLargc=0;
+ if (this->gl_config.depth_size)
+ {
+ OGLAttrib[OGLargc++]=PHOGL_ATTRIB_DEPTH_BITS;
+ OGLAttrib[OGLargc++]=this->gl_config.depth_size;
+ }
+ if (this->gl_config.stencil_size)
+ {
+ OGLAttrib[OGLargc++]=PHOGL_ATTRIB_STENCIL_BITS;
+ OGLAttrib[OGLargc++]=this->gl_config.stencil_size;
+ }
+ OGLAttrib[OGLargc++]=PHOGL_ATTRIB_FORCE_SW;
+ if (flags & SDL_FULLSCREEN)
+ {
+ OGLAttrib[OGLargc++]=PHOGL_ATTRIB_FULLSCREEN;
+ OGLAttrib[OGLargc++]=PHOGL_ATTRIB_DIRECT;
+ OGLAttrib[OGLargc++]=PHOGL_ATTRIB_FULLSCREEN_BEST;
+ OGLAttrib[OGLargc++]=PHOGL_ATTRIB_FULLSCREEN_CENTER;
+ }
+ OGLAttrib[OGLargc++]=PHOGL_ATTRIB_NONE;
+
+ if (this->gl_config.double_buffer)
+ {
+ oglctx=PdCreateOpenGLContext(2, &dim, 0, OGLAttrib);
+ }
+ else
+ {
+ oglctx=PdCreateOpenGLContext(1, &dim, 0, OGLAttrib);
+ }
+
+ if (oglctx==NULL)
+ {
+ SDL_SetError("ph_SetupOpenGLContext(): cannot create OpenGL context !\n");
+ return (-1);
+ }
+
+ PhDCSetCurrent(oglctx);
+
+ PtFlush();
+
+ oglflags=flags;
+ oglbpp=bpp;
+
+ if (exposepost!=0)
+ {
+ /* OpenGL context has been recreated, so report about this fact */
+ SDL_PrivateExpose();
+ }
+
+ return 0;
+}
+
+int ph_SetupOpenGLImage(_THIS, SDL_Surface* screen)
+{
+ this->UpdateRects = ph_OpenGLUpdate;
+ screen->pixels=NULL;
+ screen->pitch=NULL;
+
+ if (ph_SetupOpenGLContext(this, screen->w, screen->h, screen->format->BitsPerPixel, screen->flags)!=0)
+ {
+ screen->flags &= ~SDL_OPENGL;
+ return -1;
+ }
+
+ return 0;
+}
+
+#endif /* HAVE_OPENGL */
+
+void ph_DestroyImage(_THIS, SDL_Surface* screen)
+{
+
+#ifdef HAVE_OPENGL
+ if ((screen->flags & SDL_OPENGL)==SDL_OPENGL)
+ {
+ if (oglctx)
+ {
+ PhDCSetCurrent(NULL);
+ PhDCRelease(oglctx);
+ oglctx=NULL;
+ oglflags=0;
+ oglbpp=0;
+ }
+ return;
+ }
+#endif /* HAVE_OPENGL */
+
if (currently_fullscreen)
{
/* if we right now in 8bpp fullscreen we must release palette */
@@ -320,10 +427,16 @@ void ph_DestroyImage(_THIS, SDL_Surface *screen)
}
}
-int ph_SetupUpdateFunction(_THIS, SDL_Surface *screen, Uint32 flags)
+int ph_SetupUpdateFunction(_THIS, SDL_Surface* screen, Uint32 flags)
{
ph_DestroyImage(this, screen);
+#ifdef HAVE_OPENGL
+ if ((flags & SDL_OPENGL)==SDL_OPENGL)
+ {
+ return ph_SetupOpenGLImage(this, screen);
+ }
+#endif /* HAVE_OPENGL */
if ((flags & SDL_FULLSCREEN)==SDL_FULLSCREEN)
{
return ph_SetupFullScreenImage(this, screen);
@@ -332,43 +445,31 @@ int ph_SetupUpdateFunction(_THIS, SDL_Surface *screen, Uint32 flags)
{
return ph_SetupOCImage(this, screen);
}
- if ((flags & SDL_OPENGL)==SDL_OPENGL)
- {
- return ph_SetupOpenGLImage(this, screen);
- }
return ph_SetupImage(this, screen);
}
-int ph_AllocHWSurface(_THIS, SDL_Surface *surface)
+int ph_AllocHWSurface(_THIS, SDL_Surface* surface)
{
return(-1);
}
-void ph_FreeHWSurface(_THIS, SDL_Surface *surface)
+void ph_FreeHWSurface(_THIS, SDL_Surface* surface)
{
return;
}
-int ph_FlipHWSurface(_THIS, SDL_Surface *screen)
+int ph_FlipHWSurface(_THIS, SDL_Surface* screen)
{
- PhArea_t area;
-
- area.pos.x=0;
- area.pos.y=0;
- area.size.w=screen->w;
- area.size.h=screen->h;
-
if ((screen->flags & SDL_FULLSCREEN) == SDL_FULLSCREEN)
{
+ PgWaitHWIdle();
if (OCImage.current==0)
{
PgSwapDisplay(OCImage.offscreen_context, 0);
OCImage.current=1;
screen->pitch = OCImage.offscreen_backcontext->pitch;
screen->pixels = OCImage.FrameData1;
-// memcpy(OCImage.FrameData1, OCImage.FrameData0, OCImage.offscreen_context->shared_size);
- PgContextBlitArea(OCImage.offscreen_context, &area, OCImage.offscreen_backcontext, &area);
PhDCSetCurrent(OCImage.offscreen_backcontext);
PgFlush();
}
@@ -378,8 +479,6 @@ int ph_FlipHWSurface(_THIS, SDL_Surface *screen)
OCImage.current=0;
screen->pitch = OCImage.offscreen_context->pitch;
screen->pixels = OCImage.FrameData0;
-// memcpy(OCImage.FrameData0, OCImage.FrameData1, OCImage.offscreen_context->shared_size);
- PgContextBlitArea(OCImage.offscreen_backcontext, &area, OCImage.offscreen_context, &area);
PhDCSetCurrent(OCImage.offscreen_context);
PgFlush();
}
@@ -397,12 +496,14 @@ void ph_UnlockHWSurface(_THIS, SDL_Surface *surface)
return;
}
+#ifdef HAVE_OPENGL
void ph_OpenGLUpdate(_THIS, int numrects, SDL_Rect* rects)
{
this->GL_SwapBuffers(this);
return;
}
+#endif /* HAVE_OPENGL */
void ph_NormalUpdate(_THIS, int numrects, SDL_Rect *rects)
{
diff --git a/src/video/photon/SDL_ph_image_c.h b/src/video/photon/SDL_ph_image_c.h
index 96fc1a47d..e21422b7a 100644
--- a/src/video/photon/SDL_ph_image_c.h
+++ b/src/video/photon/SDL_ph_image_c.h
@@ -20,16 +20,20 @@
slouken@libsdl.org
*/
+#ifndef __SDL_PH_IMAGE_H__
+#define __SDL_PH_IMAGE_H__
+
#ifdef SAVE_RCSID
static char rcsid =
"@(#) $Id$";
-#endif
+#endif /* SAVE_RCSID */
+#include "SDL_events_c.h"
#include "SDL_ph_video.h"
-extern int ph_SetupImage(_THIS, SDL_Surface *screen);
-extern void ph_DestroyImage(_THIS, SDL_Surface *screen);
-extern int ph_SetupUpdateFunction(_THIS, SDL_Surface *screen, Uint32 flags);
+extern int ph_SetupImage(_THIS, SDL_Surface* screen);
+extern void ph_DestroyImage(_THIS, SDL_Surface* screen);
+extern int ph_SetupUpdateFunction(_THIS, SDL_Surface* screen, Uint32 flags);
extern int ph_AllocHWSurface(_THIS, SDL_Surface *surface);
extern void ph_FreeHWSurface(_THIS, SDL_Surface *surface);
@@ -41,3 +45,5 @@ extern void ph_NormalUpdate(_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);
+
+#endif /* __SDL_PH_IMAGE_H__ */
diff --git a/src/video/photon/SDL_ph_modes_c.h b/src/video/photon/SDL_ph_modes_c.h
index 59e3e0f51..3729a962c 100644
--- a/src/video/photon/SDL_ph_modes_c.h
+++ b/src/video/photon/SDL_ph_modes_c.h
@@ -20,14 +20,13 @@
slouken@libsdl.org
*/
+#ifndef __SDL_PH_MODES_H__
+#define __SDL_PH_MODES_H__
+
#ifdef SAVE_RCSID
static char rcsid =
"@(#) $Id$";
-#endif
-
-
-#ifndef _PH_MODES_INCLUDED_
-#define _PH_MODES_INCLUDED_
+#endif /* SAVE_RCSID */
#include "SDL_ph_video.h"
@@ -42,4 +41,4 @@ extern int ph_GetVideoMode(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);
-#endif /* _PH_MODES_INCLUDED_ */
+#endif /* __SDL_PH_MODES_H__ */
diff --git a/src/video/photon/SDL_ph_mouse.c b/src/video/photon/SDL_ph_mouse.c
index f34394310..414869921 100644
--- a/src/video/photon/SDL_ph_mouse.c
+++ b/src/video/photon/SDL_ph_mouse.c
@@ -120,10 +120,10 @@ WMcursor *ph_CreateWMCursor(_THIS, Uint8 *data, Uint8 *mask, int w, int h, int h
PhCursorDef_t ph_GetWMPhCursor(WMcursor *cursor)
{
- return(*cursor->ph_cursor);
+ return (*cursor->ph_cursor);
}
-int ph_ShowWMCursor(_THIS, WMcursor *cursor)
+int ph_ShowWMCursor(_THIS, WMcursor* cursor)
{
PtArg_t args[3];
int nargs = 0;
@@ -137,7 +137,15 @@ int ph_ShowWMCursor(_THIS, WMcursor *cursor)
/* looks like photon can't draw mouse cursor in direct mode */
if ((this->screen->flags & SDL_FULLSCREEN) == SDL_FULLSCREEN)
{
- return (0);
+ /* disable the fake mouse in the fullscreen OpenGL mode */
+ if ((this->screen->flags & SDL_OPENGL) == SDL_OPENGL)
+ {
+ cursor=NULL;
+ }
+ else
+ {
+ return (0);
+ }
}
/* Set the photon cursor, or blank if cursor is NULL */
@@ -167,6 +175,7 @@ int ph_ShowWMCursor(_THIS, WMcursor *cursor)
return (1);
}
+
void ph_WarpWMCursor(_THIS, Uint16 x, Uint16 y)
{
short abs_x, abs_y;
@@ -190,3 +199,31 @@ void ph_CheckMouseMode(_THIS)
mouse_relative = 0;
}
}
+
+
+void ph_UpdateMouse(_THIS)
+{
+ PhCursorInfo_t phcursor;
+ short abs_x;
+ short abs_y;
+
+ /* Lock the event thread, in multi-threading environments */
+ SDL_Lock_EventThread();
+
+ /* synchronizing photon mouse cursor position and SDL mouse position, if cursor appears over window. */
+ PtGetAbsPosition(window, &abs_x, &abs_y);
+ PhQueryCursor(PhInputGroup(NULL), &phcursor);
+ if (((phcursor.pos.x >= abs_x) && (phcursor.pos.x <= abs_x + this->screen->w)) &&
+ ((phcursor.pos.y >= abs_y) && (phcursor.pos.y <= abs_y + this->screen->h)))
+ {
+ SDL_PrivateAppActive(1, SDL_APPMOUSEFOCUS);
+ SDL_PrivateMouseMotion(0, 0, phcursor.pos.x-abs_x, phcursor.pos.y-abs_y);
+ }
+ else
+ {
+ SDL_PrivateAppActive(0, SDL_APPMOUSEFOCUS);
+ }
+
+ /* Unlock the event thread, in multi-threading environments */
+ SDL_Unlock_EventThread();
+}
diff --git a/src/video/photon/SDL_ph_mouse_c.h b/src/video/photon/SDL_ph_mouse_c.h
index 796adc047..5525b0a09 100644
--- a/src/video/photon/SDL_ph_mouse_c.h
+++ b/src/video/photon/SDL_ph_mouse_c.h
@@ -20,10 +20,13 @@
slouken@libsdl.org
*/
+#ifndef __SDL_PH_MOUSE_H__
+#define __SDL_PH_MOUSE_H__
+
#ifdef SAVE_RCSID
static char rcsid =
"@(#) $Id$";
-#endif
+#endif /* SAVE_RCSID */
#include "SDL_ph_video.h"
@@ -35,3 +38,6 @@ extern PhCursorDef_t ph_GetWMPhCursor(WMcursor *cursor);
extern int ph_ShowWMCursor(_THIS, WMcursor *cursor);
extern void ph_WarpWMCursor(_THIS, Uint16 x, Uint16 y);
extern void ph_CheckMouseMode(_THIS);
+extern void ph_UpdateMouse(_THIS);
+
+#endif /* __SDL_PH_MOUSE_H__ */
diff --git a/src/video/photon/SDL_ph_video.c b/src/video/photon/SDL_ph_video.c
index 56738fcf4..c4cef53b6 100644
--- a/src/video/photon/SDL_ph_video.c
+++ b/src/video/photon/SDL_ph_video.c
@@ -50,21 +50,18 @@ static char rcsid =
#include "SDL_phyuv_c.h"
#include "blank_cursor.h"
-static int ph_VideoInit(_THIS, SDL_PixelFormat *vformat);
-static SDL_Surface *ph_SetVideoMode(_THIS, SDL_Surface *current,
- int width, int height, int bpp, Uint32 flags);
-static int ph_SetColors(_THIS, int firstcolor, int ncolors, SDL_Color *colors);
+static int ph_VideoInit(_THIS, SDL_PixelFormat *vformat);
+static SDL_Surface *ph_SetVideoMode(_THIS, SDL_Surface *current, int width, int height, int bpp, Uint32 flags);
+static int ph_SetColors(_THIS, int firstcolor, int ncolors, SDL_Color *colors);
static void ph_VideoQuit(_THIS);
static void ph_DeleteDevice(SDL_VideoDevice *device);
-static void ph_UpdateMouse(_THIS);
#ifdef HAVE_OPENGL
-static int ph_SetupOpenGLContext(_THIS, int width, int height, int bpp, Uint32 flags);
-static void ph_GL_SwapBuffers(_THIS);
-static int ph_GL_GetAttribute(_THIS, SDL_GLattr attrib, int* value);
-static int ph_GL_LoadLibrary(_THIS, const char* path);
+static void ph_GL_SwapBuffers(_THIS);
+static int ph_GL_GetAttribute(_THIS, SDL_GLattr attrib, int* value);
+static int ph_GL_LoadLibrary(_THIS, const char* path);
static void* ph_GL_GetProcAddress(_THIS, const char* proc);
-
+static int ph_GL_MakeCurrent(_THIS);
#endif /* HAVE_OPENGL */
static int ph_Available(void)
@@ -132,18 +129,20 @@ static SDL_VideoDevice *ph_CreateDevice(int devindex)
device->CreateWMCursor = ph_CreateWMCursor;
device->ShowWMCursor = ph_ShowWMCursor;
device->WarpWMCursor = ph_WarpWMCursor;
+ device->MoveWMCursor = NULL;
device->CheckMouseMode = ph_CheckMouseMode;
device->InitOSKeymap = ph_InitOSKeymap;
device->PumpEvents = ph_PumpEvents;
/* OpenGL support. */
- device->GL_MakeCurrent = NULL;
#ifdef HAVE_OPENGL
+ device->GL_MakeCurrent = ph_GL_MakeCurrent;
device->GL_SwapBuffers = ph_GL_SwapBuffers;
device->GL_GetAttribute = ph_GL_GetAttribute;
device->GL_LoadLibrary = ph_GL_LoadLibrary;
device->GL_GetProcAddress = ph_GL_GetProcAddress;
#else
+ device->GL_MakeCurrent = NULL;
device->GL_SwapBuffers = NULL;
device->GL_GetAttribute = NULL;
device->GL_LoadLibrary = NULL;
@@ -313,8 +312,11 @@ static int ph_VideoInit(_THIS, SDL_PixelFormat *vformat)
window=NULL;
desktoppal=SDLPH_PAL_NONE;
+
#ifdef HAVE_OPENGL
oglctx=NULL;
+ oglflags=0;
+ oglbpp=0;
#endif /* HAVE_OPENGL */
old_video_mode=-1;
@@ -428,21 +430,10 @@ static SDL_Surface *ph_SetVideoMode(_THIS, SDL_Surface *current,
}
#ifdef HAVE_OPENGL
- if (current->flags & SDL_OPENGL)
+ if ((current->flags & SDL_OPENGL)==SDL_OPENGL)
{
- /* ph_SetupOpenGLContext creates also window as need */
- if (ph_SetupOpenGLContext(this, width, height, bpp, flags)==0)
- {
- ph_SetupUpdateFunction(this, current, flags);
- }
- else
- {
- /* if context creation fail, report no OpenGL to high level */
- current->flags &= ~SDL_OPENGL;
- return NULL;
- }
#else
- if (current->flags & SDL_OPENGL) /* if no built-in OpenGL support */
+ if ((current->flags & SDL_OPENGL)==SDL_OPENGL) /* if no built-in OpenGL support */
{
SDL_SetError("ph_SetVideoMode(): no OpenGL support, try to recompile library.\n");
current->flags &= ~SDL_OPENGL;
@@ -528,10 +519,6 @@ static SDL_Surface *ph_SetVideoMode(_THIS, SDL_Surface *current,
static void ph_VideoQuit(_THIS)
{
-#ifdef HAVE_OPENGL
- PhRegion_t region_info;
-#endif /* HAVE_OPENGL */
-
/* restore palette */
if (desktopbpp==8)
{
@@ -542,22 +529,6 @@ static void ph_VideoQuit(_THIS)
ph_DestroyImage(this, SDL_VideoSurface);
-#ifdef HAVE_OPENGL
- /* prevent double SEGFAULT during parachute mode */
- if (this->screen)
- {
- if (((this->screen->flags & SDL_FULLSCREEN)==SDL_FULLSCREEN) &&
- ((this->screen->flags & SDL_OPENGL)==SDL_OPENGL))
- {
- region_info.cursor_type=Ph_CURSOR_POINTER;
- region_info.rid=PtWidgetRid(window);
- PhRegionChange(Ph_REGION_CURSOR, 0, ®ion_info, NULL, NULL);
- }
- }
-
- PtFlush();
-#endif /* HAVE_OPENGL */
-
if (window)
{
PtUnrealizeWidget(window);
@@ -565,15 +536,6 @@ static void ph_VideoQuit(_THIS)
window=NULL;
}
-#ifdef HAVE_OPENGL
- if (oglctx)
- {
- PhDCSetCurrent(NULL);
- PhDCRelease(oglctx);
- oglctx=NULL;
- }
-#endif /* HAVE_OPENGL */
-
if (event!=NULL)
{
free(event);
@@ -638,82 +600,13 @@ static int ph_SetColors(_THIS, int firstcolor, int ncolors, SDL_Color *colors)
#ifdef HAVE_OPENGL
-int ph_SetupOpenGLContext(_THIS, int width, int height, int bpp, Uint32 flags)
-{
- PhDim_t dim;
- uint64_t OGLAttrib[PH_OGL_MAX_ATTRIBS];
- int OGLargc;
-
- dim.w=width;
- dim.h=height;
-
- if (oglctx!=NULL)
- {
- PhDCSetCurrent(NULL);
- PhDCRelease(oglctx);
- oglctx=NULL;
- }
-
- OGLargc=0;
- if (this->gl_config.depth_size)
- {
- OGLAttrib[OGLargc++]=PHOGL_ATTRIB_DEPTH_BITS;
- OGLAttrib[OGLargc++]=this->gl_config.depth_size;
- }
- if (this->gl_config.stencil_size)
- {
- OGLAttrib[OGLargc++]=PHOGL_ATTRIB_STENCIL_BITS;
- OGLAttrib[OGLargc++]=this->gl_config.stencil_size;
- }
- OGLAttrib[OGLargc++]=PHOGL_ATTRIB_FORCE_SW;
- if (flags & SDL_FULLSCREEN)
- {
- OGLAttrib[OGLargc++]=PHOGL_ATTRIB_FULLSCREEN;
- OGLAttrib[OGLargc++]=PHOGL_ATTRIB_DIRECT;
- OGLAttrib[OGLargc++]=PHOGL_ATTRIB_FULLSCREEN_BEST;
- OGLAttrib[OGLargc++]=PHOGL_ATTRIB_FULLSCREEN_CENTER;
- }
- OGLAttrib[OGLargc++]=PHOGL_ATTRIB_NONE;
-
- if (this->gl_config.double_buffer)
- {
- oglctx=PdCreateOpenGLContext(2, &dim, 0, OGLAttrib);
- }
- else
- {
- oglctx=PdCreateOpenGLContext(1, &dim, 0, OGLAttrib);
- }
-
- if (oglctx==NULL)
- {
- SDL_SetError("ph_SetupOpenGLContext(): cannot create OpenGL context !\n");
- return (-1);
- }
-
- PhDCSetCurrent(oglctx);
-
- /* disable mouse for fullscreen */
- if (flags & SDL_FULLSCREEN)
- {
- PhRegion_t region_info;
-
- region_info.cursor_type=Ph_CURSOR_NONE;
- region_info.rid=PtWidgetRid(window);
- PhRegionChange(Ph_REGION_CURSOR, 0, ®ion_info, NULL, NULL);
- }
-
- PtFlush();
-
- return 0;
-}
-
-void ph_GL_SwapBuffers(_THIS)
+static void ph_GL_SwapBuffers(_THIS)
{
PgSetRegion(PtWidgetRid(window));
PdOpenGLContextSwapBuffers(oglctx);
}
-int ph_GL_GetAttribute(_THIS, SDL_GLattr attrib, int* value)
+static int ph_GL_GetAttribute(_THIS, SDL_GLattr attrib, int* value)
{
switch (attrib)
{
@@ -733,44 +626,29 @@ int ph_GL_GetAttribute(_THIS, SDL_GLattr attrib, int* value)
return 0;
}
-int ph_GL_LoadLibrary(_THIS, const char* path)
+static int ph_GL_LoadLibrary(_THIS, const char* path)
{
- /* if code compiled with HAVE_OPENGL, the library already linked */
+ /* if code compiled with HAVE_OPENGL, that mean that library already linked */
this->gl_config.driver_loaded = 1;
return 0;
}
-void* ph_GL_GetProcAddress(_THIS, const char* proc)
+static void* ph_GL_GetProcAddress(_THIS, const char* proc)
{
return NULL;
}
-#endif /* HAVE_OPENGL */
-
-static void ph_UpdateMouse(_THIS)
+static int ph_GL_MakeCurrent(_THIS)
{
- PhCursorInfo_t phcursor;
- short abs_x;
- short abs_y;
+ PgSetRegion(PtWidgetRid(window));
- /* Lock the event thread, in multi-threading environments */
- SDL_Lock_EventThread();
-
- /* synchronizing photon mouse cursor position and SDL mouse position, if cursor appears over window. */
- PtGetAbsPosition(window, &abs_x, &abs_y);
- PhQueryCursor(PhInputGroup(NULL), &phcursor);
- if (((phcursor.pos.x >= abs_x) && (phcursor.pos.x <= abs_x + this->screen->w)) &&
- ((phcursor.pos.y >= abs_y) && (phcursor.pos.y <= abs_y + this->screen->h)))
+ if (oglctx!=NULL)
{
- SDL_PrivateAppActive(1, SDL_APPMOUSEFOCUS);
- SDL_PrivateMouseMotion(0, 0, phcursor.pos.x-abs_x, phcursor.pos.y-abs_y);
- }
- else
- {
- SDL_PrivateAppActive(0, SDL_APPMOUSEFOCUS);
+ PhDCSetCurrent(oglctx);
}
- /* Unlock the event thread, in multi-threading environments */
- SDL_Unlock_EventThread();
+ return 0;
}
+
+#endif /* HAVE_OPENGL */
diff --git a/src/video/photon/SDL_ph_video.h b/src/video/photon/SDL_ph_video.h
index fd3acea77..3b0e3d9d2 100644
--- a/src/video/photon/SDL_ph_video.h
+++ b/src/video/photon/SDL_ph_video.h
@@ -46,9 +46,9 @@
typedef struct
{
- unsigned char* Y;
- unsigned char* V;
- unsigned char* U;
+ unsigned char* Y;
+ unsigned char* V;
+ unsigned char* U;
} FRAMEDATA;
/* Mask values for SDL_ReallocFormat() */
@@ -68,6 +68,8 @@ struct SDL_PrivateVideoData {
PhImage_t *image; /* used to display image */
#ifdef HAVE_OPENGL
PdOpenGLContext_t* OGLContext; /* OpenGL context */
+ Uint32 OGLFlags; /* OpenGL flags */
+ Uint32 OGLBPP; /* OpenGL bpp */
#endif /* HAVE_OPENGL */
PgColor_t savedpal[_Pg_MAX_PALETTE];
PgColor_t syspalph[_Pg_MAX_PALETTE];
@@ -82,8 +84,8 @@ struct SDL_PrivateVideoData {
unsigned char* CurrentFrameData;
unsigned char* FrameData0;
unsigned char* FrameData1;
- int current;
- long flags;
+ Uint32 current;
+ Uint32 flags;
} ocimage;
PgHWCaps_t graphics_card_caps; /* Graphics card caps at the moment of start */
@@ -94,9 +96,9 @@ struct SDL_PrivateVideoData {
int mouse_relative;
WMcursor* BlankCursor;
- int depth; /* current visual depth (not bpp) */
- int desktopbpp; /* bpp of desktop at the moment of start */
- int 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 */
@@ -107,7 +109,6 @@ struct SDL_PrivateVideoData {
#define mode_settings (this->hidden->mode_settings)
#define window (this->hidden->Window)
-#define oglctx (this->hidden->OGLContext)
#define SDL_Image (this->hidden->image)
#define OCImage (this->hidden->ocimage)
#define old_video_mode (this->hidden->old_video_mode)
@@ -122,9 +123,13 @@ struct SDL_PrivateVideoData {
#define event (this->hidden->event)
#define current_overlay (this->hidden->overlay)
#define desktop_mode (this->hidden->desktop_mode)
-
-/* Old variable names */
#define mouse_relative (this->hidden->mouse_relative)
#define SDL_BlankCursor (this->hidden->BlankCursor)
+#ifdef HAVE_OPENGL
+ #define oglctx (this->hidden->OGLContext)
+ #define oglflags (this->hidden->OGLFlags)
+ #define oglbpp (this->hidden->OGLBPP)
+#endif /* HAVE_OPENGL */
+
#endif /* __SDL_PH_VIDEO_H__ */
diff --git a/src/video/photon/SDL_ph_wm_c.h b/src/video/photon/SDL_ph_wm_c.h
index ae43cb5fc..17356f211 100644
--- a/src/video/photon/SDL_ph_wm_c.h
+++ b/src/video/photon/SDL_ph_wm_c.h
@@ -20,10 +20,13 @@
slouken@libsdl.org
*/
+#ifndef __SDL_PH_WM_H__
+#define __SDL_PH_WM_H__
+
#ifdef SAVE_RCSID
static char rcsid =
"@(#) $Id$";
-#endif
+#endif /* SAVE_RCSID */
#include "SDL_ph_video.h"
@@ -35,3 +38,4 @@ extern SDL_GrabMode ph_GrabInputNoLock(_THIS, SDL_GrabMode mode);
extern SDL_GrabMode ph_GrabInput(_THIS, SDL_GrabMode mode);
extern int ph_GetWMInfo(_THIS, SDL_SysWMinfo *info);
+#endif /* __SDL_PH_WM_H__ */
diff --git a/src/video/photon/SDL_phyuv_c.h b/src/video/photon/SDL_phyuv_c.h
index 5a22bffbb..291078b4a 100644
--- a/src/video/photon/SDL_phyuv_c.h
+++ b/src/video/photon/SDL_phyuv_c.h
@@ -20,10 +20,14 @@
slouken@libsdl.org
*/
+
+#ifndef __SDL_PH_YUV_H__
+#define __SDL_PH_YUV_H__
+
#ifdef SAVE_RCSID
static char rcsid =
"@(#) $Id$";
-#endif
+#endif /* SAVE_RCSID */
/* This is the photon implementation of YUV video overlays */
@@ -59,3 +63,5 @@ 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);
+
+#endif /* __SDL_PH_YUV_H__ */