[fix] fix title bar display error when streaming

This commit is contained in:
dijunkun
2024-08-02 13:57:12 +08:00
parent 3395004f93
commit 88cd4aca4a
3 changed files with 13 additions and 9 deletions

View File

@@ -706,7 +706,8 @@ int main(int argc, char *argv[]) {
std::string user_id = "C-" + mac_addr_str; std::string user_id = "C-" + mac_addr_str;
ret = JoinConnection(peer_server, remote_id, client_password); ret = JoinConnection(peer_server, remote_id, client_password);
if (0 == ret) { if (0 == ret) {
// joined = true; is_client_mode_ = true;
rejoin_ = false;
} }
#if CHINESE_FONT #if CHINESE_FONT
} else if (strcmp(connect_label, u8"断开连接") == 0 && joined) { } else if (strcmp(connect_label, u8"断开连接") == 0 && joined) {

View File

@@ -71,9 +71,7 @@ int Render::RemoteWindow() {
ret = JoinConnection(peer_reserved_ ? peer_reserved_ : peer_, ret = JoinConnection(peer_reserved_ ? peer_reserved_ : peer_,
remote_id_, remote_password_.c_str()); remote_id_, remote_password_.c_str());
if (0 == ret) { if (0 == ret) {
if (peer_reserved_) { is_client_mode_ = true;
is_client_mode_ = true;
}
rejoin_ = false; rejoin_ = false;
} else { } else {
rejoin_ = true; rejoin_ = true;

View File

@@ -501,22 +501,27 @@ int Render::Run() {
&main_window_height_); &main_window_height_);
int video_width = main_window_width_; int video_width = main_window_width_;
int video_height = main_window_height_ - title_bar_height_; int video_height = main_window_height_ -
(fullscreen_button_pressed_ ? 0 : title_bar_height_);
if (video_width * 9 < video_height * 16) { if (video_width * 9 < video_height * 16) {
stream_render_rect_.x = 0; stream_render_rect_.x = 0;
stream_render_rect_.y = stream_render_rect_.y = abs(video_height - video_width * 9 / 16) / 2 +
abs(video_height - video_width * 9 / 16) / 2 + title_bar_height_; fullscreen_button_pressed_
? 0
: title_bar_height_;
stream_render_rect_.w = video_width; stream_render_rect_.w = video_width;
stream_render_rect_.h = video_width * 9 / 16; stream_render_rect_.h = video_width * 9 / 16;
} else if (video_width * 9 > video_height * 16) { } else if (video_width * 9 > video_height * 16) {
stream_render_rect_.x = abs(video_width - video_height * 16 / 9) / 2; stream_render_rect_.x = abs(video_width - video_height * 16 / 9) / 2;
stream_render_rect_.y = title_bar_height_; stream_render_rect_.y =
fullscreen_button_pressed_ ? 0 : title_bar_height_;
stream_render_rect_.w = video_height * 16 / 9; stream_render_rect_.w = video_height * 16 / 9;
stream_render_rect_.h = video_height; stream_render_rect_.h = video_height;
} else { } else {
stream_render_rect_.x = 0; stream_render_rect_.x = 0;
stream_render_rect_.y = title_bar_height_; stream_render_rect_.y =
fullscreen_button_pressed_ ? 0 : title_bar_height_;
stream_render_rect_.w = video_width; stream_render_rect_.w = video_width;
stream_render_rect_.h = video_height; stream_render_rect_.h = video_height;
} }