diff src/video/x11/SDL_x11mouse.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 07def9d03315
children c9b51268668f
line wrap: on
line diff
--- a/src/video/x11/SDL_x11mouse.c	Sat Nov 05 17:41:11 2005 +0000
+++ b/src/video/x11/SDL_x11mouse.c	Sat Nov 05 19:53:37 2005 +0000
@@ -50,8 +50,8 @@
 {
 	if ( SDL_Display != NULL ) {
 		SDL_Lock_EventThread();
-		XFreeCursor(SDL_Display, cursor->x_cursor);
-		XSync(SDL_Display, False);
+		pXFreeCursor(SDL_Display, cursor->x_cursor);
+		pXSync(SDL_Display, False);
 		SDL_Unlock_EventThread();
 	}
 	free(cursor);
@@ -105,48 +105,48 @@
 	SDL_Lock_EventThread();
 
 	/* Create the data image */
-	data_image = XCreateImage(SDL_Display, 
+	data_image = pXCreateImage(SDL_Display, 
 			DefaultVisual(SDL_Display, SDL_Screen),
 					1, XYBitmap, 0, x_data, w, h, 8, w/8);
 	data_image->byte_order = MSBFirst;
 	data_image->bitmap_bit_order = MSBFirst;
-	data_pixmap = XCreatePixmap(SDL_Display, SDL_Root, w, h, 1);
+	data_pixmap = pXCreatePixmap(SDL_Display, SDL_Root, w, h, 1);
 
 	/* Create the data mask */
-	mask_image = XCreateImage(SDL_Display, 
+	mask_image = pXCreateImage(SDL_Display, 
 			DefaultVisual(SDL_Display, SDL_Screen),
 					1, XYBitmap, 0, x_mask, w, h, 8, w/8);
 	mask_image->byte_order = MSBFirst;
 	mask_image->bitmap_bit_order = MSBFirst;
-	mask_pixmap = XCreatePixmap(SDL_Display, SDL_Root, w, h, 1);
+	mask_pixmap = pXCreatePixmap(SDL_Display, SDL_Root, w, h, 1);
 
 	/* Create the graphics context */
 	GCvalues.function = GXcopy;
 	GCvalues.foreground = ~0;
 	GCvalues.background =  0;
 	GCvalues.plane_mask = AllPlanes;
-	GCcursor = XCreateGC(SDL_Display, data_pixmap,
+	GCcursor = pXCreateGC(SDL_Display, data_pixmap,
 			(GCFunction|GCForeground|GCBackground|GCPlaneMask),
 								&GCvalues);
 
 	/* Blit the images to the pixmaps */
-	XPutImage(SDL_Display, data_pixmap, GCcursor, data_image,
+	pXPutImage(SDL_Display, data_pixmap, GCcursor, data_image,
 							0, 0, 0, 0, w, h);
-	XPutImage(SDL_Display, mask_pixmap, GCcursor, mask_image,
+	pXPutImage(SDL_Display, mask_pixmap, GCcursor, mask_image,
 							0, 0, 0, 0, w, h);
-	XFreeGC(SDL_Display, GCcursor);
+	pXFreeGC(SDL_Display, GCcursor);
 	/* These free the x_data and x_mask memory pointers */
-	XDestroyImage(data_image);
-	XDestroyImage(mask_image);
+	pXDestroyImage(data_image);
+	pXDestroyImage(mask_image);
 
 	/* Create the cursor */
-	cursor->x_cursor = XCreatePixmapCursor(SDL_Display, data_pixmap,
+	cursor->x_cursor = pXCreatePixmapCursor(SDL_Display, data_pixmap,
 				mask_pixmap, &black, &white, hot_x, hot_y);
-	XFreePixmap(SDL_Display, data_pixmap);
-	XFreePixmap(SDL_Display, mask_pixmap);
+	pXFreePixmap(SDL_Display, data_pixmap);
+	pXFreePixmap(SDL_Display, mask_pixmap);
 
 	/* Release the event thread */
-	XSync(SDL_Display, False);
+	pXSync(SDL_Display, False);
 	SDL_Unlock_EventThread();
 
 	return(cursor);
@@ -164,13 +164,13 @@
 		SDL_Lock_EventThread();
 		if ( cursor == NULL ) {
 			if ( SDL_BlankCursor != NULL ) {
-				XDefineCursor(SDL_Display, SDL_Window,
+				pXDefineCursor(SDL_Display, SDL_Window,
 					SDL_BlankCursor->x_cursor);
 			}
 		} else {
-			XDefineCursor(SDL_Display, SDL_Window, cursor->x_cursor);
+			pXDefineCursor(SDL_Display, SDL_Window, cursor->x_cursor);
 		}
-		XSync(SDL_Display, False);
+		pXSync(SDL_Display, False);
 		SDL_Unlock_EventThread();
 	}
 	return(1);
@@ -187,8 +187,8 @@
 		SDL_PrivateMouseMotion(0, 0, x, y);
 	} else {
 		SDL_Lock_EventThread();
-		XWarpPointer(SDL_Display, None, SDL_Window, 0, 0, 0, 0, x, y);
-		XSync(SDL_Display, False);
+		pXWarpPointer(SDL_Display, None, SDL_Window, 0, 0, 0, 0, x, y);
+		pXSync(SDL_Display, False);
 		SDL_Unlock_EventThread();
 	}
 }
@@ -224,7 +224,7 @@
 		}
 	}
 	if ( mouse_param_buf ) {
-		XChangePointerControl(SDL_Display, True, True,
+		pXChangePointerControl(SDL_Display, True, True,
 			accel_value[0], accel_value[1], accel_value[2]);
 		free(mouse_param_buf);
 	}
@@ -257,7 +257,7 @@
 
 				SDL_GetMouseState(&mouse_last.x, &mouse_last.y);
 				/* Use as raw mouse mickeys as possible */
-				XGetPointerControl(SDL_Display,
+				pXGetPointerControl(SDL_Display,
 						&mouse_accel.numerator, 
 						&mouse_accel.denominator,
 						&mouse_accel.threshold);
@@ -273,7 +273,7 @@
 			if ( using_dga & DGA_MOUSE ) {
 				X11_DisableDGAMouse(this);
 			} else {
-				XChangePointerControl(SDL_Display, True, True,
+				pXChangePointerControl(SDL_Display, True, True,
 						mouse_accel.numerator, 
 						mouse_accel.denominator,
 						mouse_accel.threshold);