if (!SDL_WaitEvent(&event))
if (!SDL_PollEvent(&event))
static void Handle_event	(	)	{					// For detecting double-clicks.	static unsigned long last_b1_click = 0;	SDL_Event event;	Window root, win;		// Get window ID's.	int rootx, rooty, winx, winy;	// Get positions.	unsigned int mask;	char keybuf[10];	if (!SDL_WaitEvent(&event))	// Get event.		return;			// Some kind of error.	switch (event.type)		{	case SDL_MOUSEBUTTONDOWN:		gwin->end_intro();		if (gwin->get_mode() != Game_window::normal)			break;					// Move sprite toward mouse					//  when right button pressed.		if (event.button.button == 3)			gwin->start_actor(event.button.x, event.button.y);		break;	case SDL_MOUSEBUTTONUP:		if (event.button.button == 3)			{			if (gwin->get_mode() != Game_window::normal)				break;			gwin->stop_actor();			}		else if (event.button.button == 1)			{			if (gwin->get_mode() == Game_window::conversation)				{	// In a conversation.				gwin->conversation_choice(					event.button.x, event.button.y);				break;				}			timeval curtime;			gettimeofday(&curtime, 0);			unsigned long msecs = curtime.tv_sec*1000 +				curtime.tv_usec/1000;					// Last click within .5 secs?			if (msecs - last_b1_click < 500)				{				gwin->double_clicked(event.button.x, 							event.button.y);				break;				}			last_b1_click = msecs;					// Identify item(s) clicked on.			gwin->show_items(event.button.x, event.button.y);			}		break;	case SDL_MOUSEMOTION:		// Moving with right button down.		if (gwin->get_mode() != Game_window::normal)			break;		if (event.motion.state != 0)			gwin->start_actor(event.motion.x, event.motion.y);		break;	case SDL_ACTIVEEVENT:		if (event.active.state & SDL_APPINPUTFOCUS)			{			if (event.active.gain)				gwin->get_focus();			else				gwin->lose_focus();			}		if (event.active.state & SDL_APPACTIVE)					// Became active.			if (event.active.gain)				gwin->init_actors();		break;#if 0	case ConfigureNotify:		// Resize.		gwin->resized(event.xconfigure.window,			event.xconfigure.width, event.xconfigure.height);		break;#endif	case SDL_QUIT:		quitting_time = 1;		break;	case SDL_KEYDOWN:			// Keystroke.		Handle_keystroke(event.key.keysym.sym,			event.key.keysym.mod & KMOD_SHIFT);		break;		}	}