From 58943b7a9ee3d9ef92ffb7aa91361d57296b2b8c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EC=98=A4=EB=B3=91=EC=A4=80?= Date: Thu, 16 May 2024 22:54:38 +0900 Subject: [PATCH] update: temporary set display scale manually --- src/bin/transistor-client.rs | 2 +- src/bin/transistor-server.rs | 2 +- src/client.rs | 4 ++-- src/display.rs | 4 ++-- src/server.rs | 4 ++-- 5 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/bin/transistor-client.rs b/src/bin/transistor-client.rs index b6eeb0a..87b05b0 100644 --- a/src/bin/transistor-client.rs +++ b/src/bin/transistor-client.rs @@ -19,7 +19,7 @@ fn main() -> Result<(), Error> { println!("[INF] transistor client startup! server: {}", server); print_displays(); - let mut client = Client::new(server)?; + let mut client = Client::new(server, 1.0)?; client.start()?; loop {} diff --git a/src/bin/transistor-server.rs b/src/bin/transistor-server.rs index 3f5145d..570800b 100644 --- a/src/bin/transistor-server.rs +++ b/src/bin/transistor-server.rs @@ -8,7 +8,7 @@ fn main() -> Result<(), Error> { print_displays(); let client_config = config_dir!("server").join("authorized_clients.json"); - let server = Server::new()?; + let server = Server::new(1.0)?; server.start(client_config); diff --git a/src/client.rs b/src/client.rs index b48d306..2acbe9f 100644 --- a/src/client.rs +++ b/src/client.rs @@ -27,7 +27,7 @@ pub struct Client { } impl Client { - pub fn new(server: &str) -> Result { + pub fn new(server: &str, display_scale: f32) -> Result { // mkdir -p fs::create_dir_all(config_dir!("client"))?; @@ -39,7 +39,7 @@ impl Client { displays: DisplayInfo::all() .expect("[ERR] failed to get system displays") .into_iter() - .map(|x| Display::from(x, cid)) + .map(|x| Display::from(x, cid, display_scale)) .collect(), }) } diff --git a/src/display.rs b/src/display.rs index 75013c5..b06eff6 100644 --- a/src/display.rs +++ b/src/display.rs @@ -60,7 +60,7 @@ pub struct Display { } impl Display { - pub fn from(item: DisplayInfo, cid: Cid) -> Self { + pub fn from(item: DisplayInfo, cid: Cid, display_scale: f32) -> Self { Display { name: item.name, id: item.id, @@ -70,7 +70,7 @@ impl Display { width: item.width as i32, height: item.height as i32, rotation: item.rotation, - scale_factor: item.scale_factor, + scale_factor: display_scale, frequency: item.frequency, is_primary: item.is_primary, warpzones: Vec::new(), diff --git a/src/server.rs b/src/server.rs index 518c11a..a257fa4 100644 --- a/src/server.rs +++ b/src/server.rs @@ -43,14 +43,14 @@ pub struct Server { } impl Server { - pub fn new() -> Result { + pub fn new(display_scale: f32) -> Result { // mkdir -p fs::create_dir_all(config_dir!("server"))?; let mut disp: Vec = DisplayInfo::all() .expect("[ERR] failed to get system displays") .into_iter() - .map(|x| Display::from(x, SERVER_CID)) + .map(|x| Display::from(x, SERVER_CID, display_scale)) .collect(); if disp.len() == 0 {