void HandleOtherEvents(Event *event)
{
  switch (event->type)
  {
    case EVENT_EXPOSE:
      HandleExposeEvent((ExposeEvent *) event);
      break;

    case EVENT_UNMAPNOTIFY:
#if 0
      /* This causes the game to stop not only when iconified, but also
	 when on another virtual desktop, which might be not desired. */
      SleepWhileUnmapped();
#endif
      break;

    case EVENT_FOCUSIN:
    case EVENT_FOCUSOUT:
      HandleFocusEvent((FocusChangeEvent *) event);
      break;

    case EVENT_CLIENTMESSAGE:
      HandleClientMessageEvent((ClientMessageEvent *) event);
      break;

#if defined(TARGET_SDL)
    case SDL_JOYAXISMOTION:
    case SDL_JOYBUTTONDOWN:
    case SDL_JOYBUTTONUP:
      HandleJoystickEvent(event);
      break;

    case SDL_SYSWMEVENT:
      HandleWindowManagerEvent(event);
      break;
#endif

    default:
      break;
  }
}
Example #2
0
		Event GUIWindow::GetNextEvent()
		{
			// Setup a temporary event and get the next X11 event
			Event event;
			XNextEvent(display, &xEvent);

			// See what type of event we have
			switch(xEvent.type)
			{
				case Expose:
					HandleExposeEvent(event);
				break;

				case KeyPress:
					HandleKeyPressEvent(event);
				break;

				case KeyRelease:
					HandleKeyReleaseEvent(event);
				break;

				case ButtonPress:
					HandleButtonPressEvent(event);
				break;

				case ButtonRelease:
					HandleButtonReleaseEvent(event);
				break;

				case MotionNotify:
					HandleMotionNotifyEvent(event);
				break;

				case ClientMessage:
					HandleClientMessageEvent(event);
				break;

				case ConfigureNotify:
				{
					XConfigureEvent xce = xEvent.xconfigure;

					// Test for resize event
					if(xce.width != width || xce.height != height)
					{
						width = xce.width;
						height = xce.height;

						event.eventType = evResize;
						event.mouseX = width;
						event.mouseY = height;
					}
				}
				break;

				default:
					HandleIgnoreEvent(event);
				break;
			}

			return event;
		}