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

pull/119/merge
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 ) || if ( Fl::event_inside( output_connection_handle ) ||
Fl::event_inside( output_connection2_handle ) || Fl::event_inside( output_connection2_handle ) ||
Fl::event_inside( input_connection_handle ) ) Fl::event_inside( input_connection_handle ) )
{
fl_cursor( FL_CURSOR_HAND ); fl_cursor( FL_CURSOR_HAND );
}
else else
fl_cursor( FL_CURSOR_DEFAULT ); 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; return 1;
case FL_ENTER: case FL_ENTER:
case FL_DND_ENTER: case FL_DND_ENTER:

View File

@ -1081,7 +1081,8 @@ Track::handle ( int m )
case FL_DND_DRAG: case FL_DND_DRAG:
case FL_DND_RELEASE: case FL_DND_RELEASE:
case FL_PASTE: 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); return sequence()->handle(m);
default: default:
break; break;
@ -1122,6 +1123,7 @@ Track::handle ( int m )
if ( Fl::event_button1() && Fl::event_inside( ((Track_Header*)child(0))->color_box ) ) if ( Fl::event_button1() && Fl::event_inside( ((Track_Header*)child(0))->color_box ) )
{ {
dragging = this; dragging = this;
fl_cursor( FL_CURSOR_MOVE );
return 1; return 1;
} }
if ( Fl::event_button1() && Fl::event_inside( ((Track_Header*)child(0))->output_connector_handle ) ) 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_ENTER:
case FL_LEAVE: case FL_LEAVE:
case FL_MOVE: 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); 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; return 1;
case FL_DND_ENTER: case FL_DND_ENTER:
return 1; return 1;
case FL_DND_LEAVE: 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; receptive_to_drop = 0;
redraw(); redraw();
Fl::selection_owner(0); Fl::selection_owner(0);
} /* } */
return 1; return 1;
case FL_RELEASE: case FL_RELEASE:
if ( dragging == this ) if ( dragging == this )
{ {
dragging = NULL; dragging = NULL;
timeline->insert_track( this, timeline->event_inside() ); 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 ); return Fl_Group::handle( m );
break; break;
case FL_DND_RELEASE: case FL_DND_RELEASE:
@ -1253,6 +1272,9 @@ Track::handle ( int m )
} }
case FL_DRAG: case FL_DRAG:
{ {
if ( Fl::event_is_click() )
return 1;
if ( this != Fl::selection_owner() && if ( this != Fl::selection_owner() &&
Fl::event_inside( ((Track_Header*)child(0))->output_connector_handle ) ) 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 ) for ( unsigned int i = 0; i < output.size(); ++i )
{ {
char *s2; 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 ); s = (char*)realloc( s, strlen( s ) + strlen( s2 ) + 1 );
strcat( s, s2 ); strcat( s, s2 );
@ -1275,14 +1298,12 @@ Track::handle ( int m )
free( s ); free( s );
dragging = ((Track_Header*)child(0))->output_connector_handle;
Fl::dnd(); Fl::dnd();
}
return 1;
} return 1;
else
{
return 1;
}
} }
default: default:
return Fl_Group::handle( m ); return Fl_Group::handle( m );