rnd-20060815-2-src
[rocksndiamonds.git] / src / events.c
index d78ff4a9439738cbed3df5234bb28c7d33085765..3e159dc4740db50ef0a85b3f8ca317946233a52f 100644 (file)
@@ -315,6 +315,11 @@ void HandleExposeEvent(ExposeEvent *event)
 
 void HandleButtonEvent(ButtonEvent *event)
 {
+#if 0
+  printf("::: BUTTON EVENT: button %d %s\n", event->button,
+        event->type == EVENT_BUTTONPRESS ? "pressed" : "released");
+#endif
+
   motion_status = FALSE;
 
   if (event->type == EVENT_BUTTONPRESS)
@@ -345,6 +350,11 @@ void HandleKeyEvent(KeyEvent *event)
   Key key = GetEventKey(event, with_modifiers);
   Key keymod = (with_modifiers ? GetEventKey(event, FALSE) : key);
 
+#if 0
+  printf("::: KEY EVENT: %d %s\n", GetEventKey(event, TRUE),
+        event->type == EVENT_KEYPRESS ? "pressed" : "released");
+#endif
+
   HandleKeyModState(keymod, key_status);
   HandleKey(key, key_status);
 }
@@ -419,7 +429,7 @@ void HandleButton(int mx, int my, int button, int button_nr)
   }
 
   /* do not use scroll wheel button events for anything other than gadgets */
-  if (button_nr > 3)
+  if (IS_WHEEL_BUTTON(button_nr))
     return;
 
   switch (game_status)
@@ -677,12 +687,26 @@ void HandleKey(Key key, int key_status)
   if (key_status == KEY_RELEASED)
     return;
 
+  if ((key == KSYM_Return || key == KSYM_KP_Enter) &&
+      (GetKeyModState() & KMOD_Alt) && video.fullscreen_available)
+  {
+    setup.fullscreen = !setup.fullscreen;
+
+    ToggleFullscreenIfNeeded();
+
+    return;
+  }
+
   if (game_status == GAME_MODE_PLAYING && AllPlayersGone &&
       (key == KSYM_Return || key == setup.shortcut.toggle_pause))
   {
+#if 1
+    GameEnd();
+#else
     CloseDoor(DOOR_CLOSE_1);
     game_status = GAME_MODE_MAIN;
     DrawMainMenu();
+#endif
 
     return;
   }
@@ -1045,9 +1069,14 @@ void HandleJoystick()
 
       if (AllPlayersGone && newbutton)
       {
+#if 1
+       GameEnd();
+#else
        CloseDoor(DOOR_CLOSE_1);
        game_status = GAME_MODE_MAIN;
        DrawMainMenu();
+#endif
+
        return;
       }