[feat] capture cursor when connected to a web client

This commit is contained in:
dijunkun
2025-11-18 16:24:28 +08:00
parent f5d0291b5a
commit 4ba4f17a6b
14 changed files with 42 additions and 18 deletions

View File

@@ -464,6 +464,13 @@ void Render::OnConnectionStatusCb(ConnectionStatus status, const char* user_id,
#else
render->start_mouse_controller_ = true;
#endif
if (std::all_of(render->connection_status_.begin(),
render->connection_status_.end(), [](const auto& kv) {
return kv.first.find("web") != std::string::npos;
})) {
render->show_cursor_ = true;
}
break;
}
case ConnectionStatus::Closed: {
@@ -486,6 +493,14 @@ void Render::OnConnectionStatusCb(ConnectionStatus status, const char* user_id,
render->connection_status_.erase(remote_id);
}
if (std::all_of(render->connection_status_.begin(),
render->connection_status_.end(), [](const auto& kv) {
return kv.first.find("web") == std::string::npos;
})) {
render->show_cursor_ = false;
}
break;
}
default: