[client] all: move keybind implementation into app.c/h

This commit is contained in:
Geoffrey McRae
2021-01-26 02:33:28 +11:00
parent 9674421ce4
commit 3d03699cc8
6 changed files with 88 additions and 118 deletions

View File

@@ -55,7 +55,7 @@ void app_alert(LG_MsgAlert type, const char * fmt, ...)
free(buffer);
}
KeybindHandle app_register_keybind(SDL_Scancode key, SuperEventFn callback, void * opaque)
KeybindHandle app_registerKeybind(SDL_Scancode key, SuperEventFn callback, void * opaque)
{
// don't allow duplicate binds
if (g_state.bindings[key])
@@ -73,7 +73,7 @@ KeybindHandle app_register_keybind(SDL_Scancode key, SuperEventFn callback, void
return handle;
}
void app_release_keybind(KeybindHandle * handle)
void app_releaseKeybind(KeybindHandle * handle)
{
if (!*handle)
return;
@@ -83,6 +83,16 @@ void app_release_keybind(KeybindHandle * handle)
*handle = NULL;
}
void app_releaseAllKeybinds(void)
{
for(int i = 0; i < KEY_MAX; ++i)
if (g_state.bindings[i])
{
free(g_state.bindings[i]);
g_state.bindings[i] = NULL;
}
}
bool app_getProp(LG_DSProperty prop, void * ret)
{
return g_state.ds->getProp(prop, ret);