diff --git a/libs/hbb_common/src/config.rs b/libs/hbb_common/src/config.rs index 819f4f8d7..bf4dfb7da 100644 --- a/libs/hbb_common/src/config.rs +++ b/libs/hbb_common/src/config.rs @@ -153,7 +153,10 @@ fn patch(path: PathBuf) -> PathBuf { { if _tmp == "/root" { if let Ok(output) = std::process::Command::new("whoami").output() { - let user = String::from_utf8_lossy(&output.stdout).to_string().trim().to_owned(); + let user = String::from_utf8_lossy(&output.stdout) + .to_string() + .trim() + .to_owned(); if user != "root" { return format!("/home/{}", user).into(); } diff --git a/src/platform/linux.rs b/src/platform/linux.rs index 9b68c3656..7368d3c04 100644 --- a/src/platform/linux.rs +++ b/src/platform/linux.rs @@ -417,7 +417,7 @@ pub fn fix_login_wayland() { "sed", "-i", "s/#WaylandEnable=false/WaylandEnable=false/g", - &file + &file, ]) .output() { @@ -435,20 +435,22 @@ pub fn fix_login_wayland() { pub fn current_is_wayland() -> bool { let dtype = get_display_server(); - return "wayland" == dtype && unsafe{UNMODIFIED}; + return "wayland" == dtype && unsafe { UNMODIFIED }; } pub fn modify_default_login() -> String { let dsession = std::env::var("DESKTOP_SESSION").unwrap(); let user_name = std::env::var("USERNAME").unwrap(); - if let Ok(Some(x)) = run_cmds("ls /usr/share/* | grep ${DESKTOP_SESSION}-xorg.desktop".to_owned()) { + if let Ok(Some(x)) = + run_cmds("ls /usr/share/* | grep ${DESKTOP_SESSION}-xorg.desktop".to_owned()) + { if x.trim_end().to_string() != "" { match std::process::Command::new("pkexec") .args(vec![ "sed", "-i", &format!("s/={0}$/={0}-xorg/g", &dsession), - &format!("/var/lib/AccountsService/users/{}", &user_name) + &format!("/var/lib/AccountsService/users/{}", &user_name), ]) .output() { @@ -458,7 +460,9 @@ pub fn modify_default_login() -> String { log::error!("modify_default_login failed: {}", x); return "Fix failed! Please re-login with X server manually".to_owned(); } else { - unsafe {UNMODIFIED = false;} + unsafe { + UNMODIFIED = false; + } return "".to_owned(); } } @@ -467,14 +471,16 @@ pub fn modify_default_login() -> String { return "Fix failed! Please re-login with X server manually".to_owned(); } } - } else if let Ok(Some(z)) = run_cmds("ls /usr/share/* | grep ${DESKTOP_SESSION:0:-8}.desktop".to_owned()) { + } else if let Ok(Some(z)) = + run_cmds("ls /usr/share/* | grep ${DESKTOP_SESSION:0:-8}.desktop".to_owned()) + { if z.trim_end().to_string() != "" { match std::process::Command::new("pkexec") .args(vec![ "sed", "-i", - &format!("s/={}$/={}/g", &dsession, &dsession[..dsession.len()-8]), - &format!("/var/lib/AccountsService/users/{}", &user_name) + &format!("s/={}$/={}/g", &dsession, &dsession[..dsession.len() - 8]), + &format!("/var/lib/AccountsService/users/{}", &user_name), ]) .output() { @@ -484,7 +490,9 @@ pub fn modify_default_login() -> String { log::error!("modify_default_login failed: {}", x); return "Fix failed! Please re-login with X server manually".to_owned(); } else { - unsafe {UNMODIFIED = false;} + unsafe { + UNMODIFIED = false; + } return "".to_owned(); } } diff --git a/src/platform/windows.rs b/src/platform/windows.rs index 5a18a2a5f..4fc134914 100644 --- a/src/platform/windows.rs +++ b/src/platform/windows.rs @@ -145,7 +145,13 @@ pub fn get_cursor_data(hcursor: u64) -> ResultType { if do_outline { let mut outline = Vec::new(); outline.resize(((width + 2) * (height + 2) * 4) as _, 0); - drawOutline(outline.as_mut_ptr(), cbits.as_ptr(), width, height, outline.len() as _); + drawOutline( + outline.as_mut_ptr(), + cbits.as_ptr(), + width, + height, + outline.len() as _, + ); cbits = outline; width += 2; height += 2; @@ -357,7 +363,7 @@ fn fix_cursor_mask( let mut alpha = 255; if mask_idx < bm_size { if (mbits[mask_idx] << (x & 0x7)) & 0x80 == 0 { - alpha = 0; + alpha = 0; } } let a = cbits[pix_idx + 2]; @@ -393,8 +399,14 @@ extern "C" { fn LaunchProcessWin(cmd: *const u16, session_id: DWORD, as_user: BOOL) -> HANDLE; fn selectInputDesktop() -> BOOL; fn inputDesktopSelected() -> BOOL; - fn handleMask(out: *mut u8, mask: *const u8, width: i32, height: i32, bmWidthBytes: i32, bmHeight: i32) - -> i32; + fn handleMask( + out: *mut u8, + mask: *const u8, + width: i32, + height: i32, + bmWidthBytes: i32, + bmHeight: i32, + ) -> i32; fn drawOutline(out: *mut u8, in_: *const u8, width: i32, height: i32, out_size: i32); fn get_di_bits(out: *mut u8, dc: HDC, hbmColor: HBITMAP, width: i32, height: i32) -> i32; fn blank_screen(v: BOOL); diff --git a/src/server/video_service.rs b/src/server/video_service.rs index 953d5efd8..fe3797930 100644 --- a/src/server/video_service.rs +++ b/src/server/video_service.rs @@ -99,7 +99,6 @@ fn run(sp: GenericService) -> ResultType<()> { *SWITCH.lock().unwrap() = false; sp.send(msg_out); } - let mut crc = (0, 0); let start = time::Instant::now(); let mut last_sent = time::Instant::now(); diff --git a/src/ui.rs b/src/ui.rs index ca6fbd950..15c2bc9ee 100644 --- a/src/ui.rs +++ b/src/ui.rs @@ -477,7 +477,7 @@ impl UI { #[cfg(target_os = "linux")] return crate::platform::linux::fix_login_wayland(); } - + fn current_is_wayland(&mut self) -> bool { #[cfg(target_os = "linux")] return crate::platform::linux::current_is_wayland();