From 9790201fd8ba324f30c30415466ad53fb399bad3 Mon Sep 17 00:00:00 2001 From: Jonathan Moore Liles Date: Sat, 7 Jun 2014 16:43:39 -0700 Subject: [PATCH] Timeline: Fix bug where opening context menu on a region is equivalent to initiating a drag on that region. Closes #126 --- timeline/src/Audio_Region.C | 3 +++ timeline/src/Sequence.C | 33 ++++++++++++++++++++------------- timeline/src/Track.C | 2 +- 3 files changed, 24 insertions(+), 14 deletions(-) diff --git a/timeline/src/Audio_Region.C b/timeline/src/Audio_Region.C index 4ce3633..15968bd 100644 --- a/timeline/src/Audio_Region.C +++ b/timeline/src/Audio_Region.C @@ -841,6 +841,9 @@ Audio_Region::handle ( int m ) } case FL_DRAG: + if ( Fl::event_is_click() ) + return 1; + if ( ! _drag ) { begin_drag( Drag( X, Y, x_to_offset( X ) ) ); diff --git a/timeline/src/Sequence.C b/timeline/src/Sequence.C index 7d8ed2c..28eaba2 100644 --- a/timeline/src/Sequence.C +++ b/timeline/src/Sequence.C @@ -321,6 +321,10 @@ Sequence::handle ( int m ) /* if ( m != FL_NO_EVENT ) */ /* DMESSAGE( "%s", event_name( m ) ); */ +// if ( m == FL_RELEASE ) + if ( ! Fl::pushed() ) + Sequence_Widget::pushed( NULL ); + switch ( m ) { case FL_KEYBOARD: @@ -398,14 +402,16 @@ Sequence::handle ( int m ) if ( Sequence_Widget::pushed()->sequence()->class_name() == class_name() ) { /* accept objects dragged from other sequences of this type */ - - timeline->sequence_lock.wrlock(); - add( Sequence_Widget::pushed() ); - timeline->sequence_lock.unlock(); - - damage( FL_DAMAGE_USER1 ); - - fl_cursor( FL_CURSOR_MOVE ); + if ( Sequence_Widget::pushed()->sequence() != this ) + { + timeline->sequence_lock.wrlock(); + add( Sequence_Widget::pushed() ); + timeline->sequence_lock.unlock(); + + damage( FL_DAMAGE_USER1 ); + + fl_cursor( FL_CURSOR_MOVE ); + } } else fl_cursor( FL_CURSOR_DEFAULT ); @@ -446,9 +452,9 @@ Sequence::handle ( int m ) if ( r ) r->handle( FL_ENTER ); } - - return 1; } + + return 1; } default: { @@ -462,6 +468,9 @@ Sequence::handle ( int m ) /* if ( this == Fl::focus() ) */ /* DMESSAGE( "Sequence widget = %p", r ); */ + if ( m == FL_RELEASE ) + Sequence_Widget::pushed( NULL ); + if ( r ) { int retval = r->dispatch( m ); @@ -482,8 +491,6 @@ Sequence::handle ( int m ) r->handle( FL_FOCUS ); } - else if ( m == FL_RELEASE ) - Sequence_Widget::pushed( NULL ); } if ( _delete_queue.size() ) @@ -508,7 +515,7 @@ Sequence::handle ( int m ) timeline->sequence_lock.unlock(); } - Loggable::block_end(); + Loggable::block_end(); } if ( m == FL_PUSH ) diff --git a/timeline/src/Track.C b/timeline/src/Track.C index b416407..128ec78 100644 --- a/timeline/src/Track.C +++ b/timeline/src/Track.C @@ -1137,7 +1137,7 @@ Track::handle ( int m ) timeline->insert_track( this, timeline->event_inside() ); return 1; } - return 0; + return Fl_Group::handle( m ); break; case FL_DND_RELEASE: receptive_to_drop = 0;