mirror of
https://github.com/kovidgoyal/kitty
synced 2026-06-08 14:18:26 +02:00
Merge branch 'fix-drag-tab' of https://github.com/zzhaolei/kitty
This commit is contained in:
@@ -4209,11 +4209,22 @@ set_image_for_dragging_item(NSDraggingItem *draggingItem, const GLFWimage *thumb
|
||||
if (!_glfw.ns.drag_image) { [imageRep release]; return ENOMEM; }
|
||||
[_glfw.ns.drag_image addRepresentation:imageRep];
|
||||
[imageRep release];
|
||||
if (!_glfw.ns.drag_session) {
|
||||
_GLFWwindow *glfw_window = _glfwWindowForId(_glfw.drag.window_id);
|
||||
if (glfw_window && glfw_window->ns.view) {
|
||||
NSRect contentRect = [glfw_window->ns.view frame];
|
||||
NSPoint cursor = NSMakePoint(glfw_window->virtualCursorPosX,
|
||||
contentRect.size.height - glfw_window->virtualCursorPosY);
|
||||
[draggingItem setDraggingFrame:NSMakeRect(cursor.x, cursor.y, pointSize.width, pointSize.height) contents:nil];
|
||||
} else {
|
||||
[draggingItem setDraggingFrame:NSMakeRect(0, 0, pointSize.width, pointSize.height) contents:nil];
|
||||
}
|
||||
}
|
||||
[draggingItem setImageComponentsProvider:^NSArray<NSDraggingImageComponent *> * _Nonnull{
|
||||
NSDraggingImageComponent *icon = [NSDraggingImageComponent draggingImageComponentWithKey:NSDraggingImageComponentIconKey];
|
||||
NSImage *image = _glfw.ns.drag_image;
|
||||
icon.contents = image;
|
||||
icon.frame = NSMakeRect(pointSize.width, pointSize.height, pointSize.width, pointSize.height);
|
||||
icon.frame = NSMakeRect(0, 0, pointSize.width, pointSize.height);
|
||||
return @[icon];
|
||||
}];
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user