Mixer,Timeline: Fix port connection drag and drop between applications.

This commit is contained in:
Jonathan Moore Liles 2020-11-01 22:29:33 -08:00
parent da78618e5b
commit 6bde5017f5
2 changed files with 38 additions and 18 deletions

View File

@ -614,13 +614,12 @@ JACK_Module::handle ( int m )
if ( Fl::event_inside( output_connection_handle ) ||
Fl::event_inside( output_connection2_handle ) ||
Fl::event_inside( input_connection_handle ) )
{
fl_cursor( FL_CURSOR_HAND );
}
else
fl_cursor( FL_CURSOR_DEFAULT );
Module::handle(m);
/* This calls Fl_Group::handle() which somehow prevent DND FL_PASTE event from being delivered later */
/* Module::handle(m); */
return 1;
case FL_ENTER:
case FL_DND_ENTER:

View File

@ -1081,7 +1081,8 @@ Track::handle ( int m )
case FL_DND_DRAG:
case FL_DND_RELEASE:
case FL_PASTE:
if ( Fl::event_x() > Track::width() )
if ( dragging != ((Track_Header*)child(0))->output_connector_handle &&
Fl::event_x() > Track::width() )
return sequence()->handle(m);
default:
break;
@ -1122,6 +1123,7 @@ Track::handle ( int m )
if ( Fl::event_button1() && Fl::event_inside( ((Track_Header*)child(0))->color_box ) )
{
dragging = this;
fl_cursor( FL_CURSOR_MOVE );
return 1;
}
if ( Fl::event_button1() && Fl::event_inside( ((Track_Header*)child(0))->output_connector_handle ) )
@ -1144,29 +1146,46 @@ Track::handle ( int m )
case FL_ENTER:
case FL_LEAVE:
case FL_MOVE:
if ( Fl::event_x() >= Track::width() )
if ( dragging != ((Track_Header*)child(0))->output_connector_handle &&
Fl::event_x() >= Track::width() )
{
return Fl_Group::handle(m);
}
else
{
if ( Fl::event_inside( ((Track_Header*)child(0))->output_connector_handle ) ||
Fl::event_inside( ((Track_Header*)child(0))->input_connector_handle ) ||
Fl::event_inside( ((Track_Header*)child(0))->color_box ) )
fl_cursor( FL_CURSOR_HAND );
}
return 1;
case FL_DND_ENTER:
return 1;
case FL_DND_LEAVE:
if ( ! Fl::event_inside(this) && this == receptive_to_drop )
{
/* if ( ! Fl::event_inside(this) )// && this == receptive_to_drop ) */
/* { */
receptive_to_drop = 0;
redraw();
Fl::selection_owner(0);
}
/* } */
return 1;
case FL_RELEASE:
if ( dragging == this )
{
dragging = NULL;
timeline->insert_track( this, timeline->event_inside() );
return 1;
fl_cursor( FL_CURSOR_DEFAULT );
return 1;
}
else if ( dragging == ((Track_Header*)child(0))->output_connector_handle )
{
dragging = NULL;
fl_cursor( FL_CURSOR_DEFAULT );
return 1;
}
return Fl_Group::handle( m );
break;
case FL_DND_RELEASE:
@ -1253,6 +1272,9 @@ Track::handle ( int m )
}
case FL_DRAG:
{
if ( Fl::event_is_click() )
return 1;
if ( this != Fl::selection_owner() &&
Fl::event_inside( ((Track_Header*)child(0))->output_connector_handle ) )
{
@ -1262,8 +1284,9 @@ Track::handle ( int m )
for ( unsigned int i = 0; i < output.size(); ++i )
{
char *s2;
asprintf(&s2, "jack.port://%s:%s\r\n", instance_name, output[i].name() );
asprintf(&s2, "jack.port://%s\r\n",
output[i].jack_name() );
s = (char*)realloc( s, strlen( s ) + strlen( s2 ) + 1 );
strcat( s, s2 );
@ -1275,14 +1298,12 @@ Track::handle ( int m )
free( s );
dragging = ((Track_Header*)child(0))->output_connector_handle;
Fl::dnd();
return 1;
}
else
{
return 1;
}
}
return 1;
}
default:
return Fl_Group::handle( m );