From 52fa1000331d2eec7d216bf00cb649f92e964359 Mon Sep 17 00:00:00 2001 From: Kensuke Matsuzaki Date: Fri, 9 Apr 2004 05:52:50 +0000 Subject: [PATCH] Fix window reordering. Remove winMWExtWMReorderWindows. --- hw/xwin/winblock.c | 5 ---- hw/xwin/winwakeup.c | 5 ---- hw/xwin/winwin32rootlesswindow.c | 27 +++++++++-------- hw/xwin/winwin32rootlesswndproc.c | 48 +++++++++++++++++++++++++++++-- 4 files changed, 58 insertions(+), 27 deletions(-) diff --git a/hw/xwin/winblock.c b/hw/xwin/winblock.c index c2f3bc2f7..19c1829a8 100644 --- a/hw/xwin/winblock.c +++ b/hw/xwin/winblock.c @@ -89,9 +89,4 @@ winBlockHandler_ProcessMessages: DispatchMessage (&msg); } } - -#ifdef XWIN_MULTIWINDOWEXTWM - if (pScreenPriv->pScreenInfo->fMWExtWM) - winMWExtWMReorderWindows ((ScreenPtr)pBlockData); -#endif } diff --git a/hw/xwin/winwakeup.c b/hw/xwin/winwakeup.c index 14e786b09..4553a4636 100644 --- a/hw/xwin/winwakeup.c +++ b/hw/xwin/winwakeup.c @@ -67,9 +67,4 @@ winWakeupHandler (int nScreen, DispatchMessage (&msg); } } - -#ifdef XWIN_MULTIWINDOWEXTWM - if (pScreenPriv->pScreenInfo->fMWExtWM) - winMWExtWMReorderWindows ((ScreenPtr)pWakeupData); -#endif } diff --git a/hw/xwin/winwin32rootlesswindow.c b/hw/xwin/winwin32rootlesswindow.c index e68d524b7..298b23e44 100755 --- a/hw/xwin/winwin32rootlesswindow.c +++ b/hw/xwin/winwin32rootlesswindow.c @@ -41,6 +41,7 @@ extern HICON g_hiconX; +#if 0 /* * winMWExtWMReorderWindows */ @@ -54,6 +55,7 @@ winMWExtWMReorderWindows (ScreenPtr pScreen) win32RootlessWindowPtr pRLWinSib = NULL; DWORD dwCurrentProcessID = GetCurrentProcessId (); DWORD dwWindowProcessID = 0; + XID vlist[2]; #if CYGMULTIWINDOW_DEBUG && FALSE ErrorF ("winMWExtWMReorderWindows\n"); @@ -80,22 +82,19 @@ winMWExtWMReorderWindows (ScreenPtr pScreen) if (pRLWinSib) { - XID *vlist = malloc (sizeof(long) * 2); - - if (vlist == NULL) - { - ErrorF ("winMWExtWMReorderWindows - malloc () " - "failed\n"); - return; - } - - ((long*)vlist)[0] = pRLWinSib->pFrame->win->drawable.id; - ((long*)vlist)[1] = Below; + vlist[0] = pRLWinSib->pFrame->win->drawable.id; + vlist[1] = Below; ConfigureWindow (pRLWin->pFrame->win, CWSibling | CWStackMode, vlist, wClient(pRLWin->pFrame->win)); - - free (vlist); + } + else + { + /* 1st window - raise to the top */ + vlist[0] = Above; + + ConfigureWindow (pRLWin->pFrame->win, CWStackMode, + vlist, wClient(pRLWin->pFrame->win)); } } hwnd = GetNextWindow (hwnd, GW_HWNDNEXT); @@ -104,8 +103,8 @@ winMWExtWMReorderWindows (ScreenPtr pScreen) pScreenPriv->fRestacking = FALSE; pScreenPriv->fWindowOrderChanged = FALSE; - } +#endif /* diff --git a/hw/xwin/winwin32rootlesswndproc.c b/hw/xwin/winwin32rootlesswndproc.c index 75cf3c50d..565adbe57 100755 --- a/hw/xwin/winwin32rootlesswndproc.c +++ b/hw/xwin/winwin32rootlesswndproc.c @@ -412,6 +412,7 @@ winMWExtWMWindowProc (HWND hwnd, UINT message, PAINTSTRUCT ps; LPWINDOWPOS pWinPos = NULL; RECT rcClient; + XID vlist[2]; /* Check if the Windows window property for our X window pointer is valid */ if ((pRLWinPriv = (win32RootlessWindowPtr)GetProp (hwnd, WIN_WINDOW_PROP)) != NULL) @@ -898,8 +899,48 @@ winMWExtWMWindowProc (HWND hwnd, UINT message, /* Reorder if window z order was changed */ if ((pScreenPriv != NULL) - && !(pWinPos->flags & SWP_NOZORDER)) - pScreenPriv->fWindowOrderChanged = TRUE; + && !(pWinPos->flags & SWP_NOZORDER) + && !(pWinPos->flags & SWP_SHOWWINDOW)) + { + pScreenPriv->fWindowOrderChanged = TRUE; + if (pWinPos->hwndInsertAfter == HWND_TOP + ||pWinPos->hwndInsertAfter == HWND_TOPMOST + ||pWinPos->hwndInsertAfter == HWND_NOTOPMOST) + { + vlist[0] = Above; + ConfigureWindow (pWin, CWStackMode, + vlist, wClient(pWin)); + } +#if 1 + else if (pWinPos->hwndInsertAfter == HWND_BOTTOM) + { + } + else + { + HWND hWndAbove = NULL; + DWORD dwCurrentProcessID = GetCurrentProcessId (); + DWORD dwWindowProcessID = 0; + + for (hWndAbove = pWinPos->hwndInsertAfter; + hWndAbove != NULL; + hWndAbove = GetNextWindow (hWndAbove, GW_HWNDPREV)) + { + GetWindowThreadProcessId (hWndAbove, &dwWindowProcessID); + + if ((dwWindowProcessID == dwCurrentProcessID) + && GetProp (Above, WIN_WINDOW_PROP) + && !IsIconic (hwnd) ) /* ignore minimized windows */ + break; + } + if (hWndAbove == NULL) + { + vlist[0] = Above; + ConfigureWindow (pWin, CWStackMode, + vlist, wClient(pWin)); + } + } +#endif + } if (!(pWinPos->flags & SWP_NOSIZE)) { if (IsIconic(hwnd)){ @@ -936,7 +977,8 @@ winMWExtWMWindowProc (HWND hwnd, UINT message, } if (!g_fNoConfigureWindow ) { - if (!pRLWinPriv->fMovingOrSizing) { + if (!pRLWinPriv->fMovingOrSizing + && (pWinPos->flags & SWP_SHOWWINDOW)) { GetClientRect (hwnd, &rcClient); MapWindowPoints (hwnd, HWND_DESKTOP, (LPPOINT)&rcClient, 2);