diff --git a/src/gui/panels/remote_peer_panel.cpp b/src/gui/panels/remote_peer_panel.cpp index 67df1a5..f94f576 100644 --- a/src/gui/panels/remote_peer_panel.cpp +++ b/src/gui/panels/remote_peer_panel.cpp @@ -224,6 +224,8 @@ int Render::ConnectTo(const std::string& remote_id, const char* password, } AddAudioStream(props->peer_, props->audio_label_.c_str()); AddDataStream(props->peer_, props->data_label_.c_str(), false); + AddDataStream(props->peer_, props->mouse_label_.c_str(), false); + AddDataStream(props->peer_, props->keyboard_label_.c_str(), true); AddDataStream(props->peer_, props->control_data_label_.c_str(), true); AddDataStream(props->peer_, props->file_label_.c_str(), true); AddDataStream(props->peer_, props->file_feedback_label_.c_str(), true); diff --git a/src/gui/render.cpp b/src/gui/render.cpp index 3f12abd..27c5de1 100644 --- a/src/gui/render.cpp +++ b/src/gui/render.cpp @@ -901,6 +901,8 @@ int Render::CreateConnectionPeer() { AddAudioStream(peer_, audio_label_.c_str()); AddDataStream(peer_, data_label_.c_str(), false); + AddDataStream(peer_, mouse_label_.c_str(), false); + AddDataStream(peer_, keyboard_label_.c_str(), true); AddDataStream(peer_, control_data_label_.c_str(), true); AddDataStream(peer_, file_label_.c_str(), true); AddDataStream(peer_, file_feedback_label_.c_str(), true); diff --git a/src/gui/render.h b/src/gui/render.h index d36dc1f..f0790b5 100644 --- a/src/gui/render.h +++ b/src/gui/render.h @@ -83,6 +83,8 @@ class Render { PeerPtr* peer_ = nullptr; std::string audio_label_ = "control_audio"; std::string data_label_ = "data"; + std::string mouse_label_ = "mouse"; + std::string keyboard_label_ = "keyboard"; std::string file_label_ = "file"; std::string control_data_label_ = "control_data"; std::string file_feedback_label_ = "file_feedback"; @@ -603,6 +605,8 @@ class Render { std::string video_secondary_label_ = "secondary_display"; std::string audio_label_ = "audio"; std::string data_label_ = "data"; + std::string mouse_label_ = "mouse"; + std::string keyboard_label_ = "keyboard"; std::string info_label_ = "info"; std::string control_data_label_ = "control_data"; std::string file_label_ = "file"; diff --git a/src/gui/render_callback.cpp b/src/gui/render_callback.cpp index f0f10e9..6d1b9c8 100644 --- a/src/gui/render_callback.cpp +++ b/src/gui/render_callback.cpp @@ -99,8 +99,12 @@ int Render::SendKeyCommand(int key_code, bool is_down) { if (props->connection_status_ == ConnectionStatus::Connected && props->peer_) { std::string msg = remote_action.to_json(); - SendDataFrame(props->peer_, msg.c_str(), msg.size(), - props->data_label_.c_str()); + int ret = SendReliableDataFrame(props->peer_, msg.c_str(), msg.size(), + props->keyboard_label_.c_str()); + if (ret != 0) { + LOG_WARN("Send keyboard command failed, remote_id={}, ret={}", + target_id, ret); + } } } } @@ -227,7 +231,7 @@ int Render::ProcessMouseEvent(const SDL_Event& event) { if (props->peer_) { std::string msg = remote_action.to_json(); SendDataFrame(props->peer_, msg.c_str(), msg.size(), - props->data_label_.c_str()); + props->mouse_label_.c_str()); } } else if (SDL_EVENT_MOUSE_WHEEL == event.type && last_mouse_event.button.x >= render_rect.x && @@ -273,7 +277,7 @@ int Render::ProcessMouseEvent(const SDL_Event& event) { if (props->peer_) { std::string msg = remote_action.to_json(); SendDataFrame(props->peer_, msg.c_str(), msg.size(), - props->data_label_.c_str()); + props->mouse_label_.c_str()); } } }