From 721ad1eecf38ef6c3464d73e919b6c78be810e56 Mon Sep 17 00:00:00 2001 From: Enrico Lumetti Date: Wed, 10 Mar 2021 23:29:03 +0100 Subject: [PATCH] Fix notification handling when tool is already selected --- src/main.rs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/main.rs b/src/main.rs index b59f028..2ba5bf9 100644 --- a/src/main.rs +++ b/src/main.rs @@ -209,11 +209,14 @@ impl> Controller for ToolSwitcher { match event { Event::Notification(cmd) => { let new_tool = if cmd.get(stiletto::commands::PUSH_ERASER).is_some() { + ctx.set_handled(); self.saved_tool = data.current_tool; Some(data.eraser_tool_id) } else if cmd.get(stiletto::commands::POP_ERASER).is_some() { + ctx.set_handled(); Some(self.saved_tool) } else if cmd.get(stiletto::commands::UPDATE_TOOL).is_some() { + ctx.set_handled(); let old_tool = data.current_tool; data.tool_icons .iter() @@ -225,7 +228,6 @@ impl> Controller for ToolSwitcher { if let Some(new_tool) = new_tool { data.set_tool(new_tool); - ctx.set_handled(); } } _ => {}