diff --git a/src/platform/common.h b/src/platform/common.h index d7d3edc4c6c..d5b5761df50 100644 --- a/src/platform/common.h +++ b/src/platform/common.h @@ -610,6 +610,8 @@ namespace platf { }; void adjust_thread_priority(thread_priority_e priority); + void enable_mouse_keys(); + // Allow OS-specific actions to be taken to prepare for streaming void streaming_will_start(); void streaming_will_stop(); diff --git a/src/platform/linux/misc.cpp b/src/platform/linux/misc.cpp index 30ca8e08ee4..485d7958ed2 100644 --- a/src/platform/linux/misc.cpp +++ b/src/platform/linux/misc.cpp @@ -327,6 +327,10 @@ namespace platf { // Unimplemented } + void enable_mouse_keys() { + // Unimplemented + } + void streaming_will_start() { // Nothing to do } diff --git a/src/platform/macos/misc.mm b/src/platform/macos/misc.mm index 540dd74ff04..e56b13b8620 100644 --- a/src/platform/macos/misc.mm +++ b/src/platform/macos/misc.mm @@ -214,6 +214,10 @@ void adjust_thread_priority(thread_priority_e priority) { // Unimplemented } + void enable_mouse_keys() { + // Unimplemented + } + void streaming_will_start() { // Nothing to do } diff --git a/src/platform/windows/misc.cpp b/src/platform/windows/misc.cpp index b1899f20160..cb276034512 100644 --- a/src/platform/windows/misc.cpp +++ b/src/platform/windows/misc.cpp @@ -1133,7 +1133,10 @@ namespace platf { } } } + enable_mouse_keys(); + } + void enable_mouse_keys() { // If there is no mouse connected, enable Mouse Keys to force the cursor to appear if (!GetSystemMetrics(SM_MOUSEPRESENT)) { BOOST_LOG(info) << "A mouse was not detected. Sunshine will enable Mouse Keys while streaming to force the mouse cursor to appear."; diff --git a/src/video.cpp b/src/video.cpp index 55bd322ad5d..3771b3ed2c6 100644 --- a/src/video.cpp +++ b/src/video.cpp @@ -1977,6 +1977,10 @@ namespace video { } session->request_normal_frame(); + + // While streaming check to see if the mouse is present and enable Mouse Keys to force the cursor to appear + // This is useful for KVM switch scenarios where mouse may disappear during streaming + platf::enable_mouse_keys(); } }