winex11: Abstract the server part of SetWindowPos into a separate function.
This commit is contained in:
parent
2921f5c156
commit
5df4e62312
|
@ -233,6 +233,55 @@ static void update_wm_states( Display *display, struct x11drv_win_data *data, BO
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/***********************************************************************
|
||||||
|
* set_server_window_pos
|
||||||
|
*
|
||||||
|
* Set the window pos on the server side only. Helper for SetWindowPos.
|
||||||
|
*/
|
||||||
|
static BOOL set_server_window_pos( HWND hwnd, HWND insert_after, const RECT *rectWindow,
|
||||||
|
const RECT *rectClient, UINT swp_flags, const RECT *valid_rects,
|
||||||
|
RECT *visible_rect )
|
||||||
|
{
|
||||||
|
WND *win;
|
||||||
|
BOOL ret;
|
||||||
|
|
||||||
|
if (!(win = WIN_GetPtr( hwnd ))) return FALSE;
|
||||||
|
if (win == WND_DESKTOP || win == WND_OTHER_PROCESS) return FALSE;
|
||||||
|
|
||||||
|
SERVER_START_REQ( set_window_pos )
|
||||||
|
{
|
||||||
|
req->handle = hwnd;
|
||||||
|
req->previous = insert_after;
|
||||||
|
req->flags = swp_flags;
|
||||||
|
req->window.left = rectWindow->left;
|
||||||
|
req->window.top = rectWindow->top;
|
||||||
|
req->window.right = rectWindow->right;
|
||||||
|
req->window.bottom = rectWindow->bottom;
|
||||||
|
req->client.left = rectClient->left;
|
||||||
|
req->client.top = rectClient->top;
|
||||||
|
req->client.right = rectClient->right;
|
||||||
|
req->client.bottom = rectClient->bottom;
|
||||||
|
if (!IsRectEmpty( &valid_rects[0] ))
|
||||||
|
wine_server_add_data( req, valid_rects, 2 * sizeof(*valid_rects) );
|
||||||
|
if ((ret = !wine_server_call( req )))
|
||||||
|
{
|
||||||
|
win->dwStyle = reply->new_style;
|
||||||
|
win->dwExStyle = reply->new_ex_style;
|
||||||
|
win->rectWindow = *rectWindow;
|
||||||
|
win->rectClient = *rectClient;
|
||||||
|
visible_rect->left = reply->visible.left;
|
||||||
|
visible_rect->top = reply->visible.top;
|
||||||
|
visible_rect->right = reply->visible.right;
|
||||||
|
visible_rect->bottom = reply->visible.bottom;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
SERVER_END_REQ;
|
||||||
|
|
||||||
|
WIN_ReleasePtr( win );
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/***********************************************************************
|
/***********************************************************************
|
||||||
* SetWindowPos (X11DRV.@)
|
* SetWindowPos (X11DRV.@)
|
||||||
*/
|
*/
|
||||||
|
@ -241,9 +290,8 @@ BOOL X11DRV_SetWindowPos( HWND hwnd, HWND insert_after, const RECT *rectWindow,
|
||||||
{
|
{
|
||||||
Display *display = thread_display();
|
Display *display = thread_display();
|
||||||
struct x11drv_win_data *data;
|
struct x11drv_win_data *data;
|
||||||
RECT new_whole_rect, old_client_rect, visible_rect;
|
RECT new_whole_rect, visible_rect;
|
||||||
WND *win;
|
DWORD old_style, new_style;
|
||||||
DWORD old_style, new_style, new_ex_style;
|
|
||||||
BOOL ret, make_managed = FALSE;
|
BOOL ret, make_managed = FALSE;
|
||||||
|
|
||||||
if (!(data = X11DRV_get_win_data( hwnd ))) return FALSE;
|
if (!(data = X11DRV_get_win_data( hwnd ))) return FALSE;
|
||||||
|
@ -262,56 +310,20 @@ BOOL X11DRV_SetWindowPos( HWND hwnd, HWND insert_after, const RECT *rectWindow,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
old_client_rect = data->client_rect;
|
old_style = GetWindowLongW( hwnd, GWL_STYLE );
|
||||||
|
|
||||||
if (!data->whole_window) swp_flags |= SWP_NOCOPYBITS; /* we can't rely on X11 to move the bits */
|
if (!data->whole_window) swp_flags |= SWP_NOCOPYBITS; /* we can't rely on X11 to move the bits */
|
||||||
|
|
||||||
if (!(win = WIN_GetPtr( hwnd ))) return FALSE;
|
if ((ret = set_server_window_pos( hwnd, insert_after, rectWindow, rectClient, swp_flags,
|
||||||
if (win == WND_DESKTOP || win == WND_OTHER_PROCESS)
|
valid_rects, &visible_rect )))
|
||||||
{
|
|
||||||
if (IsWindow( hwnd )) ERR( "cannot set rectangles of other process window %p\n", hwnd );
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
SERVER_START_REQ( set_window_pos )
|
|
||||||
{
|
|
||||||
req->handle = hwnd;
|
|
||||||
req->previous = insert_after;
|
|
||||||
req->flags = swp_flags;
|
|
||||||
req->window.left = rectWindow->left;
|
|
||||||
req->window.top = rectWindow->top;
|
|
||||||
req->window.right = rectWindow->right;
|
|
||||||
req->window.bottom = rectWindow->bottom;
|
|
||||||
req->client.left = rectClient->left;
|
|
||||||
req->client.top = rectClient->top;
|
|
||||||
req->client.right = rectClient->right;
|
|
||||||
req->client.bottom = rectClient->bottom;
|
|
||||||
if (!IsRectEmpty( &valid_rects[0] ))
|
|
||||||
wine_server_add_data( req, valid_rects, 2 * sizeof(*valid_rects) );
|
|
||||||
if ((ret = !wine_server_call( req )))
|
|
||||||
{
|
|
||||||
new_style = reply->new_style;
|
|
||||||
new_ex_style = reply->new_ex_style;
|
|
||||||
visible_rect.left = reply->visible.left;
|
|
||||||
visible_rect.top = reply->visible.top;
|
|
||||||
visible_rect.right = reply->visible.right;
|
|
||||||
visible_rect.bottom = reply->visible.bottom;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
SERVER_END_REQ;
|
|
||||||
|
|
||||||
if (ret)
|
|
||||||
{
|
{
|
||||||
if (data->whole_window == DefaultRootWindow(gdi_display))
|
if (data->whole_window == DefaultRootWindow(gdi_display))
|
||||||
{
|
{
|
||||||
data->whole_rect = data->client_rect = data->window_rect = *rectWindow;
|
data->whole_rect = data->client_rect = data->window_rect = *rectWindow;
|
||||||
win->rectWindow = *rectWindow;
|
|
||||||
win->rectClient = *rectClient;
|
|
||||||
win->dwStyle = new_style;
|
|
||||||
win->dwExStyle = new_ex_style;
|
|
||||||
WIN_ReleasePtr( win );
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
new_style = GetWindowLongW( hwnd, GWL_STYLE );
|
||||||
new_whole_rect = *rectWindow;
|
new_whole_rect = *rectWindow;
|
||||||
X11DRV_window_to_X_rect( data, &new_whole_rect );
|
X11DRV_window_to_X_rect( data, &new_whole_rect );
|
||||||
if (memcmp( &visible_rect, &new_whole_rect, sizeof(RECT) ))
|
if (memcmp( &visible_rect, &new_whole_rect, sizeof(RECT) ))
|
||||||
|
@ -337,17 +349,10 @@ BOOL X11DRV_SetWindowPos( HWND hwnd, HWND insert_after, const RECT *rectWindow,
|
||||||
(swp_flags & (SWP_HIDEWINDOW | SWP_SHOWWINDOW)))
|
(swp_flags & (SWP_HIDEWINDOW | SWP_SHOWWINDOW)))
|
||||||
{
|
{
|
||||||
RECT rect;
|
RECT rect;
|
||||||
UnionRect( &rect, rectWindow, &win->rectWindow );
|
UnionRect( &rect, rectWindow, &data->window_rect );
|
||||||
invalidate_dce( hwnd, &rect );
|
invalidate_dce( hwnd, &rect );
|
||||||
}
|
}
|
||||||
|
|
||||||
win->rectWindow = *rectWindow;
|
|
||||||
win->rectClient = *rectClient;
|
|
||||||
old_style = win->dwStyle;
|
|
||||||
win->dwStyle = new_style;
|
|
||||||
win->dwExStyle = new_ex_style;
|
|
||||||
data->window_rect = *rectWindow;
|
|
||||||
|
|
||||||
TRACE( "win %p window %s client %s style %08x\n",
|
TRACE( "win %p window %s client %s style %08x\n",
|
||||||
hwnd, wine_dbgstr_rect(rectWindow), wine_dbgstr_rect(rectClient), new_style );
|
hwnd, wine_dbgstr_rect(rectWindow), wine_dbgstr_rect(rectClient), new_style );
|
||||||
|
|
||||||
|
@ -403,6 +408,7 @@ BOOL X11DRV_SetWindowPos( HWND hwnd, HWND insert_after, const RECT *rectWindow,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
data->window_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 && !data->lock_changes)
|
if (data->whole_window && !data->lock_changes)
|
||||||
|
@ -440,7 +446,6 @@ BOOL X11DRV_SetWindowPos( HWND hwnd, HWND insert_after, const RECT *rectWindow,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
WIN_ReleasePtr( win );
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue