[fix] send host info when connected

This commit is contained in:
dijunkun
2025-04-16 16:13:54 +08:00
parent 44c5fde086
commit 22aed6ea53
3 changed files with 10 additions and 8 deletions

View File

@@ -42,8 +42,8 @@ typedef struct {
typedef struct { typedef struct {
char host_name[64]; char host_name[64];
size_t host_name_size; size_t host_name_size;
size_t origin_display_width; size_t original_display_width;
size_t origin_display_height; size_t original_display_height;
} HostInfo; } HostInfo;
typedef struct { typedef struct {

View File

@@ -830,8 +830,10 @@ void Render::MainLoop() {
remote_action.type = ControlType::host_infomation; remote_action.type = ControlType::host_infomation;
memcpy(&remote_action.i.host_name, host_name.data(), host_name.size()); memcpy(&remote_action.i.host_name, host_name.data(), host_name.size());
remote_action.i.host_name_size = host_name.size(); remote_action.i.host_name_size = host_name.size();
remote_action.i.origin_display_width = screen_width_; remote_action.i.original_display_width =
remote_action.i.origin_display_height = screen_height_; screen_width_ * main_window_dpi_scaling_w_;
remote_action.i.original_display_height =
screen_height_ * main_window_dpi_scaling_h_;
int ret = SendDataFrame(peer_, (const char*)&remote_action, int ret = SendDataFrame(peer_, (const char*)&remote_action,
sizeof(remote_action)); sizeof(remote_action));
if (0 == ret) { if (0 == ret) {

View File

@@ -262,11 +262,11 @@ void Render::OnReceiveDataBufferCb(const char *data, size_t size,
if (ControlType::host_infomation == remote_action.type) { if (ControlType::host_infomation == remote_action.type) {
props->remote_host_name_ = std::string(remote_action.i.host_name, props->remote_host_name_ = std::string(remote_action.i.host_name,
remote_action.i.host_name_size); remote_action.i.host_name_size);
props->original_display_width_ = remote_action.i.origin_display_width; props->original_display_width_ = remote_action.i.original_display_width;
props->original_display_height_ = remote_action.i.origin_display_height; props->original_display_height_ = remote_action.i.original_display_height;
LOG_INFO("Remote hostname: [{}], resolution: [{}x{}]", LOG_INFO("Remote hostname: [{}], resolution: [{}x{}]",
props->remote_host_name_, remote_action.i.origin_display_width, props->remote_host_name_, remote_action.i.original_display_width,
remote_action.i.origin_display_height); remote_action.i.original_display_height);
} }
} else { } else {
if (ControlType::mouse == remote_action.type && render->mouse_controller_) { if (ControlType::mouse == remote_action.type && render->mouse_controller_) {