mirror of
https://github.com/fltk/fltk.git
synced 2026-05-28 20:06:18 +08:00
macOS: Avoid premature FL_RELEASE event at start of drag-n-drop - cont'd
This commit is contained in:
+17
-12
@@ -717,6 +717,8 @@ void Fl::remove_timeout(Fl_Timeout_Handler cb, void* data)
|
|||||||
#endif
|
#endif
|
||||||
#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_7
|
#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_7
|
||||||
- (NSDragOperation)draggingSession:(NSDraggingSession *)session sourceOperationMaskForDraggingContext:(NSDraggingContext)context;
|
- (NSDragOperation)draggingSession:(NSDraggingSession *)session sourceOperationMaskForDraggingContext:(NSDraggingContext)context;
|
||||||
|
- (void)draggingSession:(NSDraggingSession *)session
|
||||||
|
endedAtPoint:(NSPoint)screenPoint operation:(NSDragOperation)operation;
|
||||||
#endif
|
#endif
|
||||||
- (BOOL)did_view_resolution_change;
|
- (BOOL)did_view_resolution_change;
|
||||||
#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_14
|
#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_14
|
||||||
@@ -2700,17 +2702,6 @@ static FLTextInputContext* fltextinputcontext_instance = nil;
|
|||||||
}
|
}
|
||||||
fl_unlock_function();
|
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
|
- (NSDragOperation)draggingSourceOperationMaskForLocal:(BOOL)isLocal
|
||||||
{
|
{
|
||||||
return NSDragOperationGeneric;
|
return NSDragOperationGeneric;
|
||||||
@@ -2947,6 +2938,17 @@ static FLTextInputContext* fltextinputcontext_instance = nil;
|
|||||||
{
|
{
|
||||||
return NSDragOperationCopy;
|
return NSDragOperationCopy;
|
||||||
}
|
}
|
||||||
|
- (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 );
|
||||||
|
}
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@end
|
@end
|
||||||
@@ -4283,7 +4285,10 @@ static NSImage *defaultDragImage(int *pwidth, int *pheight)
|
|||||||
else {
|
else {
|
||||||
width = 16; height = 16;
|
width = 16; height = 16;
|
||||||
}
|
}
|
||||||
Fl_Offscreen off = fl_create_offscreen(width, height);
|
void *data = calloc(width * height, 4);
|
||||||
|
CGColorSpaceRef lut = CGColorSpaceCreateDeviceRGB();
|
||||||
|
CGContextRef off = CGBitmapContextCreate(data, width, height, 8, width*4, lut, kCGImageAlphaPremultipliedLast);
|
||||||
|
CGColorSpaceRelease(lut);
|
||||||
fl_begin_offscreen(off);
|
fl_begin_offscreen(off);
|
||||||
if (fl_mac_os_version >= version_threshold) {
|
if (fl_mac_os_version >= version_threshold) {
|
||||||
fl_font(FL_HELVETICA, 20);
|
fl_font(FL_HELVETICA, 20);
|
||||||
|
|||||||
Reference in New Issue
Block a user