notedeck

One damus client to rule them all
git clone git://jb55.com/notedeck
Log | Files | Refs | README | LICENSE

commit 3a891a982c5982cb54f62280b93e6eee4d5f406d
parent 93b7af1a4e0dc8f69420d84425aef7ef26a3cf8b
Author: William Casarin <jb55@jb55.com>
Date:   Fri, 17 May 2024 19:14:55 -0500

input: process input once

Instead of calling ctx.input multiple times, let's do it once. We are
going to do a lot more stuff in here, such as vim key bindings

Diffstat:
Msrc/app.rs | 14++++++++------
1 file changed, 8 insertions(+), 6 deletions(-)

diff --git a/src/app.rs b/src/app.rs @@ -105,12 +105,14 @@ fn send_initial_filters(damus: &mut Damus, relay_url: &str) { } fn try_process_event(damus: &mut Damus, ctx: &egui::Context) -> Result<()> { - let amount = 0.2; - if ctx.input(|i| i.key_pressed(egui::Key::Equals)) { - ctx.set_pixels_per_point(ctx.pixels_per_point() + amount); - } else if ctx.input(|i| i.key_pressed(egui::Key::Minus)) { - ctx.set_pixels_per_point(ctx.pixels_per_point() - amount); - } + ctx.input(|i| { + let amount = 0.2; + if i.key_pressed(egui::Key::Equals) { + ctx.set_pixels_per_point(ctx.pixels_per_point() + amount); + } else if i.key_pressed(egui::Key::Minus) { + ctx.set_pixels_per_point(ctx.pixels_per_point() - amount); + } + }); let ctx2 = ctx.clone(); let wakeup = move || {