rnd-20091210-1-src
[rocksndiamonds.git] / src / events.c
index 7ea4356bc8920f6afaa51f0c7bdc397ad4a64b93..278704e6763f9924142f2a6cc4c74c00f055773a 100644 (file)
@@ -223,6 +223,10 @@ void HandleOtherEvents(Event *event)
     case SDL_JOYBUTTONUP:
       HandleJoystickEvent(event);
       break;
+
+    case SDL_SYSWMEVENT:
+      HandleWindowManagerEvent(event);
+      break;
 #endif
 
     default:
@@ -413,6 +417,13 @@ void HandleClientMessageEvent(ClientMessageEvent *event)
     CloseAllAndExit(0);
 }
 
+void HandleWindowManagerEvent(Event *event)
+{
+#if defined(TARGET_SDL)
+  SDLHandleWindowManagerEvent(event);
+#endif
+}
+
 void HandleButton(int mx, int my, int button, int button_nr)
 {
   static int old_mx = 0, old_my = 0;
@@ -717,9 +728,8 @@ void HandleKey(Key key, int key_status)
     return;
   }
 
-#if 1
-  if (game_status == GAME_MODE_PLAYING &&
-      local_player->LevelSolved_GameEnd &&
+#if 0
+  if (game_status == GAME_MODE_PLAYING && local_player->LevelSolved_GameEnd &&
       (key == KSYM_Return || key == setup.shortcut.toggle_pause))
 #else
   if (game_status == GAME_MODE_PLAYING && AllPlayersGone &&
@@ -734,7 +744,7 @@ void HandleKey(Key key, int key_status)
   if (game_status == GAME_MODE_MAIN &&
       (key == setup.shortcut.toggle_pause || key == KSYM_space))
   {
-    StartGameActions(options.network, setup.autorecord, NEW_RANDOMIZE);
+    StartGameActions(options.network, setup.autorecord, level.random_seed);
 
     return;
   }
@@ -812,6 +822,9 @@ void HandleKey(Key key, int key_status)
          break;
 
        case KSYM_Escape:
+         if (game_status != GAME_MODE_MAIN)
+           FadeSkipNextFadeIn();
+
          if (game_status == GAME_MODE_TITLE)
            HandleTitleScreen(0, 0, 0, 0, MB_MENU_LEAVE);
           else if (game_status == GAME_MODE_LEVELS)
@@ -1068,7 +1081,7 @@ void HandleJoystick()
       if (tape.playing || keyboard)
        newbutton = ((joy & JOY_BUTTON) != 0);
 
-#if 1
+#if 0
       if (local_player->LevelSolved_GameEnd && newbutton)
 #else
       if (AllPlayersGone && newbutton)