From b10540d1ffddb487e8dacb6dc77d4e0d8bdf6be0 Mon Sep 17 00:00:00 2001 From: David Robillard Date: Thu, 8 Oct 2015 18:14:38 -0400 Subject: Fix invalid event access --- pugl_test.c | 12 ++++++------ 1 file 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; + } } } -- cgit v1.2.1