[Top][All Lists]

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

Re: GSDragView wrong position

From: Enrico Sersale
Subject: Re: GSDragView wrong position
Date: Fri, 01 Apr 2005 15:24:33 +0300

On 2005-04-01 12:19:37 +0300 Richard Frith-Macdonald <richard@brainstorm.co.uk> 

On 2005-04-01 02:28:52 +0100 Enrico Sersale <enrico@dtedu.net> wrote:

Visible in GWorkspace and GNUMail. (Probably in other places too, but here it's 4 am and I can't verify now). GNUMail runs natively on OS X so I must suppose that this is a bug.

I hope you are more awake now ... please could I have more information.
I've recently fixed several bugs in DnD and was hoping I had it working pretty much fully as documented at last (I guess that may not be the same thing as working exactly like MacOS-X ... but I hope it is). However, until now the mouse offset argument when starting a DnD session has been ignored completely, and as there is no experience using it, I'm not sure I've got it right ... but that's one possible place to look for changes in behavior.

Anyway ... If you could give me exact descriptions of where this appears wrong (and ideally the CVS version and the point in the GWorkspace/GNUMail source code that the DnD is initiated) I can make more of an attempt at understanding iwhat the issue might be.

I've looked at GWorkspace and dragging icons on the shelf.
The DnD here appears to be initiated in [FSNIcon(DraggingSource) startExternalDragOnEvent:] and this code appears to say that the bottom left corner of the image should be positioned at the current mouse location. Looking at it on my system, the visible icon image actually appears a few pixels above and to the right of the the mouse pointer ... if the image has a transparent border it could explain that small offset, if not ... I guess there is a bug there. Is that the problem you are referring to?

In this case you are right. All the GWorkspace icons use -locationInWindow: and 
-convertPoint:fromView: before starting the drag. Now I should only add the 
offset calculation.

Other classes as NSColorPanel, NSImageView, NSToolbarItem, etc. use NSZeroPoint 
as argument. In these cases the position is shifted up and right. This should 
be fixed.

But my doubt comes from NSTableView.
In -mouseDown:, NSTableView should calculate the position of the image using 
its -dragImageForRows:event:dragImageOffset: method; the third argument of this 
method is a pointer to a NSPoint that must be used after in dragImage:::::::. 
The standard implementation returns an 8x8 empty NSImage and ignores the 
NSPoint pointer (and -mouseDown: uses NSZeroPoint for the position and 
NSZeroSize for the offset).

Now, we have two classes that inherit from NSTableView: FSNListView in GW and 
ExtendedOutlineView in GNUMail; both these classes override 
-dragImageForRows:event:dragImageOffset: to return the right drag image; but 
both the classes ignore, as NSTableView does, the NSPoint.

The strange think is that, with this code, GNUMail runs perfectly on OS X...

Calculating the point in -dragImageForRows:event:dragImageOffset: and fixing 
-mouseDown: in NSTableView gets the right position but the doubt remains...

reply via email to

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