Skip to content

Commit b47a5ee

Browse files
authored
Merge pull request #3066 from quicksilver/closeWindowOnDrop
Close window on drop
2 parents 2d8ade0 + 7873c8a commit b47a5ee

4 files changed

Lines changed: 36 additions & 4 deletions

File tree

Quicksilver/Code-QuickStepInterface/QSObjectView.m

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -237,11 +237,16 @@ - (NSDragOperation) draggingSourceOperationMaskForLocal:(BOOL)isLocal {
237237
else return ([[NSApp currentEvent] modifierFlags] & NSEventModifierFlagCommand) ? NSDragOperationNone : NSDragOperationEvery;
238238
}
239239

240-
- (void)draggedImage:(NSImage *)anImage endedAt:(NSPoint)aPoint operation:(NSDragOperation)operation {
240+
- (void)draggingSession:(NSDraggingSession *)session endedAtPoint:(NSPoint)screenPoint operation:(NSDragOperation)operation {
241241
performingDrag = NO;
242-
// NSLog(@"ended at %f %f %d", aPoint.x, aPoint.y, operation);
243-
// if (operation == NSDragOperationNone) NSShowAnimationEffect(NSAnimationEffectDisappearingItemDefault, aPoint, NSZeroSize, nil, nil, nil);
242+
// NSLog(@"ended at %f %f %d", screenPoint.x, screenPoint.y, operation);
243+
// if (operation == NSDragOperationNone) NSShowAnimationEffect(NSAnimationEffectDisappearingItemDefault, screenPoint, NSZeroSize, nil, nil, nil);
244244
// if (operation == NSDragOperationMove) [self removeFromSuperview];
245+
246+
// Check if drag was successful (not NSDragOperationNone) and close interface if preference is set
247+
if (operation != NSDragOperationNone && [[NSUserDefaults standardUserDefaults] boolForKey:@"QSCloseInterfaceOnSuccessfulDrop"]) {
248+
[[self controller] hideMainWindow:self];
249+
}
245250
}
246251

247252
//Dragging

Quicksilver/Localized/en.lproj/QSAdvancedPrefPane.strings

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,3 +26,5 @@
2626

2727
"Double Delete Clears Object:title" = "Pressing the Delete key clears the whole search string";
2828
"QSHistoryMaxLength:title" = "Number of items in Quicksilver’s history";
29+
30+
"QSCloseInterfaceOnSuccessfulDrop:title" = "Close the interface after a successful drag and drop";

Quicksilver/Quicksilver.xcodeproj/project.pbxproj

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2205,7 +2205,7 @@
22052205
E18001D007B2BBB800010DB0 /* QSCatalogPrefPane.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = QSCatalogPrefPane.h; sourceTree = "<group>"; usesTabs = 1; };
22062206
E18001D107B2BBB800010DB0 /* QSCatalogPrefPane.m */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.objc; path = QSCatalogPrefPane.m; sourceTree = "<group>"; usesTabs = 1; };
22072207
E18001D407B2BBB800010DB0 /* QSController.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = QSController.h; sourceTree = "<group>"; usesTabs = 0; };
2208-
E18001D507B2BBB800010DB0 /* QSController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = QSController.m; sourceTree = "<group>"; usesTabs = 1; };
2208+
E18001D507B2BBB800010DB0 /* QSController.m */ = {isa = PBXFileReference; fileEncoding = 4; indentWidth = 2; lastKnownFileType = sourcecode.c.objc; path = QSController.m; sourceTree = "<group>"; usesTabs = 0; };
22092209
E18001DA07B2BBB800010DB0 /* QSGetURLScriptCommand.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = QSGetURLScriptCommand.h; sourceTree = "<group>"; usesTabs = 1; };
22102210
E18001DB07B2BBB800010DB0 /* QSGetURLScriptCommand.m */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.objc; path = QSGetURLScriptCommand.m; sourceTree = "<group>"; usesTabs = 1; };
22112211
E18001DC07B2BBB800010DB0 /* QSHelpersPrefPane.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = QSHelpersPrefPane.h; sourceTree = "<group>"; usesTabs = 1; };
@@ -4245,6 +4245,7 @@
42454245
isa = PBXNativeTarget;
42464246
buildConfigurationList = 7F6B3E68085CE68E000735A8 /* Build configuration list for PBXNativeTarget "Quicksilver" */;
42474247
buildPhases = (
4248+
66CAE627153EF9AD0021BC65 /* Check Code Signing Certificate */,
42484249
8D1107270486CEB800E47090 /* Headers */,
42494250
8D1107290486CEB800E47090 /* Resources */,
42504251
E1C3BE5106EA0AC500B848D6 /* Copy Plists */,
@@ -4863,6 +4864,20 @@
48634864
shellPath = /bin/sh;
48644865
shellScript = "# Intentionally blank -- only purpose is to tell XCode about the existence of\n# `Configuration/Quicksilver.pch`, copied in the step above, for automatic\n# dependency resolution. Without this (or something like it), one gets a race\n# condition with a lot of `/tmp/QS/Configuration/Quicksilver.pch: file not found`\n# type errors the first time XCode builds, which mysteriously resolve upon a\n# second build.\n#\n# Confirmed working alternatives to this hack:\n# - remove the `Copy Files` step above and use `cp -r` here instead\n# - Add a second (redundant) `Copy Files` step that explicitly (re-)copies `Quicksilver.pch`\n";
48654866
};
4867+
66CAE627153EF9AD0021BC65 /* Check Code Signing Certificate */ = {
4868+
isa = PBXShellScriptBuildPhase;
4869+
buildActionMask = 2147483647;
4870+
files = (
4871+
);
4872+
inputPaths = (
4873+
);
4874+
name = "Check Code Signing Certificate";
4875+
outputPaths = (
4876+
);
4877+
runOnlyForDeploymentPostprocessing = 0;
4878+
shellPath = /bin/sh;
4879+
shellScript = "# Check if Local Self-Signed certificate exists, fail if not found\n\nset -euf\n\n# Skip this check if running on GitHub CI\nif [ \"${CI:-}\" = \"true\" ] && [ \"${GITHUB_ACTIONS:-}\" = \"true\" ]; then\n echo \"Running on GitHub CI - skipping certificate check\"\n exit 0\nfi\n\n# Check if the Local Self-Signed certificate exists in the keychain\nif ! security find-identity -v -p codesigning | grep -q \"Local Self-Signed\"; then\n echo \"ERROR: Local Self-Signed certificate not found!\"\n echo \"Please run the following command to set up code signing:\"\n echo \" ${SRCROOT}/Tools/codesign/setup_cert.sh\"\n echo \"\"\n echo \"This will create a self-signed certificate for local development.\"\n exit 1\nelse\n echo \"Local Self-Signed certificate found.\"\nfi\n";
4880+
};
48664881
66CAE628153EF9AE0021BC65 /* Adjust Version-String */ = {
48674882
isa = PBXShellScriptBuildPhase;
48684883
buildActionMask = 2147483647;

Quicksilver/Resources/DefaultsMap.plist

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -132,5 +132,15 @@
132132
<key>type</key>
133133
<string>text</string>
134134
</dict>
135+
<dict>
136+
<key>category</key>
137+
<string>Command</string>
138+
<key>default</key>
139+
<string>QSCloseInterfaceOnSuccessfulDrop</string>
140+
<key>title</key>
141+
<string>Close the interface after a successful drag and drop</string>
142+
<key>type</key>
143+
<string>checkbox</string>
144+
</dict>
135145
</array>
136146
</plist>

0 commit comments

Comments
 (0)