fix, wayland, change resolutions

Signed-off-by: fufesou <shuanglongchen@yeah.net>
This commit is contained in:
fufesou 2023-07-16 08:29:26 +08:00
parent 314d7f4387
commit 2051bee3cf
2 changed files with 9 additions and 3 deletions

View File

@ -399,10 +399,10 @@ impl Config2 {
pub fn load_path<T: serde::Serialize + serde::de::DeserializeOwned + Default + std::fmt::Debug>( pub fn load_path<T: serde::Serialize + serde::de::DeserializeOwned + Default + std::fmt::Debug>(
file: PathBuf, file: PathBuf,
) -> T { ) -> T {
let cfg = match confy::load_path(file) { let cfg = match confy::load_path(&file) {
Ok(config) => config, Ok(config) => config,
Err(err) => { Err(err) => {
log::error!("Failed to load config: {}", err); log::error!("Failed to load config '{}': {}", file.as_os_str().to_str().unwrap_or(""), err);
T::default() T::default()
} }
}; };
@ -958,7 +958,7 @@ impl PeerConfig {
config config
} }
Err(err) => { Err(err) => {
log::error!("Failed to load config: {}", err); log::error!("Failed to load peer config '{}': {}", id, err);
Default::default() Default::default()
} }
} }

View File

@ -623,6 +623,8 @@ fn run(sp: GenericService) -> ResultType<()> {
bail!("SWITCH"); bail!("SWITCH");
} }
if c.current != *CURRENT_DISPLAY.lock().unwrap() { if c.current != *CURRENT_DISPLAY.lock().unwrap() {
#[cfg(target_os = "linux")]
wayland::clear();
*SWITCH.lock().unwrap() = true; *SWITCH.lock().unwrap() = true;
bail!("SWITCH"); bail!("SWITCH");
} }
@ -657,6 +659,8 @@ fn run(sp: GenericService) -> ResultType<()> {
if let Some(msg_out) = check_get_displays_changed_msg() { if let Some(msg_out) = check_get_displays_changed_msg() {
sp.send(msg_out); sp.send(msg_out);
log::info!("Displays changed"); log::info!("Displays changed");
#[cfg(target_os = "linux")]
wayland::clear();
*SWITCH.lock().unwrap() = true; *SWITCH.lock().unwrap() = true;
bail!("SWITCH"); bail!("SWITCH");
} }
@ -734,6 +738,8 @@ fn run(sp: GenericService) -> ResultType<()> {
Err(err) => { Err(err) => {
if check_display_changed(c.ndisplay, c.current, c.width, c.height) { if check_display_changed(c.ndisplay, c.current, c.width, c.height) {
log::info!("Displays changed"); log::info!("Displays changed");
#[cfg(target_os = "linux")]
wayland::clear();
*SWITCH.lock().unwrap() = true; *SWITCH.lock().unwrap() = true;
bail!("SWITCH"); bail!("SWITCH");
} }