Skip to content

Commit 3da5315

Browse files
committed
refactor input settins to be in input section
1 parent c1f21a5 commit 3da5315

File tree

2 files changed

+11
-4
lines changed

2 files changed

+11
-4
lines changed

config.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ release_bind = ["KeyA", "KeyS", "KeyD", "KeyF"]
66
# optional port (defaults to 4242)
77
port = 4242
88

9+
[input]
910
# linear mouse acceleration
1011
mouse_sensitivity = 1.0
1112
# invert scrolling direction

src/config.rs

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -50,11 +50,17 @@ struct ConfigToml {
5050
emulation_backend: Option<EmulationBackend>,
5151
port: Option<u16>,
5252
release_bind: Option<Vec<scancode::Linux>>,
53-
mouse_sensitivity: Option<f64>,
54-
invert_scroll: Option<bool>,
5553
cert_path: Option<PathBuf>,
5654
clients: Option<Vec<TomlClient>>,
5755
authorized_fingerprints: Option<HashMap<String, String>>,
56+
input: InputConfig,
57+
}
58+
59+
#[derive(Serialize, Deserialize, Debug)]
60+
struct InputConfig {
61+
// TODO: implement scroll_sensitivity and mouse_acceleration
62+
invert_scroll: Option<bool>,
63+
mouse_sensitivity: Option<f64>,
5864
}
5965

6066
#[derive(Clone, Serialize, Deserialize, Debug, Eq, PartialEq)]
@@ -370,14 +376,14 @@ impl Config {
370376
pub fn invert_scroll(&self) -> bool {
371377
self.config_toml
372378
.as_ref()
373-
.and_then(|c| c.invert_scroll)
379+
.and_then(|c| c.input.invert_scroll)
374380
.unwrap_or(false)
375381
}
376382

377383
pub fn mouse_sensitivity(&self) -> f64 {
378384
self.config_toml
379385
.as_ref()
380-
.and_then(|c| c.mouse_sensitivity)
386+
.and_then(|c| c.input.mouse_sensitivity)
381387
.unwrap_or(1.0)
382388
}
383389

0 commit comments

Comments
 (0)