2003-11-26 Adam Fedor * orderFront fixes * Source/NSWindow.m (-orderFront:): Remove NSApp isActive check. (-orderFrontRegardless): Update for special case (otherWin=-1) (-orderWindow:relativeTo:): Pass -1 for otherWin to backend if we're the current app. * Source/GSDisplayServer.m: Update documentations. * Source/NSApplication.m (-changeWindowsItem:title:filename:): Revert patch from 2003-10-20. Index: Source/GSDisplayServer.m =================================================================== RCS file: /cvsroot/gnustep/gnustep/core/gui/Source/GSDisplayServer.m,v retrieving revision 1.18 diff -u -r1.18 GSDisplayServer.m --- Source/GSDisplayServer.m 29 Oct 2003 07:01:13 -0000 1.18 +++ Source/GSDisplayServer.m 27 Nov 2003 04:34:38 -0000 @@ -550,7 +550,7 @@ /** Sets the window device information for the current NSGraphicsContext, - typically by calling [NSGraphicsContext -GSSetDevice:::], + typically by calling [NSGraphicsContext-GSSetDevice:::], although depending on the concrete implmentation, more information than this may need to be exchanged. */ - (void) windowdevice: (int) win @@ -559,7 +559,12 @@ } /** Causes the window to be ordered onto or off the screen depending - on the value of op. The window is ordered relative to otherWin. */ + on the value of op. The window is ordered relative to otherWin. + The window will never be ordered in front of the current key/main + window except in the special case where otherWin is negative (This + is a special feature that [NSWindow-orderWindow:relativeTo:] uses + to place the window correctly). +*/ - (void) orderwindow: (int) op : (int) otherWin : (int) win { [self subclassResponsibility: _cmd]; Index: Source/NSApplication.m =================================================================== RCS file: /cvsroot/gnustep/gnustep/core/gui/Source/NSApplication.m,v retrieving revision 1.256 diff -u -r1.256 NSApplication.m --- Source/NSApplication.m 26 Nov 2003 13:57:32 -0000 1.256 +++ Source/NSApplication.m 27 Nov 2003 04:34:39 -0000 @@ -2271,7 +2271,7 @@ i++; } item = [_windows_menu insertItemWithTitle: aString - action: @selector(deminiaturize:) + action: @selector(orderFront:) keyEquivalent: @"" atIndex: i]; [item setTarget: aWindow]; Index: Source/NSWindow.m =================================================================== RCS file: /cvsroot/gnustep/gnustep/core/gui/Source/NSWindow.m,v retrieving revision 1.299 diff -u -r1.299 NSWindow.m --- Source/NSWindow.m 26 Nov 2003 23:02:20 -0000 1.299 +++ Source/NSWindow.m 27 Nov 2003 04:34:41 -0000 @@ -1357,29 +1357,67 @@ [self becomeMainWindow]; } +/** + Orders the window to the back of its level. Equivalent to + -orderWindow: NSWindowBelow relativeTo: 0. +*/ - (void) orderBack: (id)sender { [self orderWindow: NSWindowBelow relativeTo: 0]; } +/** + If the application is active, orders the window to the front in its + level. If the application is not active, the window is ordered in as + far forward as possible in its level without being ordered in front + of the key or main window of the currently active app. The current key + and main window status is not changed. Equivalent to -orderWindow: + NSWindowAbove relativeTo: 0. +*/ - (void) orderFront: (id)sender { - if ([NSApp isActive] == YES) - { - [self orderWindow: NSWindowAbove relativeTo: 0]; - } + [self orderWindow: NSWindowAbove relativeTo: 0]; } +/** + Orders the window to the front in its level (even in front of the + key and main windows of the current app) regardless of whether the + app is current or not. This method should only be used in rare cases + where the app is cooperating with another app that is displaying + data for it. The current key and main window status is not changed. +*/ - (void) orderFrontRegardless { - [self orderWindow: NSWindowAbove relativeTo: 0]; + [self orderWindow: NSWindowAbove relativeTo: -1]; } +/** + Orders the window out from the screen. Equivalent to -orderWindow: + NSWindowOut relativeTo: 0. +*/ - (void) orderOut: (id)sender { [self orderWindow: NSWindowOut relativeTo: 0]; } +/** +

+ If place is NSWindowOut, removes the window from the screen. If + place is NSWindowAbove, places the window directly above otherWin, + or directly above all windows in its level if otherWin is 0. If + place is NSWindowBelow, places the window directly below otherWin, + or directly below all windows in its level if otherWin is 0. +

+

+ If place is NSWindowAbove or NSWindowBelow and the application is + hidden, the application is unhidden. +

+*/ +/* + As a special undocumented case (for -orderFrontRegardless), if otherWin + is negative, then the backend should not try to keep the window below the + current key/main window +*/ - (void) orderWindow: (NSWindowOrderingMode)place relativeTo: (int)otherWin { GSDisplayServer *srv = GSServerForWindow(self); @@ -1431,6 +1469,14 @@ else if (place != NSWindowOut) [_contentView displayIfNeeded]; + /* The backend will keep us below the current key window unless we + force it not too */ + if ((otherWin == 0 + || otherWin == [[NSApp keyWindow] windowNumber] + || otherWin == [[NSApp mainWindow] windowNumber]) + && [NSApp isActive]) + otherWin = -1; + [srv orderwindow: place : otherWin : _windowNum]; if (display) [self display];