bindings: add a mechanism to prevent binding activation during drag
This commit is contained in:
@@ -46,6 +46,7 @@ using namespace PBD;
|
||||
|
||||
list<Bindings*> Bindings::bindings; /* global. Gulp */
|
||||
PBD::Signal1<void,Bindings*> Bindings::BindingsChanged;
|
||||
int Bindings::_drag_active = 0;
|
||||
|
||||
template <typename IteratorValueType>
|
||||
struct ActionNameRegistered
|
||||
@@ -492,6 +493,12 @@ Bindings::activate (KeyboardKey kb, Operation op)
|
||||
action = ActionManager::get_action (k->second.action_name, false);
|
||||
}
|
||||
|
||||
/* bindings cannot be used during drags */
|
||||
|
||||
if (_drag_active) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (action) {
|
||||
/* lets do it ... */
|
||||
if (action->get_sensitive()) {
|
||||
|
||||
@@ -167,6 +167,15 @@ class LIBGTKMM2EXT_API Bindings {
|
||||
|
||||
static PBD::Signal1<void,Bindings*> BindingsChanged;
|
||||
|
||||
struct DragsBlockBindings {
|
||||
DragsBlockBindings() { Bindings::_drag_active++; }
|
||||
~DragsBlockBindings() {
|
||||
if (Bindings::_drag_active--) {
|
||||
Bindings::_drag_active--;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
private:
|
||||
std::string _name;
|
||||
KeybindingMap press_bindings;
|
||||
@@ -197,6 +206,8 @@ class LIBGTKMM2EXT_API Bindings {
|
||||
*/
|
||||
static std::string ardour_action_name (Glib::RefPtr<Gtk::Action>);
|
||||
|
||||
static int _drag_active;
|
||||
friend struct DragsBlockBindings;
|
||||
};
|
||||
|
||||
} // namespace
|
||||
|
||||
Reference in New Issue
Block a user