diff src/video/x11/SDL_x11events.c @ 1575:3ba88cb7eb1b

Updated dynamic X11 code. See details in Bugzilla #170.
author Ryan C. Gordon <icculus@icculus.org>
date Wed, 22 Mar 2006 05:00:59 +0000
parents d910939febfa
children 5b0805ceb50f
line wrap: on
line diff
--- a/src/video/x11/SDL_x11events.c	Wed Mar 22 04:51:44 2006 +0000
+++ b/src/video/x11/SDL_x11events.c	Wed Mar 22 05:00:59 2006 +0000
@@ -187,13 +187,13 @@
 	int repeated;
 
 	repeated = 0;
-	if ( pXPending(display) ) {
-		pXPeekEvent(display, &peekevent);
+	if ( XPending(display) ) {
+		XPeekEvent(display, &peekevent);
 		if ( (peekevent.type == KeyPress) &&
 		     (peekevent.xkey.keycode == event->xkey.keycode) &&
 		     ((peekevent.xkey.time-event->xkey.time) < 2) ) {
 			repeated = 1;
-			pXNextEvent(display, &peekevent);
+			XNextEvent(display, &peekevent);
 		}
 	}
 	return(repeated);
@@ -228,7 +228,7 @@
 	     (xevent->xmotion.y < MOUSE_FUDGE_FACTOR) ||
 	     (xevent->xmotion.y > (h-MOUSE_FUDGE_FACTOR)) ) {
 		/* Get the events that have accumulated */
-		while ( pXCheckTypedEvent(SDL_Display, MotionNotify, xevent) ) {
+		while ( XCheckTypedEvent(SDL_Display, MotionNotify, xevent) ) {
 			deltax = xevent->xmotion.x - mouse_last.x;
 			deltay = xevent->xmotion.y - mouse_last.y;
 #ifdef DEBUG_MOTION
@@ -240,10 +240,10 @@
 		}
 		mouse_last.x = w/2;
 		mouse_last.y = h/2;
-		pXWarpPointer(SDL_Display, None, SDL_Window, 0, 0, 0, 0,
+		XWarpPointer(SDL_Display, None, SDL_Window, 0, 0, 0, 0,
 					mouse_last.x, mouse_last.y);
 		for ( i=0; i<10; ++i ) {
-        		pXMaskEvent(SDL_Display, PointerMotionMask, xevent);
+        		XMaskEvent(SDL_Display, PointerMotionMask, xevent);
 			if ( (xevent->xmotion.x >
 			          (mouse_last.x-MOUSE_FUDGE_FACTOR)) &&
 			     (xevent->xmotion.x <
@@ -273,7 +273,7 @@
 	XEvent xevent;
 
 	SDL_memset(&xevent, '\0', sizeof (XEvent));  /* valgrind fix. --ryan. */
-	pXNextEvent(SDL_Display, &xevent);
+	XNextEvent(SDL_Display, &xevent);
 
 	posted = 0;
 	switch (xevent.type) {
@@ -332,7 +332,7 @@
 
 #ifdef X_HAVE_UTF8_STRING
 		if ( SDL_IC != NULL ) {
-			pXSetICFocus(SDL_IC);
+			XSetICFocus(SDL_IC);
 		}
 #endif
 		/* Queue entry into fullscreen mode */
@@ -350,7 +350,7 @@
 
 #ifdef X_HAVE_UTF8_STRING
 		if ( SDL_IC != NULL ) {
-			pXUnsetICFocus(SDL_IC);
+			XUnsetICFocus(SDL_IC);
 		}
 #endif
 		/* Queue leaving fullscreen mode */
@@ -433,7 +433,7 @@
 			break;
 		}
 
-		if ( pXFilterEvent(&xevent, None) ) {
+		if ( XFilterEvent(&xevent, None) ) {
 			if ( xevent.xkey.keycode ) {
 				posted = SDL_PrivateKeyboard(SDL_PRESSED, &keysym);
 			} else {
@@ -450,7 +450,7 @@
 			static Status state;
 			/* A UTF-8 character can be at most 6 bytes */
 			char keybuf[6];
-			if ( pXutf8LookupString(SDL_IC, &xevent.xkey,
+			if ( Xutf8LookupString(SDL_IC, &xevent.xkey,
 			                        keybuf, sizeof(keybuf),
 			                        NULL, &state) ) {
 				keysym.unicode = Utf8ToUcs4((Uint8*)keybuf);
@@ -462,7 +462,7 @@
 			static XComposeStatus state;
 			char keybuf[32];
 
-			if ( pXLookupString(&xevent.xkey,
+			if ( XLookupString(&xevent.xkey,
 			                    keybuf, sizeof(keybuf),
 			                    NULL, &state) ) {
 				/*
@@ -622,8 +622,8 @@
 int X11_Pending(Display *display)
 {
 	/* Flush the display connection and look to see if events are queued */
-	pXFlush(display);
-	if ( pXEventsQueued(display, QueuedAlready) ) {
+	XFlush(display);
+	if ( XEventsQueued(display, QueuedAlready) ) {
 		return(1);
 	}
 
@@ -637,7 +637,7 @@
 		FD_ZERO(&fdset);
 		FD_SET(x11_fd, &fdset);
 		if ( select(x11_fd+1, &fdset, NULL, NULL, &zero_time) == 1 ) {
-			return(pXPending(display));
+			return(XPending(display));
 		}
 	}
 
@@ -827,7 +827,7 @@
 	KeySym xsym;
 	SDLKey key;
 
-	xsym = pXKeycodeToKeysym(display, kc, 0);
+	xsym = XKeycodeToKeysym(display, kc, 0);
 #ifdef DEBUG_KEYS
 	fprintf(stderr, "Translating key code %d -> 0x%.4x\n", kc, xsym);
 #endif
@@ -914,12 +914,12 @@
 	if(got_masks)
 		return;
 
-	xmods = pXGetModifierMapping(display);
+	xmods = XGetModifierMapping(display);
 	n = xmods->max_keypermod;
 	for(i = 3; i < 8; i++) {
 		for(j = 0; j < n; j++) {
 			KeyCode kc = xmods->modifiermap[i * n + j];
-			KeySym ks = pXKeycodeToKeysym(display, kc, 0);
+			KeySym ks = XKeycodeToKeysym(display, kc, 0);
 			unsigned mask = 1 << i;
 			switch(ks) {
 			case XK_Num_Lock:
@@ -937,7 +937,7 @@
 			}
 		}
 	}
-	pXFreeModifiermap(xmods);
+	XFreeModifiermap(xmods);
 	got_masks = 1;
 }
 
@@ -979,7 +979,7 @@
 		}
 	}
 
-	xkey.keycode = pXKeysymToKeycode(xkey.display, xsym);
+	xkey.keycode = XKeysymToKeycode(xkey.display, xsym);
 
 	get_modifier_masks(SDL_Display);
 	if(modifiers & KMOD_SHIFT)
@@ -1002,7 +1002,7 @@
 		xkey.state |= num_mask;
 
 	unicode = 0;
-	if ( pXLookupString(&xkey, keybuf, sizeof(keybuf), NULL, NULL) )
+	if ( XLookupString(&xkey, keybuf, sizeof(keybuf), NULL, NULL) )
 		unicode = (unsigned char)keybuf[0];
 	return(unicode);
 }
@@ -1025,14 +1025,14 @@
 
 	/* The first time the window is mapped, we initialize key state */
 	if ( ! key_vec ) {
-		pXQueryKeymap(display, keys_return);
+		XQueryKeymap(display, keys_return);
 		key_vec = keys_return;
 	}
 
 	/* Get the keyboard modifier state */
 	modstate = 0;
 	get_modifier_masks(display);
-	if ( pXQueryPointer(display, DefaultRootWindow(display),
+	if ( XQueryPointer(display, DefaultRootWindow(display),
 		&junk_window, &junk_window, &x, &y, &x, &y, &mask) ) {
 		if ( mask & LockMask ) {
 			modstate |= KMOD_CAPS;