diff src/video/Xext/Xxf86dga/XF86DGA.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 eadc0746dfaf
children d05306f0dc21
line wrap: on
line diff
--- a/src/video/Xext/Xxf86dga/XF86DGA.c	Sat Nov 05 17:41:11 2005 +0000
+++ b/src/video/Xext/Xxf86dga/XF86DGA.c	Sat Nov 05 19:53:37 2005 +0000
@@ -56,7 +56,6 @@
 #undef _SC_PAGESIZE
 #endif
 
-
 #define NEED_EVENTS
 #define NEED_REPLIES
 #include <X11/Xlibint.h>
@@ -65,6 +64,14 @@
 #include <X11/extensions/Xext.h>
 #include "extutil.h"
 
+#include "../../x11/SDL_x11dyn.h"
+
+/* Workaround code in headers... */
+#define _XFlush p_XFlush
+#define _XFlushGCCache p_XFlushGCCache
+#define _XReply p_XReply
+#define _XSend p_XSend
+
 extern XExtDisplayInfo* SDL_NAME(xdga_find_display)(Display*);
 extern char *SDL_NAME(xdga_extension_name);
 
@@ -112,7 +119,7 @@
     req->reqType = info->codes->major_opcode;
     req->dgaReqType = X_XF86DGAGetVideoLL;
     req->screen = screen;
-    if (!_XReply(dpy, (xReply *)&rep, 0, xFalse)) {
+    if (!p_XReply(dpy, (xReply *)&rep, 0, xFalse)) {
 	UnlockDisplay(dpy);
 	SyncHandle();
 	return False;
@@ -147,7 +154,7 @@
     req->enable = enable;
     UnlockDisplay(dpy);
     SyncHandle();
-    XSync(dpy,False);
+    pXSync(dpy,False);
     return True;
 }
 
@@ -168,7 +175,7 @@
     req->reqType = info->codes->major_opcode;
     req->dgaReqType = X_XF86DGAGetViewPortSize;
     req->screen = screen;
-    if (!_XReply(dpy, (xReply *)&rep, 0, xFalse)) {
+    if (!p_XReply(dpy, (xReply *)&rep, 0, xFalse)) {
 	UnlockDisplay(dpy);
 	SyncHandle();
 	return False;
@@ -203,7 +210,7 @@
     req->y = y;
     UnlockDisplay(dpy);
     SyncHandle();
-    XSync(dpy,False);
+    pXSync(dpy,False);
     return True;
 }
 
@@ -224,7 +231,7 @@
     req->reqType = info->codes->major_opcode;
     req->dgaReqType = X_XF86DGAGetVidPage;
     req->screen = screen;
-    if (!_XReply(dpy, (xReply *)&rep, 0, xFalse)) {
+    if (!p_XReply(dpy, (xReply *)&rep, 0, xFalse)) {
 	UnlockDisplay(dpy);
 	SyncHandle();
 	return False;
@@ -255,7 +262,7 @@
     req->vpage = vpage;
     UnlockDisplay(dpy);
     SyncHandle();
-    XSync(dpy,False);
+    pXSync(dpy,False);
     return True;
 }
 
@@ -277,7 +284,7 @@
     req->id = cmap;
     UnlockDisplay(dpy);
     SyncHandle();
-    XSync(dpy,False);
+    pXSync(dpy,False);
     return True;
 }
 
@@ -297,7 +304,7 @@
     req->reqType = info->codes->major_opcode;
     req->dgaReqType = X_XF86DGAQueryDirectVideo;
     req->screen = screen;
-    if (!_XReply(dpy, (xReply *)&rep, 0, xFalse)) {
+    if (!p_XReply(dpy, (xReply *)&rep, 0, xFalse)) {
 	UnlockDisplay(dpy);
 	SyncHandle();
 	return False;
@@ -325,7 +332,7 @@
     req->dgaReqType = X_XF86DGAViewPortChanged;
     req->screen = screen;
     req->n = n;
-    if (!_XReply(dpy, (xReply *)&rep, 0, xFalse)) {
+    if (!p_XReply(dpy, (xReply *)&rep, 0, xFalse)) {
 	UnlockDisplay(dpy);
 	SyncHandle();
 	return False;
@@ -598,7 +605,7 @@
 	for (i = 0; i < numScrs; i++) {
 	    sp = scrList[i];
 	    SDL_NAME(XF86DGADirectVideoLL)(sp->display, sp->screen, 0);
-	    XSync(sp->display, False);
+	    pXSync(sp->display, False);
 	}
         if (WIFEXITED(status))
 	    _exit(0);
@@ -658,7 +665,7 @@
     for (i = 0; i < numScrs; i++) {
 	sp = scrList[i];
 	SDL_NAME(XF86DGADirectVideo)(sp->display, sp->screen, 0);
-	XSync(sp->display, False);
+	pXSync(sp->display, False);
     }
     _exit(3);
 }