mirror of
https://github.com/gnif/LookingGlass.git
synced 2024-11-10 08:38:20 +00:00
parent
0851fd13e6
commit
dd7413f973
@ -947,18 +947,48 @@ static void mouse_sens_dec(SDL_Scancode key, void * opaque)
|
|||||||
free(msg);
|
free(msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void ctrl_alt_fn(SDL_Scancode key, void * opaque)
|
||||||
|
{
|
||||||
|
const uint32_t ctrl = mapScancode(SDL_SCANCODE_LCTRL);
|
||||||
|
const uint32_t alt = mapScancode(SDL_SCANCODE_LALT );
|
||||||
|
const uint32_t fn = mapScancode(key);
|
||||||
|
|
||||||
|
spice_key_down(ctrl);
|
||||||
|
spice_key_down(alt );
|
||||||
|
spice_key_down(fn );
|
||||||
|
|
||||||
|
spice_key_up(ctrl);
|
||||||
|
spice_key_up(alt );
|
||||||
|
spice_key_up(fn );
|
||||||
|
}
|
||||||
|
|
||||||
static void register_key_binds()
|
static void register_key_binds()
|
||||||
{
|
{
|
||||||
state.kbFS = app_register_keybind(SDL_SCANCODE_F , toggle_fullscreen, NULL);
|
state.kbFS = app_register_keybind(SDL_SCANCODE_F , toggle_fullscreen, NULL);
|
||||||
state.kbInput = app_register_keybind(SDL_SCANCODE_I , toggle_input , NULL);
|
state.kbInput = app_register_keybind(SDL_SCANCODE_I , toggle_input , NULL);
|
||||||
state.kbMouseSensInc = app_register_keybind(SDL_SCANCODE_INSERT, mouse_sens_inc , NULL);
|
state.kbMouseSensInc = app_register_keybind(SDL_SCANCODE_INSERT, mouse_sens_inc , NULL);
|
||||||
state.kbMouseSensDec = app_register_keybind(SDL_SCANCODE_DELETE, mouse_sens_dec , NULL);
|
state.kbMouseSensDec = app_register_keybind(SDL_SCANCODE_DELETE, mouse_sens_dec , NULL);
|
||||||
|
|
||||||
|
state.kbCtrlAltFn[0 ] = app_register_keybind(SDL_SCANCODE_F1 , ctrl_alt_fn, NULL);
|
||||||
|
state.kbCtrlAltFn[1 ] = app_register_keybind(SDL_SCANCODE_F2 , ctrl_alt_fn, NULL);
|
||||||
|
state.kbCtrlAltFn[2 ] = app_register_keybind(SDL_SCANCODE_F3 , ctrl_alt_fn, NULL);
|
||||||
|
state.kbCtrlAltFn[3 ] = app_register_keybind(SDL_SCANCODE_F4 , ctrl_alt_fn, NULL);
|
||||||
|
state.kbCtrlAltFn[4 ] = app_register_keybind(SDL_SCANCODE_F5 , ctrl_alt_fn, NULL);
|
||||||
|
state.kbCtrlAltFn[5 ] = app_register_keybind(SDL_SCANCODE_F6 , ctrl_alt_fn, NULL);
|
||||||
|
state.kbCtrlAltFn[6 ] = app_register_keybind(SDL_SCANCODE_F7 , ctrl_alt_fn, NULL);
|
||||||
|
state.kbCtrlAltFn[7 ] = app_register_keybind(SDL_SCANCODE_F8 , ctrl_alt_fn, NULL);
|
||||||
|
state.kbCtrlAltFn[8 ] = app_register_keybind(SDL_SCANCODE_F9 , ctrl_alt_fn, NULL);
|
||||||
|
state.kbCtrlAltFn[9 ] = app_register_keybind(SDL_SCANCODE_F10, ctrl_alt_fn, NULL);
|
||||||
|
state.kbCtrlAltFn[10] = app_register_keybind(SDL_SCANCODE_F11, ctrl_alt_fn, NULL);
|
||||||
|
state.kbCtrlAltFn[11] = app_register_keybind(SDL_SCANCODE_F12, ctrl_alt_fn, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void release_key_binds()
|
static void release_key_binds()
|
||||||
{
|
{
|
||||||
app_release_keybind(&state.kbFS);
|
app_release_keybind(&state.kbFS);
|
||||||
app_release_keybind(&state.kbInput);
|
app_release_keybind(&state.kbInput);
|
||||||
|
for(int i = 0; i < 12; ++i)
|
||||||
|
app_release_keybind(&state.kbCtrlAltFn[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
int run()
|
int run()
|
||||||
|
@ -68,6 +68,7 @@ struct AppState
|
|||||||
KeybindHandle kbInput;
|
KeybindHandle kbInput;
|
||||||
KeybindHandle kbMouseSensInc;
|
KeybindHandle kbMouseSensInc;
|
||||||
KeybindHandle kbMouseSensDec;
|
KeybindHandle kbMouseSensDec;
|
||||||
|
KeybindHandle kbCtrlAltFn[12];
|
||||||
|
|
||||||
int mouseSens;
|
int mouseSens;
|
||||||
float sensX, sensY;
|
float sensX, sensY;
|
||||||
@ -128,4 +129,4 @@ struct KeybindHandle
|
|||||||
|
|
||||||
// forwards
|
// forwards
|
||||||
extern struct AppState state;
|
extern struct AppState state;
|
||||||
extern struct AppParams params;
|
extern struct AppParams params;
|
Loading…
Reference in New Issue
Block a user