diff --git a/ChangeLog b/ChangeLog index 9e9c26ab0..8c4be4a5d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2006-03-05 Richard Frith-Macdonald + + * Source/NSScreen.m: ([-visibleFrame]) fix to work when using + mac style horizontal menu. + 2006-03-01 Richard Frith-Macdonald * Source/NSMenuView.m: ([-rectOfItemAtIndex:]) Fix bug #15934 by diff --git a/Source/NSMenu.m b/Source/NSMenu.m index 0f180530b..d6e522f76 100644 --- a/Source/NSMenu.m +++ b/Source/NSMenu.m @@ -59,18 +59,18 @@ /* Drawing related: - NSMenu superMenu (if not root menu, the parent meu) - ^ - | - | +------------------> NSMenuView view (content, draws the menu items) - | | - NSMenu +----------+-------> NSMenuPanel A (regular window, torn off window) - | | `-------> NSMenuPanel B (transient window) - | | - | +------------------> NSString title (title) - | - v - NSMenu attachedMenu (the menu that is attached to this one, during navigation) + NSMenu superMenu (if not root menu, the parent meu) + ^ + | + | +------------------> NSMenuView view (content, draws the menu items) + | | + NSMenu +----------+-------> NSMenuPanel A (regular window, torn off window) + | | `-------> NSMenuPanel B (transient window) + | | + | +------------------> NSString title (title) + | + v + NSMenu attachedMenu (the menu attached to this one, during navigation) diff --git a/Source/NSScreen.m b/Source/NSScreen.m index 8e173f2c5..4497642b6 100644 --- a/Source/NSScreen.m +++ b/Source/NSScreen.m @@ -31,6 +31,8 @@ #include "AppKit/NSScreen.h" #include "AppKit/NSInterfaceStyle.h" #include "AppKit/NSGraphicsContext.h" +#include "AppKit/NSWindow.h" +#include "AppKit/NSMenu.h" #include "AppKit/AppKitExceptions.h" #include "GNUstepGUI/GSDisplayServer.h" @@ -302,22 +304,38 @@ static NSMutableArray *screenArray = nil; { NSRect visFrame = _frame; - switch (NSInterfaceStyleForKey(@"NSInterfaceStyle", nil)) + switch (NSInterfaceStyleForKey(@"NSMenuInterfaceStyle", nil)) { case NSMacintoshInterfaceStyle: - // What is the size of the Mac menubar? - visFrame.size.height -= 25; - return visFrame; + if ([NSApp mainMenu] != nil) + { + float menuHeight = [[[NSApp mainMenu] window] frame].size.height; + + visFrame.size.height -= menuHeight; + } + break; + case GSWindowMakerInterfaceStyle: case NSNextStepInterfaceStyle: - visFrame.size.width -= 64; - return visFrame; + /* FIXME: Menu width will vary from app to app and there is no + * fixed position for the menu ... should we be making room for + * a menu top left, or something else? + */ +#if 0 + if ([NSApp mainMenu] != nil) + { + float menuWidth = [[[NSApp mainMenu] window] frame].size.width; + + visFrame.size.width -= menuWidth; + visFrame.origin.x += menuWidth; + } +#endif + break; - case NSWindows95InterfaceStyle: - case NSNoInterfaceStyle: default: - return _frame; + break; } + return visFrame; } /** Returns the screen number */ diff --git a/Source/NSWindow.m b/Source/NSWindow.m index 1272329d8..f989ada74 100644 --- a/Source/NSWindow.m +++ b/Source/NSWindow.m @@ -1519,8 +1519,8 @@ many times. don't constrain if we are merely unhidding the window or if it's already visible and is just being reordered. */ if ((_styleMask & NSTitledWindowMask) - && [NSApp isHidden] == NO - && _f.visible == NO) + && [NSApp isHidden] == NO + && _f.visible == NO) { NSRect nframe = [self constrainFrameRect: _frame toScreen: [self screen]]; @@ -1750,7 +1750,8 @@ many times. if (resizeTime == 0) { NSNumber *num; - num = [[NSUserDefaults standardUserDefaults] objectForKey: @"NSWindowResizeTime"]; + num = [[NSUserDefaults standardUserDefaults] + objectForKey: @"NSWindowResizeTime"]; if (num != nil) { resizeTime = [num floatValue]; @@ -3895,7 +3896,7 @@ resetCursorRectsForView(NSView *theView) } - (BOOL) setFrameUsingName: (NSString *)name - force: (BOOL)force + force: (BOOL)force { // FIXME return [self setFrameUsingName: name]; @@ -3980,10 +3981,10 @@ resetCursorRectsForView(NSView *theView) maxRect = [self constrainFrameRect: maxRect toScreen: [self screen]]; // Compare the new frame with the current one - if ((abs(NSMaxX(maxRect) - NSMaxX(_frame)) < DIST) && - (abs(NSMaxY(maxRect) - NSMaxY(_frame)) < DIST) && - (abs(NSMinX(maxRect) - NSMinX(_frame)) < DIST) && - (abs(NSMinY(maxRect) - NSMinY(_frame)) < DIST)) + if ((abs(NSMaxX(maxRect) - NSMaxX(_frame)) < DIST) + && (abs(NSMaxY(maxRect) - NSMaxY(_frame)) < DIST) + && (abs(NSMinX(maxRect) - NSMinX(_frame)) < DIST) + && (abs(NSMinY(maxRect) - NSMinY(_frame)) < DIST)) { // Already in zoomed mode, reset user frame, if stored if (_autosaveName != nil)