diff options
author | David Robillard <d@drobilla.net> | 2015-10-08 18:14:38 -0400 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2015-10-08 18:18:27 -0400 |
commit | b10540d1ffddb487e8dacb6dc77d4e0d8bdf6be0 (patch) | |
tree | 836e3686a83b1d9c16d90651474a52867cd0c4ff | |
parent | 845061e593cc8d62fd2ca2295e5b013687a1ec2d (diff) |
Fix invalid event access
-rw-r--r-- | pugl_test.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/pugl_test.c b/pugl_test.c index af51e53..eb192c9 100644 --- a/pugl_test.c +++ b/pugl_test.c @@ -101,15 +101,15 @@ printModifiers(PuglView* view) static void onEvent(PuglView* view, const PuglEvent* event) { - const uint32_t ucode = event->key.character; if (event->type == PUGL_KEY_PRESS) { + const uint32_t ucode = event->key.character; fprintf(stderr, "Key %u (char %u) down (%s)%s\n", - event->key.keycode, event->key.character, event->key.utf8, + event->key.keycode, ucode, event->key.utf8, event->key.filter ? " (filtered)" : ""); - } - if (ucode == 'q' || ucode == 'Q' || ucode == PUGL_CHAR_ESCAPE || - ucode == PUGL_CHAR_DELETE || ucode == PUGL_CHAR_BACKSPACE) { - quit = 1; + + if (ucode == 'q' || ucode == 'Q' || ucode == PUGL_CHAR_ESCAPE) { + quit = 1; + } } } |