These patches make orderFront: and related methods work
better.Unfortunately there is a problem with the window manager (at
least WindowMaker), where iconified or closed windows are sent a "Take
Focus" message when they are ordered in, which makes the application
active when it shouldn't be. We would have to change how the window
manager behaved to fix that problem.
2003-11-26 Adam Fedor <[EMAIL PROTECTED]>
* 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];
}
+/**
+ <p>
+ 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.
+ </p>
+ <p>
+ If place is NSWindowAbove or NSWindowBelow and the application is
+ hidden, the application is unhidden.
+ <p>
+*/
+/*
+ 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];
2003-11-26 Adam Fedor <[EMAIL PROTECTED]>
* Source/x11/XGServerWindow.m ([XGServer -orderwindow:::]):
When orderWin == 0, make sure the window does not go in front
of the current key window.
Index: Source/x11/XGServerWindow.m
===================================================================
RCS file: /cvsroot/gnustep/gnustep/core/back/Source/x11/XGServerWindow.m,v
retrieving revision 1.35
diff -u -r1.35 XGServerWindow.m
--- Source/x11/XGServerWindow.m 19 Nov 2003 16:05:29 -0000 1.35
+++ Source/x11/XGServerWindow.m 27 Nov 2003 04:36:17 -0000
@@ -1534,10 +1534,27 @@
NSDebugLLog(@"XGTrace", @"DPSorderwindow: %d : %d : %d",op,otherWin,winNum);
level = window->win_attrs.window_level;
- if (otherWin != 0)
+ if (otherWin > 0)
{
other = WINDOW_WITH_TAG(otherWin);
- level = other->win_attrs.window_level;
+ if (other)
+ level = other->win_attrs.window_level;
+ }
+ else if (otherWin == 0 && op == NSWindowAbove)
+ {
+ /* Don't let the window go in front of the current key/main window. */
+ /* FIXME: Don't know how to get the current main window. */
+ Window keywin;
+ int revert, status;
+ status = XGetInputFocus(dpy, &keywin, &revert);
+ other = NULL;
+ if (status == True)
+ {
+ /* Alloc a temporary window structure */
+ other = GSAutoreleasedBuffer(sizeof(gswindow_device_t));
+ other->ident = keywin;
+ op = NSWindowBelow;
+ }
}
else
{
_______________________________________________
Bug-gnustep mailing list
[EMAIL PROTECTED]
http://mail.gnu.org/mailman/listinfo/bug-gnustep