Commit 92499dba authored by Ulrich Weigand's avatar Ulrich Weigand Committed by Alexandre Julliard

Try to improve ConfigureNotify event processing.

parent 50e96dc2
...@@ -376,9 +376,8 @@ static unsigned __td_lookup( Window w, Window* list, unsigned max ) ...@@ -376,9 +376,8 @@ static unsigned __td_lookup( Window w, Window* list, unsigned max )
return i; return i;
} }
static BOOL EVENT_QueryZOrder( HWND hWndCheck) static HWND EVENT_QueryZOrder( HWND hWndCheck)
{ {
BOOL bRet = FALSE;
HWND hwndInsertAfter = HWND_TOP; HWND hwndInsertAfter = HWND_TOP;
WND *pWndCheck = WIN_FindWndPtr(hWndCheck); WND *pWndCheck = WIN_FindWndPtr(hWndCheck);
WND *pDesktop = WIN_GetDesktop(); WND *pDesktop = WIN_GetDesktop();
...@@ -391,7 +390,7 @@ static BOOL EVENT_QueryZOrder( HWND hWndCheck) ...@@ -391,7 +390,7 @@ static BOOL EVENT_QueryZOrder( HWND hWndCheck)
WIN_ReleaseWndPtr(pWndCheck); WIN_ReleaseWndPtr(pWndCheck);
WIN_ReleaseWndPtr(pDesktop->child); WIN_ReleaseWndPtr(pDesktop->child);
WIN_ReleaseDesktop(); WIN_ReleaseDesktop();
return TRUE; return hwndInsertAfter;
} }
WIN_LockWndPtr(pWndZ); WIN_LockWndPtr(pWndZ);
WIN_LockWndPtr(pWnd); WIN_LockWndPtr(pWnd);
...@@ -433,16 +432,13 @@ static BOOL EVENT_QueryZOrder( HWND hWndCheck) ...@@ -433,16 +432,13 @@ static BOOL EVENT_QueryZOrder( HWND hWndCheck)
if( best - check == 1 ) break; if( best - check == 1 ) break;
} }
} }
/* and link pWndCheck right behind it in the local z-order */
} }
WIN_UnlinkWindow( pWndCheck->hwndSelf );
WIN_LinkWindow( pWndCheck->hwndSelf, hwndInsertAfter);
} }
if( children ) TSXFree( children ); if( children ) TSXFree( children );
WIN_ReleaseWndPtr(pWnd); WIN_ReleaseWndPtr(pWnd);
WIN_ReleaseWndPtr(pWndZ); WIN_ReleaseWndPtr(pWndZ);
WIN_ReleaseWndPtr(pWndCheck); WIN_ReleaseWndPtr(pWndCheck);
return bRet; return hwndInsertAfter;
} }
/*********************************************************************** /***********************************************************************
...@@ -758,101 +754,49 @@ static void EVENT_GetGeometry( Window win, int *px, int *py, ...@@ -758,101 +754,49 @@ static void EVENT_GetGeometry( Window win, int *px, int *py,
*/ */
static void EVENT_ConfigureNotify( HWND hWnd, XConfigureEvent *event ) static void EVENT_ConfigureNotify( HWND hWnd, XConfigureEvent *event )
{ {
WINDOWPOS winpos; RECT rectWindow;
RECT newWindowRect, newClientRect; int x, y, flags = 0;
RECT oldWindowRect, oldClientRect; unsigned int width, height;
Window above = event->above; HWND newInsertAfter, oldInsertAfter;
int x, y;
unsigned int width, height;
WND *pWnd = WIN_FindWndPtr(hWnd); /* Get geometry and Z-order according to X */
assert (pWnd->flags & WIN_MANAGED);
/* We don't rely on the event geometry info, because it is relative
* to parent and not to root, and it may be wrong (XFree sets x,y to 0,0
* if the window hasn't moved).
*/
EVENT_GetGeometry( event->window, &x, &y, &width, &height );
TRACE_(win)("%04x adjusted to (%i,%i)-(%i,%i)\n", pWnd->hwndSelf,
x, y, x + width, y + height );
/* Fill WINDOWPOS struct */
winpos.flags = SWP_NOACTIVATE | SWP_NOZORDER;
winpos.hwnd = hWnd;
winpos.x = x;
winpos.y = y;
winpos.cx = width;
winpos.cy = height;
/* Check for unchanged attributes */
if (winpos.x == pWnd->rectWindow.left && winpos.y == pWnd->rectWindow.top)
winpos.flags |= SWP_NOMOVE;
if ((winpos.cx == pWnd->rectWindow.right - pWnd->rectWindow.left) &&
(winpos.cy == pWnd->rectWindow.bottom - pWnd->rectWindow.top))
winpos.flags |= SWP_NOSIZE;
else
{
RECT rect;
rect.left = 0; EVENT_GetGeometry( event->window, &x, &y, &width, &height );
rect.top = 0; newInsertAfter = EVENT_QueryZOrder( hWnd );
rect.right = pWnd->rectWindow.right - pWnd->rectWindow.left;
rect.bottom = pWnd->rectWindow.bottom - pWnd->rectWindow.top;
DCE_InvalidateDCE( pWnd, &rect ); /* Get geometry and Z-order according to Wine */
}
/* Send WM_WINDOWPOSCHANGING */
SendMessageA( winpos.hwnd, WM_WINDOWPOSCHANGING, 0, (LPARAM)&winpos );
if (!IsWindow( winpos.hwnd )) GetWindowRect( hWnd, &rectWindow );
{ oldInsertAfter = GetWindow( hWnd, GW_HWNDPREV );
WIN_ReleaseWndPtr(pWnd); if ( !oldInsertAfter ) oldInsertAfter = HWND_TOP;
return;
}
/* Calculate new position and size */
newWindowRect.left = x;
newWindowRect.right = x + width;
newWindowRect.top = y;
newWindowRect.bottom = y + height;
WINPOS_SendNCCalcSize( winpos.hwnd, TRUE, &newWindowRect,
&pWnd->rectWindow, &pWnd->rectClient,
&winpos, &newClientRect );
if (!IsWindow( winpos.hwnd ))
{
WIN_ReleaseWndPtr(pWnd);
return;
}
oldWindowRect = pWnd->rectWindow;
oldClientRect = pWnd->rectClient;
/* Set new size and position */ /* Compare what has changed */
pWnd->rectWindow = newWindowRect;
pWnd->rectClient = newClientRect;
/* FIXME: Copy valid bits */ if ( rectWindow.left == x && rectWindow.top == y )
flags |= SWP_NOMOVE;
else
TRACE_(win)( "%04x moving from (%d,%d) to (%d,%d)\n", hWnd,
rectWindow.left, rectWindow.top, x, y );
if( oldClientRect.top - oldWindowRect.top != newClientRect.top - newWindowRect.top || if ( rectWindow.right - rectWindow.left == width
oldClientRect.left - oldWindowRect.left != newClientRect.left - newWindowRect.left ) && rectWindow.bottom - rectWindow.top == height )
RedrawWindow( winpos.hwnd, NULL, 0, RDW_FRAME | RDW_ALLCHILDREN | flags |= SWP_NOSIZE;
RDW_INVALIDATE | RDW_ERASE | RDW_ERASENOW ); else
TRACE_(win)( "%04x resizing from (%d,%d) to (%d,%d)\n", hWnd,
rectWindow.right - rectWindow.left,
rectWindow.bottom - rectWindow.top, width, height );
WIN_ReleaseWndPtr(pWnd); if ( newInsertAfter == oldInsertAfter )
flags |= SWP_NOZORDER;
else
TRACE_(win)( "%04x restacking from after %04x to after %04x\n", hWnd,
oldInsertAfter, newInsertAfter );
SendMessageA( winpos.hwnd, WM_WINDOWPOSCHANGED, 0, (LPARAM)&winpos ); /* If anything changed, call SetWindowPos */
if (!IsWindow( winpos.hwnd )) return; if ( flags != (SWP_NOMOVE | SWP_NOSIZE | SWP_NOZORDER) )
if( above == None ) /* absolute bottom */ SetWindowPos( hWnd, newInsertAfter, x, y, width, height,
{ flags | SWP_NOACTIVATE );
WIN_UnlinkWindow( winpos.hwnd );
WIN_LinkWindow( winpos.hwnd, HWND_BOTTOM);
}
else EVENT_QueryZOrder( hWnd ); /* try to outsmart window manager */
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment