From 5af9afdd8d5655a92a02381f765976b5926fab0b Mon Sep 17 00:00:00 2001 From: Jonathan Moore Liles Date: Mon, 22 Apr 2013 21:54:45 -0700 Subject: [PATCH] Mixer: Fix some button handling. --- FL/Fl_Packscroller.H | 29 ++++++++++------------------- mixer/src/Mixer_Strip.C | 1 + mixer/src/Module.C | 31 ++++++++++++++++++------------- 3 files changed, 29 insertions(+), 32 deletions(-) diff --git a/FL/Fl_Packscroller.H b/FL/Fl_Packscroller.H index 7e67a5f..0661b48 100644 --- a/FL/Fl_Packscroller.H +++ b/FL/Fl_Packscroller.H @@ -155,13 +155,9 @@ public: virtual int handle ( int m ) { - static int _button; - switch ( m ) { case FL_PUSH: - _button = Fl::event_button(); - if ( top_sb_visible() && Fl::event_inside( x(), y(), w(), sbh ) ) { @@ -175,22 +171,17 @@ public: break; case FL_RELEASE: { - int b = _button; - _button = 0; - if ( b == 1 ) + if ( top_sb_visible() && + Fl::event_inside( x(), y(), w(), sbh ) ) { - if ( top_sb_visible() && - Fl::event_inside( x(), y(), w(), sbh ) ) - { - yposition( yposition() + ( h() / 4 ) ); - return 1; - } - else if ( bottom_sb_visible() && - Fl::event_inside( x(), y() + h() - sbh, w(), sbh ) ) - { - yposition( yposition() - (h() / 4 ) ); - return 1; - } + yposition( yposition() + ( h() / 4 ) ); + return 1; + } + else if ( bottom_sb_visible() && + Fl::event_inside( x(), y() + h() - sbh, w(), sbh ) ) + { + yposition( yposition() - (h() / 4 ) ); + return 1; } break; } diff --git a/mixer/src/Mixer_Strip.C b/mixer/src/Mixer_Strip.C index 4ef75f3..b9261bb 100644 --- a/mixer/src/Mixer_Strip.C +++ b/mixer/src/Mixer_Strip.C @@ -726,6 +726,7 @@ Mixer_Strip::handle ( int m ) } case FL_PUSH: _button = Fl::event_button(); + break; case FL_RELEASE: { int b = _button; diff --git a/mixer/src/Module.C b/mixer/src/Module.C index 4f21afc..e9de8df 100644 --- a/mixer/src/Module.C +++ b/mixer/src/Module.C @@ -778,7 +778,9 @@ Module::handle_chain_name_changed ( ) int Module::handle ( int m ) { - static int _button = 0; + static unsigned long _event_state = 0; + + unsigned long evstate = Fl::event_state(); if ( Fl_Group::handle( m ) ) return 1; @@ -797,33 +799,36 @@ Module::handle ( int m ) } case FL_PUSH: take_focus(); - _button = Fl::event_button(); + _event_state = evstate; return 1; // if ( Fl::visible_focus() && handle( FL_FOCUS )) Fl::focus(this); case FL_DRAG: - _button = Fl::event_button(); + _event_state = evstate; return 1; case FL_RELEASE: { - int b = _button; - _button = 0; - DMESSAGE( "Button %i", b); - if ( 3 == b ) - { - menu_popup( &menu() ); + unsigned long e = _event_state; + _event_state = 0; + + if ( ! Fl::event_inside( this ) ) return 1; - } - else if ( 1 == b ) + + if ( e & FL_BUTTON1 ) { command_open_parameter_editor(); return 1; } - else if ( 3 == b && Fl::event_ctrl() ) + else if ( e & FL_BUTTON3 && e & FL_CTRL ) { command_remove(); return 1; } - else if ( 2 == b ) + else if ( e & FL_BUTTON3 ) + { + menu_popup( &menu() ); + return 1; + } + else if ( e & FL_BUTTON2 ) { if ( !bypassable() ) {