added ignoring screen navigation events if text input gadgets are active
[rocksndiamonds.git] / src / events.c
index b610ff8b7a05b211daf6393031e0694df00e0a7d..9f18adbe8b413dce59899fe9ac17cb35cec9243a 100644 (file)
@@ -164,7 +164,7 @@ boolean NextValidEvent(Event *event)
   return FALSE;
 }
 
-void HandleEvents()
+static void HandleEvents(void)
 {
   Event event;
   unsigned int event_frame_delay = 0;
@@ -283,7 +283,7 @@ void HandleOtherEvents(Event *event)
   }
 }
 
-void HandleMouseCursor()
+static void HandleMouseCursor(void)
 {
   if (game_status == GAME_MODE_TITLE)
   {
@@ -347,7 +347,7 @@ void EventLoop(void)
   }
 }
 
-void ClearAutoRepeatKeyEvents()
+void ClearAutoRepeatKeyEvents(void)
 {
   while (PendingEvent())
   {
@@ -364,7 +364,7 @@ void ClearAutoRepeatKeyEvents()
   }
 }
 
-void ClearEventQueue()
+void ClearEventQueue(void)
 {
   Event event;
 
@@ -394,14 +394,14 @@ void ClearEventQueue()
   }
 }
 
-void ClearPlayerMouseAction()
+static void ClearPlayerMouseAction(void)
 {
   local_player->mouse_action.lx = 0;
   local_player->mouse_action.ly = 0;
   local_player->mouse_action.button = 0;
 }
 
-void ClearPlayerAction()
+void ClearPlayerAction(void)
 {
   int i;
 
@@ -414,7 +414,7 @@ void ClearPlayerAction()
   ClearPlayerMouseAction();
 }
 
-void SetPlayerMouseAction(int mx, int my, int button)
+static void SetPlayerMouseAction(int mx, int my, int button)
 {
   int lx = getLevelFromScreenX(mx);
   int ly = getLevelFromScreenY(my);
@@ -442,7 +442,7 @@ void SetPlayerMouseAction(int mx, int my, int button)
   SetTileCursorXY(lx, ly);
 }
 
-void SleepWhileUnmapped()
+void SleepWhileUnmapped(void)
 {
   boolean window_unmapped = TRUE;
 
@@ -693,7 +693,7 @@ static struct
   Key key;
 } touch_info[NUM_TOUCH_FINGERS];
 
-void HandleFingerEvent_VirtualButtons(FingerEvent *event)
+static void HandleFingerEvent_VirtualButtons(FingerEvent *event)
 {
 #if 1
   int x = event->x * overlay.grid_xsize;
@@ -853,7 +853,7 @@ void HandleFingerEvent_VirtualButtons(FingerEvent *event)
   }
 }
 
-void HandleFingerEvent_WipeGestures(FingerEvent *event)
+static void HandleFingerEvent_WipeGestures(FingerEvent *event)
 {
   static Key motion_key_x = KSYM_UNDEFINED;
   static Key motion_key_y = KSYM_UNDEFINED;
@@ -1399,7 +1399,7 @@ static void HandleButtonOrFinger(int mx, int my, int button)
 
 #if defined(TARGET_SDL2)
 
-static boolean checkTextInputKeyModState()
+static boolean checkTextInputKeyModState(void)
 {
   // when playing, only handle raw key events and ignore text input
   if (game_status == GAME_MODE_PLAYING)
@@ -2113,6 +2113,10 @@ void HandleKey(Key key, int key_status)
     case GAME_MODE_SETUP:
     case GAME_MODE_INFO:
     case GAME_MODE_SCORES:
+
+      if (anyTextGadgetActiveOrJustFinished && key != KSYM_Escape)
+       break;
+
       switch (key)
       {
        case KSYM_space:
@@ -2215,7 +2219,7 @@ void HandleKey(Key key, int key_status)
   HandleKeysDebug(key);
 }
 
-void HandleNoEvent()
+void HandleNoEvent(void)
 {
   HandleMouseCursor();
 
@@ -2227,7 +2231,7 @@ void HandleNoEvent()
   }
 }
 
-void HandleEventActions()
+void HandleEventActions(void)
 {
   // if (button_status && game_status != GAME_MODE_PLAYING)
   if (button_status && (game_status != GAME_MODE_PLAYING ||
@@ -2290,7 +2294,7 @@ static void HandleTileCursor(int dx, int dy, int button)
   }
 }
 
-static int HandleJoystickForAllPlayers()
+static int HandleJoystickForAllPlayers(void)
 {
   int i;
   int result = 0;
@@ -2323,7 +2327,7 @@ static int HandleJoystickForAllPlayers()
   return result;
 }
 
-void HandleJoystick()
+void HandleJoystick(void)
 {
   static unsigned int joytest_delay = 0;
   static unsigned int joytest_delay_value = GADGET_FRAME_DELAY;
@@ -2393,6 +2397,9 @@ void HandleJoystick()
     case GAME_MODE_INFO:
     case GAME_MODE_SCORES:
     {
+      if (anyTextGadgetActive())
+       break;
+
       if (game_status == GAME_MODE_TITLE)
        HandleTitleScreen(0,0,dx,dy, newbutton ? MB_MENU_CHOICE : MB_MENU_MARK);
       else if (game_status == GAME_MODE_MAIN)