diff --git a/gtk2_ardour/crossfade_edit.cc b/gtk2_ardour/crossfade_edit.cc index 2c0085c796..c5d7b72db4 100644 --- a/gtk2_ardour/crossfade_edit.cc +++ b/gtk2_ardour/crossfade_edit.cc @@ -403,7 +403,7 @@ CrossfadeEditor::point_event (GdkEvent* event, Point* point) if (Keyboard::is_delete_event (&event->button)) { fade[current].points.remove (point); delete point; - } + } redraw (); break; diff --git a/gtk2_ardour/editor_mouse.cc b/gtk2_ardour/editor_mouse.cc index a3585d2872..7b526c86e6 100644 --- a/gtk2_ardour/editor_mouse.cc +++ b/gtk2_ardour/editor_mouse.cc @@ -1850,7 +1850,7 @@ Editor::start_grab (GdkEvent* event, Gdk::Cursor *cursor) // if dragging with button2, the motion is x constrained, with Alt-button2 it is y constrained - if (event->button.button == 2) { + if (Keyboard::is_button2_event (&event->button)) { if (Keyboard::modifier_state_equals (event->button.state, Keyboard::SecondaryModifier)) { drag_info.y_constrained = true; drag_info.x_constrained = false; diff --git a/gtk2_ardour/gain_meter.cc b/gtk2_ardour/gain_meter.cc index 1d05d43876..3e60b39128 100644 --- a/gtk2_ardour/gain_meter.cc +++ b/gtk2_ardour/gain_meter.cc @@ -453,7 +453,7 @@ GainMeterBase::meter_press(GdkEventButton* ev) } else { - if (ev->button == 2) { + if (Keyboard::is_button2_event(ev)) { // Primary-button2 click is the midi binding click // button2-click is "momentary" @@ -464,7 +464,7 @@ GainMeterBase::meter_press(GdkEventButton* ev) } } - if (ev->button == 1 || ev->button == 2) { + if (ev->button == 1 || Keyboard::is_button2_event (ev)) { if (Keyboard::modifier_state_equals (ev->state, Keyboard::ModifierMask (Keyboard::PrimaryModifier|Keyboard::TertiaryModifier))) { diff --git a/gtk2_ardour/keyboard.cc b/gtk2_ardour/keyboard.cc index e5fb8d8b10..4b0a810429 100644 --- a/gtk2_ardour/keyboard.cc +++ b/gtk2_ardour/keyboard.cc @@ -61,6 +61,7 @@ guint Keyboard::TertiaryModifier = GDK_SHIFT_MASK; // Shift guint Keyboard::Level4Modifier = GDK_CONTROL_MASK; // Control guint Keyboard::CopyModifier = GDK_MOD1_MASK; // Alt/Option guint Keyboard::RangeSelectModifier = GDK_SHIFT_MASK; +guint Keyboard::button2_modifiers = Keyboard::SecondaryModifier|Keyboard::Level4Modifier; #else guint Keyboard::PrimaryModifier = GDK_CONTROL_MASK; // Control guint Keyboard::SecondaryModifier = GDK_MOD1_MASK; // Alt/Option @@ -68,8 +69,10 @@ guint Keyboard::TertiaryModifier = GDK_SHIFT_MASK; // Shift guint Keyboard::Level4Modifier = GDK_MOD4_MASK; // Mod4/Windows guint Keyboard::CopyModifier = GDK_CONTROL_MASK; guint Keyboard::RangeSelectModifier = GDK_SHIFT_MASK; +guint Keyboard::button2_modifiers = 0; /* not used */ #endif + Keyboard* Keyboard::_the_keyboard = 0; Gtk::Window* Keyboard::current_window = 0; bool Keyboard::_some_magic_widget_has_focus = false; @@ -375,6 +378,18 @@ Keyboard::is_edit_event (GdkEventButton *ev) ((ev->state & RelevantModifierKeyMask) == Keyboard::edit_modifier()); } +bool +Keyboard::is_button2_event (GdkEventButton* ev) +{ +#ifdef GTKOSX + return (ev->button == 2) || + ((ev->button == 1) && + ((ev->state & Keyboard::button2_modifiers) == Keyboard::button2_modifiers)); +#else + return ev->button == 2; +#endif +} + bool Keyboard::is_delete_event (GdkEventButton *ev) { diff --git a/gtk2_ardour/keyboard.h b/gtk2_ardour/keyboard.h index 2b6d7c4564..e8ded792b9 100644 --- a/gtk2_ardour/keyboard.h +++ b/gtk2_ardour/keyboard.h @@ -108,6 +108,7 @@ class Keyboard : public sigc::trackable, Stateful static bool is_edit_event (GdkEventButton*); static bool is_delete_event (GdkEventButton*); static bool is_context_menu_event (GdkEventButton*); + static bool is_button2_event (GdkEventButton*); static Keyboard& the_keyboard() { return *_the_keyboard; } @@ -144,6 +145,7 @@ class Keyboard : public sigc::trackable, Stateful static guint delete_but; static guint delete_mod; static guint snap_mod; + static guint button2_modifiers; static Gtk::Window* current_window; static std::string user_keybindings_path; static bool can_save_keybindings; diff --git a/gtk2_ardour/redirect_box.cc b/gtk2_ardour/redirect_box.cc index 6748034cfa..155fa4e1e6 100644 --- a/gtk2_ardour/redirect_box.cc +++ b/gtk2_ardour/redirect_box.cc @@ -349,7 +349,7 @@ RedirectBox::redirect_button_release_event (GdkEventButton *ev) show_redirect_menu(ev->time); ret = true; - } else if (redirect && (ev->button == 2) && (Keyboard::no_modifier_keys_pressed (ev) && ((ev->state & Gdk::BUTTON2_MASK) == Gdk::BUTTON2_MASK))) { + } else if (redirect && Keyboard::is_button2_event (ev) && (Keyboard::no_modifier_keys_pressed (ev) && ((ev->state & Gdk::BUTTON2_MASK) == Gdk::BUTTON2_MASK))) { /* button2-click with no modifiers */ diff --git a/gtk2_ardour/route_ui.cc b/gtk2_ardour/route_ui.cc index a46a61314c..de6b6cfad9 100644 --- a/gtk2_ardour/route_ui.cc +++ b/gtk2_ardour/route_ui.cc @@ -218,7 +218,7 @@ RouteUI::mute_press(GdkEventButton* ev) } else { - if (ev->button == 2) { + if (Keyboard::is_button2_event (ev)) { // Primary-button2 click is the midi binding click // button2-click is "momentary" @@ -229,7 +229,7 @@ RouteUI::mute_press(GdkEventButton* ev) } } - if (ev->button == 1 || ev->button == 2) { + if (ev->button == 1 || Keyboard::is_button2_event (ev)) { if (Keyboard::modifier_state_equals (ev->state, Keyboard::ModifierMask (Keyboard::PrimaryModifier|Keyboard::TertiaryModifier))) { @@ -301,7 +301,7 @@ RouteUI::solo_press(GdkEventButton* ev) } else { - if (ev->button == 2) { + if (Keyboard::is_button2_event (ev)) { // Primary-button2 click is the midi binding click // button2-click is "momentary" @@ -313,7 +313,7 @@ RouteUI::solo_press(GdkEventButton* ev) } } - if (ev->button == 1 || ev->button == 2) { + if (ev->button == 1 || Keyboard::is_button2_event (ev)) { if (Keyboard::modifier_state_equals (ev->state, Keyboard::ModifierMask (Keyboard::PrimaryModifier|Keyboard::TertiaryModifier))) { @@ -398,7 +398,7 @@ RouteUI::rec_enable_press(GdkEventButton* ev) if (!ignore_toggle && is_track() && rec_enable_button) { - if (ev->button == 2 && Keyboard::modifier_state_equals (ev->state, Keyboard::PrimaryModifier)) { + if (Keyboard::is_button2_event (ev) && Keyboard::modifier_state_equals (ev->state, Keyboard::PrimaryModifier)) { // do nothing on midi bind event return false;