From bc39c721e3d011eebb452e9b3b7b018a774fb724 Mon Sep 17 00:00:00 2001 From: Cameron Gutman Date: Sat, 26 Dec 2020 19:47:00 -0600 Subject: [PATCH] Add a key combo to toggle cursor display in remote desktop mouse mode --- app/streaming/input/keyboard.cpp | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/app/streaming/input/keyboard.cpp b/app/streaming/input/keyboard.cpp index 8a0d461d..e2e1b7ab 100644 --- a/app/streaming/input/keyboard.cpp +++ b/app/streaming/input/keyboard.cpp @@ -104,6 +104,20 @@ void SdlInputHandler::handleKeyEvent(SDL_KeyboardEvent* event) raiseAllKeys(); return; } + // Check for mouse show combo (Ctrl+Alt+Shift+C) + else if (event->keysym.sym == SDLK_c) { + SDL_LogInfo(SDL_LOG_CATEGORY_APPLICATION, + "Detected show mouse combo (SDLK)"); + + if (!SDL_GetRelativeMouseMode()) { + SDL_ShowCursor(!SDL_ShowCursor(SDL_QUERY)); + } + else { + SDL_LogWarn(SDL_LOG_CATEGORY_APPLICATION, + "Cursor can only be shown in remote desktop mouse mode"); + } + return; + } // Check for quit combo (Ctrl+Alt+Shift+Q) else if (event->keysym.scancode == SDL_SCANCODE_Q) { SDL_LogInfo(SDL_LOG_CATEGORY_APPLICATION, @@ -168,6 +182,20 @@ void SdlInputHandler::handleKeyEvent(SDL_KeyboardEvent* event) raiseAllKeys(); return; } + // Check for mouse show combo (Ctrl+Alt+Shift+C) + else if (event->keysym.sym == SDL_SCANCODE_C) { + SDL_LogInfo(SDL_LOG_CATEGORY_APPLICATION, + "Detected show mouse combo (scancode)"); + + if (!SDL_GetRelativeMouseMode()) { + SDL_ShowCursor(!SDL_ShowCursor(SDL_QUERY)); + } + else { + SDL_LogWarn(SDL_LOG_CATEGORY_APPLICATION, + "Cursor can only be shown in remote desktop mouse mode"); + } + return; + } } if (event->repeat) {