fix "can't drag and drop buttons when customizing toolbars", patch by Stan Shebs. b=358446 r=josh sr=pav

This commit is contained in:
joshmoz@gmail.com 2007-05-28 22:06:12 -07:00
parent ea2a949931
commit 5aa5625012
3 changed files with 15 additions and 1 deletions

View File

@ -1819,6 +1819,7 @@ NSEvent* globalDragEvent = nil;
[self registerForDraggedTypes:[NSArray arrayWithObjects:NSFilenamesPboardType,
NSStringPboardType,
NSURLPboardType,
kWildcardPboardType,
nil]];
return self;

View File

@ -43,6 +43,8 @@
#include <Cocoa/Cocoa.h>
extern NSString* const kWildcardPboardType;
class nsILocalFile;
class nsIDOMDragEvent;

View File

@ -69,6 +69,8 @@ extern NSPasteboard* globalDragPboard;
extern NSView* globalDragView;
extern NSEvent* globalDragEvent;
NSString* const kWildcardPboardType = @"MozillaWildcard";
NS_IMPL_ADDREF_INHERITED(nsDragService, nsBaseDragService)
NS_IMPL_RELEASE_INHERITED(nsDragService, nsBaseDragService)
NS_IMPL_QUERY_INTERFACE2(nsDragService, nsIDragService, nsIDragSession)
@ -224,8 +226,17 @@ static nsresult SetUpDragClipboard(nsISupportsArray* aTransferableArray)
id currentValue = [pasteboardOutputDict valueForKey:currentKey];
if (currentKey == NSStringPboardType)
[generalPBoard setString:currentValue forType:currentKey];
else
else {
[generalPBoard setData:currentValue forType:currentKey];
// Record miscellaneous types of data a second time, under a
// generic type that is always registered with Cocoa as
// draggable. This allows types dynamically synthesized from
// JS to work; if in the future several different types of
// drag data need to be distinguished, it will be the
// responsibility of higher-level drag code to detect the
// situation (which it would normally have to do anyway.)
[generalPBoard setData:nil forType:kWildcardPboardType];
}
}
}