delay problems with lots of mouse motion events when mouse
button not pressed */
-int EventFilter(const Event *event)
+int FilterMouseMotionEvents(const Event *event)
{
if (event->type != EVENT_MOTIONNOTIFY)
return 1;
NextEvent(&event);
- if (EventFilter(&event))
+ if (FilterMouseMotionEvents(&event))
{
switch(event.type)
{
}
}
}
-
- HandleNoXEvent();
+ else
+ HandleNoEvent();
/* don't use all CPU time when idle; the main loop while playing
has its own synchronization and is CPU friendly, too */
- if (game_status != PLAYING)
+ if (game_status == PLAYING)
+ HandleGameActions();
+ else
{
SyncDisplay();
if (!PendingEvent()) /* delay only if no pending events */
void HandleExposeEvent(ExposeEvent *event)
{
-#ifndef USE_SDL_LIBRARY
+#ifndef TARGET_SDL
int x = event->x, y = event->y;
int width = event->width, height = event->height;
if (!PointerInWindow(window))
return; /* window and pointer are on different screens */
-#if 0
+#if 1
if (button_status == MB_RELEASED && game_status != LEVELED)
return;
#endif
void HandleClientMessageEvent(ClientMessageEvent *event)
{
-#ifdef USE_SDL_LIBRARY
- CloseAllAndExit(0); /* the only possible message here is SDL_QUIT */
-#else
-#ifndef MSDOS
- if ((event->window == window) &&
- (event->data.l[0] == XInternAtom(display, "WM_DELETE_WINDOW", FALSE)))
+ if (CheckCloseWindowEvent(event))
CloseAllAndExit(0);
-#endif
-#endif
}
void HandleButton(int mx, int my, int button)
void HandleKey(Key key, int key_status)
{
int joy = 0;
+ boolean anyTextGadgetActiveOrJustFinished = anyTextGadgetActive();
static struct SetupKeyboardInfo custom_key;
static struct
{
break;
case LEVELED:
- HandleLevelEditorKeyInput(key);
+ if (!anyTextGadgetActiveOrJustFinished)
+ HandleLevelEditorKeyInput(key);
break;
case PLAYING:
printf("ScrollStepSize == %d (1/1)\n", ScrollStepSize);
break;
-#ifndef MSDOS
case KEY_Q:
-#endif
- case KEY_q:
local_player->dynamite = 1000;
break;
}
}
-void HandleNoXEvent()
+void HandleNoEvent()
{
if (button_status && game_status != PLAYING)
{
#endif
HandleJoystick();
-
- if (game_status == PLAYING)
- HandleGameActions();
}
static int HandleJoystickForAllPlayers()