Skip to content

Commit daeea1b

Browse files
committed
Fix accelerator handling for menu items when no accelerator is present
1 parent 0b58da3 commit daeea1b

1 file changed

Lines changed: 6 additions & 3 deletions

File tree

src/platform_impl/gtk4/mod.rs

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -801,9 +801,12 @@ impl PlatformMenuItem {
801801
let gtk_accelerator = accelerator.and_then(MenuAccelerator::to_gtk);
802802

803803
for item in self.instances.values().flat_map(|v| v.iter()) {
804-
if let Some(accelerator) = gtk_accelerator.as_ref() {
805-
let app = item.application();
806-
app.set_accels_for_action(&detailed_action, &[accelerator]);
804+
let app = item.application();
805+
match gtk_accelerator.as_ref() {
806+
Some(accelerator) => {
807+
app.set_accels_for_action(&detailed_action, &[accelerator]);
808+
}
809+
None => app.set_accels_for_action(&detailed_action, &[]),
807810
}
808811
}
809812

0 commit comments

Comments
 (0)