From 3cf958fb0836cc07df413792be0266fe80988e00 Mon Sep 17 00:00:00 2001 From: sanine-a Date: Fri, 22 May 2020 23:50:07 -0500 Subject: add honey_key_unbind_all() --- include/input.h | 6 ++++++ src/input.c | 9 +++++++++ 2 files changed, 15 insertions(+) diff --git a/include/input.h b/include/input.h index 6482f1f..d80b860 100644 --- a/include/input.h +++ b/include/input.h @@ -175,6 +175,12 @@ void honey_key_bind(int key, void (*callback)(void*, int), void* data); */ void honey_key_unbind(int key); +/** @brief Unbind all key callbacks. + * + * THIS FUNCTION DOES NOT FREE MEMORY! If you allocated any, be sure to free it yourself! + */ +void honey_key_unbind_all(); + void default_honey_keyboard_callback(honey_window window, int key, int scancode, int action, int mods); #endif diff --git a/src/input.c b/src/input.c index 7188560..bae32c6 100644 --- a/src/input.c +++ b/src/input.c @@ -39,6 +39,15 @@ void honey_key_unbind(int key) { /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */ +void honey_key_unbind_all() { + for (int i=0; i