Commit 7f53c573 authored by Ulrich Weigand's avatar Ulrich Weigand Committed by Alexandre Julliard

- 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.
parent d1fc9e80
...@@ -15,6 +15,9 @@ ...@@ -15,6 +15,9 @@
#define SWP_NOCLIENTSIZE 0x0800 #define SWP_NOCLIENTSIZE 0x0800
#define SWP_NOCLIENTMOVE 0x1000 #define SWP_NOCLIENTMOVE 0x1000
/* Wine extra SWP flag */
#define SWP_WINE_NOHOSTMOVE 0x80000000
struct tagWINDOWPOS16; struct tagWINDOWPOS16;
typedef struct typedef struct
......
...@@ -2336,6 +2336,7 @@ DECL_WINELIB_TYPE_AW(LPNONCLIENTMETRICS) ...@@ -2336,6 +2336,7 @@ DECL_WINELIB_TYPE_AW(LPNONCLIENTMETRICS)
#define SWP_NOSENDCHANGING 0x0400 #define SWP_NOSENDCHANGING 0x0400
#define SWP_DEFERERASE 0x2000 #define SWP_DEFERERASE 0x2000
#define SWP_ASYNCWINDOWPOS 0x4000
#define HWND_DESKTOP ((HWND)0) #define HWND_DESKTOP ((HWND)0)
#define HWND_BROADCAST ((HWND)0xffff) #define HWND_BROADCAST ((HWND)0xffff)
...@@ -3542,7 +3543,7 @@ HHOOK WINAPI SetWindowsHookW(INT,HOOKPROC); ...@@ -3542,7 +3543,7 @@ HHOOK WINAPI SetWindowsHookW(INT,HOOKPROC);
HHOOK WINAPI SetWindowsHookExA(INT,HOOKPROC,HINSTANCE,DWORD); HHOOK WINAPI SetWindowsHookExA(INT,HOOKPROC,HINSTANCE,DWORD);
HHOOK WINAPI SetWindowsHookExW(INT,HOOKPROC,HINSTANCE,DWORD); HHOOK WINAPI SetWindowsHookExW(INT,HOOKPROC,HINSTANCE,DWORD);
#define SetWindowsHookEx WINELIB_NAME_AW(SetWindowsHookEx) #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); INT WINAPI SetWindowRgn(HWND,HRGN,BOOL);
BOOL WINAPI SetWindowTextA(HWND,LPCSTR); BOOL WINAPI SetWindowTextA(HWND,LPCSTR);
BOOL WINAPI SetWindowTextW(HWND,LPCWSTR); BOOL WINAPI SetWindowTextW(HWND,LPCWSTR);
......
...@@ -2449,7 +2449,7 @@ BOOL16 WINAPI SetWindowPos16( HWND16 hwnd, HWND16 hwndInsertAfter, ...@@ -2449,7 +2449,7 @@ BOOL16 WINAPI SetWindowPos16( HWND16 hwnd, HWND16 hwndInsertAfter,
* SetWindowPos (USER32.520) * SetWindowPos (USER32.520)
*/ */
BOOL WINAPI SetWindowPos( HWND hwnd, HWND hwndInsertAfter, 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; WINDOWPOS winpos;
WND * wndPtr,*wndTemp; WND * wndPtr,*wndTemp;
...@@ -2457,7 +2457,7 @@ BOOL WINAPI SetWindowPos( HWND hwnd, HWND hwndInsertAfter, ...@@ -2457,7 +2457,7 @@ BOOL WINAPI SetWindowPos( HWND hwnd, HWND hwndInsertAfter,
RECT oldWindowRect, oldClientRect; RECT oldWindowRect, oldClientRect;
HRGN visRgn = 0; HRGN visRgn = 0;
UINT wvrFlags = 0, uFlags = 0; UINT wvrFlags = 0, uFlags = 0;
BOOL retvalue, resync = FALSE; BOOL retvalue, resync = FALSE, bChangePos;
HWND hwndActive = 0; HWND hwndActive = 0;
/* Get current active window from the active queue */ /* Get current active window from the active queue */
...@@ -2474,6 +2474,10 @@ BOOL WINAPI SetWindowPos( HWND hwnd, HWND hwndInsertAfter, ...@@ -2474,6 +2474,10 @@ BOOL WINAPI SetWindowPos( HWND hwnd, HWND hwndInsertAfter,
TRACE(win,"hwnd %04x, swp (%i,%i)-(%i,%i) flags %08x\n", TRACE(win,"hwnd %04x, swp (%i,%i)-(%i,%i) flags %08x\n",
hwnd, x, y, x+cx, y+cy, flags); hwnd, x, y, x+cx, y+cy, flags);
bChangePos = !(flags & SWP_WINE_NOHOSTMOVE);
flags &= ~SWP_WINE_NOHOSTMOVE;
/* ------------------------------------------------------------------------ CHECKS */ /* ------------------------------------------------------------------------ CHECKS */
/* Check window handle */ /* Check window handle */
...@@ -2651,7 +2655,7 @@ Pos: /* ----------------------------------------------------------------------- ...@@ -2651,7 +2655,7 @@ Pos: /* -----------------------------------------------------------------------
cx = newWindowRect.right - newWindowRect.left; cx = newWindowRect.right - newWindowRect.left;
cy = newWindowRect.bottom - newWindowRect.top; cy = newWindowRect.bottom - newWindowRect.top;
wndPtr->pDriver->pSetWindowPos(wndPtr, &winpos, TRUE); wndPtr->pDriver->pSetWindowPos(wndPtr, &winpos, bChangePos);
winpos.hwndInsertAfter = tempInsertAfter; winpos.hwndInsertAfter = tempInsertAfter;
bCallDriver = FALSE; bCallDriver = FALSE;
...@@ -2701,7 +2705,7 @@ Pos: /* ----------------------------------------------------------------------- ...@@ -2701,7 +2705,7 @@ Pos: /* -----------------------------------------------------------------------
wndPtr->pDriver->pSetHostAttr(wndPtr, HAK_BITGRAVITY, BGForget ); wndPtr->pDriver->pSetHostAttr(wndPtr, HAK_BITGRAVITY, BGForget );
} }
wndPtr->pDriver->pSetWindowPos(wndPtr, &winpos, TRUE); wndPtr->pDriver->pSetWindowPos(wndPtr, &winpos, bChangePos);
winpos.hwndInsertAfter = tempInsertAfter; winpos.hwndInsertAfter = tempInsertAfter;
} }
......
...@@ -708,32 +708,25 @@ BOOL X11DRV_EVENT_CheckFocus(void) ...@@ -708,32 +708,25 @@ BOOL X11DRV_EVENT_CheckFocus(void)
static void EVENT_GetGeometry( Window win, int *px, int *py, static void EVENT_GetGeometry( Window win, int *px, int *py,
unsigned int *pwidth, unsigned int *pheight ) unsigned int *pwidth, unsigned int *pheight )
{ {
Window root, parent, *children; Window root, top;
int xpos, ypos; int x, y, width, height, border, depth;
unsigned int width, height, border, depth, nb_children;
if (!TSXGetGeometry( display, win, &root, px, py, pwidth, pheight, EnterCriticalSection( &X11DRV_CritSection );
&border, &depth )) return;
if (win == X11DRV_GetXRootWindow())
{
*px = *py = 0;
return;
}
for (;;) /* Get the geometry of the window */
{ XGetGeometry( display, win, &root, &x, &y, &width, &height,
if (!TSXQueryTree(display, win, &root, &parent, &children, &nb_children)) &border, &depth );
return;
TSXFree( children ); /* Translate the window origin to root coordinates */
if (parent == X11DRV_GetXRootWindow()) break; XTranslateCoordinates( display, win, root, 0, 0, &x, &y, &top );
win = parent;
if (!TSXGetGeometry( display, win, &root, &xpos, &ypos,
&width, &height, &border, &depth )) return;
*px += xpos;
*py += ypos;
}
}
LeaveCriticalSection( &X11DRV_CritSection );
*px = x;
*py = y;
*pwidth = width;
*pheight = height;
}
/********************************************************************** /**********************************************************************
* EVENT_ConfigureNotify * EVENT_ConfigureNotify
...@@ -785,7 +778,7 @@ static void EVENT_ConfigureNotify( HWND hWnd, XConfigureEvent *event ) ...@@ -785,7 +778,7 @@ static void EVENT_ConfigureNotify( HWND hWnd, XConfigureEvent *event )
if ( flags != (SWP_NOMOVE | SWP_NOSIZE | SWP_NOZORDER) ) if ( flags != (SWP_NOMOVE | SWP_NOSIZE | SWP_NOZORDER) )
SetWindowPos( hWnd, newInsertAfter, x, y, width, height, SetWindowPos( hWnd, newInsertAfter, x, y, width, height,
flags | SWP_NOACTIVATE ); flags | SWP_NOACTIVATE | SWP_WINE_NOHOSTMOVE );
} }
......
...@@ -234,6 +234,7 @@ BOOL X11DRV_WND_CreateWindow(WND *wndPtr, CLASS *classPtr, CREATESTRUCTA *cs, BO ...@@ -234,6 +234,7 @@ BOOL X11DRV_WND_CreateWindow(WND *wndPtr, CLASS *classPtr, CREATESTRUCTA *cs, BO
if (wndPtr->flags & WIN_MANAGED) if (wndPtr->flags & WIN_MANAGED)
{ {
XClassHint *class_hints = TSXAllocClassHint(); XClassHint *class_hints = TSXAllocClassHint();
XSizeHints* size_hints = TSXAllocSizeHints();
if (class_hints) if (class_hints)
{ {
...@@ -243,21 +244,23 @@ BOOL X11DRV_WND_CreateWindow(WND *wndPtr, CLASS *classPtr, CREATESTRUCTA *cs, BO ...@@ -243,21 +244,23 @@ BOOL X11DRV_WND_CreateWindow(WND *wndPtr, CLASS *classPtr, CREATESTRUCTA *cs, BO
TSXFree (class_hints); 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_width = size_hints->max_width = cs->cx;
size_hints->min_height = size_hints->max_height = cs->cy; size_hints->min_height = size_hints->max_height = cs->cy;
size_hints->flags = (PSize | PMinSize | PMaxSize); size_hints->flags |= PMinSize | PMaxSize;
}
TSXSetWMSizeHints( display, X11DRV_WND_GetXWindow(wndPtr), TSXSetWMSizeHints( display, X11DRV_WND_GetXWindow(wndPtr),
size_hints, XA_WM_NORMAL_HINTS ); size_hints, XA_WM_NORMAL_HINTS );
TSXFree(size_hints); TSXFree(size_hints);
} }
} }
}
if (cs->hwndParent) /* Get window owner */ if (cs->hwndParent) /* Get window owner */
{ {
...@@ -488,6 +491,7 @@ void X11DRV_WND_SetWindowPos(WND *wndPtr, const WINDOWPOS *winpos, BOOL bChangeP ...@@ -488,6 +491,7 @@ void X11DRV_WND_SetWindowPos(WND *wndPtr, const WINDOWPOS *winpos, BOOL bChangeP
XWindowChanges winChanges; XWindowChanges winChanges;
int changeMask = 0; int changeMask = 0;
WND *winposPtr = WIN_FindWndPtr( winpos->hwnd ); WND *winposPtr = WIN_FindWndPtr( winpos->hwnd );
if ( !winposPtr ) return;
if(!wndPtr->hwndSelf) wndPtr = NULL; /* FIXME: WND destroyed, shouldn't happend!!! */ if(!wndPtr->hwndSelf) wndPtr = NULL; /* FIXME: WND destroyed, shouldn't happend!!! */
......
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