mirror of
https://github.com/gnustep/libs-gui.git
synced 2025-05-31 18:50:48 +00:00
Tidyup
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@6216 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
dfba95af30
commit
fd4462c7af
3 changed files with 20 additions and 65 deletions
|
@ -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>
|
Wed Mar 08 13:15:00 2000 Richard Frith-Macdonald <richard@brainstorm.co.uk>
|
||||||
|
|
||||||
* Source/NSWindow.m: Final (I hope) coordinate handling fixes to
|
* Source/NSWindow.m: Final (I hope) coordinate handling fixes to
|
||||||
|
|
|
@ -317,18 +317,8 @@ Class _nspopupbuttonCellClass = 0;
|
||||||
[_cell attachPopUpWithFrame: _bounds
|
[_cell attachPopUpWithFrame: _bounds
|
||||||
inView: self];
|
inView: self];
|
||||||
|
|
||||||
{
|
p = [_window convertBaseToScreen: [theEvent locationInWindow]];
|
||||||
// Hack, function in NSPopUpButtonCell
|
p = [[mr window] convertScreenToBase: p];
|
||||||
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])];
|
|
||||||
}
|
|
||||||
|
|
||||||
// Process events; we start menu events processing by converting
|
// Process events; we start menu events processing by converting
|
||||||
// this event to the menu window, and sending it there.
|
// this event to the menu window, and sending it there.
|
||||||
|
|
|
@ -46,49 +46,6 @@
|
||||||
}
|
}
|
||||||
@end
|
@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
|
/* The image to use in a specific popupbutton is
|
||||||
* _pbc_image[_pbcFlags.pullsDown]; that is, _pbc_image[0] if it is a
|
* _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. */
|
* 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];
|
NSWindow *cvWin = [controlView window];
|
||||||
NSMenuView *mr = [_menu menuRepresentation];
|
NSMenuView *mr = [_menu menuRepresentation];
|
||||||
int items;
|
int items;
|
||||||
NSRect origCellFrame = [controlView convertRect: cellFrame
|
|
||||||
toView: nil];
|
|
||||||
|
|
||||||
[nc postNotificationName: NSPopUpButtonCellWillPopUpNotification
|
[nc postNotificationName: NSPopUpButtonCellWillPopUpNotification
|
||||||
object: self];
|
object: self];
|
||||||
|
|
||||||
[nc postNotificationName: NSPopUpButtonCellWillPopUpNotification
|
[nc postNotificationName: NSPopUpButtonCellWillPopUpNotification
|
||||||
object: controlView];
|
object: controlView];
|
||||||
|
|
||||||
[mr _setCellSize: cellFrame.size];
|
[mr _setCellSize: cellFrame.size];
|
||||||
[_menu sizeToFit];
|
[_menu sizeToFit];
|
||||||
|
|
||||||
// Compute the frame (NB: the temporary frame to be passed
|
/*
|
||||||
// to mr as per spec, not yet the definitive frame where
|
* Compute the frame (NB: the temporary frame to be passed
|
||||||
// the menu is going to appear)
|
* to mr as per spec, not yet the definitive frame where
|
||||||
|
* the menu is going to appear)
|
||||||
|
*/
|
||||||
items = [_menu numberOfItems];
|
items = [_menu numberOfItems];
|
||||||
if (items > 1)
|
if (items > 1)
|
||||||
{
|
{
|
||||||
|
@ -506,10 +463,9 @@ static NSImage *_pbc_image[2];
|
||||||
|
|
||||||
/* Convert to content view */
|
/* Convert to content view */
|
||||||
cellFrame = [controlView convertRect: cellFrame
|
cellFrame = [controlView convertRect: cellFrame
|
||||||
toView: nil];
|
toView: nil];
|
||||||
|
|
||||||
cellFrame.origin = _convertBaseToScreen_with_fix (origCellFrame, cvWin,
|
cellFrame.origin = [cvWin convertBaseToScreen: cellFrame.origin];
|
||||||
cellFrame.origin);
|
|
||||||
|
|
||||||
// Ask the MenuView to attach the menu to this rect
|
// Ask the MenuView to attach the menu to this rect
|
||||||
if (_pbcFlags.pullsDown)
|
if (_pbcFlags.pullsDown)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue