diff --git a/Cargo.lock b/Cargo.lock index ae6cc48..6845c51 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -541,7 +541,7 @@ dependencies = [ [[package]] name = "quickemu-rs" -version = "0.6.1" +version = "0.6.2" dependencies = [ "anyhow", "clap", diff --git a/Cargo.toml b/Cargo.toml index 6922433..5969745 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "quickemu-rs" -version = "0.6.1" +version = "0.6.2" edition = "2021" [dependencies] @@ -29,7 +29,8 @@ panic = "abort" [features] default = [ "check_smartcard", - "get_qemu_ver" + "get_qemu_ver", + "support_bash_conf", ] check_smartcard = [] diff --git a/src/main.rs b/src/main.rs index cafe04a..97453da 100644 --- a/src/main.rs +++ b/src/main.rs @@ -105,6 +105,7 @@ fn parse_conf(conf_file: Vec) -> Result<(String, ConfigFile)> { } }, None => { + let pkg = env!("CARGO_PKG_NAME"); match conf_file.into_iter().find_map(|arg| { let arg = if arg.ends_with(".conf") { arg } else { arg + ".conf" }; let conf_path = PathBuf::from(&arg); @@ -116,11 +117,13 @@ fn parse_conf(conf_file: Vec) -> Result<(String, ConfigFile)> { }) { #[cfg(not(feature = "support_bash_conf"))] Some((conf, _)) => { - let pkg = env!("CARGO_PKG_NAME"); bail!("{} no longer supports '.conf' configuration files.\nPlease convert your configuration file to the TOML format using `{} --migrate-config {} {}`.", pkg, pkg, conf, conf.replace(".conf", ".toml")) }, #[cfg(feature = "support_bash_conf")] - Some((arg, conf)) => return Ok((arg, actions::read_legacy_conf(&conf)?)), + Some((arg, conf)) => { + log::warn!("Legacy configuration files may be parsed inaccurately, and do not support all of the features of {}. Consider migrating to TOML with `{} --migrate-config {} {}`", pkg, pkg, arg, arg.replace(".conf", ".toml")); + return Ok((arg, actions::read_legacy_conf(&conf)?)); + }, None => bail!("You are required to input a valid configuration file."), } }, diff --git a/src/qemu_args.rs b/src/qemu_args.rs index ad00ae5..280606b 100644 --- a/src/qemu_args.rs +++ b/src/qemu_args.rs @@ -116,7 +116,10 @@ impl Args { sh_file.set_permissions(PermissionsExt::from_mode(0o755)).unwrap(); write!(sh_file, "{} {}", qemu_bin.to_string_lossy(), qemu_args.iter().map(|arg| "\"".to_string() + &arg.to_string_lossy() + "\"").collect::>().join(" ")).unwrap(); - Command::new(&qemu_bin).args(qemu_args).spawn()?; + match self.display { + Display::Sdl => Command::new(&qemu_bin).args(qemu_args).env("SDL_MOUSE_FOCUS_CLICKTHROUGH", "1").spawn()?, + _ => Command::new(&qemu_bin).args(qemu_args).spawn()?, + }; #[cfg(feature = "get_qemu_ver")] { let qemu_version = qemu_version.wait_with_output()?;