mirror of
https://github.com/gnif/LookingGlass.git
synced 2024-11-26 07:17:23 +00:00
[client] app: replace old SDL_Scancode with int
This commit is contained in:
parent
3d03699cc8
commit
e18f7d3365
@ -35,7 +35,6 @@ typedef enum LG_MsgAlert
|
|||||||
}
|
}
|
||||||
LG_MsgAlert;
|
LG_MsgAlert;
|
||||||
|
|
||||||
|
|
||||||
SDL_Window * app_getWindow(void);
|
SDL_Window * app_getWindow(void);
|
||||||
|
|
||||||
bool app_getProp(LG_DSProperty prop, void * ret);
|
bool app_getProp(LG_DSProperty prop, void * ret);
|
||||||
@ -81,7 +80,7 @@ void app_alert(LG_MsgAlert type, const char * fmt, ...);
|
|||||||
* @retval A handle for the binding or NULL on failure.
|
* @retval A handle for the binding or NULL on failure.
|
||||||
* The caller is required to release the handle via `app_releaseKeybind` when it is no longer required
|
* The caller is required to release the handle via `app_releaseKeybind` when it is no longer required
|
||||||
*/
|
*/
|
||||||
KeybindHandle app_registerKeybind(uint32_t sc, SuperEventFn callback, void * opaque);
|
KeybindHandle app_registerKeybind(int sc, SuperEventFn callback, void * opaque);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Release an existing key binding
|
* Release an existing key binding
|
||||||
|
@ -55,21 +55,21 @@ void app_alert(LG_MsgAlert type, const char * fmt, ...)
|
|||||||
free(buffer);
|
free(buffer);
|
||||||
}
|
}
|
||||||
|
|
||||||
KeybindHandle app_registerKeybind(SDL_Scancode key, SuperEventFn callback, void * opaque)
|
KeybindHandle app_registerKeybind(int sc, SuperEventFn callback, void * opaque)
|
||||||
{
|
{
|
||||||
// don't allow duplicate binds
|
// don't allow duplicate binds
|
||||||
if (g_state.bindings[key])
|
if (g_state.bindings[sc])
|
||||||
{
|
{
|
||||||
DEBUG_INFO("Key already bound");
|
DEBUG_INFO("Key already bound");
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
KeybindHandle handle = (KeybindHandle)malloc(sizeof(struct KeybindHandle));
|
KeybindHandle handle = (KeybindHandle)malloc(sizeof(struct KeybindHandle));
|
||||||
handle->key = key;
|
handle->sc = sc;
|
||||||
handle->callback = callback;
|
handle->callback = callback;
|
||||||
handle->opaque = opaque;
|
handle->opaque = opaque;
|
||||||
|
|
||||||
g_state.bindings[key] = handle;
|
g_state.bindings[sc] = handle;
|
||||||
return handle;
|
return handle;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -78,7 +78,7 @@ void app_releaseKeybind(KeybindHandle * handle)
|
|||||||
if (!*handle)
|
if (!*handle)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
g_state.bindings[(*handle)->key] = NULL;
|
g_state.bindings[(*handle)->sc] = NULL;
|
||||||
free(*handle);
|
free(*handle);
|
||||||
*handle = NULL;
|
*handle = NULL;
|
||||||
}
|
}
|
||||||
|
@ -1231,6 +1231,7 @@ static void lg_shutdown(void)
|
|||||||
|
|
||||||
ivshmemClose(&g_state.shm);
|
ivshmemClose(&g_state.shm);
|
||||||
|
|
||||||
|
// this must run last to ensure that we don't free any pointers still in use
|
||||||
app_releaseAllKeybinds();
|
app_releaseAllKeybinds();
|
||||||
|
|
||||||
SDL_Quit();
|
SDL_Quit();
|
||||||
|
@ -154,7 +154,7 @@ struct CBRequest
|
|||||||
|
|
||||||
struct KeybindHandle
|
struct KeybindHandle
|
||||||
{
|
{
|
||||||
SDL_Scancode key;
|
int sc;
|
||||||
SuperEventFn callback;
|
SuperEventFn callback;
|
||||||
void * opaque;
|
void * opaque;
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user