x11drv: Replace the SWP_WINE_NOHOSTMOVE flag by a lock count.

This commit is contained in:
Alexandre Julliard 2006-03-29 18:27:01 +02:00
parent 4c777d7466
commit 3217e534fe
4 changed files with 20 additions and 13 deletions

View File

@ -602,8 +602,7 @@ void X11DRV_sync_window_position( Display *display, struct x11drv_win_data *data
data->client_rect = *new_client_rect; data->client_rect = *new_client_rect;
OffsetRect( &data->client_rect, -data->whole_rect.left, -data->whole_rect.top ); OffsetRect( &data->client_rect, -data->whole_rect.left, -data->whole_rect.top );
if (!data->whole_window) return; if (!data->whole_window || data->lock_changes) return;
if (swp_flags & SWP_WINE_NOHOSTMOVE) return;
mask = get_window_changes( &changes, &old_whole_rect, &data->whole_rect ); mask = get_window_changes( &changes, &old_whole_rect, &data->whole_rect );
@ -837,6 +836,7 @@ static struct x11drv_win_data *alloc_win_data( Display *display, HWND hwnd )
data->xic = 0; data->xic = 0;
data->managed = FALSE; data->managed = FALSE;
data->dce = NULL; data->dce = NULL;
data->lock_changes = 0;
data->hWMIconBitmap = 0; data->hWMIconBitmap = 0;
data->hWMIconMask = 0; data->hWMIconMask = 0;

View File

@ -567,7 +567,7 @@ BOOL X11DRV_set_window_pos( HWND hwnd, HWND insert_after, const RECT *rectWindow
{ {
req->handle = hwnd; req->handle = hwnd;
req->previous = insert_after; req->previous = insert_after;
req->flags = swp_flags & ~SWP_WINE_NOHOSTMOVE; req->flags = swp_flags;
req->window.left = rectWindow->left; req->window.left = rectWindow->left;
req->window.top = rectWindow->top; req->window.top = rectWindow->top;
req->window.right = rectWindow->right; req->window.right = rectWindow->right;
@ -625,7 +625,7 @@ BOOL X11DRV_set_window_pos( HWND hwnd, HWND insert_after, const RECT *rectWindow
/* FIXME: copy the valid bits */ /* FIXME: copy the valid bits */
if (data->whole_window && !(swp_flags & SWP_WINE_NOHOSTMOVE)) if (data->whole_window && !data->lock_changes)
{ {
if ((old_style & WS_VISIBLE) && !(new_style & WS_VISIBLE)) if ((old_style & WS_VISIBLE) && !(new_style & WS_VISIBLE))
{ {
@ -647,7 +647,7 @@ BOOL X11DRV_set_window_pos( HWND hwnd, HWND insert_after, const RECT *rectWindow
X11DRV_sync_window_position( display, data, swp_flags, rectClient, &new_whole_rect ); X11DRV_sync_window_position( display, data, swp_flags, rectClient, &new_whole_rect );
if (data->whole_window && !(swp_flags & SWP_WINE_NOHOSTMOVE)) if (data->whole_window && !data->lock_changes)
{ {
if ((new_style & WS_VISIBLE) && !(new_style & WS_MINIMIZE) && if ((new_style & WS_VISIBLE) && !(new_style & WS_MINIMIZE) &&
X11DRV_is_window_rect_mapped( rectWindow )) X11DRV_is_window_rect_mapped( rectWindow ))
@ -694,7 +694,6 @@ BOOL X11DRV_SetWindowPos( WINDOWPOS *winpos )
winpos->cx, winpos->cy, winpos->flags); winpos->cx, winpos->cy, winpos->flags);
orig_flags = winpos->flags; orig_flags = winpos->flags;
winpos->flags &= ~SWP_WINE_NOHOSTMOVE;
/* First make sure that coordinates are valid for WM_WINDOWPOSCHANGING */ /* First make sure that coordinates are valid for WM_WINDOWPOSCHANGING */
if (!(winpos->flags & SWP_NOMOVE)) if (!(winpos->flags & SWP_NOMOVE))
@ -1107,8 +1106,10 @@ void X11DRV_MapNotify( HWND hwnd, XEvent *event )
WIN_ReleasePtr( win ); WIN_ReleasePtr( win );
SendMessageA( hwnd, WM_SHOWWINDOW, SW_RESTORE, 0 ); SendMessageA( hwnd, WM_SHOWWINDOW, SW_RESTORE, 0 );
data->lock_changes++;
SetWindowPos( hwnd, 0, rect.left, rect.top, rect.right-rect.left, rect.bottom-rect.top, SetWindowPos( hwnd, 0, rect.left, rect.top, rect.right-rect.left, rect.bottom-rect.top,
SWP_NOZORDER | SWP_WINE_NOHOSTMOVE ); SWP_NOZORDER );
data->lock_changes--;
} }
else WIN_ReleasePtr( win ); else WIN_ReleasePtr( win );
if (hwndFocus && IsChild( hwnd, hwndFocus )) X11DRV_SetFocus(hwndFocus); /* FIXME */ if (hwndFocus && IsChild( hwnd, hwndFocus )) X11DRV_SetFocus(hwndFocus); /* FIXME */
@ -1140,8 +1141,10 @@ void X11DRV_UnmapNotify( HWND hwnd, XEvent *event )
EndMenu(); EndMenu();
SendMessageA( hwnd, WM_SHOWWINDOW, SW_MINIMIZE, 0 ); SendMessageA( hwnd, WM_SHOWWINDOW, SW_MINIMIZE, 0 );
data->lock_changes++;
SetWindowPos( hwnd, 0, 0, 0, GetSystemMetrics(SM_CXICON), GetSystemMetrics(SM_CYICON), SetWindowPos( hwnd, 0, 0, 0, GetSystemMetrics(SM_CXICON), GetSystemMetrics(SM_CYICON),
SWP_NOMOVE | SWP_NOACTIVATE | SWP_NOZORDER | SWP_WINE_NOHOSTMOVE ); SWP_NOMOVE | SWP_NOACTIVATE | SWP_NOZORDER );
data->lock_changes--;
} }
else WIN_ReleasePtr( win ); else WIN_ReleasePtr( win );
} }
@ -1154,12 +1157,16 @@ void X11DRV_handle_desktop_resize( unsigned int width, unsigned int height )
{ {
RECT rect; RECT rect;
HWND hwnd = GetDesktopWindow(); HWND hwnd = GetDesktopWindow();
struct x11drv_win_data *data;
if (!(data = X11DRV_get_win_data( hwnd ))) return;
screen_width = width; screen_width = width;
screen_height = height; screen_height = height;
TRACE("desktop %p change to (%dx%d)\n", hwnd, width, height); TRACE("desktop %p change to (%dx%d)\n", hwnd, width, height);
SetRect( &rect, 0, 0, width, height ); SetRect( &rect, 0, 0, width, height );
X11DRV_set_window_pos( hwnd, 0, &rect, &rect, SWP_NOZORDER|SWP_NOMOVE|SWP_WINE_NOHOSTMOVE, NULL ); data->lock_changes++;
X11DRV_set_window_pos( hwnd, 0, &rect, &rect, SWP_NOZORDER|SWP_NOMOVE, NULL );
data->lock_changes--;
SendMessageTimeoutW( HWND_BROADCAST, WM_DISPLAYCHANGE, screen_depth, SendMessageTimeoutW( HWND_BROADCAST, WM_DISPLAYCHANGE, screen_depth,
MAKELPARAM( width, height ), SMTO_ABORTIFHUNG, 2000, NULL ); MAKELPARAM( width, height ), SMTO_ABORTIFHUNG, 2000, NULL );
} }
@ -1202,7 +1209,7 @@ void X11DRV_ConfigureNotify( HWND hwnd, XEvent *xev )
y = rect.top; y = rect.top;
cx = rect.right - rect.left; cx = rect.right - rect.left;
cy = rect.bottom - rect.top; cy = rect.bottom - rect.top;
flags = SWP_NOACTIVATE | SWP_NOZORDER | SWP_WINE_NOHOSTMOVE; flags = SWP_NOACTIVATE | SWP_NOZORDER;
/* Compare what has changed */ /* Compare what has changed */
@ -1223,7 +1230,9 @@ void X11DRV_ConfigureNotify( HWND hwnd, XEvent *xev )
TRACE( "%p resizing from (%ldx%ld) to (%dx%d)\n", TRACE( "%p resizing from (%ldx%ld) to (%dx%d)\n",
hwnd, rect.right - rect.left, rect.bottom - rect.top, cx, cy ); hwnd, rect.right - rect.left, rect.bottom - rect.top, cx, cy );
data->lock_changes++;
SetWindowPos( hwnd, 0, x, y, cx, cy, flags ); SetWindowPos( hwnd, 0, x, y, cx, cy, flags );
data->lock_changes--;
} }

View File

@ -643,6 +643,7 @@ struct x11drv_win_data
XIC xic; /* X input context */ XIC xic; /* X input context */
BOOL managed; /* is window managed? */ BOOL managed; /* is window managed? */
struct dce *dce; /* DCE for CS_OWNDC or CS_CLASSDC windows */ struct dce *dce; /* DCE for CS_OWNDC or CS_CLASSDC windows */
unsigned int lock_changes; /* lock count for X11 change requests */
HBITMAP hWMIconBitmap; HBITMAP hWMIconBitmap;
HBITMAP hWMIconMask; HBITMAP hWMIconMask;
}; };

View File

@ -31,9 +31,6 @@
#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
extern BOOL WINPOS_RedrawIconTitle( HWND hWnd ); extern BOOL WINPOS_RedrawIconTitle( HWND hWnd );
extern BOOL WINPOS_ShowIconTitle( HWND hwnd, BOOL bShow ); extern BOOL WINPOS_ShowIconTitle( HWND hwnd, BOOL bShow );
extern void WINPOS_GetMinMaxInfo( HWND hwnd, POINT *maxSize, POINT *maxPos, POINT *minTrack, extern void WINPOS_GetMinMaxInfo( HWND hwnd, POINT *maxSize, POINT *maxPos, POINT *minTrack,