Merge branch 'macos-stable-dnd' into 'main'

macos: Drag and drop should not freeze applications

See merge request GNOME/gtk!5291
This commit is contained in:
Matthias Clasen
2023-01-09 11:52:50 +00:00
3 changed files with 17 additions and 5 deletions

View File

@@ -576,6 +576,8 @@ typedef NSString *CALayerContentsGravity;
initialResizeLocation = convert_nspoint_to_screen (self, [self mouseLocationOutsideOfEventStream]);
}
// NSDraggingDestination protocol
-(NSDragOperation)draggingEntered:(id <NSDraggingInfo>)sender
{
NSPoint location = [sender draggingLocation];
@@ -665,9 +667,9 @@ typedef NSString *CALayerContentsGravity;
return NO;
}
-(void)draggedImage:(NSImage *)anImage endedAt:(NSPoint)aPoint operation:(NSDragOperation)operation
{
}
// NSDraggingSource protocol
// ...
// end
-(void)setStyleMask:(NSWindowStyleMask)styleMask
{

View File

@@ -218,6 +218,12 @@ drag_ungrab (GdkMacosDrag *self)
g_assert (GDK_IS_MACOS_DRAG (self));
if (self->drag_seat)
{
gdk_seat_ungrab (self->drag_seat);
g_clear_object (&self->drag_seat);
}
display = gdk_drag_get_display (GDK_DRAG (self));
_gdk_macos_display_break_all_grabs (GDK_MACOS_DISPLAY (display), GDK_CURRENT_TIME);
}
@@ -536,7 +542,11 @@ gdk_macos_drag_finalize (GObject *object)
GdkMacosDragSurface *drag_surface = g_steal_pointer (&self->drag_surface);
g_clear_object (&self->cursor);
g_clear_object (&self->drag_seat);
if (self->drag_seat)
{
gdk_seat_ungrab (self->drag_seat);
g_clear_object (&self->drag_seat);
}
G_OBJECT_CLASS (gdk_macos_drag_parent_class)->finalize (object);

View File

@@ -431,7 +431,7 @@ gdk_macos_surface_drag_begin (GdkSurface *surface,
_gdk_macos_surface_get_root_coords (GDK_MACOS_SURFACE (surface), &sx, &sy);
drag_surface = _gdk_macos_surface_new (GDK_MACOS_DISPLAY (surface->display),
GDK_SURFACE_DRAG,
surface,
NULL,
sx, sy, 1, 1);
drag = g_object_new (GDK_TYPE_MACOS_DRAG,
"drag-surface", drag_surface,