fix problem with mouse tracking being off in submenus that are shifted to stay on screen

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/branches/testplant_1@29026 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Doug Simons 2009-11-16 22:51:14 +00:00
parent f3072e79af
commit 187090ff6a

View file

@ -43,6 +43,7 @@
#include "AppKit/NSImage.h"
#include "GNUstepGUI/GSTitleView.h"
#include "GNUstepGUI/GSDisplayServer.h"
#include <Foundation/Foundation.h>
@ -1353,6 +1354,14 @@ static NSMapTable *viewInfo = 0;
NSEventType type;
NSEventType end;
/* Find out whether the window is really where it thinks it is. */
/* In some cases, the back end adjusts its location without the window knowing it. */
GSDisplayServer *srv = GSServerForWindow(_window);
NSRect displayServerBounds = [srv windowbounds: [_window windowNumber]];
NSRect windowFrame = [_window frame];
NSPoint discrepancy = NSMakePoint(displayServerBounds.origin.x - windowFrame.origin.x,
displayServerBounds.origin.y - windowFrame.origin.y);
/*
* The original event is unused except to determine whether the method
* was invoked in response to a right or left mouse down.
@ -1408,6 +1417,9 @@ static NSMapTable *viewInfo = 0;
int index;
location = [_window mouseLocationOutsideOfEventStream];
location.x -= discrepancy.x;
location.y -= discrepancy.y;
index = [self indexOfItemAtPoint:
[self convertPoint: location fromView: nil]];