Add locking. Don't call handle_widget_change often while dragging.

This commit is contained in:
Jonathan Moore Liles 2008-05-25 14:11:28 -05:00
parent 9f567c6966
commit 9b38190211
2 changed files with 21 additions and 8 deletions

View File

@ -124,12 +124,12 @@ Sequence::draw ( void )
fl_clip_box( x(), y(), w(), h(), X, Y, W, H );
if ( Sequence_Widget::pushed() && Sequence_Widget::pushed()->sequence() == this )
{
/* make sure the Sequence_Widget::pushed widget is above all others */
remove( Sequence_Widget::pushed() );
add( Sequence_Widget::pushed() );
}
/* if ( Sequence_Widget::pushed() && Sequence_Widget::pushed()->sequence() == this ) */
/* { */
/* /\* make sure the Sequence_Widget::pushed widget is above all others *\/ */
/* remove( Sequence_Widget::pushed() ); */
/* add( Sequence_Widget::pushed() ); */
/* } */
// printf( "track::draw %d,%d %dx%d\n", X,Y,W,H );
@ -149,8 +149,12 @@ Sequence::draw ( void )
void
Sequence::remove ( Sequence_Widget *r )
{
timeline->wrlock();
_widgets.remove( r );
timeline->unlock();
handle_widget_change( r->start(), r->length() );
}
@ -209,11 +213,15 @@ Sequence::add ( Sequence_Widget *r )
// r->track()->redraw();
}
timeline->wrlock();
r->sequence( this );
_widgets.push_back( r );
sort();
timeline->unlock();
handle_widget_change( r->start(), r->length() );
}

View File

@ -88,7 +88,12 @@ void
Sequence_Widget::begin_drag ( const Drag &d )
{
_drag = new Drag( d );
timeline->rdlock();
_r = new Range( _range );
timeline->unlock();
}
void
@ -106,6 +111,8 @@ Sequence_Widget::end_drag ( void )
delete _drag;
_drag = NULL;
sequence()->handle_widget_change( _r->start, _r->length );
}
/** set position of widget on the timeline. */
@ -313,8 +320,6 @@ Sequence_Widget::handle ( int m )
_log.release();
}
sequence()->handle_widget_change( _r->start, _r->length );
fl_cursor( FL_CURSOR_HAND );
return 1;