Skip to content

Commit efb4cce

Browse files
wash2mmstick
authored andcommitted
fix: context menu
1 parent 795c47f commit efb4cce

File tree

2 files changed

+32
-25
lines changed

2 files changed

+32
-25
lines changed

Cargo.lock

Lines changed: 18 additions & 18 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/app.rs

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -684,12 +684,14 @@ impl cosmic::Application for CosmicAppLibrary {
684684
}
685685
Message::Layer(e, id) => match e {
686686
LayerEvent::Focused => {
687-
if id == WINDOW_ID.clone() {
688-
return text_input::focus(SEARCH_ID.clone());
689-
} else if id == DELETE_GROUP_WINDOW_ID.clone() {
690-
return button::focus(SUBMIT_DELETE_ID.clone());
691-
} else if id == NEW_GROUP_WINDOW_ID.clone() {
692-
return text_input::focus(NEW_GROUP_ID.clone());
687+
if self.menu.is_none() {
688+
if id == WINDOW_ID.clone() {
689+
return text_input::focus(SEARCH_ID.clone());
690+
} else if id == DELETE_GROUP_WINDOW_ID.clone() {
691+
return button::focus(SUBMIT_DELETE_ID.clone());
692+
} else if id == NEW_GROUP_WINDOW_ID.clone() {
693+
return text_input::focus(NEW_GROUP_ID.clone());
694+
}
693695
}
694696
}
695697
LayerEvent::Unfocused => {
@@ -859,7 +861,7 @@ impl cosmic::Application for CosmicAppLibrary {
859861
reactive: true,
860862
..Default::default()
861863
},
862-
grab: true,
864+
grab: false,
863865
parent_size: None,
864866
close_with_children: true,
865867
input_zone: None,
@@ -1680,6 +1682,11 @@ impl cosmic::Application for CosmicAppLibrary {
16801682
modifiers: _mods,
16811683
..
16821684
}) => Some(Message::Hide),
1685+
cosmic::iced::Event::Mouse(iced::mouse::Event::ButtonPressed(_))
1686+
if id == WINDOW_ID.clone() =>
1687+
{
1688+
Some(Message::CloseContextMenu)
1689+
}
16831690
cosmic::iced::Event::Keyboard(iced::keyboard::Event::KeyPressed {
16841691
key,
16851692
text: _,

0 commit comments

Comments
 (0)