While shifting a menu on screen that is partially off screen, correctly

handle the cases where the menu is off screen on the top and the left
side of the screen, respectively. This fixes bug #31415.


git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@31038 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Wolfgang Lux 2010-07-26 19:16:18 +00:00
parent 660c9414bb
commit 85c794ab22
3 changed files with 28 additions and 8 deletions

View file

@ -1473,14 +1473,15 @@ static NSMapTable *viewInfo = 0;
if ([_attachedMenu isPartlyOffScreen])
{
NSPoint pointerLoc = [_window convertBaseToScreen: location];
NSRect screenFrame = [[_window screen] visibleFrame];
/*
* The +/-1 in the y - direction is because the flipping
* between X-coordinates and GNUstep coordinates let the
* GNUstep screen coordinates start with 1.
*/
if (pointerLoc.x == 0 || pointerLoc.y == 1
|| pointerLoc.x == [[_window screen] frame].size.width - 1
|| pointerLoc.y == [[_window screen] frame].size.height)
|| pointerLoc.x == screenFrame.size.width - 1
|| pointerLoc.y == screenFrame.size.height)
[_attachedMenu shiftOnScreen];
}
@ -1520,7 +1521,7 @@ static NSMapTable *viewInfo = 0;
= [_window convertBaseToScreen: location];
/*
* 3a - Check if moved into one of the ancester menus.
* 3a - Check if moved into one of the ancestor menus.
* This is tricky, there are a few possibilities:
* We are a transient attached menu of a
* non-transient menu