- Do not call XConfigureWindow if SetWindowPos was called due to a

received ConfigureNotify event (to avoid recursion).
- Use XTranslateCoordinates in EVENT_GetGeometry instead of manually
  walking the tree.
- Set XSizeHint.win_gravity to StaticGravity for managed windows.
This commit is contained in:
Ulrich Weigand 1999-06-18 17:03:13 +00:00 committed by Alexandre Julliard
parent d1fc9e80ac
commit 7f53c57321
5 changed files with 45 additions and 40 deletions

View File

@ -15,6 +15,9 @@
#define SWP_NOCLIENTSIZE 0x0800
#define SWP_NOCLIENTMOVE 0x1000
/* Wine extra SWP flag */
#define SWP_WINE_NOHOSTMOVE 0x80000000
struct tagWINDOWPOS16;
typedef struct

View File

@ -2336,6 +2336,7 @@ DECL_WINELIB_TYPE_AW(LPNONCLIENTMETRICS)
#define SWP_NOSENDCHANGING 0x0400
#define SWP_DEFERERASE 0x2000
#define SWP_ASYNCWINDOWPOS 0x4000
#define HWND_DESKTOP ((HWND)0)
#define HWND_BROADCAST ((HWND)0xffff)
@ -3542,7 +3543,7 @@ HHOOK WINAPI SetWindowsHookW(INT,HOOKPROC);
HHOOK WINAPI SetWindowsHookExA(INT,HOOKPROC,HINSTANCE,DWORD);
HHOOK WINAPI SetWindowsHookExW(INT,HOOKPROC,HINSTANCE,DWORD);
#define SetWindowsHookEx WINELIB_NAME_AW(SetWindowsHookEx)
BOOL WINAPI SetWindowPos(HWND,HWND,INT,INT,INT,INT,WORD);
BOOL WINAPI SetWindowPos(HWND,HWND,INT,INT,INT,INT,UINT);
INT WINAPI SetWindowRgn(HWND,HRGN,BOOL);
BOOL WINAPI SetWindowTextA(HWND,LPCSTR);
BOOL WINAPI SetWindowTextW(HWND,LPCWSTR);

View File

@ -2449,7 +2449,7 @@ BOOL16 WINAPI SetWindowPos16( HWND16 hwnd, HWND16 hwndInsertAfter,
* SetWindowPos (USER32.520)
*/
BOOL WINAPI SetWindowPos( HWND hwnd, HWND hwndInsertAfter,
INT x, INT y, INT cx, INT cy, WORD flags)
INT x, INT y, INT cx, INT cy, UINT flags )
{
WINDOWPOS winpos;
WND * wndPtr,*wndTemp;
@ -2457,7 +2457,7 @@ BOOL WINAPI SetWindowPos( HWND hwnd, HWND hwndInsertAfter,
RECT oldWindowRect, oldClientRect;
HRGN visRgn = 0;
UINT wvrFlags = 0, uFlags = 0;
BOOL retvalue, resync = FALSE;
BOOL retvalue, resync = FALSE, bChangePos;
HWND hwndActive = 0;
/* Get current active window from the active queue */
@ -2474,6 +2474,10 @@ BOOL WINAPI SetWindowPos( HWND hwnd, HWND hwndInsertAfter,
TRACE(win,"hwnd %04x, swp (%i,%i)-(%i,%i) flags %08x\n",
hwnd, x, y, x+cx, y+cy, flags);
bChangePos = !(flags & SWP_WINE_NOHOSTMOVE);
flags &= ~SWP_WINE_NOHOSTMOVE;
/* ------------------------------------------------------------------------ CHECKS */
/* Check window handle */
@ -2651,7 +2655,7 @@ Pos: /* -----------------------------------------------------------------------
cx = newWindowRect.right - newWindowRect.left;
cy = newWindowRect.bottom - newWindowRect.top;
wndPtr->pDriver->pSetWindowPos(wndPtr, &winpos, TRUE);
wndPtr->pDriver->pSetWindowPos(wndPtr, &winpos, bChangePos);
winpos.hwndInsertAfter = tempInsertAfter;
bCallDriver = FALSE;
@ -2701,7 +2705,7 @@ Pos: /* -----------------------------------------------------------------------
wndPtr->pDriver->pSetHostAttr(wndPtr, HAK_BITGRAVITY, BGForget );
}
wndPtr->pDriver->pSetWindowPos(wndPtr, &winpos, TRUE);
wndPtr->pDriver->pSetWindowPos(wndPtr, &winpos, bChangePos);
winpos.hwndInsertAfter = tempInsertAfter;
}

View File

@ -708,33 +708,26 @@ BOOL X11DRV_EVENT_CheckFocus(void)
static void EVENT_GetGeometry( Window win, int *px, int *py,
unsigned int *pwidth, unsigned int *pheight )
{
Window root, parent, *children;
int xpos, ypos;
unsigned int width, height, border, depth, nb_children;
Window root, top;
int x, y, width, height, border, depth;
if (!TSXGetGeometry( display, win, &root, px, py, pwidth, pheight,
&border, &depth )) return;
if (win == X11DRV_GetXRootWindow())
{
*px = *py = 0;
return;
}
EnterCriticalSection( &X11DRV_CritSection );
for (;;)
{
if (!TSXQueryTree(display, win, &root, &parent, &children, &nb_children))
return;
TSXFree( children );
if (parent == X11DRV_GetXRootWindow()) break;
win = parent;
if (!TSXGetGeometry( display, win, &root, &xpos, &ypos,
&width, &height, &border, &depth )) return;
*px += xpos;
*py += ypos;
}
/* Get the geometry of the window */
XGetGeometry( display, win, &root, &x, &y, &width, &height,
&border, &depth );
/* Translate the window origin to root coordinates */
XTranslateCoordinates( display, win, root, 0, 0, &x, &y, &top );
LeaveCriticalSection( &X11DRV_CritSection );
*px = x;
*py = y;
*pwidth = width;
*pheight = height;
}
/**********************************************************************
* EVENT_ConfigureNotify
*
@ -785,7 +778,7 @@ static void EVENT_ConfigureNotify( HWND hWnd, XConfigureEvent *event )
if ( flags != (SWP_NOMOVE | SWP_NOSIZE | SWP_NOZORDER) )
SetWindowPos( hWnd, newInsertAfter, x, y, width, height,
flags | SWP_NOACTIVATE );
flags | SWP_NOACTIVATE | SWP_WINE_NOHOSTMOVE );
}

View File

@ -234,6 +234,7 @@ BOOL X11DRV_WND_CreateWindow(WND *wndPtr, CLASS *classPtr, CREATESTRUCTA *cs, BO
if (wndPtr->flags & WIN_MANAGED)
{
XClassHint *class_hints = TSXAllocClassHint();
XSizeHints* size_hints = TSXAllocSizeHints();
if (class_hints)
{
@ -243,19 +244,21 @@ BOOL X11DRV_WND_CreateWindow(WND *wndPtr, CLASS *classPtr, CREATESTRUCTA *cs, BO
TSXFree (class_hints);
}
if (cs->dwExStyle & WS_EX_DLGMODALFRAME)
if (size_hints)
{
XSizeHints* size_hints = TSXAllocSizeHints();
size_hints->win_gravity = StaticGravity;
size_hints->flags = PWinGravity;
if (size_hints)
if (cs->dwExStyle & WS_EX_DLGMODALFRAME)
{
size_hints->min_width = size_hints->max_width = cs->cx;
size_hints->min_height = size_hints->max_height = cs->cy;
size_hints->flags = (PSize | PMinSize | PMaxSize);
TSXSetWMSizeHints( display, X11DRV_WND_GetXWindow(wndPtr),
size_hints, XA_WM_NORMAL_HINTS );
TSXFree(size_hints);
size_hints->flags |= PMinSize | PMaxSize;
}
TSXSetWMSizeHints( display, X11DRV_WND_GetXWindow(wndPtr),
size_hints, XA_WM_NORMAL_HINTS );
TSXFree(size_hints);
}
}
@ -488,6 +491,7 @@ void X11DRV_WND_SetWindowPos(WND *wndPtr, const WINDOWPOS *winpos, BOOL bChangeP
XWindowChanges winChanges;
int changeMask = 0;
WND *winposPtr = WIN_FindWndPtr( winpos->hwnd );
if ( !winposPtr ) return;
if(!wndPtr->hwndSelf) wndPtr = NULL; /* FIXME: WND destroyed, shouldn't happend!!! */