mirror of
https://github.com/kunkundi/crossdesk.git
synced 2025-10-26 20:25:34 +08:00
[fix] fix all unused variables and type conversions on MacOSX
This commit is contained in:
@@ -3,12 +3,12 @@
|
|||||||
#include "rd_log.h"
|
#include "rd_log.h"
|
||||||
#include "render.h"
|
#include "render.h"
|
||||||
|
|
||||||
int CountDigits(uint64_t number) {
|
int CountDigits(int number) {
|
||||||
if (number == 0) return 1;
|
if (number == 0) return 1;
|
||||||
return (int)std::floor(std::log10(std::abs((int)number))) + 1;
|
return (int)std::floor(std::log10(std::abs(number))) + 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
int BitrateDisplay(uint64_t bitrate) {
|
int BitrateDisplay(int bitrate) {
|
||||||
int num_of_digits = CountDigits(bitrate);
|
int num_of_digits = CountDigits(bitrate);
|
||||||
if (num_of_digits <= 3) {
|
if (num_of_digits <= 3) {
|
||||||
ImGui::Text("%d bps", bitrate);
|
ImGui::Text("%d bps", bitrate);
|
||||||
@@ -219,35 +219,35 @@ int Render::NetTrafficStats() {
|
|||||||
ImGui::Text("%s",
|
ImGui::Text("%s",
|
||||||
localization::video[localization_language_index_].c_str());
|
localization::video[localization_language_index_].c_str());
|
||||||
ImGui::TableNextColumn();
|
ImGui::TableNextColumn();
|
||||||
BitrateDisplay(net_traffic_stats_.video_in);
|
BitrateDisplay((int)net_traffic_stats_.video_in);
|
||||||
ImGui::TableNextColumn();
|
ImGui::TableNextColumn();
|
||||||
BitrateDisplay(net_traffic_stats_.video_out);
|
BitrateDisplay((int)net_traffic_stats_.video_out);
|
||||||
|
|
||||||
ImGui::TableNextRow();
|
ImGui::TableNextRow();
|
||||||
ImGui::TableNextColumn();
|
ImGui::TableNextColumn();
|
||||||
ImGui::Text("%s",
|
ImGui::Text("%s",
|
||||||
localization::audio[localization_language_index_].c_str());
|
localization::audio[localization_language_index_].c_str());
|
||||||
ImGui::TableNextColumn();
|
ImGui::TableNextColumn();
|
||||||
BitrateDisplay(net_traffic_stats_.audio_in);
|
BitrateDisplay((int)net_traffic_stats_.audio_in);
|
||||||
ImGui::TableNextColumn();
|
ImGui::TableNextColumn();
|
||||||
BitrateDisplay(net_traffic_stats_.audio_out);
|
BitrateDisplay((int)net_traffic_stats_.audio_out);
|
||||||
|
|
||||||
ImGui::TableNextRow();
|
ImGui::TableNextRow();
|
||||||
ImGui::TableNextColumn();
|
ImGui::TableNextColumn();
|
||||||
ImGui::Text("%s", localization::data[localization_language_index_].c_str());
|
ImGui::Text("%s", localization::data[localization_language_index_].c_str());
|
||||||
ImGui::TableNextColumn();
|
ImGui::TableNextColumn();
|
||||||
BitrateDisplay(net_traffic_stats_.data_in);
|
BitrateDisplay((int)net_traffic_stats_.data_in);
|
||||||
ImGui::TableNextColumn();
|
ImGui::TableNextColumn();
|
||||||
BitrateDisplay(net_traffic_stats_.data_out);
|
BitrateDisplay((int)net_traffic_stats_.data_out);
|
||||||
|
|
||||||
ImGui::TableNextRow();
|
ImGui::TableNextRow();
|
||||||
ImGui::TableNextColumn();
|
ImGui::TableNextColumn();
|
||||||
ImGui::Text("%s",
|
ImGui::Text("%s",
|
||||||
localization::total[localization_language_index_].c_str());
|
localization::total[localization_language_index_].c_str());
|
||||||
ImGui::TableNextColumn();
|
ImGui::TableNextColumn();
|
||||||
BitrateDisplay(net_traffic_stats_.total_in);
|
BitrateDisplay((int)net_traffic_stats_.total_in);
|
||||||
ImGui::TableNextColumn();
|
ImGui::TableNextColumn();
|
||||||
BitrateDisplay(net_traffic_stats_.total_out);
|
BitrateDisplay((int)net_traffic_stats_.total_out);
|
||||||
|
|
||||||
ImGui::EndTable();
|
ImGui::EndTable();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -47,7 +47,7 @@ int Render::ControlWindow() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (reset_control_bar_pos_) {
|
if (reset_control_bar_pos_) {
|
||||||
float new_control_window_pos_x, new_control_window_pos_y, new_cursor_pos_x,
|
int new_control_window_pos_x, new_control_window_pos_y, new_cursor_pos_x,
|
||||||
new_cursor_pos_y;
|
new_cursor_pos_y;
|
||||||
|
|
||||||
// set control window pos
|
// set control window pos
|
||||||
@@ -94,8 +94,7 @@ int Render::ControlWindow() {
|
|||||||
|
|
||||||
if (0 != mouse_diff_control_bar_pos_x_ &&
|
if (0 != mouse_diff_control_bar_pos_x_ &&
|
||||||
0 != mouse_diff_control_bar_pos_y_) {
|
0 != mouse_diff_control_bar_pos_y_) {
|
||||||
SDL_WarpMouseInWindow(stream_window_, (int)new_cursor_pos_x,
|
SDL_WarpMouseInWindow(stream_window_, new_cursor_pos_x, new_cursor_pos_y);
|
||||||
(int)new_cursor_pos_y);
|
|
||||||
}
|
}
|
||||||
reset_control_bar_pos_ = false;
|
reset_control_bar_pos_ = false;
|
||||||
} else if (!reset_control_bar_pos_ &&
|
} else if (!reset_control_bar_pos_ &&
|
||||||
@@ -196,7 +195,7 @@ int Render::ControlWindow() {
|
|||||||
ImGui::PopStyleVar();
|
ImGui::PopStyleVar();
|
||||||
|
|
||||||
control_winodw_pos_ = ImGui::GetWindowPos();
|
control_winodw_pos_ = ImGui::GetWindowPos();
|
||||||
SDL_GetMouseState(&(int)mouse_pos_x_, &(int)mouse_pos_y_);
|
SDL_GetMouseState(&mouse_pos_x_, &mouse_pos_y_);
|
||||||
mouse_diff_control_bar_pos_x_ = mouse_pos_x_ - control_winodw_pos_.x;
|
mouse_diff_control_bar_pos_x_ = mouse_pos_x_ - control_winodw_pos_.x;
|
||||||
mouse_diff_control_bar_pos_y_ = mouse_pos_y_ - control_winodw_pos_.y;
|
mouse_diff_control_bar_pos_y_ = mouse_pos_y_ - control_winodw_pos_.y;
|
||||||
|
|
||||||
|
|||||||
@@ -453,8 +453,9 @@ int Render::CreateMainWindow() {
|
|||||||
|
|
||||||
ImGui::SetCurrentContext(main_ctx_);
|
ImGui::SetCurrentContext(main_ctx_);
|
||||||
|
|
||||||
SDL_WindowFlags window_flags = (SDL_WindowFlags)(
|
SDL_WindowFlags window_flags =
|
||||||
SDL_WINDOW_ALLOW_HIGHDPI | SDL_WINDOW_BORDERLESS | SDL_WINDOW_HIDDEN);
|
(SDL_WindowFlags)(SDL_WINDOW_ALLOW_HIGHDPI | SDL_WINDOW_BORDERLESS |
|
||||||
|
SDL_WINDOW_HIDDEN);
|
||||||
main_window_ =
|
main_window_ =
|
||||||
SDL_CreateWindow("Remote Desk", SDL_WINDOWPOS_UNDEFINED,
|
SDL_CreateWindow("Remote Desk", SDL_WINDOWPOS_UNDEFINED,
|
||||||
SDL_WINDOWPOS_UNDEFINED, (int)main_window_width_default_,
|
SDL_WINDOWPOS_UNDEFINED, (int)main_window_width_default_,
|
||||||
@@ -903,8 +904,8 @@ int Render::Run() {
|
|||||||
window_maximized_ = false;
|
window_maximized_ = false;
|
||||||
} else if (event.window.event == SDL_WINDOWEVENT_SIZE_CHANGED) {
|
} else if (event.window.event == SDL_WINDOWEVENT_SIZE_CHANGED) {
|
||||||
reset_control_bar_pos_ = true;
|
reset_control_bar_pos_ = true;
|
||||||
SDL_GetWindowSize(stream_window_, &((int)stream_window_width_),
|
SDL_GetWindowSize(stream_window_, (int*)&stream_window_width_,
|
||||||
&((int)stream_window_height_));
|
(int*)&stream_window_height_);
|
||||||
|
|
||||||
float video_ratio = (float)video_width_ / (float)video_height_;
|
float video_ratio = (float)video_width_ / (float)video_height_;
|
||||||
float video_ratio_reverse = (float)video_height_ / (float)video_width_;
|
float video_ratio_reverse = (float)video_height_ / (float)video_width_;
|
||||||
|
|||||||
@@ -215,12 +215,12 @@ class Render {
|
|||||||
|
|
||||||
float control_bar_pos_x_ = 0;
|
float control_bar_pos_x_ = 0;
|
||||||
float control_bar_pos_y_ = 30;
|
float control_bar_pos_y_ = 30;
|
||||||
float mouse_diff_control_bar_pos_x_ = 0;
|
int mouse_diff_control_bar_pos_x_ = 0;
|
||||||
float mouse_diff_control_bar_pos_y_ = 0;
|
int mouse_diff_control_bar_pos_y_ = 0;
|
||||||
float mouse_pos_x_ = 0;
|
int mouse_pos_x_ = 0;
|
||||||
float mouse_pos_y_ = 0;
|
int mouse_pos_y_ = 0;
|
||||||
float mouse_pos_x_last_ = 0;
|
int mouse_pos_x_last_ = 0;
|
||||||
float mouse_pos_y_last_ = 0;
|
int mouse_pos_y_last_ = 0;
|
||||||
|
|
||||||
int main_window_width_real_ = 720;
|
int main_window_width_real_ = 720;
|
||||||
int main_window_height_real_ = 540;
|
int main_window_height_real_ = 540;
|
||||||
|
|||||||
2
thirdparty/projectx
vendored
2
thirdparty/projectx
vendored
Submodule thirdparty/projectx updated: 826fc2d312...1b7c8905b7
Reference in New Issue
Block a user