changeset 3514:f0b7bc1fe12d

Added Ctrl-Z common key binding
author Sam Lantinga <slouken@libsdl.org>
date Wed, 02 Dec 2009 07:56:09 +0000
parents b66c9e8090d4
children d94e331e85fa
files test/common.c test/common.h
diffstat 2 files changed, 15 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/test/common.c	Wed Dec 02 07:55:23 2009 +0000
+++ b/test/common.c	Wed Dec 02 07:56:09 2009 +0000
@@ -1031,6 +1031,8 @@
 void
 CommonEvent(CommonState * state, SDL_Event * event, int *done)
 {
+    int i;
+
     if (state->verbose & VERBOSE_EVENT) {
         PrintEvent(event);
     }
@@ -1051,6 +1053,15 @@
                 /* Ctrl-G toggle grab */
             }
             break;
+        case SDLK_z:
+            if (event->key.keysym.mod & KMOD_CTRL) {
+                /* Ctrl-Z minimize */
+                /* FIXME: Which window has focus for this keyboard? */
+                for (i = 0; i < state->num_windows; ++i) {
+                    SDL_MinimizeWindow(state->windows[i]);
+                }
+            }
+            break;
         case SDLK_ESCAPE:
             *done = 1;
             break;
@@ -1078,3 +1089,5 @@
     }
     SDL_free(state);
 }
+
+/* vi: set ts=4 sw=4 expandtab: */
--- a/test/common.h	Wed Dec 02 07:55:23 2009 +0000
+++ b/test/common.h	Wed Dec 02 07:56:09 2009 +0000
@@ -70,3 +70,5 @@
 extern SDL_bool CommonInit(CommonState * state);
 extern void CommonEvent(CommonState * state, SDL_Event * event, int *done);
 extern void CommonQuit(CommonState * state);
+
+/* vi: set ts=4 sw=4 expandtab: */