From 083deff48948a45078d818e045b1e2612d028218 Mon Sep 17 00:00:00 2001 From: Geoffrey McRae Date: Tue, 19 Jan 2021 03:49:09 +1100 Subject: [PATCH] [client] add keybind to rotate the display at runtime --- client/src/main.c | 10 ++++++++++ client/src/main.h | 1 + 2 files changed, 11 insertions(+) diff --git a/client/src/main.c b/client/src/main.c index 7eaaea1f..4597af17 100644 --- a/client/src/main.c +++ b/client/src/main.c @@ -1630,6 +1630,15 @@ static void toggle_video(uint32_t scancode, void * opaque) } } +static void toggle_rotate(uint32_t scancode, void * opaque) +{ + if (params.winRotate == LG_ROTATE_MAX-1) + params.winRotate = 0; + else + ++params.winRotate; + updatePositionInfo(); +} + static void toggle_input(uint32_t scancode, void * opaque) { g_state.ignoreInput = !g_state.ignoreInput; @@ -1698,6 +1707,7 @@ static void register_key_binds(void) { g_state.kbFS = app_register_keybind(KEY_F , toggle_fullscreen, NULL); g_state.kbVideo = app_register_keybind(KEY_V , toggle_video , NULL); + g_state.kbRotate = app_register_keybind(KEY_R , toggle_rotate , NULL); g_state.kbInput = app_register_keybind(KEY_I , toggle_input , NULL); g_state.kbQuit = app_register_keybind(KEY_Q , quit , NULL); g_state.kbMouseSensInc = app_register_keybind(KEY_INSERT, mouse_sens_inc , NULL); diff --git a/client/src/main.h b/client/src/main.h index 6f52b912..564db336 100644 --- a/client/src/main.h +++ b/client/src/main.h @@ -90,6 +90,7 @@ struct AppState KeybindHandle kbFS; KeybindHandle kbVideo; + KeybindHandle kbRotate; KeybindHandle kbInput; KeybindHandle kbQuit; KeybindHandle kbMouseSensInc;