diff src/video/x11/SDL_x11yuv.c @ 1168:045f186426e1

Dynamically load X11 libraries like we currently do for alsa, esd, etc. This allows you to run an SDL program on a system without Xlib, since it'll just report the x11 target unavailable at runtime.
author Ryan C. Gordon <icculus@icculus.org>
date Sat, 05 Nov 2005 19:53:37 +0000
parents b7a5c1b64829
children b81f54c3963f
line wrap: on
line diff
--- a/src/video/x11/SDL_x11yuv.c	Sat Nov 05 17:41:11 2005 +0000
+++ b/src/video/x11/SDL_x11yuv.c	Sat Nov 05 19:53:37 2005 +0000
@@ -159,7 +159,7 @@
 					}
 				}
 				if ( formats ) {
-					XFree(formats);
+					pXFree(formats);
 				}
 			}
 		}
@@ -208,21 +208,21 @@
 		unsigned int i;
 
 		SDL_NAME(XvSelectPortNotify)(GFX_Display, xv_port, True);
-		X_handler = XSetErrorHandler(xv_errhandler);
+		X_handler = pXSetErrorHandler(xv_errhandler);
 		for ( i=0; i < sizeof(attr)/(sizeof attr[0]); ++i ) {
 			Atom a;
 
 			xv_error = False;
-			a = XInternAtom(GFX_Display, attr[i], True);
+			a = pXInternAtom(GFX_Display, attr[i], True);
 			if ( a != None ) {
      				SDL_NAME(XvSetPortAttribute)(GFX_Display, xv_port, a, 1);
-				XSync(GFX_Display, True);
+				pXSync(GFX_Display, True);
 				if ( ! xv_error ) {
 					break;
 				}
 			}
 		}
-		XSetErrorHandler(X_handler);
+		pXSetErrorHandler(X_handler);
 		SDL_NAME(XvSelectPortNotify)(GFX_Display, xv_port, False);
 	}
 
@@ -262,7 +262,7 @@
 #ifdef PITCH_WORKAROUND
 	if ( hwdata->image != NULL && hwdata->image->pitches[0] != (width*bpp) ) {
 		/* Ajust overlay width according to pitch */ 
-		XFree(hwdata->image);
+		pXFree(hwdata->image);
 		width = hwdata->image->pitches[0] / bpp;
 		hwdata->image = SDL_NAME(XvShmCreateImage)(GFX_Display, xv_port, format,
 							   0, width, height, yuvshm);
@@ -277,10 +277,10 @@
 			yuvshm->readOnly = False;
 			if ( yuvshm->shmaddr != (char *)-1 ) {
 				shm_error = False;
-				X_handler = XSetErrorHandler(shm_errhandler);
-				XShmAttach(GFX_Display, yuvshm);
-				XSync(GFX_Display, True);
-				XSetErrorHandler(X_handler);
+				X_handler = pXSetErrorHandler(shm_errhandler);
+				pXShmAttach(GFX_Display, yuvshm);
+				pXSync(GFX_Display, True);
+				pXSetErrorHandler(X_handler);
 				if ( shm_error )
 					shmdt(yuvshm->shmaddr);
 			} else {
@@ -291,7 +291,7 @@
 			shm_error = True;
 		}
 		if ( shm_error ) {
-			XFree(hwdata->image);
+			pXFree(hwdata->image);
 			hwdata->yuv_use_mitshm = 0;
 		} else {
 			hwdata->image->data = yuvshm->shmaddr;
@@ -306,7 +306,7 @@
 #ifdef PITCH_WORKAROUND
 		if ( hwdata->image != NULL && hwdata->image->pitches[0] != (width*bpp) ) {
 			/* Ajust overlay width according to pitch */ 
-			XFree(hwdata->image);
+			pXFree(hwdata->image);
 			width = hwdata->image->pitches[0] / bpp;
 			hwdata->image = SDL_NAME(XvCreateImage)(GFX_Display, xv_port, format,
 								0, width, height);
@@ -380,7 +380,7 @@
 				     hwdata->image, 0, 0, overlay->w, overlay->h,
 				     dstrect->x, dstrect->y, dstrect->w, dstrect->h);
 	}
-	XSync(GFX_Display, False);
+	pXSync(GFX_Display, False);
 	return(0);
 }
 
@@ -393,12 +393,12 @@
 		SDL_NAME(XvUngrabPort)(GFX_Display, hwdata->port, CurrentTime);
 #ifndef NO_SHARED_MEMORY
 		if ( hwdata->yuv_use_mitshm ) {
-			XShmDetach(GFX_Display, &hwdata->yuvshm);
+			pXShmDetach(GFX_Display, &hwdata->yuvshm);
 			shmdt(hwdata->yuvshm.shmaddr);
 		}
 #endif
 		if ( hwdata->image ) {
-			XFree(hwdata->image);
+			pXFree(hwdata->image);
 		}
 		free(hwdata);
 	}