bugs: move application quirks into workspace crate
This commit is contained in:
parent
d50863bbd8
commit
061991218f
5 changed files with 57 additions and 38 deletions
8
Cargo.lock
generated
8
Cargo.lock
generated
|
|
@ -658,6 +658,13 @@ dependencies = [
|
|||
"uapi",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "jay-bugs"
|
||||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"ahash",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "jay-cmm"
|
||||
version = "0.1.0"
|
||||
|
|
@ -693,6 +700,7 @@ dependencies = [
|
|||
"jay-ash",
|
||||
"jay-async-engine",
|
||||
"jay-bufio",
|
||||
"jay-bugs",
|
||||
"jay-cmm",
|
||||
"jay-config",
|
||||
"jay-cpu-worker",
|
||||
|
|
|
|||
|
|
@ -40,6 +40,7 @@ members = [
|
|||
"cpu-worker",
|
||||
"sighand",
|
||||
"pr-caps",
|
||||
"bugs",
|
||||
"toml-config",
|
||||
"algorithms",
|
||||
"toml-spec",
|
||||
|
|
@ -81,6 +82,7 @@ jay-wheel = { version = "0.1.0", path = "wheel" }
|
|||
jay-cpu-worker = { version = "0.1.0", path = "cpu-worker" }
|
||||
jay-sighand = { version = "0.1.0", path = "sighand" }
|
||||
jay-pr-caps = { version = "0.1.0", path = "pr-caps" }
|
||||
jay-bugs = { version = "0.1.0", path = "bugs" }
|
||||
|
||||
uapi = "0.2.13"
|
||||
thiserror = "2.0.11"
|
||||
|
|
|
|||
8
bugs/Cargo.toml
Normal file
8
bugs/Cargo.toml
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
[package]
|
||||
name = "jay-bugs"
|
||||
version = "0.1.0"
|
||||
edition = "2024"
|
||||
license = "GPL-3.0-only"
|
||||
|
||||
[dependencies]
|
||||
ahash = "0.8.7"
|
||||
38
bugs/src/lib.rs
Normal file
38
bugs/src/lib.rs
Normal file
|
|
@ -0,0 +1,38 @@
|
|||
use {ahash::AHashMap, std::sync::LazyLock};
|
||||
|
||||
static BUGS: LazyLock<AHashMap<&'static str, Bugs>> = LazyLock::new(|| {
|
||||
let mut map = AHashMap::new();
|
||||
map.insert(
|
||||
"chromium",
|
||||
Bugs {
|
||||
respect_min_max_size: true,
|
||||
..Default::default()
|
||||
},
|
||||
);
|
||||
map.insert(
|
||||
"Alacritty",
|
||||
Bugs {
|
||||
min_width: Some(100),
|
||||
min_height: Some(100),
|
||||
..Default::default()
|
||||
},
|
||||
);
|
||||
map
|
||||
});
|
||||
|
||||
pub fn get(app_id: &str) -> &'static Bugs {
|
||||
BUGS.get(app_id).unwrap_or(&NONE)
|
||||
}
|
||||
|
||||
pub static NONE: Bugs = Bugs {
|
||||
respect_min_max_size: false,
|
||||
min_width: None,
|
||||
min_height: None,
|
||||
};
|
||||
|
||||
#[derive(Default, Debug)]
|
||||
pub struct Bugs {
|
||||
pub respect_min_max_size: bool,
|
||||
pub min_width: Option<i32>,
|
||||
pub min_height: Option<i32>,
|
||||
}
|
||||
39
src/bugs.rs
39
src/bugs.rs
|
|
@ -1,38 +1 @@
|
|||
use {ahash::AHashMap, std::sync::LazyLock};
|
||||
|
||||
static BUGS: LazyLock<AHashMap<&'static str, Bugs>> = LazyLock::new(|| {
|
||||
let mut map = AHashMap::new();
|
||||
map.insert(
|
||||
"chromium",
|
||||
Bugs {
|
||||
respect_min_max_size: true,
|
||||
..Default::default()
|
||||
},
|
||||
);
|
||||
map.insert(
|
||||
"Alacritty",
|
||||
Bugs {
|
||||
min_width: Some(100),
|
||||
min_height: Some(100),
|
||||
..Default::default()
|
||||
},
|
||||
);
|
||||
map
|
||||
});
|
||||
|
||||
pub fn get(app_id: &str) -> &'static Bugs {
|
||||
BUGS.get(app_id).unwrap_or(&NONE)
|
||||
}
|
||||
|
||||
pub static NONE: Bugs = Bugs {
|
||||
respect_min_max_size: false,
|
||||
min_width: None,
|
||||
min_height: None,
|
||||
};
|
||||
|
||||
#[derive(Default, Debug)]
|
||||
pub struct Bugs {
|
||||
pub respect_min_max_size: bool,
|
||||
pub min_width: Option<i32>,
|
||||
pub min_height: Option<i32>,
|
||||
}
|
||||
pub use jay_bugs::*;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue