[maemo-commits] [maemo-commits] r8404 - in projects/haf/trunk/libsdl1.2: debian src/events src/video src/video/dga src/video/directfb src/video/fbcon src/video/x11

From: www-data at stage.maemo.org www-data at stage.maemo.org
Date: Tue Nov 28 12:26:56 EET 2006
Author: kusalone
Date: 2006-11-28 12:26:54 +0200 (Tue, 28 Nov 2006)
New Revision: 8404

Modified:
   projects/haf/trunk/libsdl1.2/debian/changelog
   projects/haf/trunk/libsdl1.2/src/events/SDL_events.c
   projects/haf/trunk/libsdl1.2/src/events/SDL_events_c.h
   projects/haf/trunk/libsdl1.2/src/events/SDL_keyboard.c
   projects/haf/trunk/libsdl1.2/src/video/SDL_sysvideo.h
   projects/haf/trunk/libsdl1.2/src/video/dga/SDL_dgaevents.c
   projects/haf/trunk/libsdl1.2/src/video/dga/SDL_dgaevents_c.h
   projects/haf/trunk/libsdl1.2/src/video/directfb/SDL_DirectFB_events.c
   projects/haf/trunk/libsdl1.2/src/video/directfb/SDL_DirectFB_events.h
   projects/haf/trunk/libsdl1.2/src/video/fbcon/SDL_fbevents.c
   projects/haf/trunk/libsdl1.2/src/video/x11/SDL_x11events.c
   projects/haf/trunk/libsdl1.2/src/video/x11/SDL_x11events_c.h
Log:
committed back patch, event system did not work properly


Modified: projects/haf/trunk/libsdl1.2/debian/changelog
===================================================================
--- projects/haf/trunk/libsdl1.2/debian/changelog	2006-11-28 10:13:58 UTC (rev 8403)
+++ projects/haf/trunk/libsdl1.2/debian/changelog	2006-11-28 10:26:54 UTC (rev 8404)
@@ -1,11 +1,3 @@
-libsdl1.2 (1.2.8-15unreleased) unstable; urgency=low
-
-  * Applied patch from http://bugzilla.libsdl.org/show_bug.cgi?id=323 to allow
-    SDL_WaitEvents() to sleep. Affects multiple files.
-  * UNRELEASED
-
- -- Kuisma Salonen <kuisma.salonen at nokia.com>  Mon, 13 Nov 2006 16:10:21 +0200
-
 libsdl1.2 (1.2.8-14) unstable; urgency=low
 
   * src/video/SDL_video.c: SDL_UpdateRect() clips now the rect to the screen.

Modified: projects/haf/trunk/libsdl1.2/src/events/SDL_events.c
===================================================================
--- projects/haf/trunk/libsdl1.2/src/events/SDL_events.c	2006-11-28 10:13:58 UTC (rev 8403)
+++ projects/haf/trunk/libsdl1.2/src/events/SDL_events.c	2006-11-28 10:26:54 UTC (rev 8404)
@@ -96,27 +96,22 @@
 	while ( SDL_EventQ.active ) {
 		SDL_VideoDevice *video = current_video;
 		SDL_VideoDevice *this  = current_video;
-		int wait_for_event = 0;  /* !!! FIXME: sanity check, then set to 1. */
 
+		/* Get events from the video subsystem */
+		if ( video ) {
+			video->PumpEvents(this);
+		}
+
+		/* Queue pending key-repeat events */
+		SDL_CheckKeyRepeat();
+
 #ifndef DISABLE_JOYSTICK
 		/* Check for joystick state change */
-		/* !!! FIXME: Check for OPEN sticks, not existing ones... */
 		if ( SDL_numjoysticks && (SDL_eventstate & SDL_JOYEVENTMASK) ) {
-			wait_for_event = 0;  /* !!! FIXME: We can't block twice in here! */
 			SDL_JoystickUpdate();
 		}
 #endif
 
-		/* Queue pending key-repeat events */
-		if (SDL_CheckKeyRepeat()) {
-			wait_for_event = 0;  /* can't block until key is unpressed. */
-		}
-
-		/* Get events from the video subsystem */
-		if ( video ) {
-			video->PumpEvents(this, wait_for_event);
-		}
-
 		/* Give up the CPU for the rest of our timeslice */
 		SDL_EventLock.safe = 1;
 		if( SDL_timer_running ) {
@@ -348,35 +343,34 @@
 }
 
 /* Run the system dependent event loops */
-static void pump_events(int wait_for_event)
+void SDL_PumpEvents(void)
 {
 	if ( !SDL_EventThread ) {
 		SDL_VideoDevice *video = current_video;
 		SDL_VideoDevice *this  = current_video;
 
+		/* Get events from the video subsystem */
+		if ( video ) {
+			video->PumpEvents(this);
+		}
+
+		/* Queue pending key-repeat events */
+		SDL_CheckKeyRepeat();
+
 #ifndef DISABLE_JOYSTICK
 		/* Check for joystick state change */
-		/* !!! FIXME: Check for OPEN sticks, not existing ones... */
 		if ( SDL_numjoysticks && (SDL_eventstate & SDL_JOYEVENTMASK) ) {
-			wait_for_event = 0;  /* !!! FIXME: We can't block twice in here! */
 			SDL_JoystickUpdate();
 		}
 #endif
 	}
 }
 
-
-void SDL_PumpEvents(void)
-{
-	pump_events(0);
-}
-
-
 /* Public functions */
 
 int SDL_PollEvent (SDL_Event *event)
 {
-	pump_events(0);
+	SDL_PumpEvents();
 
 	/* We can't return -1, just return 0 (no event) on error */
 	if ( SDL_PeepEvents(event, 1, SDL_GETEVENT, SDL_ALLEVENTS) <= 0 )
@@ -387,7 +381,7 @@
 int SDL_WaitEvent (SDL_Event *event)
 {
 	while ( 1 ) {
-		pump_events(1);
+		SDL_PumpEvents();
 		switch(SDL_PeepEvents(event, 1, SDL_GETEVENT, SDL_ALLEVENTS)) {
 		    case -1: return 0;
 		    case 1: return 1;

Modified: projects/haf/trunk/libsdl1.2/src/events/SDL_events_c.h
===================================================================
--- projects/haf/trunk/libsdl1.2/src/events/SDL_events_c.h	2006-11-28 10:13:58 UTC (rev 8403)
+++ projects/haf/trunk/libsdl1.2/src/events/SDL_events_c.h	2006-11-28 10:26:54 UTC (rev 8404)
@@ -69,7 +69,7 @@
 extern void SDL_ResetKeyboard(void);
 
 /* Used by the event loop to queue pending keyboard repeat events */
-extern int SDL_CheckKeyRepeat(void);
+extern void SDL_CheckKeyRepeat(void);
 
 /* Used by the OS keyboard code to detect whether or not to do UNICODE */
 #ifndef DEFAULT_UNICODE_TRANSLATION

Modified: projects/haf/trunk/libsdl1.2/src/events/SDL_keyboard.c
===================================================================
--- projects/haf/trunk/libsdl1.2/src/events/SDL_keyboard.c	2006-11-28 10:13:58 UTC (rev 8403)
+++ projects/haf/trunk/libsdl1.2/src/events/SDL_keyboard.c	2006-11-28 10:26:54 UTC (rev 8404)
@@ -533,13 +533,11 @@
 /*
  * jk 991215 - Added
  */
-int SDL_CheckKeyRepeat(void)
+void SDL_CheckKeyRepeat(void)
 {
-	int enabled = 0;
 	if ( SDL_KeyRepeat.timestamp ) {
 		Uint32 now, interval;
 
-		enabled = 1;
 		now = SDL_GetTicks();
 		interval = (now - SDL_KeyRepeat.timestamp);
 		if ( SDL_KeyRepeat.firsttime ) {
@@ -556,8 +554,6 @@
 			}
 		}
 	}
-
-	return(enabled);
 }
 
 int SDL_EnableKeyRepeat(int delay, int interval)

Modified: projects/haf/trunk/libsdl1.2/src/video/SDL_sysvideo.h
===================================================================
--- projects/haf/trunk/libsdl1.2/src/video/SDL_sysvideo.h	2006-11-28 10:13:58 UTC (rev 8403)
+++ projects/haf/trunk/libsdl1.2/src/video/SDL_sysvideo.h	2006-11-28 10:26:54 UTC (rev 8404)
@@ -269,14 +269,8 @@
 	/* Initialize keyboard mapping for this driver */
 	void (*InitOSKeymap)(_THIS);
 
-	/* Handle any queued OS events
-	   wait_for_event is an optimization...drivers can ignore it and return
-	   immediately even if no new events are available, but if the system
-	   can put the process to sleep until an event arrives, they should
-	   do so if this variable is non-zero. Otherwise, SDL_WaitEvent() will
-	   poll and sleep in a loop to simulate the behaviour.
-	*/
-	void (*PumpEvents)(_THIS, int wait_for_event);
+	/* Handle any queued OS events */
+	void (*PumpEvents)(_THIS);
 
 	/* * * */
 	/* Data common to all drivers */

Modified: projects/haf/trunk/libsdl1.2/src/video/dga/SDL_dgaevents.c
===================================================================
--- projects/haf/trunk/libsdl1.2/src/video/dga/SDL_dgaevents.c	2006-11-28 10:13:58 UTC (rev 8403)
+++ projects/haf/trunk/libsdl1.2/src/video/dga/SDL_dgaevents.c	2006-11-28 10:26:54 UTC (rev 8404)
@@ -37,7 +37,7 @@
 #include "SDL_dgaevents_c.h"
 
 /* Heheh we're using X11 event code */
-extern int X11_Pending(Display *display, int wait_for_event);
+extern int X11_Pending(Display *display);
 extern void X11_InitKeymap(void);
 extern SDL_keysym *X11_TranslateKey(Display *display, XKeyEvent *xkey,
 				    KeyCode kc, SDL_keysym *keysym);
@@ -94,13 +94,12 @@
 	return(posted);
 }
 
-void DGA_PumpEvents(_THIS, int wait_for_event)
+void DGA_PumpEvents(_THIS)
 {
 	/* Keep processing pending events */
 	LOCK_DISPLAY();
-	while ( X11_Pending(DGA_Display, wait_for_event) ) {
+	while ( X11_Pending(DGA_Display) ) {
 		DGA_DispatchEvent(this);
-		wait_for_event = 0;
 	}
 	UNLOCK_DISPLAY();
 }

Modified: projects/haf/trunk/libsdl1.2/src/video/dga/SDL_dgaevents_c.h
===================================================================
--- projects/haf/trunk/libsdl1.2/src/video/dga/SDL_dgaevents_c.h	2006-11-28 10:13:58 UTC (rev 8403)
+++ projects/haf/trunk/libsdl1.2/src/video/dga/SDL_dgaevents_c.h	2006-11-28 10:26:54 UTC (rev 8404)
@@ -28,5 +28,5 @@
 #include "SDL_dgavideo.h"
 
 /* Functions to be exported */
-extern void DGA_PumpEvents(_THIS, int wait_for_event);
+extern void DGA_PumpEvents(_THIS);
 extern void DGA_InitOSKeymap(_THIS);

Modified: projects/haf/trunk/libsdl1.2/src/video/directfb/SDL_DirectFB_events.c
===================================================================
--- projects/haf/trunk/libsdl1.2/src/video/directfb/SDL_DirectFB_events.c	2006-11-28 10:13:58 UTC (rev 8403)
+++ projects/haf/trunk/libsdl1.2/src/video/directfb/SDL_DirectFB_events.c	2006-11-28 10:26:54 UTC (rev 8404)
@@ -52,7 +52,7 @@
 static int posted = 0;
 
 
-void DirectFB_PumpEvents (_THIS, int wait_for_event)
+void DirectFB_PumpEvents (_THIS)
 {
   DFBInputEvent evt;
 

Modified: projects/haf/trunk/libsdl1.2/src/video/directfb/SDL_DirectFB_events.h
===================================================================
--- projects/haf/trunk/libsdl1.2/src/video/directfb/SDL_DirectFB_events.h	2006-11-28 10:13:58 UTC (rev 8403)
+++ projects/haf/trunk/libsdl1.2/src/video/directfb/SDL_DirectFB_events.h	2006-11-28 10:26:54 UTC (rev 8404)
@@ -29,5 +29,5 @@
 
 /* Functions to be exported */
 extern void DirectFB_InitOSKeymap(_THIS);
-extern void DirectFB_PumpEvents(_THIS, int wait_for_event);
+extern void DirectFB_PumpEvents(_THIS);
 

Modified: projects/haf/trunk/libsdl1.2/src/video/fbcon/SDL_fbevents.c
===================================================================
--- projects/haf/trunk/libsdl1.2/src/video/fbcon/SDL_fbevents.c	2006-11-28 10:13:58 UTC (rev 8403)
+++ projects/haf/trunk/libsdl1.2/src/video/fbcon/SDL_fbevents.c	2006-11-28 10:26:54 UTC (rev 8404)
@@ -928,12 +928,11 @@
 	}
 }
 
-void FB_PumpEvents(_THIS, int wait_for_event)
+void FB_PumpEvents(_THIS)
 {
 	fd_set fdset;
 	int max_fd;
-	struct timeval zero = { 0, 0 };
-	struct timeval *timeout = ((wait_for_event) ? NULL : &zero);
+	static struct timeval zero;
 
 	do {
 		posted = 0;
@@ -952,7 +951,7 @@
 				max_fd = mouse_fd;
 			}
 		}
-		if ( select(max_fd+1, &fdset, NULL, NULL, timeout) > 0 ) {
+		if ( select(max_fd+1, &fdset, NULL, NULL, &zero) > 0 ) {
 			if ( keyboard_fd >= 0 ) {
 				if ( FD_ISSET(keyboard_fd, &fdset) ) {
 					handle_keyboard(this);

Modified: projects/haf/trunk/libsdl1.2/src/video/x11/SDL_x11events.c
===================================================================
--- projects/haf/trunk/libsdl1.2/src/video/x11/SDL_x11events.c	2006-11-28 10:13:58 UTC (rev 8403)
+++ projects/haf/trunk/libsdl1.2/src/video/x11/SDL_x11events.c	2006-11-28 10:26:54 UTC (rev 8404)
@@ -433,7 +433,7 @@
 }
 
 /* Ack!  XPending() actually performs a blocking read if no events available */
-int X11_Pending(Display *display, int wait_for_event)
+int X11_Pending(Display *display)
 {
 	/* Flush the display connection and look to see if events are queued */
 	XFlush(display);
@@ -443,15 +443,14 @@
 
 	/* More drastic measures are required -- see if X is ready to talk */
 	{
-		struct timeval zero = { 0, 0 };
-		struct timeval *timeout = ((wait_for_event) ? NULL : &zero);
+		static struct timeval zero_time;	/* static == 0 */
 		int x11_fd;
 		fd_set fdset;
 
 		x11_fd = ConnectionNumber(display);
 		FD_ZERO(&fdset);
 		FD_SET(x11_fd, &fdset);
-		if ( select(x11_fd+1, &fdset, NULL, NULL, timeout) == 1 ) {
+		if ( select(x11_fd+1, &fdset, NULL, NULL, &zero_time) == 1 ) {
 			return(XPending(display));
 		}
 	}
@@ -460,20 +459,14 @@
 	return(0);
 }
 
-void X11_PumpEvents(_THIS, int wait_for_event)
+void X11_PumpEvents(_THIS)
 {
 	int pending;
 
 	/* Keep processing pending events */
 	pending = 0;
-
-	if ( switch_waiting ) {
-		wait_for_event = 0;  /* just flush out what's waiting this time. */
-	}
-
-	while ( X11_Pending(SDL_Display, wait_for_event) ) {
+	while ( X11_Pending(SDL_Display) ) {
 		X11_DispatchEvent(this);
-		wait_for_event = 0;  /* don't wait for more events if none left. */
 		++pending;
 	}
 	if ( switch_waiting ) {

Modified: projects/haf/trunk/libsdl1.2/src/video/x11/SDL_x11events_c.h
===================================================================
--- projects/haf/trunk/libsdl1.2/src/video/x11/SDL_x11events_c.h	2006-11-28 10:13:58 UTC (rev 8403)
+++ projects/haf/trunk/libsdl1.2/src/video/x11/SDL_x11events_c.h	2006-11-28 10:26:54 UTC (rev 8404)
@@ -29,6 +29,6 @@
 
 /* Functions to be exported */
 extern void X11_InitOSKeymap(_THIS);
-extern void X11_PumpEvents(_THIS, int wait_for_event);
+extern void X11_PumpEvents(_THIS);
 extern void X11_SetKeyboardState(Display *display, const char *key_vec);
 


More information about the maemo-commits mailing list