macOS: Avoid premature FL_RELEASE event at start of drag-n-drop operation.

This fixes this issue mentioned in fltk.general :
https://www.fltk.org/newsgroups.php?s40623+gfltk.general+v40638+T
This commit is contained in:
ManoloFLTK 2021-05-27 08:11:25 +02:00
parent f9e5d29ae0
commit 40031b67f6

View File

@ -2700,6 +2700,17 @@ static FLTextInputContext* fltextinputcontext_instance = nil;
}
fl_unlock_function();
}
- (void)draggingSession:(NSDraggingSession *)session
endedAtPoint:(NSPoint)screenPoint
operation:(NSDragOperation)operation {
Fl_Widget *w = Fl::pushed();
if ( w ) {
int old_event = Fl::e_number;
w->handle(Fl::e_number = FL_RELEASE);
Fl::e_number = old_event;
Fl::pushed( 0 );
}
}
- (NSDragOperation)draggingSourceOperationMaskForLocal:(BOOL)isLocal
{
return NSDragOperationGeneric;
@ -4342,14 +4353,14 @@ int Fl_X::dnd(int use_selection)
[myview dragImage:image at:pt offset:offset // deprecated in 10.7
event:theEvent pasteboard:mypasteboard
source:myview slideBack:YES];
if ( w ) {
int old_event = Fl::e_number;
w->handle(Fl::e_number = FL_RELEASE);
Fl::e_number = old_event;
Fl::pushed( 0 );
}
}
CFRelease(text);
if ( w ) {
int old_event = Fl::e_number;
w->handle(Fl::e_number = FL_RELEASE);
Fl::e_number = old_event;
Fl::pushed( 0 );
}
[localPool release];
return true;
}