13
0

Consistently use context-menu button action

This fixes an issue where brining up a menu can directly activate an
action in the menu. Notably on macOS.

Nathan reports that this may also address #9515

Note: mac touchpads are not affected since right-click there is
effectively a "press and hold".
This commit is contained in:
Robin Gareus 2023-10-31 20:10:49 +01:00
parent 43c5f0ab46
commit c162aa7aca
Signed by: rgareus
GPG Key ID: A090BCE02CF57F04
22 changed files with 39 additions and 39 deletions

View File

@ -1109,7 +1109,7 @@ ARDOUR_UI::tabbable_visibility_button_press (GdkEventButton* ev, string const& t
string menu_name = string ("/ui/") + tabbable_name + X_("TabbableButtonMenu");
Gtk::Menu* menu = dynamic_cast<Gtk::Menu*> (ActionManager::get_widget (menu_name.c_str()));
if (menu) {
menu->popup (3, ev->time);
menu->popup (ev->button, ev->time);
}
return true;
}

View File

@ -1745,7 +1745,7 @@ AudioClock::on_button_release_event (GdkEventButton *ev)
if (ops_menu == 0) {
build_ops_menu ();
}
ops_menu->popup (1, ev->time);
ops_menu->popup (ev->button, ev->time);
return true;
}

View File

@ -314,7 +314,7 @@ AutomationController::on_button_release(GdkEventButton* ev)
MenuList& items = menu->items();
items.push_back(MenuElem(_("Select Note..."),
sigc::mem_fun(*this, &AutomationController::run_note_select_dialog)));
menu->popup(1, ev->time);
menu->popup(ev->button, ev->time);
return true;
} else if (desc.unit == ARDOUR::ParameterDescriptor::HZ) {
Gtk::Menu* menu = ARDOUR_UI_UTILS::shared_popup_menu ();
@ -338,7 +338,7 @@ AutomationController::on_button_release(GdkEventButton* ev)
(double)beats)));
}
}
menu->popup(1, ev->time);
menu->popup(ev->button, ev->time);
return true;
}

View File

@ -213,7 +213,7 @@ ControlSlaveUI::vca_button_release (GdkEventButton* ev, uint32_t n)
}
if (!items.empty()) {
context_menu->popup (1, ev->time);
context_menu->popup (ev->button, ev->time);
return true;
}

View File

@ -298,7 +298,7 @@ CueBoxUI::context_menu (uint64_t idx)
items.push_back (SeparatorElem());
items.push_back (MenuElem (_("Clear All..."), sigc::bind (sigc::mem_fun (*this, &CueBoxUI::clear_all_triggers), idx)));
_context_menu->popup (1, gtk_get_current_event_time ());
_context_menu->popup (3, gtk_get_current_event_time ());
}
void

View File

@ -1026,14 +1026,14 @@ Editor::tempo_map_marker_context_menu (GdkEventButton* ev, ArdourCanvas::Item* i
if (mm) {
can_remove = !mm->meter().map().is_initial (mm->meter());
build_meter_marker_menu (mm, can_remove);
meter_marker_menu->popup (1, ev->time);
meter_marker_menu->popup (ev->button, ev->time);
} else if (tm) {
can_remove = !tm->tempo().map().is_initial(tm->tempo()) && !tm->tempo().locked_to_meter();
build_tempo_marker_menu (tm, can_remove);
tempo_marker_menu->popup (1, ev->time);
tempo_marker_menu->popup (ev->button, ev->time);
} else if (bm) {
build_bbt_marker_menu (bm);
bbt_marker_menu->popup (1, ev->time);
bbt_marker_menu->popup (ev->button, ev->time);
} else {
return;
}
@ -1062,7 +1062,7 @@ Editor::marker_context_menu (GdkEventButton* ev, ArdourCanvas::Item* item)
build_range_marker_menu (loc, loc == transport_loop_location() || loc == transport_punch_location(), loc->is_session_range());
marker_menu_item = item;
range_marker_menu->popup (1, ev->time);
range_marker_menu->popup (ev->button, ev->time);
} else if (loc->is_mark()) {
@ -1083,12 +1083,12 @@ Editor::marker_context_menu (GdkEventButton* ev, ArdourCanvas::Item* item)
}
#endif
marker_menu_item = item;
marker_menu->popup (1, ev->time);
marker_menu->popup (ev->button, ev->time);
} else if (loc->is_range_marker()) {
build_range_marker_menu (loc, false, false);
marker_menu_item = item;
range_marker_menu->popup (1, ev->time);
range_marker_menu->popup (ev->button, ev->time);
}
}
@ -1099,7 +1099,7 @@ Editor::new_transport_marker_context_menu (GdkEventButton* ev, ArdourCanvas::Ite
build_new_transport_marker_menu ();
}
new_transport_marker_menu->popup (1, ev->time);
new_transport_marker_menu->popup (ev->button, ev->time);
}

View File

@ -148,7 +148,7 @@ EditorSources::show_context_menu (int button, int time)
#endif
items.push_back (MenuElem (_("Remove the selected Sources"),
sigc::mem_fun (*this, &EditorSources::remove_selected_sources)));
menu->popup (1, time);
menu->popup (button, time);
}
void

View File

@ -497,7 +497,7 @@ GainMeterBase::popup_meter_menu (GdkEventButton *ev)
items.push_back (MenuElem ("-4 .. -2dBFS"));
}
meter_menu->popup (1, ev->time);
meter_menu->popup (ev->button, ev->time);
}
bool

View File

@ -1210,7 +1210,7 @@ MixerStrip::name_button_button_press (GdkEventButton* ev)
Gtkmm2ext::anchored_menu_popup(route_ops_menu, &name_button, "",
1, ev->time);
} else {
route_ops_menu->popup (3, ev->time);
route_ops_menu->popup (ev->button, ev->time);
}
return true;
@ -1230,7 +1230,7 @@ MixerStrip::number_button_button_press (GdkEventButton* ev)
if (ev->button == 3) {
list_route_operations ();
route_ops_menu->popup (1, ev->time);
route_ops_menu->popup (ev->button, ev->time);
return true;
}

View File

@ -2079,7 +2079,7 @@ Mixer_UI::group_display_button_press (GdkEventButton* ev)
RouteGroup* group = (*iter)[group_columns.group];
if (Keyboard::is_context_menu_event (ev)) {
_group_tabs->get_menu(group)->popup (1, ev->time);
_group_tabs->get_menu(group)->popup (ev->button, ev->time);
return true;
}
@ -4107,7 +4107,7 @@ Mixer_UI::popup_scene_menu (GdkEventButton* ev, int scn_idx)
items.back().set_sensitive (!PublicEditor::instance().get_selection().tracks.routelist ().empty ());
}
menu->popup(1, ev->time);
menu->popup(ev->button, ev->time);
}
bool

View File

@ -385,7 +385,7 @@ PannerUI::pan_button_event (GdkEventButton* ev)
pan_menu->set_name ("ArdourContextMenu");
}
build_pan_menu ();
pan_menu->popup (1, ev->time);
pan_menu->popup (ev->button, ev->time);
return true;
break;
default:
@ -528,7 +528,7 @@ PannerUI::pan_automation_state_button_event (GdkEventButton *ev)
if (pan_astate_menu == 0) {
build_astate_menu ();
}
pan_astate_menu->popup (1, ev->time);
pan_astate_menu->popup (ev->button, ev->time);
break;
default:
break;

View File

@ -559,7 +559,7 @@ PortMatrix::popup_menu (BundleChannel column, BundleChannel row, uint32_t t)
items.push_back (MenuElem (_("Flip"), sigc::mem_fun (*this, &PortMatrix::flip)));
items.back().set_sensitive (can_flip ());
_menu->popup (1, t);
_menu->popup (3, t);
}
void

View File

@ -2527,7 +2527,7 @@ ProcessorBox::show_processor_menu (int arg)
&& !std::dynamic_pointer_cast<Amp> (single_selection->processor ())
&& !std::dynamic_pointer_cast<UnknownProcessor> (single_selection->processor ()));
processor_menu->popup (1, arg);
processor_menu->popup (3, arg);
/* Add a placeholder gap to the processor list to indicate where a processor would be
inserted were one chosen from the menu.

View File

@ -456,7 +456,7 @@ RouteParams_UI::show_track_menu()
track_menu->set_name ("ArdourContextMenu");
track_menu->items().push_back (MenuElem (_("Add Track or Bus"), sigc::mem_fun (*(ARDOUR_UI::instance()), &ARDOUR_UI::add_route)));
}
track_menu->popup (1, gtk_get_current_event_time());
track_menu->popup (1, gtk_get_current_event_time()); // show by "clicked" signal, btn1
}
void

View File

@ -487,7 +487,7 @@ RouteUI::mute_press (GdkEventButton* ev)
build_mute_menu();
}
mute_menu->popup(0,ev->time);
mute_menu->popup (ev->button, ev->time);
return true;
@ -653,7 +653,7 @@ RouteUI::solo_press(GdkEventButton* ev)
build_solo_menu ();
}
solo_menu->popup (1, ev->time);
solo_menu->popup (ev->button, ev->time);
} else {
@ -1027,7 +1027,7 @@ RouteUI::rec_enable_release (GdkEventButton* ev)
if (Keyboard::is_context_menu_event (ev)) {
build_record_menu ();
if (_record_menu) {
_record_menu->popup (1, ev->time);
_record_menu->popup (ev->button, ev->time);
}
return false;
}
@ -1154,7 +1154,7 @@ RouteUI::show_sends_press(GdkEventButton* ev)
build_sends_menu ();
}
sends_menu->popup (0, ev->time);
sends_menu->popup (ev->button, ev->time);
} else if (ev->button == 1) {
@ -2233,7 +2233,7 @@ RouteUI::invert_press (GdkEventButton* ev)
--_i_am_the_modifier;
}
_invert_menu->popup (0, ev->time);
_invert_menu->popup (ev->button, ev->time);
return true;
}

View File

@ -721,7 +721,7 @@ CueMaster::context_menu ()
items.push_back (SeparatorElem());
items.push_back (MenuElem (_("Clear All..."), sigc::mem_fun (*this, &CueMaster::clear_all_triggers)));
_context_menu->popup (1, gtk_get_current_event_time ());
_context_menu->popup (3, gtk_get_current_event_time ());
}
void

View File

@ -574,7 +574,7 @@ TriggerStrip::name_button_press (GdkEventButton* ev)
if (ev->button == 1) {
Gtkmm2ext::anchored_menu_popup (_route_ops_menu, &_name_button, "", 1, ev->time);
} else {
_route_ops_menu->popup (3, ev->time);
_route_ops_menu->popup (ev->button, ev->time);
}
return true;

View File

@ -546,11 +546,11 @@ TriggerUI::launch_context_menu ()
dynamic_cast<Gtk::CheckMenuItem*> (&items.back ())->set_active (true);
}
_launch_context_menu->popup (1, gtk_get_current_event_time ());
_launch_context_menu->popup (3, gtk_get_current_event_time ());
}
void
TriggerUI::follow_context_menu ()
TriggerUI::follow_context_menu (GdkEventButton* ev)
{
using namespace Gtk;
using namespace Gtk::Menu_Helpers;
@ -583,7 +583,7 @@ TriggerUI::follow_context_menu ()
_ignore_menu_action = false;
_follow_context_menu->popup (1, gtk_get_current_event_time ());
_follow_context_menu->popup (ev->button, ev->time);
}
void

View File

@ -73,7 +73,7 @@ public:
void sample_chosen (int r);
void launch_context_menu ();
void follow_context_menu ();
void follow_context_menu (GdkEventButton*);
void context_menu ();
void edit_jump_done (int r, TriggerJumpDialog* d);

View File

@ -664,7 +664,7 @@ TriggerEntry::follow_button_event (GdkEvent* ev)
switch (ev->button.button) {
case 1:
case 3:
follow_context_menu ();
follow_context_menu (ev->button);
default:
break;
}

View File

@ -401,7 +401,7 @@ VCAMasterStrip::vertical_button_release (GdkEventButton* ev)
if (!context_menu) {
build_context_menu ();
}
context_menu->popup (1, ev->time);
context_menu->popup (ev->time, ev->time);
return true;
}
@ -419,7 +419,7 @@ VCAMasterStrip::number_button_press (GdkEventButton* ev)
if (!context_menu) {
build_context_menu ();
}
context_menu->popup (1, ev->time);
context_menu->popup (ev->time, ev->time);
return true;
}
return false;

View File

@ -82,7 +82,7 @@ VisibilityGroup::button_press_event (GdkEventButton* ev)
j->signal_activate().connect (sigc::bind (sigc::mem_fun (*this, &VisibilityGroup::toggle), i));
}
m->popup (1, ev->time);
m->popup (ev->button, ev->time);
return true;
}