|
|
commit 40031b67f69997db702bb84e8373d5f4ab958b3c
Author: ManoloFLTK <41016272+ManoloFLTK@users.noreply.github.com>
AuthorDate: Thu May 27 08:11:25 2021 +0200
Commit: ManoloFLTK <41016272+ManoloFLTK@users.noreply.github.com>
CommitDate: Thu May 27 08:11:25 2021 +0200
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
src/Fl_cocoa.mm | 23 +++++++++++++++++------
1 file changed, 17 insertions(+), 6 deletions(-)
diff --git src/Fl_cocoa.mm src/Fl_cocoa.mm
index c9ee7d7..fd2c50b 100644
--- src/Fl_cocoa.mm
+++ src/Fl_cocoa.mm
@@ -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;
}
[ Direct Link to Message ] | |
|
| |