-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Allow dragging a folder on the Welcome window to open a repository - Closes #468 and #247 #469
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Found a typo. |
If it's a typo you introduced, why not just fix it in this one as another commit? |
@hawkrives Done. I wasn't sure that new commit would become part of the pull request since I had already created the pull request. Thanks. |
if (self.isHighlighted) { | ||
NSBezierPath *path = [NSBezierPath bezierPathWithRoundedRect:dirtyRect xRadius:10 yRadius:10]; | ||
// systemBlueColor from https://developer.apple.com/design/human-interface-guidelines/macos/visual-design/color/ | ||
NSColor *higlightColor = [NSColor colorWithRed:27.0/255.0 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Typo in name, and also, perhaps better to use [NSColor highlightColor]
or one of its siblings to have the color change appropriately with dark mode/user preferences?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
controlAccentColor
should be used when available before falling back to systemBlueColor
. (systemBlueColor
requires 10.10; see also #534.)
@sdrpa I've recently taken over as temporary maintainer of GitUp. If I can get an overview of visual changes here and squash changes into a single commit, I'd love to start the discussion on merging this in. |
|
||
- (void)awakeFromNib { | ||
[super awakeFromNib]; | ||
[self registerForDraggedTypes:@[NSFilenamesPboardType]]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
On modern macOS, drag support should be registered either using one of the non-deprecated pasteboard types (post-10.14) or a UTI. Here, use @[ (__bridge id)kUTTypeFileURL ]
or NSURL.readableTypeIdentifiersForItemProvider
, whichever you prefer.
- (NSDragOperation)draggingEntered:(id <NSDraggingInfo>)sender { | ||
BOOL isDragOperationGeneric = (NSDragOperationGeneric & [sender draggingSourceOperationMask]) == NSDragOperationGeneric; | ||
NSPasteboard *pasteboard = [sender draggingPasteboard]; | ||
if (isDragOperationGeneric && [self directoryURLFromPasteboard:pasteboard]) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
On modern macOS, drag operations should be validated using the multi-contents support of -[NSPasteboard canReadObjectForClasses:options:]
.
Here, that would be:
[pasteboard canReadObjectForClasses:@[ NSURL.class ] options:@{
NSPasteboardURLReadingFileURLsOnlyKey: @YES,
NSPasteboardURLReadingContentsConformToTypesKey: @[
(__bridge id)kUTTypeDirectory
]
}]
|
||
- (BOOL)performDragOperation:(id <NSDraggingInfo>)sender { | ||
NSPasteboard *pasteboard = [sender draggingPasteboard]; | ||
NSURL *directoryURL = [self directoryURLFromPasteboard:pasteboard]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
On modern macOS, drag operations should be performed using the multi-contents support of -[NSPasteboard readObjectsForClasses:options:]
.
Here, that would be:
NSArray* urls = [pasteboard readObjectsForClasses:@[ NSURL.class ] options:@{
NSPasteboardURLReadingFileURLsOnlyKey: @YES,
NSPasteboardURLReadingContentsConformToTypesKey: @[
(__bridge id)kUTTypeDirectory
]
}]
[super drawRect:dirtyRect]; | ||
|
||
if (self.isHighlighted) { | ||
NSBezierPath *path = [NSBezierPath bezierPathWithRoundedRect:dirtyRect xRadius:10 yRadius:10]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
dirtyRect
can be called with subsections of self
. You probably want to still use self.bounds
.
if (self.isHighlighted) { | ||
NSBezierPath *path = [NSBezierPath bezierPathWithRoundedRect:dirtyRect xRadius:10 yRadius:10]; | ||
// systemBlueColor from https://developer.apple.com/design/human-interface-guidelines/macos/visual-design/color/ | ||
NSColor *higlightColor = [NSColor colorWithRed:27.0/255.0 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
controlAccentColor
should be used when available before falling back to systemBlueColor
. (systemBlueColor
requires 10.10; see also #534.)
Going to close this out as we need updates to Dark Mode at this point. If somebody makes the changes and wants to reopen, I'll gladly look over it again. |
No description provided.