git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@6216 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Richard Frith-MacDonald 2000-03-08 16:45:44 +00:00
parent 6956d4e182
commit bb0bd00009
3 changed files with 20 additions and 65 deletions

View file

@ -1,3 +1,12 @@
Wed Mar 08 115:4500 2000 Richard Frith-Macdonald <richard@brainstorm.co.uk>
Removed a fixup that should no longer be needed now that the
coordinate stuff is fixed - NB you need to update your copy of
WindowMaker to the latest CVS code because that contains some
coordinate handling bug fixes that we need.
* Source/NSPopPupButton.m: Removed workaround for bad coordinates.
* Source/NSPopPupButtonCell.m: ditto.
Wed Mar 08 13:15:00 2000 Richard Frith-Macdonald <richard@brainstorm.co.uk>
* Source/NSWindow.m: Final (I hope) coordinate handling fixes to

View file

@ -317,18 +317,8 @@ Class _nspopupbuttonCellClass = 0;
[_cell attachPopUpWithFrame: _bounds
inView: self];
{
// Hack, function in NSPopUpButtonCell
extern NSPoint
_convertBaseToScreen_with_fix (NSRect frame, NSWindow *window,
NSPoint point);
p = [[mr window]
convertScreenToBase:
_convertBaseToScreen_with_fix ([self convertRect:_bounds
toView: nil], _window,
[theEvent locationInWindow])];
}
p = [_window convertBaseToScreen: [theEvent locationInWindow]];
p = [[mr window] convertScreenToBase: p];
// Process events; we start menu events processing by converting
// this event to the menu window, and sending it there.

View file

@ -46,49 +46,6 @@
}
@end
/* Same as [NSWindow -convertBaseToScreen:] with the difference
that detects and fixes at run time bugs in the window frame management */
/* frame is a frame where the mouse is supposed to be.
If the mouse is out of that frame, it means the window code has got the
window origin wrong -- presumably by a decoration height.
Looking if mouse is upper or lower than the given frame we determine
if decoration window size need to be added or subtracted. */
NSPoint
_convertBaseToScreen_with_fix(NSRect frame, NSWindow *window, NSPoint point)
{
/* We get mouse position */
NSPoint mouse = [window mouseLocationOutsideOfEventStream];
float l, r, b;
float t = 0;
NSPoint ret;
/* If the reported mouse position is not in frame
this means that the window frame origin is broken. */
if (mouse.y > frame.origin.y + frame.size.height)
{
NSLog (@"Window Frame Origin Bug Detected: point reported higher");
NSLog (@"Workaround enabled.");
DPSstyleoffsets (GSCurrentContext (), &l, &r, &t, &b,
[window styleMask]);
}
else if (mouse.y < frame.origin. y)
{
NSLog (@"Window Frame Origin Bug Detected: point reported lower");
NSLog (@"Workaround enabled.");
DPSstyleoffsets (GSCurrentContext (), &l, &r, &t, &b,
[window styleMask]);
t = -t;
}
/* Convert the origin */
ret = [window convertBaseToScreen: point];
/* Add the bug correction */
ret.y += t;
return ret;
}
/* The image to use in a specific popupbutton is
* _pbc_image[_pbcFlags.pullsDown]; that is, _pbc_image[0] if it is a
* popup menu, _pbc_image[1] if it is a pulls down list. */
@ -477,21 +434,21 @@ static NSImage *_pbc_image[2];
NSWindow *cvWin = [controlView window];
NSMenuView *mr = [_menu menuRepresentation];
int items;
NSRect origCellFrame = [controlView convertRect: cellFrame
toView: nil];
[nc postNotificationName: NSPopUpButtonCellWillPopUpNotification
object: self];
object: self];
[nc postNotificationName: NSPopUpButtonCellWillPopUpNotification
object: controlView];
object: controlView];
[mr _setCellSize: cellFrame.size];
[_menu sizeToFit];
// Compute the frame (NB: the temporary frame to be passed
// to mr as per spec, not yet the definitive frame where
// the menu is going to appear)
/*
* Compute the frame (NB: the temporary frame to be passed
* to mr as per spec, not yet the definitive frame where
* the menu is going to appear)
*/
items = [_menu numberOfItems];
if (items > 1)
{
@ -506,10 +463,9 @@ static NSImage *_pbc_image[2];
/* Convert to content view */
cellFrame = [controlView convertRect: cellFrame
toView: nil];
toView: nil];
cellFrame.origin = _convertBaseToScreen_with_fix (origCellFrame, cvWin,
cellFrame.origin);
cellFrame.origin = [cvWin convertBaseToScreen: cellFrame.origin];
// Ask the MenuView to attach the menu to this rect
if (_pbcFlags.pullsDown)