Commit a1db2482 authored by Sam Lantinga's avatar Sam Lantinga

Added SDL_LockRect() and SDL_UnlockRect()

 Incorporated XFree86 extension libraries into the source

--HG--
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%40293
parent 84075e73
......@@ -3,6 +3,12 @@ This is a list of API changes in SDL's version history.
Version 1.0:
1.2.4:
Added SDL_LockRect() and SDL_UnlockRect() to lock a portion of a
surface. This may be more efficient than a full lock if you are
using a hardware surface and plan to make a few changes to small
areas in the surface.
1.2.0:
Added SDL_VIDEOEXPOSE event to signal that the screen needs to
be redrawn. This is currently only delivered to OpenGL windows
......
......@@ -495,7 +495,7 @@ CheckX11()
AC_PATH_X
AC_PATH_XTRA
if test x$have_x = xyes; then
CFLAGS="$CFLAGS $X_CFLAGS -DENABLE_X11"
CFLAGS="$CFLAGS $X_CFLAGS -DENABLE_X11 -Isrc/video"
if test x$ac_cv_func_shmat != xyes; then
CFLAGS="$CFLAGS -DNO_SHARED_MEMORY"
fi
......@@ -511,7 +511,7 @@ CheckX11()
video_x11_vm=no
AC_TRY_COMPILE([
#include <X11/Xlib.h>
#include <X11/extensions/xf86vmode.h>
#include <XFree86/extensions/xf86vmode.h>
],[
],[
video_x11_vm=yes
......@@ -519,34 +519,15 @@ CheckX11()
AC_MSG_RESULT($video_x11_vm)
if test x$video_x11_vm = xyes; then
CFLAGS="$CFLAGS -DXFREE86_VM"
# Check for nasty XFree86 4.0/Glide hack
AC_ARG_ENABLE(xfree86_glidehack,
[ --enable-xfree86-glidehack Alternate vidmode lib for old Glide [default=no]],
, enable_xfreeglidehack=no)
if test x$enable_xfree86_glidehack = xyes; then
ac_save_libs="$LIBS"
LIBS="$LIBS $X_LIBS -lX11 -lXext"
if test x$xfree86_glidehack = x; then
AC_CHECK_LIB(Xxf86vm, XF40VidModeQueryExtension, xfree86_glidehack=Xxf86vm)
fi
if test x$xfree86_glidehack = x; then
AC_CHECK_LIB(Xxf86vm40, XF40VidModeQueryExtension, xfree86_glidehack=Xxf86vm40)
fi
LIBS="$ac_save_libs"
fi
if test x$xfree86_glidehack != x; then
CFLAGS="$CFLAGS -DXFREE86_VM_DYNAMIC_HACK"
SYSTEM_LIBS="$SYSTEM_LIBS -l$xfree86_glidehack"
else
SYSTEM_LIBS="$SYSTEM_LIBS -lXxf86vm"
fi
VIDEO_SUBDIRS="$VIDEO_SUBDIRS XFree86/Xxf86vm"
VIDEO_DRIVERS="$VIDEO_DRIVERS XFree86/Xxf86vm/libXFree86_Xxf86vm.la"
AC_MSG_CHECKING(for XFree86 VidMode gamma support)
video_x11_vmgamma=no
AC_TRY_COMPILE([
#include <X11/Xlib.h>
#include <X11/extensions/xf86vmode.h>
#include <XFree86/extensions/xf86vmode.h>
],[
XF86VidModeGamma gamma;
SDL_NAME(XF86VidModeGamma) gamma;
],[
video_x11_vmgamma=yes
])
......@@ -567,7 +548,7 @@ CheckX11()
video_x11_dga=no
AC_TRY_COMPILE([
#include <X11/Xlib.h>
#include <X11/extensions/xf86dga.h>
#include <XFree86/extensions/xf86dga.h>
],[
],[
video_x11_dga=yes
......@@ -578,7 +559,8 @@ CheckX11()
if test x$enable_video_x11_dgamouse = xyes; then
CFLAGS="$CFLAGS -DDEFAULT_DGAMOUSE"
fi
SYSTEM_LIBS="$SYSTEM_LIBS -lXxf86dga"
VIDEO_SUBDIRS="$VIDEO_SUBDIRS XFree86/Xxf86dga"
VIDEO_DRIVERS="$VIDEO_DRIVERS XFree86/Xxf86dga/libXFree86_Xxf86dga.la"
fi
fi
AC_ARG_ENABLE(video-x11-xv,
......@@ -592,16 +574,17 @@ CheckX11()
#include <sys/ipc.h>
#include <sys/shm.h>
#include <X11/extensions/XShm.h>
#include <X11/extensions/Xvlib.h>
#include <XFree86/extensions/Xvlib.h>
],[
XvImage *image;
SDL_NAME(XvImage) *image;
],[
video_x11_xv=yes
])
AC_MSG_RESULT($video_x11_xv)
if test x$video_x11_xv = xyes; then
CFLAGS="$CFLAGS -DXFREE86_XV"
SYSTEM_LIBS="$SYSTEM_LIBS -lXv"
VIDEO_SUBDIRS="$VIDEO_SUBDIRS XFree86/Xv"
VIDEO_DRIVERS="$VIDEO_DRIVERS XFree86/Xv/libXFree86_Xv.la"
fi
fi
AC_ARG_ENABLE(video-x11-xinerama,
......@@ -612,16 +595,17 @@ CheckX11()
video_x11_xinerama=no
AC_TRY_COMPILE([
#include <X11/Xlib.h>
#include <X11/extensions/Xinerama.h>
#include <XFree86/extensions/Xinerama.h>
],[
XineramaScreenInfo *xinerama;
SDL_NAME(XineramaScreenInfo) *xinerama;
],[
video_x11_xinerama=yes
])
AC_MSG_RESULT($video_x11_xinerama)
if test x$video_x11_xinerama = xyes; then
CFLAGS="$CFLAGS -DHAVE_XINERAMA"
SYSTEM_LIBS="$SYSTEM_LIBS -lXinerama"
VIDEO_SUBDIRS="$VIDEO_SUBDIRS XFree86/Xinerama"
VIDEO_DRIVERS="$VIDEO_DRIVERS XFree86/Xinerama/libXFree86_Xinerama.la"
fi
fi
AC_ARG_ENABLE(video-x11-xme,
......@@ -648,6 +632,33 @@ CheckX11()
fi
}
dnl Find the X11 DGA 2.0 include and library directories
CheckDGA()
{
AC_ARG_ENABLE(video-dga,
[ --enable-video-dga use DGA 2.0 video driver [default=yes]],
, enable_video_dga=yes)
if test x$video_x11_dga = xyes -a x$enable_video_dga = xyes; then
save_CFLAGS="$CFLAGS"; CFLAGS="$CFLAGS -Isrc/video"
AC_MSG_CHECKING(for XFree86 DGA 2.0 support)
video_x11_dga2=no
AC_TRY_COMPILE([
#include <X11/Xlib.h>
#include <XFree86/extensions/xf86dga.h>
],[
SDL_NAME(XDGAEvent) xevent;
],[
video_x11_dga2=yes
])
AC_MSG_RESULT($video_x11_dga2)
if test x$video_x11_dga2 = xyes; then
CFLAGS="$CFLAGS -DENABLE_DGA"
VIDEO_SUBDIRS="$VIDEO_SUBDIRS dga"
VIDEO_DRIVERS="$VIDEO_DRIVERS dga/libvideo_dga.la"
fi
fi
}
CheckPHOTON()
{
AC_ARG_ENABLE(video-photon,
......@@ -677,32 +688,6 @@ CheckPHOTON()
fi
}
dnl Find the X11 DGA 2.0 include and library directories
CheckDGA()
{
AC_ARG_ENABLE(video-dga,
[ --enable-video-dga use DGA 2.0 video driver [default=yes]],
, enable_video_dga=yes)
if test x$video_x11_dga = xyes -a x$enable_video_dga = xyes; then
AC_MSG_CHECKING(for XFree86 DGA 2.0 support)
video_x11_dga2=no
AC_TRY_COMPILE([
#include <X11/Xlib.h>
#include <X11/extensions/xf86dga.h>
],[
XDGAEvent xevent;
],[
video_x11_dga2=yes
])
AC_MSG_RESULT($video_x11_dga2)
if test x$video_x11_dga2 = xyes; then
CFLAGS="$CFLAGS -DENABLE_DGA"
VIDEO_SUBDIRS="$VIDEO_SUBDIRS dga"
VIDEO_DRIVERS="$VIDEO_DRIVERS dga/libvideo_dga.la"
fi
fi
}
dnl Find the framebuffer console includes
CheckFBCON()
{
......@@ -2335,6 +2320,7 @@ CFLAGS="$CFLAGS -I\$(top_srcdir)/src -I\$(top_srcdir)/src/$ARCH"
CFLAGS="$CFLAGS -I\$(top_srcdir)/src/main"
CFLAGS="$CFLAGS -I\$(top_srcdir)/src/audio"
CFLAGS="$CFLAGS -I\$(top_srcdir)/src/video"
CFLAGS="$CFLAGS -I\$(top_srcdir)/src/video/XFree86/extensions"
CFLAGS="$CFLAGS -I\$(top_srcdir)/src/events"
CFLAGS="$CFLAGS -I\$(top_srcdir)/src/joystick"
CFLAGS="$CFLAGS -I\$(top_srcdir)/src/cdrom"
......@@ -2391,6 +2377,12 @@ src/audio/windib/Makefile
src/audio/windx5/Makefile
src/audio/disk/Makefile
src/video/Makefile
src/video/XFree86/Makefile
src/video/XFree86/extensions/Makefile
src/video/XFree86/Xinerama/Makefile
src/video/XFree86/Xv/Makefile
src/video/XFree86/Xxf86dga/Makefile
src/video/XFree86/Xxf86vm/Makefile
src/video/cybergfx/Makefile
src/video/x11/Makefile
src/video/dga/Makefile
......
......@@ -16,6 +16,8 @@ be found at the <A HREF="http://www.libsdl.org/"> main SDL page</A>.
Major changes since SDL 1.0.0:
</H2>
<UL>
<LI> 1.2.4: Added SDL_LockRect() and SDL_UnlockRect()
<LI> 1.2.4: Incorporated XFree86 extension libraries into the source
<LI> 1.2.4: Added initial support for Atari (thanks Patrice!)
<LI> 1.2.4: Added support for joysticks on *BSD (thanks Wilbern!)
<LI> 1.2.4: Added a YUV overlay test program (thanks Jon!)
......
......@@ -531,6 +531,26 @@ extern DECLSPEC void SDL_FreeSurface(SDL_Surface *surface);
extern DECLSPEC int SDL_LockSurface(SDL_Surface *surface);
extern DECLSPEC void SDL_UnlockSurface(SDL_Surface *surface);
/*
* SDL_LockRect() locks a portion of the surface designated by the 'rect'
* parameter, and saves the resulting pixels and pitch in the arguments.
* The rect will be clipped if it extends beyond the bounds of the surface
*
* This may be more efficient than a full lock if you are using a hardware
* surface and plan to make a few changes to small areas in the surface.
*
* While a rectangle is locked, no other lock or blit call may be called
* on the surface. No operating system or library calls should be made
* between lock/unlock pairs, as critical system locks may be held during
* this time.
*
* After the surface is unlocked, the pixels pointer is no longer valid.
*
* SDL_LockRect() returns 0, or -1 if the surface couldn't be locked.
*/
extern DECLSPEC int SDL_LockRect(SDL_Surface *surface, SDL_Rect *rect, void **pixels, int *pitch);
extern DECLSPEC void SDL_UnlockRect(SDL_Surface *surface);
/*
* Load a surface from a seekable SDL data source (memory or file.)
* If 'freesrc' is non-zero, the source will be closed after being read.
......
......@@ -74,6 +74,7 @@ _SDL_GetKeyState
_SDL_GetModState
_SDL_SetModState
_SDL_GetKeyName
_SDL_SetModuleHandle
_SDL_RegisterApp
_SDL_InitQuickDraw
_SDL_GetMouseState
......@@ -143,6 +144,8 @@ _SDL_CreateRGBSurfaceFrom
_SDL_FreeSurface
_SDL_LockSurface
_SDL_UnlockSurface
_SDL_LockRect
_SDL_UnlockRect
_SDL_LoadBMP_RW
_SDL_SaveBMP_RW
_SDL_SetColorKey
......@@ -174,3 +177,4 @@ _SDL_WM_SetIcon
_SDL_WM_IconifyWindow
_SDL_WM_ToggleFullScreen
_SDL_WM_GrabInput
_SDL_SoftStretch
......@@ -143,6 +143,8 @@
SDL_FreeSurface
SDL_LockSurface
SDL_UnlockSurface
SDL_LockRect
SDL_UnlockRect
SDL_LoadBMP_RW
SDL_SaveBMP_RW
SDL_SetColorKey
......@@ -174,4 +176,5 @@
SDL_WM_IconifyWindow
SDL_WM_ToggleFullScreen
SDL_WM_GrabInput
SDL_SoftStretch
SDL_InitQuickDraw
......@@ -141,6 +141,8 @@
_SDL_FreeSurface
_SDL_LockSurface
_SDL_UnlockSurface
_SDL_LockRect
_SDL_UnlockRect
_SDL_LoadBMP_RW
_SDL_SaveBMP_RW
_SDL_SetColorKey
......
......@@ -74,6 +74,7 @@
SDL_GetModState
SDL_SetModState
SDL_GetKeyName
SDL_SetModuleHandle
SDL_RegisterApp
SDL_InitQuickDraw
SDL_GetMouseState
......@@ -143,6 +144,8 @@
SDL_FreeSurface
SDL_LockSurface
SDL_UnlockSurface
SDL_LockRect
SDL_UnlockRect
SDL_LoadBMP_RW
SDL_SaveBMP_RW
SDL_SetColorKey
......
......@@ -9,7 +9,7 @@ DIST_SUBDIRS = dummy x11 dga nanox fbcon directfb vgl svga ggi aalib \
wincommon windib windx5 \
maccommon macdsp macrom quartz \
bwindow ps2gs photon cybergfx epoc \
ataricommon xbios gem
ataricommon xbios gem XFree86
DRIVERS = @VIDEO_DRIVERS@
......
......@@ -630,6 +630,10 @@ int SDL_FillRect(SDL_Surface *dst, SDL_Rect *dstrect, Uint32 color)
*/
int SDL_LockSurface (SDL_Surface *surface)
{
if ( surface->locked < 0 ) {
SDL_SetError("Surface has a rectangle lock");
return(-1);
}
if ( ! surface->locked ) {
/* Perform the lock */
if ( surface->flags & (SDL_HWSURFACE|SDL_ASYNCBLIT) ) {
......@@ -653,6 +657,78 @@ int SDL_LockSurface (SDL_Surface *surface)
/* Ready to go.. */
return(0);
}
int SDL_LockRect (SDL_Surface *surface, SDL_Rect *rect, void **pixels, int *pitch)
{
int retval = 0;
/* Check to see if the surface is already locked */
*pixels = NULL;
if ( surface->locked != 0 ) {
SDL_SetError("Surface is already locked");
return(-1);
}
/* Clip the lock to the clipping rectangle of the surface */
{
SDL_Rect *clip = &surface->clip_rect;
int dx, dy;
int h = rect->h;
int w = rect->w;
dx = clip->x - rect->x;
if(dx > 0) {
w -= dx;
rect->x += dx;
}
dx = rect->x + w - clip->x - clip->w;
if(dx > 0)
w -= dx;
dy = clip->y - rect->y;
if(dy > 0) {
h -= dy;
rect->y += dy;
}
dy = rect->y + h - clip->y - clip->h;
if(dy > 0)
h -= dy;
if(w > 0 && h > 0) {
rect->w = w;
rect->h = h;
} else {
rect->w = 0;
rect->h = 0;
SDL_SetError("Rectangle was clipped");
return(-1);
}
}
/* Perform the lock */
if ( surface->flags & (SDL_HWSURFACE|SDL_ASYNCBLIT) ) {
SDL_VideoDevice *video = current_video;
SDL_VideoDevice *this = current_video;
if ( video->LockHWSurfaceRect ) {
retval = video->LockHWSurfaceRect(this, surface, rect, pixels, pitch);
if ( retval == 0 ) {
surface->locked = -1;
return 0;
}
}
}
if ( SDL_MUSTLOCK(surface) ) {
retval = SDL_LockSurface(surface);
if ( retval < 0 ) {
return retval;
}
}
surface->locked = -1;
*pixels = (Uint8 *)surface->pixels + rect->y * surface->pitch + rect->x * surface->format->BytesPerPixel;
*pitch = surface->pitch;
/* Ready to go.. */
return(0);
}
/*
* Unlock a previously locked surface
* -- Do not call this from any blit function, as SDL_DrawCursor() may recurse
......@@ -663,6 +739,9 @@ int SDL_LockSurface (SDL_Surface *surface)
void SDL_UnlockSurface (SDL_Surface *surface)
{
/* Only perform an unlock if we are locked */
if ( surface->locked < 0 ) {
return;
}
if ( ! surface->locked || (--surface->locked > 0) ) {
return;
}
......@@ -683,6 +762,29 @@ void SDL_UnlockSurface (SDL_Surface *surface)
}
}
}
void SDL_UnlockRect (SDL_Surface *surface)
{
/* Only perform an unlock if we are locked */
if ( surface->locked != -1 ) {
return;
}
/* Perform the unlock */
if ( surface->flags & (SDL_HWSURFACE|SDL_ASYNCBLIT) ) {
SDL_VideoDevice *video = current_video;
SDL_VideoDevice *this = current_video;
if ( video->LockHWSurfaceRect ) {
video->UnlockHWSurfaceRect(this, surface);
return;
}
}
if ( SDL_MUSTLOCK(surface) ) {
surface->locked = 1;
SDL_UnlockSurface(surface);
} else {
surface->locked = 0;
}
}
/*
* Convert a surface into the specified pixel format.
......
......@@ -153,6 +153,8 @@ struct SDL_VideoDevice {
/* Returns a readable/writable surface */
int (*LockHWSurface)(_THIS, SDL_Surface *surface);
void (*UnlockHWSurface)(_THIS, SDL_Surface *surface);
int (*LockHWSurfaceRect)(_THIS, SDL_Surface *surface, SDL_Rect *rect, void **pixels, int *pitch);
void (*UnlockHWSurfaceRect)(_THIS, SDL_Surface *surface);
/* Performs hardware flipping */
int (*FlipHWSurface)(_THIS, SDL_Surface *surface);
......
......@@ -1255,7 +1255,7 @@ int SDL_DisplayYUV_SW(_THIS, SDL_Overlay *overlay, SDL_Rect *dstrect)
Cb = lum + 3;
break;
default:
SDL_SetError("Unsupported YUV format in blit (??)");
SDL_SetError("Unsupported YUV format in blit");
return(-1);
}
if ( SDL_MUSTLOCK(display) ) {
......
SUBDIRS = extensions Xinerama Xv Xxf86dga Xxf86vm
EXTRA_DIST = README
The reason these libraries are built outside of the standard XFree86
tree is so that they can be linked as shared object code directly into
SDL without causing any symbol collisions with code in the application.
You can't link static library code into shared libraries on non-x86
Linux platforms. Since these libraries haven't become standard yet,
we'll just include them directly.
## Makefile.am for the XFree86 Xinerama library
noinst_LTLIBRARIES = libXFree86_Xinerama.la
libXFree86_Xinerama_la_SOURCES = Xinerama.c
/* $Xorg: XPanoramiX.c,v 1.4 2000/08/17 19:45:51 cpqbld Exp $ */
/*****************************************************************
Copyright (c) 1991, 1997 Digital Equipment Corporation, Maynard, Massachusetts.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software.
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
DIGITAL EQUIPMENT CORPORATION BE LIABLE FOR ANY CLAIM, DAMAGES, INCLUDING,
BUT NOT LIMITED TO CONSEQUENTIAL OR INCIDENTAL DAMAGES, OR OTHER LIABILITY,
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR
IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Except as contained in this notice, the name of Digital Equipment Corporation
shall not be used in advertising or otherwise to promote the sale, use or other
dealings in this Software without prior written authorization from Digital
Equipment Corporation.
******************************************************************/
/* $XFree86: xc/lib/Xinerama/Xinerama.c,v 1.2 2001/07/23 17:20:28 dawes Exp $ */
#define NEED_EVENTS
#define NEED_REPLIES
#include <X11/Xlibint.h>
#include <X11/Xutil.h>
#include <X11/extensions/Xext.h> /* in ../include */
#include "extutil.h" /* in ../include */
#include "panoramiXext.h"
#include "panoramiXproto.h" /* in ../include */
#include "Xinerama.h"
static XExtensionInfo _panoramiX_ext_info_data;
static XExtensionInfo *panoramiX_ext_info = &_panoramiX_ext_info_data;
static /* const */ char *panoramiX_extension_name = PANORAMIX_PROTOCOL_NAME;
#define PanoramiXCheckExtension(dpy,i,val) \
XextCheckExtension (dpy, i, panoramiX_extension_name, val)
#define PanoramiXSimpleCheckExtension(dpy,i) \
XextSimpleCheckExtension (dpy, i, panoramiX_extension_name)
static int close_display();
static /* const */ XExtensionHooks panoramiX_extension_hooks = {
NULL, /* create_gc */
NULL, /* copy_gc */
NULL, /* flush_gc */
NULL, /* free_gc */
NULL, /* create_font */
NULL, /* free_font */
close_display, /* close_display */
NULL, /* wire_to_event */
NULL, /* event_to_wire */
NULL, /* error */
NULL, /* error_string */
};
static XEXT_GENERATE_FIND_DISPLAY (find_display, panoramiX_ext_info,
panoramiX_extension_name,
&panoramiX_extension_hooks,
0, NULL)
static XEXT_GENERATE_CLOSE_DISPLAY (close_display, panoramiX_ext_info)
/****************************************************************************
* *
* PanoramiX public interfaces *
* *
****************************************************************************/
Bool SDL_NAME(XPanoramiXQueryExtension) (
Display *dpy,
int *event_basep,
int *error_basep
)
{
XExtDisplayInfo *info = find_display (dpy);
if (XextHasExtension(info)) {
*event_basep = info->codes->first_event;
*error_basep = info->codes->first_error;
return True;
} else {
return False;
}
}
Status SDL_NAME(XPanoramiXQueryVersion)(
Display *dpy,
int *major_versionp,
int *minor_versionp
)
{
XExtDisplayInfo *info = find_display (dpy);
xPanoramiXQueryVersionReply rep;
register xPanoramiXQueryVersionReq *req;
PanoramiXCheckExtension (dpy, info, 0);
LockDisplay (dpy);
GetReq (PanoramiXQueryVersion, req);
req->reqType = info->codes->major_opcode;
req->panoramiXReqType = X_PanoramiXQueryVersion;
req->clientMajor = PANORAMIX_MAJOR_VERSION;
req->clientMinor = PANORAMIX_MINOR_VERSION;
if (!_XReply (dpy, (xReply *) &rep, 0, xTrue)) {
UnlockDisplay (dpy);
SyncHandle ();
return 0;
}
*major_versionp = rep.majorVersion;
*minor_versionp = rep.minorVersion;
UnlockDisplay (dpy);
SyncHandle ();
return 1;
}
SDL_NAME(XPanoramiXInfo) *SDL_NAME(XPanoramiXAllocInfo)(void)
{
return (SDL_NAME(XPanoramiXInfo) *) Xmalloc (sizeof (SDL_NAME(XPanoramiXInfo)));
}
Status SDL_NAME(XPanoramiXGetState) (
Display *dpy,
Drawable drawable,
SDL_NAME(XPanoramiXInfo) *panoramiX_info
)
{
XExtDisplayInfo *info = find_display (dpy);
xPanoramiXGetStateReply rep;
register xPanoramiXGetStateReq *req;
PanoramiXCheckExtension (dpy, info, 0);
LockDisplay (dpy);
GetReq (PanoramiXGetState, req);
req->reqType = info->codes->major_opcode;
req->panoramiXReqType = X_PanoramiXGetState;
req->window = drawable;
if (!_XReply (dpy, (xReply *) &rep, 0, xTrue)) {
UnlockDisplay (dpy);
SyncHandle ();
return 0;
}
UnlockDisplay (dpy);
SyncHandle ();
panoramiX_info->window = rep.window;
panoramiX_info->State = rep.state;
return 1;
}
Status SDL_NAME(XPanoramiXGetScreenCount) (
Display *dpy,
Drawable drawable,
SDL_NAME(XPanoramiXInfo) *panoramiX_info
)
{
XExtDisplayInfo *info = find_display (dpy);
xPanoramiXGetScreenCountReply rep;
register xPanoramiXGetScreenCountReq *req;
PanoramiXCheckExtension (dpy, info, 0);
LockDisplay (dpy);
GetReq (PanoramiXGetScreenCount, req);
req->reqType = info->codes->major_opcode;
req->panoramiXReqType = X_PanoramiXGetScreenCount;
req->window = drawable;
if (!_XReply (dpy, (xReply *) &rep, 0, xTrue)) {
UnlockDisplay (dpy);
SyncHandle ();
return 0;
}
UnlockDisplay (dpy);
SyncHandle ();
panoramiX_info->window = rep.window;
panoramiX_info->ScreenCount = rep.ScreenCount;
return 1;
}
Status SDL_NAME(XPanoramiXGetScreenSize) (
Display *dpy,
Drawable drawable,
int screen_num,
SDL_NAME(XPanoramiXInfo) *panoramiX_info
)
{
XExtDisplayInfo *info = find_display (dpy);
xPanoramiXGetScreenSizeReply rep;
register xPanoramiXGetScreenSizeReq *req;
PanoramiXCheckExtension (dpy, info, 0);
LockDisplay (dpy);
GetReq (PanoramiXGetScreenSize, req);
req->reqType = info->codes->major_opcode;
req->panoramiXReqType = X_PanoramiXGetScreenSize;
req->window = drawable;
req->screen = screen_num; /* need to define */
if (!_XReply (dpy, (xReply *) &rep, 0, xTrue)) {
UnlockDisplay (dpy);
SyncHandle ();
return 0;
}
UnlockDisplay (dpy);
SyncHandle ();
panoramiX_info->window = rep.window;
panoramiX_info->screen = rep.screen;
panoramiX_info->width = rep.width;
panoramiX_info->height = rep.height;
return 1;
}
/*******************************************************************\
Alternate interface to make up for shortcomings in the original,
namely, the omission of the screen origin. The new interface is
in the "Xinerama" namespace instead of "PanoramiX".
\*******************************************************************/
Bool SDL_NAME(XineramaQueryExtension) (
Display *dpy,
int *event_base,
int *error_base
)
{
return SDL_NAME(XPanoramiXQueryExtension)(dpy, event_base, error_base);
}
Status SDL_NAME(XineramaQueryVersion)(
Display *dpy,
int *major,
int *minor
)
{
return SDL_NAME(XPanoramiXQueryVersion)(dpy, major, minor);
}
Bool SDL_NAME(XineramaIsActive)(Display *dpy)
{
xXineramaIsActiveReply rep;
xXineramaIsActiveReq *req;
XExtDisplayInfo *info = find_display (dpy);
if(!XextHasExtension(info))
return False; /* server doesn't even have the extension */
LockDisplay (dpy);
GetReq (XineramaIsActive, req);
req->reqType = info->codes->major_opcode;
req->panoramiXReqType = X_XineramaIsActive;
if (!_XReply (dpy, (xReply *) &rep, 0, xTrue)) {
UnlockDisplay (dpy);
SyncHandle ();
return False;
}
UnlockDisplay (dpy);
SyncHandle ();
return rep.state;
}
#include <stdio.h>
SDL_NAME(XineramaScreenInfo) *
SDL_NAME(XineramaQueryScreens)(
Display *dpy,
int *number
)
{
XExtDisplayInfo *info = find_display (dpy);
xXineramaQueryScreensReply rep;
xXineramaQueryScreensReq *req;
SDL_NAME(XineramaScreenInfo) *scrnInfo = NULL;
PanoramiXCheckExtension (dpy, info, 0);
LockDisplay (dpy);
GetReq (XineramaQueryScreens, req);
req->reqType = info->codes->major_opcode;
req->panoramiXReqType = X_XineramaQueryScreens;
if (!_XReply (dpy, (xReply *) &rep, 0, xFalse)) {
UnlockDisplay (dpy);
SyncHandle ();
return NULL;
}
if(rep.number) {
if((scrnInfo = Xmalloc(sizeof(SDL_NAME(XineramaScreenInfo)) * rep.number))) {
xXineramaScreenInfo scratch;
int i;
for(i = 0; i < rep.number; i++) {
_XRead(dpy, (char*)(&scratch), sz_XineramaScreenInfo);
scrnInfo[i].screen_number = i;
scrnInfo[i].x_org = scratch.x_org;
scrnInfo[i].y_org = scratch.y_org;
scrnInfo[i].width = scratch.width;
scrnInfo[i].height = scratch.height;
}
*number = rep.number;
} else
_XEatData(dpy, rep.length << 2);
}
UnlockDisplay (dpy);
SyncHandle ();
return scrnInfo;
}
## Makefile.am for the XFree86 Xv library
noinst_LTLIBRARIES = libXFree86_Xv.la
libXFree86_Xv_la_SOURCES = Xv.c Xvlibint.h
This diff is collapsed.
/***********************************************************
Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts,
and the Massachusetts Institute of Technology, Cambridge, Massachusetts.
All Rights Reserved
Permission to use, copy, modify, and distribute this software and its
documentation for any purpose and without fee is hereby granted,
provided that the above copyright notice appear in all copies and that
both that copyright notice and this permission notice appear in
supporting documentation, and that the names of Digital or MIT not be
used in advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
SOFTWARE.
******************************************************************/
/* $XFree86: xc/lib/Xv/Xvlibint.h,v 1.5 2001/07/25 15:04:53 dawes Exp $ */
#ifndef XVLIBINT_H
#define XVLIBINT_H
/*
** File:
**
** Xvlibint.h --- Xv library internal header file
**
** Author:
**
** David Carver (Digital Workstation Engineering/Project Athena)
**
** Revisions:
**
** 01.24.91 Carver
** - version 1.4 upgrade
**
*/
#define NEED_REPLIES
#include <X11/Xlibint.h>
#include "Xvproto.h"
#include "Xvlib.h"
#if !defined(UNIXCPP)
#define XvGetReq(name, req) \
WORD64ALIGN\
if ((dpy->bufptr + SIZEOF(xv##name##Req)) > dpy->bufmax)\
_XFlush(dpy);\
req = (xv##name##Req *)(dpy->last_req = dpy->bufptr);\
req->reqType = info->codes->major_opcode;\
req->xvReqType = xv_##name; \
req->length = (SIZEOF(xv##name##Req))>>2;\
dpy->bufptr += SIZEOF(xv##name##Req);\
dpy->request++
#else /* non-ANSI C uses empty comment instead of "##" for token concatenation */
#define XvGetReq(name, req) \
WORD64ALIGN\
if ((dpy->bufptr + SIZEOF(xv/**/name/**/Req)) > dpy->bufmax)\
_XFlush(dpy);\
req = (xv/**/name/**/Req *)(dpy->last_req = dpy->bufptr);\
req->reqType = info->codes->major_opcode;\
req->xvReqType = xv_/**/name;\
req->length = (SIZEOF(xv/**/name/**/Req))>>2;\
dpy->bufptr += SIZEOF(xv/**/name/**/Req);\
dpy->request++
#endif
#endif /* XVLIBINT_H */
## Makefile.am for the XFree86 Xxf86dga library
noinst_LTLIBRARIES = libXFree86_Xxf86dga.la
libXFree86_Xxf86dga_la_SOURCES = XF86DGA2.c XF86DGA.c
This diff is collapsed.
This diff is collapsed.
## Makefile.am for the XFree86 Xxf86vm library
noinst_LTLIBRARIES = libXFree86_Xxf86vm.la
libXFree86_Xxf86vm_la_SOURCES = XF86VMode.c
This diff is collapsed.
noinst_HEADERS = \
extutil.h \
panoramiXext.h \
panoramiXproto.h \
SDLname.h \
xf86dga1.h \
xf86dga1str.h \
xf86dga.h \
xf86dgastr.h \
xf86vmode.h \
xf86vmstr.h \
Xinerama.h \
Xv.h \
Xvlib.h \
Xvproto.h
#ifndef _SDLname_h_
#define _SDLname_h_
#define NeedFunctionPrototypes 1
#define SDL_NAME(X) SDL_##X
#endif
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
......@@ -29,7 +29,7 @@ static char rcsid =
#include <stdio.h>
#include <X11/Xlib.h>
#include <X11/extensions/xf86dga.h>
#include <XFree86/extensions/xf86dga.h>
#include "SDL_sysvideo.h"
#include "SDL_events_c.h"
......@@ -45,7 +45,7 @@ extern SDL_keysym *X11_TranslateKey(Display *display, XKeyEvent *xkey,
static int DGA_DispatchEvent(_THIS)
{
int posted;
XDGAEvent xevent;
SDL_NAME(XDGAEvent) xevent;
XNextEvent(DGA_Display, (XEvent *)&xevent);
......@@ -82,7 +82,7 @@ static int DGA_DispatchEvent(_THIS)
SDL_keysym keysym;
XKeyEvent xkey;
XDGAKeyEventToXKeyEvent(&xevent.xkey, &xkey);
SDL_NAME(XDGAKeyEventToXKeyEvent)(&xevent.xkey, &xkey);
posted = SDL_PrivateKeyboard((xevent.type == KeyPress),
X11_TranslateKey(DGA_Display,
&xkey, xkey.keycode,
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
......@@ -66,11 +66,7 @@ dnl Check for OpenGL
AC_MSG_CHECKING(for OpenGL support)
have_opengl=no
AC_TRY_COMPILE([
#if defined(__APPLE__) && defined(__MACH__)
#include <OpenGL/gl.h>
#else
#include <GL/gl.h>
#endif
#include "SDL_opengl.h"
],[
],[
have_opengl=yes
......
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