mirror of
https://gitlab.freedesktop.org/xorg/xserver.git
synced 2026-01-10 19:50:24 +01:00
Remove fAlwaysOnTop and PreserveWin32Stack() instead of reinstating
winReorderWindowsMultiWindow(), which now inhibits reentries to avoid
infinite restacking. Call winReorderWindowsMultiWindow() in appropriate
places to keep consistent window Z order even if always-on-top windows
are mixed. (Earle F. Philhower III and Takuma Murakami)
This commit is contained in:
parent
bc966c4f19
commit
40bb4441ac
6 changed files with 124 additions and 48 deletions
|
|
@ -1523,6 +1523,9 @@ winReparentWindowMultiWindow (WindowPtr pWin, WindowPtr pPriorParent);
|
|||
void
|
||||
winRestackWindowMultiWindow (WindowPtr pWin, WindowPtr pOldNextSib);
|
||||
|
||||
void
|
||||
winReorderWindowsMultiWindow (void);
|
||||
|
||||
void
|
||||
winResizeWindowMultiWindow (WindowPtr pWin, int x, int y, unsigned int w,
|
||||
unsigned int h, WindowPtr pSib);
|
||||
|
|
|
|||
|
|
@ -103,7 +103,6 @@ winCreateWindowMultiWindow (WindowPtr pWin)
|
|||
pWinPriv->hWnd = NULL;
|
||||
pWinPriv->pScreenPriv = winGetScreenPriv(pWin->drawable.pScreen);
|
||||
pWinPriv->fXKilled = FALSE;
|
||||
pWinPriv->fAlwaysOnTop = FALSE;
|
||||
|
||||
return fResult;
|
||||
}
|
||||
|
|
@ -389,8 +388,14 @@ winRestackWindowMultiWindow (WindowPtr pWin, WindowPtr pOldNextSib)
|
|||
if (winGetScreenPriv(pWin->drawable.pScreen)->RestackWindow)
|
||||
winGetScreenPriv(pWin->drawable.pScreen)->RestackWindow (pWin,
|
||||
pOldNextSib);
|
||||
|
||||
#if 0
|
||||
|
||||
#if 1
|
||||
/*
|
||||
* Calling winReorderWindowsMultiWindow here means our window manager
|
||||
* (i.e. Windows Explorer) has initiative to determine Z order.
|
||||
*/
|
||||
winReorderWindowsMultiWindow ();
|
||||
#else
|
||||
/* Bail out if no window privates or window handle is invalid */
|
||||
if (!pWinPriv || !pWinPriv->hWnd)
|
||||
return;
|
||||
|
|
@ -574,7 +579,7 @@ winCreateWindowsWindow (WindowPtr pWin)
|
|||
/* Change style back to popup, already placed... */
|
||||
SetWindowLong (hWnd, GWL_STYLE, WS_POPUP | WS_CLIPCHILDREN | WS_CLIPSIBLINGS);
|
||||
SetWindowPos (hWnd, 0, 0, 0, 0, 0,
|
||||
SWP_FRAMECHANGED | SWP_NOZORDER | SWP_NOMOVE | SWP_NOSIZE);
|
||||
SWP_FRAMECHANGED | SWP_NOZORDER | SWP_NOMOVE | SWP_NOSIZE);
|
||||
|
||||
pWinPriv->hWnd = hWnd;
|
||||
|
||||
|
|
@ -748,6 +753,66 @@ winFindWindow (pointer value, XID id, pointer cdata)
|
|||
}
|
||||
|
||||
|
||||
/*
|
||||
* winReorderWindowsMultiWindow -
|
||||
*/
|
||||
|
||||
void
|
||||
winReorderWindowsMultiWindow (void)
|
||||
{
|
||||
HWND hwnd = NULL;
|
||||
WindowPtr pWin = NULL;
|
||||
WindowPtr pWinSib = NULL;
|
||||
XID vlist[2];
|
||||
static Bool fRestacking = FALSE; /* Avoid recusive calls to this function */
|
||||
|
||||
#if CYGMULTIWINDOW_DEBUG || CYGWINDOWING_DEBUG
|
||||
ErrorF ("winReorderWindowsMultiWindow\n");
|
||||
#endif
|
||||
|
||||
if (fRestacking)
|
||||
{
|
||||
/* It is a recusive call so immediately exit */
|
||||
#if CYGWINDOWING_DEBUG
|
||||
ErrorF ("winReorderWindowsMultiWindow - "
|
||||
"exit because fRestacking == TRUE\n");
|
||||
#endif
|
||||
return;
|
||||
}
|
||||
fRestacking = TRUE;
|
||||
|
||||
/* Loop through top level Window windows, descending in Z order */
|
||||
for ( hwnd = GetTopWindow (NULL);
|
||||
hwnd;
|
||||
hwnd = GetNextWindow (hwnd, GW_HWNDNEXT) )
|
||||
{
|
||||
if ( GetProp (hwnd, WIN_WINDOW_PROP)
|
||||
&& !IsIconic (hwnd) ) /* ignore minimized windows */
|
||||
{
|
||||
pWinSib = pWin;
|
||||
pWin = GetProp (hwnd, WIN_WINDOW_PROP);
|
||||
|
||||
if (!pWinSib)
|
||||
{ /* 1st window - raise to the top */
|
||||
vlist[0] = Above;
|
||||
|
||||
ConfigureWindow (pWin, CWStackMode, vlist, wClient(pWin));
|
||||
}
|
||||
else
|
||||
{ /* 2nd or deeper windows - just below the previous one */
|
||||
vlist[0] = winGetWindowID (pWinSib);
|
||||
vlist[1] = Below;
|
||||
|
||||
ConfigureWindow (pWin, CWSibling | CWStackMode,
|
||||
vlist, wClient(pWin));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fRestacking = FALSE;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* winMinimizeWindow - Minimize in response to WM_CHANGE_STATE
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -164,8 +164,11 @@ winRedirectErrorHandler (Display *pDisplay, XErrorEvent *pErr);
|
|||
static void
|
||||
winInitMultiWindowWM (WMInfoPtr pWMInfo, WMProcArgPtr pProcArg);
|
||||
|
||||
#if 0
|
||||
static void
|
||||
PreserveWin32Stack(WMInfoPtr pWMInfo, Window iWindow, UINT direction);
|
||||
#endif
|
||||
|
||||
|
||||
/*
|
||||
* Local globals
|
||||
|
|
@ -514,6 +517,8 @@ UpdateName (WMInfoPtr pWMInfo, Window iWindow)
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
#if 0
|
||||
/*
|
||||
* Fix up any differences between the X11 and Win32 window stacks
|
||||
* starting at the window passed in
|
||||
|
|
@ -528,7 +533,7 @@ PreserveWin32Stack(WMInfoPtr pWMInfo, Window iWindow, UINT direction)
|
|||
DWORD myWinProcID, winProcID;
|
||||
Window xWindow;
|
||||
WINDOWPLACEMENT wndPlace;
|
||||
|
||||
|
||||
hWnd = NULL;
|
||||
/* See if we can get the cached HWND for this window... */
|
||||
if (XGetWindowProperty (pWMInfo->pDisplay,
|
||||
|
|
@ -545,39 +550,41 @@ PreserveWin32Stack(WMInfoPtr pWMInfo, Window iWindow, UINT direction)
|
|||
(unsigned char **) &retHwnd) == Success)
|
||||
{
|
||||
if (retHwnd)
|
||||
{
|
||||
hWnd = *retHwnd;
|
||||
XFree (retHwnd);
|
||||
}
|
||||
{
|
||||
hWnd = *retHwnd;
|
||||
XFree (retHwnd);
|
||||
}
|
||||
}
|
||||
|
||||
if (!hWnd) return;
|
||||
|
||||
|
||||
GetWindowThreadProcessId (hWnd, &myWinProcID);
|
||||
hWnd = GetNextWindow (hWnd, direction);
|
||||
|
||||
|
||||
while (hWnd) {
|
||||
GetWindowThreadProcessId (hWnd, &winProcID);
|
||||
if (winProcID == myWinProcID)
|
||||
if (winProcID == myWinProcID)
|
||||
{
|
||||
wndPlace.length = sizeof(WINDOWPLACEMENT);
|
||||
GetWindowPlacement (hWnd, &wndPlace);
|
||||
if ( !(wndPlace.showCmd==SW_HIDE ||
|
||||
wndPlace.showCmd==SW_MINIMIZE) )
|
||||
{
|
||||
xWindow = (Window)GetProp (hWnd, WIN_WID_PROP);
|
||||
if (xWindow)
|
||||
{
|
||||
if (direction==GW_HWNDPREV)
|
||||
XRaiseWindow (pWMInfo->pDisplay, xWindow);
|
||||
else
|
||||
XLowerWindow (pWMInfo->pDisplay, xWindow);
|
||||
}
|
||||
}
|
||||
wndPlace.length = sizeof(WINDOWPLACEMENT);
|
||||
GetWindowPlacement (hWnd, &wndPlace);
|
||||
if ( !(wndPlace.showCmd==SW_HIDE ||
|
||||
wndPlace.showCmd==SW_MINIMIZE) )
|
||||
{
|
||||
xWindow = (Window)GetProp (hWnd, WIN_WID_PROP);
|
||||
if (xWindow)
|
||||
{
|
||||
if (direction==GW_HWNDPREV)
|
||||
XRaiseWindow (pWMInfo->pDisplay, xWindow);
|
||||
else
|
||||
XLowerWindow (pWMInfo->pDisplay, xWindow);
|
||||
}
|
||||
}
|
||||
}
|
||||
hWnd = GetNextWindow(hWnd, direction);
|
||||
}
|
||||
}
|
||||
#endif /* PreserveWin32Stack */
|
||||
|
||||
|
||||
/*
|
||||
* winMultiWindowWMProc
|
||||
|
|
@ -635,7 +642,9 @@ winMultiWindowWMProc (void *pArg)
|
|||
#endif
|
||||
/* Raise the window */
|
||||
XRaiseWindow (pWMInfo->pDisplay, pNode->msg.iWindow);
|
||||
#if 0
|
||||
PreserveWin32Stack (pWMInfo, pNode->msg.iWindow, GW_HWNDPREV);
|
||||
#endif
|
||||
break;
|
||||
|
||||
case WM_WM_LOWER:
|
||||
|
|
@ -662,8 +671,10 @@ winMultiWindowWMProc (void *pArg)
|
|||
1);
|
||||
UpdateName (pWMInfo, pNode->msg.iWindow);
|
||||
winUpdateIcon (pNode->msg.iWindow);
|
||||
/* Handles the case where there are AOT windows above it in W32 */
|
||||
#if 0
|
||||
/* Handles the case where there are AOT windows above it in W32 */
|
||||
PreserveWin32Stack (pWMInfo, pNode->msg.iWindow, GW_HWNDPREV);
|
||||
#endif
|
||||
break;
|
||||
|
||||
case WM_WM_UNMAP:
|
||||
|
|
|
|||
|
|
@ -364,6 +364,12 @@ winTopLevelWindowProc (HWND hwnd, UINT message,
|
|||
WIN_WID_PROP,
|
||||
(HANDLE)winGetWindowID (((LPCREATESTRUCT) lParam)->lpCreateParams));
|
||||
|
||||
/*
|
||||
* Make X windows' Z orders sync with Windows windows because
|
||||
* there can be AlwaysOnTop windows overlapped on the window
|
||||
* currently being created.
|
||||
*/
|
||||
winReorderWindowsMultiWindow ();
|
||||
return 0;
|
||||
|
||||
case WM_INIT_SYS_MENU:
|
||||
|
|
@ -883,9 +889,14 @@ winTopLevelWindowProc (HWND hwnd, UINT message,
|
|||
SetForegroundWindow (hwnd);
|
||||
}
|
||||
}
|
||||
else /* It is an overridden window so make it top of Z stack */
|
||||
SetWindowPos (hwnd, HWND_TOPMOST, 0, 0, 0, 0,
|
||||
SWP_NOACTIVATE | SWP_NOMOVE | SWP_NOSIZE);
|
||||
else /* It is an overridden window so make it top of Z stack */
|
||||
{
|
||||
#if CYGWINDOWING_DEBUG
|
||||
ErrorF ("overridden window is shown\n");
|
||||
#endif
|
||||
SetWindowPos (hwnd, HWND_TOPMOST, 0, 0, 0, 0,
|
||||
SWP_NOMOVE | SWP_NOSIZE);
|
||||
}
|
||||
|
||||
/* Setup the Window Manager message */
|
||||
wmMsg.msg = WM_WM_MAP;
|
||||
|
|
@ -934,23 +945,6 @@ winTopLevelWindowProc (HWND hwnd, UINT message,
|
|||
(int)(GetTickCount ()));
|
||||
}
|
||||
#endif
|
||||
if (wParam==SIZE_MINIMIZED)
|
||||
{
|
||||
if (GetWindowLong (hwnd, GWL_EXSTYLE) & WS_EX_TOPMOST)
|
||||
pWinPriv->fAlwaysOnTop = TRUE;
|
||||
else
|
||||
pWinPriv->fAlwaysOnTop = FALSE;
|
||||
|
||||
SetWindowPos (hwnd, HWND_BOTTOM, 0, 0, 0, 0,
|
||||
SWP_NOACTIVATE | SWP_NOMOVE | SWP_NOSIZE );
|
||||
}
|
||||
else if (wParam==SIZE_RESTORED)
|
||||
{
|
||||
if (pWinPriv->fAlwaysOnTop)
|
||||
SetWindowPos(hwnd, HWND_TOPMOST, 0, 0, 0, 0,
|
||||
SWP_NOMOVE|SWP_NOSIZE|SWP_NOACTIVATE );
|
||||
|
||||
}
|
||||
/* Adjust the X Window to the moved Windows window */
|
||||
winAdjustXWindow (pWin, hwnd);
|
||||
return 0; /* end of WM_SIZE handler */
|
||||
|
|
|
|||
|
|
@ -366,6 +366,10 @@ HandleCustomWM_COMMAND (unsigned long hwndIn,
|
|||
0, 0,
|
||||
0, 0,
|
||||
SWP_NOSIZE | SWP_NOMOVE);
|
||||
#if XWIN_MULTIWINDOW
|
||||
/* Reflect the changed Z order */
|
||||
winReorderWindowsMultiWindow ();
|
||||
#endif
|
||||
return TRUE;
|
||||
|
||||
case CMD_RELOAD:
|
||||
|
|
|
|||
|
|
@ -67,7 +67,6 @@ typedef struct
|
|||
HWND hWnd;
|
||||
winPrivScreenPtr pScreenPriv;
|
||||
Bool fXKilled;
|
||||
Bool fAlwaysOnTop;
|
||||
|
||||
/* Privates used by primary fb DirectDraw server */
|
||||
LPDDSURFACEDESC pddsdPrimary;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue