summaryrefslogtreecommitdiff
path: root/libs/gtkmm2ext
diff options
context:
space:
mode:
authorBen Loftis <ben@harrisonconsoles.com>2014-08-28 10:31:57 -0500
committerBen Loftis <ben@harrisonconsoles.com>2014-08-28 10:31:57 -0500
commit3f297f7dab524dd17ef173efe41acd0ab028b0d5 (patch)
tree3c019c527403bf6dfd2fed9e1b8fe5efcee966c2 /libs/gtkmm2ext
parent3cc19c2cce9ae7016232d28e0df3c9755ad1ca48 (diff)
Fix ArdourButton event sequence.
Always give ArdourButton a chance to handle Press or Release events if you override them. This allows ArdourButtons to do the "Pressed" animation And it now correctly eats the event so button clicks don't select the channelstrip.
Diffstat (limited to 'libs/gtkmm2ext')
-rw-r--r--libs/gtkmm2ext/binding_proxy.cc23
-rw-r--r--libs/gtkmm2ext/gtkmm2ext/binding_proxy.h8
2 files changed, 15 insertions, 16 deletions
diff --git a/libs/gtkmm2ext/binding_proxy.cc b/libs/gtkmm2ext/binding_proxy.cc
index c56ab85982..bf21c19bce 100644
--- a/libs/gtkmm2ext/binding_proxy.cc
+++ b/libs/gtkmm2ext/binding_proxy.cc
@@ -31,20 +31,17 @@ using namespace Gtkmm2ext;
using namespace std;
using namespace PBD;
+guint BindingProxy::bind_button = 2;
+guint BindingProxy::bind_statemask = Gdk::CONTROL_MASK;
+
BindingProxy::BindingProxy (boost::shared_ptr<Controllable> c)
: prompter (0),
- controllable (c),
- bind_button (2),
- bind_statemask (Gdk::CONTROL_MASK)
-
+ controllable (c)
{
}
BindingProxy::BindingProxy ()
- : prompter (0),
- bind_button (2),
- bind_statemask (Gdk::CONTROL_MASK)
-
+ : prompter (0)
{
}
@@ -69,17 +66,17 @@ BindingProxy::set_bind_button_state (guint button, guint statemask)
bind_statemask = statemask;
}
-void
-BindingProxy::get_bind_button_state (guint &button, guint &statemask)
+bool
+BindingProxy::is_bind_action (GdkEventButton *ev)
{
- button = bind_button;
- statemask = bind_statemask;
+ return ( (ev->state & bind_statemask) && ev->button == bind_button );
}
+
bool
BindingProxy::button_press_handler (GdkEventButton *ev)
{
- if (controllable && (ev->state & bind_statemask) && ev->button == bind_button) {
+ if ( controllable && is_bind_action(ev) ) {
if (Controllable::StartLearning (controllable.get())) {
string prompt = _("operate controller now");
if (prompter == 0) {
diff --git a/libs/gtkmm2ext/gtkmm2ext/binding_proxy.h b/libs/gtkmm2ext/gtkmm2ext/binding_proxy.h
index d6e3140462..022a0cbcd9 100644
--- a/libs/gtkmm2ext/gtkmm2ext/binding_proxy.h
+++ b/libs/gtkmm2ext/gtkmm2ext/binding_proxy.h
@@ -41,8 +41,8 @@ class LIBGTKMM2EXT_API BindingProxy : public sigc::trackable
virtual ~BindingProxy();
void set_bind_button_state (guint button, guint statemask);
- void get_bind_button_state (guint &button, guint &statemask);
+ static bool is_bind_action (GdkEventButton *);
bool button_press_handler (GdkEventButton *);
boost::shared_ptr<PBD::Controllable> get_controllable() const { return controllable; }
@@ -51,8 +51,10 @@ class LIBGTKMM2EXT_API BindingProxy : public sigc::trackable
protected:
Gtkmm2ext::PopUp* prompter;
boost::shared_ptr<PBD::Controllable> controllable;
- guint bind_button;
- guint bind_statemask;
+
+ static guint bind_button;
+ static guint bind_statemask;
+
PBD::ScopedConnection learning_connection;
void learning_finished ();
bool prompter_hiding (GdkEventAny *);