gnustep-dev
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: GWorkspace Dragndrop Question


From: Enrico Sersale
Subject: Re: GWorkspace Dragndrop Question
Date: Mon, 23 Jun 2003 17:34:02 +0300

On 2003-06-23 16:32:18 +0300 Fred Kiefer <address@hidden> wrote:

Hi Chad,

what you describe is an inconsistency between GWorkspace and the GNUstep GUI. 
And as you did find out GUI in this case is right, as it does the same as 
Cocoa. They both expect the copy/paste of NSFilenamesPboardType to work with 
the propertylist interface of the pastboard (which internally uses an 
NSSerializer), wheras GWorkspace uses an NSArchiver for the same task. The 
difference can be seen in the method on [NSView 
dragFile:fromRect:slideBack:event:] in GUI and the methods on IconViewsIcon in 
GWorkspace. Gworkspace will need some corrections here.

Ok, I can correct this in ten minutes :-) But, due of my bad English, I don't 
understand well if I can pass an array to -setPropertyList:forType:. GWorkspace 
uses only arrays, even with a single file.

I am also not sure if the GNUstep implementation is fully correct, as a single 
filename may be set here, where I would always expect an array of filenames. 
But than again, I did write this code some time ago, so it may be wrong. It 
looks like this is closely related with NSImage also only expecting one file 
name in the pasteboard. Both should be corrected.

Fred

address@hidden wrote:
Ok, I think I got it...

GNUstep doest like to use:
NSArray* files = [pasteboard propertyListForType:NSFilenamesPboardType],

(but Cocoa does)

Instead I used a :

NSData* pbData = [pasteboard dataForType:NSFilenamesPboardType]
and then did a
NSArray* files = [NSUnarchiver unarchiveObjectWithData: pbData]

to get the filenames and it seems to work fine...


Now I wonder if this will work in Cocoa...  This method of doing this seems to 
be depreciated in Cocoa.

Chad


On Saturday, June 21, 2003, at 11:19  PM, address@hidden wrote:

Hello Enrico,

I'm making a pure OpenStep Dock.app, in both Cocoa & GNUstep.  But I'm having a 
problem with drag events from GWorkspace.

When my app is running in OS X, I can retrieve the filenames being dragged (we 
both know how that is done) from the Finder with no problem at all.

However in GNUstep, when I'm getting doing my draggingUpdated and looking for 
what files GWorkspace is passing I can't get a valid NSArray of NSStrings from 
[pasteboard propertyListForType: NSFilenamesPboardType, I get a nil.

Before I do that I do check to see if you are passing a NSFilenamesPboardType and indeed 
you are.  However, when (Gnustep version) NSProperty tries to deserialize it it chokes 
and return nil.  Gnustep consoles out a "Bad serialized data"

Any idea why this is happening?  I imagine I am writing the first app that tries to 
accept dragged files from GWorkspace so maybe you are doing something odd in your 
D&D, or maybe this is a gnustep bug?  I would greatly appreciate it if you 
could check this out on your end.  I'm gonna take a stab at the GWorkspace sources 
myself but you know them way better than I do, of course, so you may already be 
aware of what type of problem is going on.

I'm also gonna post this in gnustep-dev in case it is a gnustep bug that 
somewhere there can shed some light on.



_______________________________________________
Gnustep-dev mailing list
address@hidden
http://mail.gnu.org/mailman/listinfo/gnustep-dev







reply via email to

[Prev in Thread] Current Thread [Next in Thread]