refactor resolution, mid commit

Signed-off-by: fufesou <shuanglongchen@yeah.net>
This commit is contained in:
fufesou
2023-05-17 23:19:20 +08:00
parent 154b86d2a5
commit a603e046e3
9 changed files with 196 additions and 55 deletions

View File

@@ -41,6 +41,7 @@ message DisplayInfo {
string name = 5;
bool online = 6;
bool cursor_embedded = 7;
Resolution original_resolution = 8;
}
message PortForward {
@@ -444,6 +445,8 @@ message SwitchDisplay {
int32 height = 5;
bool cursor_embedded = 6;
SupportedResolutions resolutions = 7;
// Do not care about the origin point for now.
Resolution original_resolution = 8;
}
message PermissionInfo {
@@ -501,6 +504,7 @@ message OptionMessage {
SupportedDecoding supported_decoding = 10;
int32 custom_fps = 11;
BoolOption disable_keyboard = 12;
Resolution custom_resolution = 13;
}
message TestDelay {

View File

@@ -191,6 +191,12 @@ pub struct Config2 {
pub options: HashMap<String, String>,
}
#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
pub struct Resolution {
pub w: i32,
pub h: i32,
}
#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
pub struct PeerConfig {
#[serde(default, deserialize_with = "deserialize_vec_u8")]
@@ -246,6 +252,9 @@ pub struct PeerConfig {
#[serde(flatten)]
pub view_only: ViewOnly,
#[serde(default, skip_serializing_if = "Option::is_none")]
pub custom_resolution: Option<Resolution>,
// The other scalar value must before this
#[serde(default, deserialize_with = "PeerConfig::deserialize_options")]
pub options: HashMap<String, String>, // not use delete to represent default values