modifiers: make a new abstraction for momentary-click, instead of button_2 (lib part)
is_button2_event() was used to detect the user's desire for a momentary-click on some buttons (mute, solo, mixer scenes) is_momentary_push_event() disambiguates this action from is_button2_event() for the special case of momentary, we can drop the workarounds for the lack of middle-mouse buttons on Mac, and instead just use shift+left-click on all platforms.
This commit is contained in:
parent
71833911a4
commit
12e703414d
|
@ -163,6 +163,7 @@ class LIBGTKMM2EXT_API Keyboard : public sigc::trackable, PBD::Stateful
|
|||
static bool is_insert_note_event (GdkEventButton*);
|
||||
static bool is_context_menu_event (GdkEventButton*);
|
||||
static bool is_button2_event (GdkEventButton*);
|
||||
static bool is_momentary_push_event (GdkEventButton*);
|
||||
|
||||
static Keyboard& the_keyboard() { return *_the_keyboard; }
|
||||
|
||||
|
@ -209,6 +210,7 @@ class LIBGTKMM2EXT_API Keyboard : public sigc::trackable, PBD::Stateful
|
|||
static guint snap_mod;
|
||||
static guint snap_delta_mod;
|
||||
static guint button2_modifiers;
|
||||
static guint momentary_push_modifiers;
|
||||
static Gtk::Window* current_window;
|
||||
static std::string user_keybindings_path;
|
||||
static bool can_save_keybindings;
|
||||
|
|
|
@ -71,6 +71,7 @@ guint Keyboard::Level4Modifier = GDK_MOD1_MASK; // Alt/Option
|
|||
guint Keyboard::CopyModifier = GDK_CONTROL_MASK; // Control
|
||||
guint Keyboard::RangeSelectModifier = GDK_SHIFT_MASK;
|
||||
guint Keyboard::button2_modifiers = Keyboard::SecondaryModifier|Keyboard::Level4Modifier;
|
||||
guint Keyboard::momentary_push_modifiers = Keyboard::TertiaryModifier;
|
||||
|
||||
const char* Keyboard::primary_modifier_name() { return _("Command"); }
|
||||
const char* Keyboard::secondary_modifier_name() { return _("Control"); }
|
||||
|
@ -96,6 +97,7 @@ guint Keyboard::Level4Modifier = GDK_MOD4_MASK|GDK_SUPER_MASK; // Mod4/Windows
|
|||
guint Keyboard::CopyModifier = GDK_CONTROL_MASK;
|
||||
guint Keyboard::RangeSelectModifier = GDK_SHIFT_MASK;
|
||||
guint Keyboard::button2_modifiers = 0; /* not used */
|
||||
guint Keyboard::momentary_push_modifiers = Keyboard::TertiaryModifier;
|
||||
|
||||
const char* Keyboard::primary_modifier_name() { return _("Control"); }
|
||||
const char* Keyboard::secondary_modifier_name() { return _("Alt"); }
|
||||
|
@ -546,6 +548,14 @@ Keyboard::is_button2_event (GdkEventButton* ev)
|
|||
#endif
|
||||
}
|
||||
|
||||
bool
|
||||
Keyboard::is_momentary_push_event (GdkEventButton* ev)
|
||||
{
|
||||
return (is_button2_event(ev)) ||
|
||||
((ev->button == 1) &&
|
||||
((ev->state & RelevantModifierKeyMask) == Keyboard::momentary_push_modifiers));
|
||||
}
|
||||
|
||||
bool
|
||||
Keyboard::is_delete_event (GdkEventButton *ev)
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue