mirror of
https://github.com/kunkundi/crossdesk.git
synced 2026-10-25 14:47:00 +08:00
[feat] add iOS system keyboard input and improve computer keyboard
This commit is contained in:
@@ -733,6 +733,14 @@ void SessionDeviceManager::DrainCapturedKeyboardInput() {
|
||||
}
|
||||
}
|
||||
|
||||
bool SessionDeviceManager::SupportsTextInput() const {
|
||||
return keyboard_capturer_ && keyboard_capturer_->SupportsTextInput();
|
||||
}
|
||||
|
||||
bool SessionDeviceManager::SendTextCommand(const std::string& text) {
|
||||
return keyboard_capturer_ && keyboard_capturer_->SendTextCommand(text) == 0;
|
||||
}
|
||||
|
||||
bool SessionDeviceManager::SendKeyboardCommand(int key_code, bool is_down,
|
||||
uint32_t scan_code,
|
||||
bool extended) {
|
||||
|
||||
@@ -73,6 +73,8 @@ public:
|
||||
void ClearAudio(const std::string& remote_id);
|
||||
void PushAudio(const std::string& remote_id, const char *data, size_t size);
|
||||
|
||||
bool SupportsTextInput() const;
|
||||
bool SendTextCommand(const std::string& text);
|
||||
bool SendKeyboardCommand(int key_code, bool is_down, uint32_t scan_code,
|
||||
bool extended);
|
||||
bool SendMouseCommand(const RemoteAction &action, int selected_display);
|
||||
|
||||
@@ -268,6 +268,15 @@ void KeyboardController::ApplyRemoteEvent(const std::string& remote_id,
|
||||
}
|
||||
}
|
||||
|
||||
void KeyboardController::ApplyRemoteText(const std::string& remote_id,
|
||||
const std::string& text) {
|
||||
std::lock_guard input_lock(remote_input_mutex_);
|
||||
if (!owner_.IsAuthorizedController(remote_id) ||
|
||||
!owner_.devices_.SupportsTextInput()) return;
|
||||
if (!owner_.devices_.SendTextCommand(text))
|
||||
LOG_WARN("Failed to inject committed remote text");
|
||||
}
|
||||
|
||||
void KeyboardController::ApplyRemoteState(const std::string& remote_id,
|
||||
const RemoteAction& action) {
|
||||
std::lock_guard input_lock(remote_input_mutex_);
|
||||
|
||||
@@ -27,6 +27,7 @@ public:
|
||||
void SendHeartbeat(bool force);
|
||||
void ApplyRemoteEvent(const std::string &remote_id,
|
||||
const RemoteAction &remote_action);
|
||||
void ApplyRemoteText(const std::string& remote_id, const std::string& text);
|
||||
void ApplyRemoteState(const std::string &remote_id,
|
||||
const RemoteAction &remote_action);
|
||||
void ReleaseRemotePressedKeys(const std::string &remote_id,
|
||||
|
||||
Reference in New Issue
Block a user