bug-gnustep
[Top][All Lists]
Advanced

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

Re: GSDragView wrong position


From: Richard Frith-Macdonald
Subject: Re: GSDragView wrong position
Date: Fri, 01 Apr 2005 17:08:37 +0100

On 2005-04-01 13:24:33 +0100 Enrico Sersale <enrico@dtedu.net> wrote:

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

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.

I believe that's what they should be doing if they want the bottom left corner of the image to appear at the mouse location specified in the event triggering the drag operation.

 Now I should only add
the offset calculation.

I think this is only needed where the mouse has already been dragged and you are passing the image coordinates relative to the mouse-down event. If I understand it correctly, the offset is supposed to be used to adjust the position of the image to where it would have been if the image drag had started immediately on mouse down.

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.

I've changed NSColorPanel and NSImageView to center the image on the mouse position ... I hope that's the desired/correct behavior.

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...

Reading the documentation for -dragImageForRows:event:dragImageOffset: I saw that the image was supposed to be centered on the mouse pointer but adjusted by the offset returtned fropm that method. The code was not doing that at all, so I implemented that behavior as far as I understand it.

The thing I lack is tests/examples. Please could you give me some instructions as to how I can reproduce problems using GWorkspace and GNUMail. I've never done much with DnD in either one, and don't know what the expected/correct behavior is. I don't have any GNUstep apps running on MacOS-X/Cocoa for comparison either :-(






reply via email to

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