Skip to content

Commit

Permalink
Bump rawaccel_convert version and add steps for libinput
Browse files Browse the repository at this point in the history
  • Loading branch information
Kuuuube committed Jul 24, 2024
1 parent 6a6c153 commit ba5ca67
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 4 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.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ version = "0.1.0"
edition = "2021"

[dependencies]
rawaccel_convert = { git = "https://github.com/Kuuuube/rawaccel_convert.git", rev = "371afa8cbd5e01e3eaf5d63294ee513f8df6b89f" }
rawaccel_convert = { git = "https://github.com/Kuuuube/rawaccel_convert.git", rev = "7278c0c5dfabb7589323ada92f562615f3e60a70" }
egui = "0.28.1"
eframe = { version = "0.28.1", features = [ "default_fonts", "glow", "persistence" ] }
env_logger = "0.11.3"
Expand Down
27 changes: 25 additions & 2 deletions src/gui.rs
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,8 @@ pub struct RawaccelConvertGui {

#[serde(skip)]
points: String,
#[serde(skip)]
libinput_steps: String,
}

impl Default for RawaccelConvertGui {
Expand All @@ -93,6 +95,7 @@ impl Default for RawaccelConvertGui {
accel_args: AccelArgs::default(),

points: String::default(),
libinput_steps: String::default(),
}
}
}
Expand Down Expand Up @@ -935,6 +938,11 @@ fn add_points_dump(rawaccel_convert_gui: &mut RawaccelConvertGui, ui: &mut egui:
};
});

ui.add_sized(
[ui.available_width(), 1.0],
egui::Label::new("Points").selectable(false),
);

egui::ScrollArea::vertical()
.max_height(100.0)
.show(ui, |ui| {
Expand All @@ -944,23 +952,38 @@ fn add_points_dump(rawaccel_convert_gui: &mut RawaccelConvertGui, ui: &mut egui:
)
});

match rawaccel_convert_gui.accel_args.point_scaling {
PointScaling::Libinput | PointScaling::LibinputDebug => {
ui.add_sized(
[ui.available_width(), 1.0],
egui::Label::new("Steps").selectable(false),
);
ui.add_sized(
[ui.available_width(), 1.0],
egui::TextEdit::singleline(&mut rawaccel_convert_gui.libinput_steps),
);
},
_ => {}
}

let generate_points = ui.add_sized(
[ui.available_width(), 1.0],
egui::Button::new("Generate Points"),
);
if generate_points.clicked() {
let curve =
rawaccel_convert::generate_curve::generate_curve(&rawaccel_convert_gui.accel_args);
rawaccel_convert_gui.libinput_steps = curve.step_size.to_string();
rawaccel_convert_gui.points = match rawaccel_convert_gui.accel_args.point_scaling {
rawaccel_convert::types::PointScaling::Libinput => {
let mut output_string = String::default();
for point in curve {
for point in curve.points {
output_string += &(point.y.to_string() + " ");
}
output_string
}
_ => {
format!("{:?}", curve)
format!("{:?}", curve.points)
}
}
}
Expand Down

0 comments on commit ba5ca67

Please sign in to comment.