Skip to content

Commit fd2bfaa

Browse files
authored
fix(windows): resolve disappearing cursor after KVM switch (#4407)
1 parent 2e2f7b6 commit fd2bfaa

File tree

5 files changed

+17
-0
lines changed

5 files changed

+17
-0
lines changed

src/platform/common.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -610,6 +610,8 @@ namespace platf {
610610
};
611611
void adjust_thread_priority(thread_priority_e priority);
612612

613+
void enable_mouse_keys();
614+
613615
// Allow OS-specific actions to be taken to prepare for streaming
614616
void streaming_will_start();
615617
void streaming_will_stop();

src/platform/linux/misc.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -327,6 +327,10 @@ namespace platf {
327327
// Unimplemented
328328
}
329329

330+
void enable_mouse_keys() {
331+
// Unimplemented
332+
}
333+
330334
void streaming_will_start() {
331335
// Nothing to do
332336
}

src/platform/macos/misc.mm

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -214,6 +214,10 @@ void adjust_thread_priority(thread_priority_e priority) {
214214
// Unimplemented
215215
}
216216

217+
void enable_mouse_keys() {
218+
// Unimplemented
219+
}
220+
217221
void streaming_will_start() {
218222
// Nothing to do
219223
}

src/platform/windows/misc.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1133,7 +1133,10 @@ namespace platf {
11331133
}
11341134
}
11351135
}
1136+
enable_mouse_keys();
1137+
}
11361138

1139+
void enable_mouse_keys() {
11371140
// If there is no mouse connected, enable Mouse Keys to force the cursor to appear
11381141
if (!GetSystemMetrics(SM_MOUSEPRESENT)) {
11391142
BOOST_LOG(info) << "A mouse was not detected. Sunshine will enable Mouse Keys while streaming to force the mouse cursor to appear.";

src/video.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1977,6 +1977,10 @@ namespace video {
19771977
}
19781978

19791979
session->request_normal_frame();
1980+
1981+
// While streaming check to see if the mouse is present and enable Mouse Keys to force the cursor to appear
1982+
// This is useful for KVM switch scenarios where mouse may disappear during streaming
1983+
platf::enable_mouse_keys();
19801984
}
19811985
}
19821986

0 commit comments

Comments
 (0)