diff src/video/x11/SDL_x11events.c @ 4264:d6f4cc9a5bf6 SDL-1.2

Batch x11 dga mouse motion events into a single SDL event. Untested attempt to fix Bugzilla #609. Do not merge into 1.3 in any case.
author Ryan C. Gordon <icculus@icculus.org>
date Tue, 29 Sep 2009 11:28:43 +0000
parents 5a203e2b0162
children 60db3d01cb3a
line wrap: on
line diff
--- a/src/video/x11/SDL_x11events.c	Tue Sep 29 06:31:29 2009 +0000
+++ b/src/video/x11/SDL_x11events.c	Tue Sep 29 11:28:43 2009 +0000
@@ -515,9 +515,9 @@
 #ifdef DEBUG_MOTION
   printf("DGA motion: %d,%d\n", xevent.xmotion.x_root, xevent.xmotion.y_root);
 #endif
-					posted = SDL_PrivateMouseMotion(0, 1,
-							xevent.xmotion.x_root,
-							xevent.xmotion.y_root);
+					/* batch DGA motion into one event, queued later. */
+					dga_x += xevent.xmotion.x_root;
+					dga_y += xevent.xmotion.y_root;
 				} else {
 					posted = X11_WarpedMotion(this,&xevent);
 				}
@@ -931,6 +931,16 @@
 		X11_DispatchEvent(this);
 		++pending;
 	}
+
+	/* We batch up all the DGA motion events and generate a single SDL
+	   event from them, since newer x.org releases might send a LOT of
+	   these at once and flood the SDL event queue. --ryan. */
+	if (dga_x || dga_y) {
+		SDL_PrivateMouseMotion(0, 1, dga_x, dga_y);
+		dga_x = 0;
+		dga_y = 0;
+	}
+
 	if ( switch_waiting ) {
 		Uint32 now;