Merge pull request #1270 from jasonrhansen/location-context-menu-fix
Fix location context menu
This commit is contained in:
commit
5a326b6ff1
2 changed files with 13 additions and 7 deletions
12
src/app.rs
12
src/app.rs
|
|
@ -4364,13 +4364,19 @@ impl Application for App {
|
|||
}
|
||||
}
|
||||
Message::NavBarContext(entity) => {
|
||||
// Close location editing if enabled
|
||||
self.nav_bar_context_id = entity;
|
||||
|
||||
let tab_entity = self.tab_model.active();
|
||||
if let Some(tab) = self.tab_model.data_mut::<Tab>(tab_entity) {
|
||||
// Close location editing if enabled
|
||||
tab.edit_location = None;
|
||||
// Close other context menus.
|
||||
tab.location_context_menu_index = None;
|
||||
return Task::done(cosmic::Action::App(Message::TabMessage(
|
||||
Some(tab_entity),
|
||||
tab::Message::ContextMenu(None, None),
|
||||
)));
|
||||
}
|
||||
|
||||
self.nav_bar_context_id = entity;
|
||||
}
|
||||
Message::NavMenuAction(action) => match action {
|
||||
NavMenuAction::Open(entity) => {
|
||||
|
|
|
|||
|
|
@ -3147,6 +3147,7 @@ impl Tab {
|
|||
self.edit_location = None;
|
||||
if point_opt.is_none() || !mod_shift {
|
||||
self.context_menu = point_opt;
|
||||
self.location_context_menu_index = None;
|
||||
|
||||
//TODO: hack for clearing selecting when right clicking empty space
|
||||
if self.context_menu.is_some() && self.last_right_click.take().is_none() {
|
||||
|
|
@ -3159,11 +3160,11 @@ impl Tab {
|
|||
}
|
||||
}
|
||||
Message::LocationContextMenuPoint(point_opt) => {
|
||||
self.context_menu = point_opt;
|
||||
self.context_menu = None;
|
||||
self.location_context_menu_point = point_opt;
|
||||
}
|
||||
Message::LocationContextMenuIndex(p, index_opt) => {
|
||||
self.context_menu = p;
|
||||
self.context_menu = None;
|
||||
self.location_context_menu_point = p;
|
||||
self.location_context_menu_index = index_opt;
|
||||
}
|
||||
|
|
@ -4627,8 +4628,7 @@ impl Tab {
|
|||
}
|
||||
|
||||
let mouse_area = crate::mouse_area::MouseArea::new(column)
|
||||
.on_right_press(Message::LocationContextMenuPoint)
|
||||
.wayland_on_right_press_window_position();
|
||||
.on_right_press(Message::LocationContextMenuPoint);
|
||||
|
||||
let mut popover = widget::popover(mouse_area);
|
||||
if let (Some(point), Some(index)) = (
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue