keep desktop level winodws at bottom of stack

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/back/trunk@26204 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
rfm 2008-03-05 13:42:45 +00:00
parent a13562b657
commit 44bad647b4
3 changed files with 99 additions and 11 deletions

View file

@ -5,6 +5,8 @@
management. NB. This is incomplete ... it seems that direct user action
like clicking on a window will reorder it without going through the
orderwindow::; method, so we need to deal with that somehow.
* Source\win32\w32_movesize.m: Ensure that desktop level windows are
pinned to the bottom.
2008-03-04 Xavier Glattard <xavier.glattard@online.fr>

View file

@ -1010,7 +1010,7 @@ NSLog(@"Callback");
WIN_INTERN *win;
WIN_INTERN *other;
int flag;
BOOL belowTop = NO;
int foreground = 0;
NSDebugLLog(@"WTrace", @"orderwindow: %d : %d : %d", op, otherWin, winNum);
@ -1052,9 +1052,15 @@ NSLog(@"Callback");
if (otherWin == 0 && op == NSWindowAbove)
{
/* This combination means we should move to the top of the current
* window level but stay below the key window.
* window level but stay below the key window, so if we have a key
* window (other than the current window), we store it's id for
* testing later.
*/
belowTop = YES;
foreground = (int)GetForegroundWindow();
if (foreground < 0 || foreground == winNum)
{
foreground = 0;
}
}
otherWin = 0;
}
@ -1129,7 +1135,9 @@ NSLog(@"Callback");
otherWin, other->level);
if (other->level >= win->level)
{
if (other->level > win->level || op == NSWindowBelow)
if (other->level > win->level
|| op == NSWindowBelow
|| foreground == otherWin)
{
break;
}
@ -1141,11 +1149,6 @@ NSLog(@"Callback");
if (otherWin == 0)
{
if (belowTop == YES)
{
/* FIXME: Need to find the current key window (otherWin == 0
means keep the window below the current key.) */
}
otherWin = (int)HWND_TOP;
NSDebugLLog(@"WTrace",
@"orderwindow: set %i (%i) to top", winNum, win->level);

View file

@ -252,12 +252,95 @@
- (void) decodeWM_WINDOWPOSCHANGEDParams: (WPARAM)wParam : (LPARAM)lParam : (HWND)hwnd
{
// stub for future dev
#if 0
/* FIXME we really want to ensure that windows stay in the correct
* level order. When we change ordering programmatically using
* orderwindow::: that's OK, but if someone else reorders our
* windows, how do we cope?
* Perhaps we should veto/adjust ordering before it happens, or
* perhaps we should re-order here?
*/
if ((inf->flags & SWP_NOZORDER) == 0)
{
/* If this window has been moved to the front, we need to move
* any other higher level windows to follow it.
*/
win = (WIN_INTERN *)GetWindowLong(hwnd, GWL_USERDATA);
if (win->level > NSDesktopWindowLevel)
{
int otherWin;
int levelToMove = NSDesktopWindowlevel;
/* Start searching from bottom of window list...
* The last child of the desktop.
*/
otherWin = (int)GetDesktopWindow();
otherWin = (int)GetWindow((HWND)otherWin, GW_CHILD);
if (otherWin > 0)
{
otherWin = (int)GetWindow((HWND)otherWin, GW_HWNDLAST);
}
while (otherWin > 0)
{
TCHAR buf[32];
otherWin = (int)GetNextWindow((HWND)otherWin, GW_HWNDPREV);
if (otherWin == 0 || otherWin == (int)hwnd)
{
break; // No higher level windows below this
}
if (GetClassName((HWND)otherWin, buf, 32) == 18
&& strncmp(buf, "GNUstepWindowClass", 18) == 0)
{
other = (WIN_INTERN *)GetWindowLong((HWND)otherWin,
GWL_USERDATA);
if (other->orderedIn == YES)
{
BOOL moveThisWindow = NO;
if (levelToMove > NSDesktopWindowLevel)
{
if (other->level == levelToMove)
{
moveThisWindow = YES;
}
}
else if (other->level > win->level)
{
levelToMove = other->level;
moveThisWindow = YES;
}
if (moveThisWidnow == YES)
{
SetWindowPos((HWND)otherWin, HWND_TOP, 0, 0, 0, 0,
SWP_NOSIZE | SWP_NOMOVE | SWP_NOACTIVATE);
}
}
}
}
}
}
#endif
}
- (void) decodeWM_WINDOWPOSCHANGINGParams: (WPARAM)wParam : (LPARAM)lParam : (HWND)hwnd
{
// stub for future dev
WIN_INTERN *win;
WINDOWPOS *inf = (WINDOWPOS*)lParam;
if ((inf->flags & SWP_NOZORDER) == 0)
{
/* desktop level windows should stay at the bottom of the
* window list, so we can simply override any re-ordering
* to ensure that they are at the bottom unless another
* desktop level window is inserted below them.
*/
win = (WIN_INTERN *)GetWindowLong(hwnd, GWL_USERDATA);
if (win->level <= NSDesktopWindowLevel)
{
inf->hwndInsertAfter = HWND_BOTTOM;
}
}
}
- (LRESULT) decodeWM_GETMINMAXINFOParams: (WPARAM)wParam : (LPARAM)lParam : (HWND)hwnd