Skip to content

Commit

Permalink
Add SDL grab-on-hover, bash config support by default (with warning)
Browse files Browse the repository at this point in the history
  • Loading branch information
lj3954 committed May 24, 2024
1 parent a053ff4 commit 39eb08b
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 6 deletions.
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 3 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "quickemu-rs"
version = "0.6.1"
version = "0.6.2"
edition = "2021"

[dependencies]
Expand Down Expand Up @@ -29,7 +29,8 @@ panic = "abort"
[features]
default = [
"check_smartcard",
"get_qemu_ver"
"get_qemu_ver",
"support_bash_conf",
]

check_smartcard = []
Expand Down
7 changes: 5 additions & 2 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,7 @@ fn parse_conf(conf_file: Vec<String>) -> 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);
Expand All @@ -116,11 +117,13 @@ fn parse_conf(conf_file: Vec<String>) -> 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."),
}
},
Expand Down
5 changes: 4 additions & 1 deletion src/qemu_args.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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::<Vec<_>>().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()?;
Expand Down

0 comments on commit 39eb08b

Please sign in to comment.