[client] fix keybind regression for EGL

This commit is contained in:
Geoffrey McRae 2021-01-19 21:12:20 +11:00
parent 0c8ce9daba
commit 819562d906
2 changed files with 6 additions and 5 deletions

View File

@ -20,6 +20,7 @@ Place, Suite 330, Boston, MA 02111-1307 USA
#pragma once
#include <SDL2/SDL.h>
#include <linux/input.h>
typedef enum LG_MsgAlert
{
@ -31,7 +32,7 @@ typedef enum LG_MsgAlert
LG_MsgAlert;
typedef struct KeybindHandle * KeybindHandle;
typedef void (*SuperEventFn)(SDL_Scancode key, void * opaque);
typedef void (*SuperEventFn)(uint32_t sc, void * opaque);
/**
* Show an alert on screen
@ -43,16 +44,16 @@ void app_alert(LG_MsgAlert type, const char * fmt, ...);
/**
* Register a handler for the <super>+<key> combination
* @param key The scancode to register
* @param sc The scancode to register
* @param callback The function to be called when the combination is pressed
* @param opaque A pointer to be passed to the callback, may be NULL
* @retval A handle for the binding or NULL on failure.
* The caller is required to release the handle via `app_release_keybind` when it is no longer required
*/
KeybindHandle app_register_keybind(SDL_Scancode key, SuperEventFn callback, void * opaque);
KeybindHandle app_register_keybind(uint32_t sc, SuperEventFn callback, void * opaque);
/**
* Release an existing key binding
* @param handle A pointer to the keybind handle to release, may be NULL
*/
void app_release_keybind(KeybindHandle * handle);
void app_release_keybind(KeybindHandle * handle);

View File

@ -136,7 +136,7 @@ bool egl_desktop_init(EGL_Desktop ** desktop, EGLDisplay * display)
egl_model_set_default((*desktop)->model);
egl_model_set_texture((*desktop)->model, (*desktop)->texture);
(*desktop)->kbNV = app_register_keybind(SDL_SCANCODE_N, egl_desktop_toggle_nv, *desktop);
(*desktop)->kbNV = app_register_keybind(KEY_N, egl_desktop_toggle_nv, *desktop);
(*desktop)->nvMax = option_get_int("egl", "nvGainMax");
(*desktop)->nvGain = option_get_int("egl", "nvGain" );