Module: wine Branch: master Commit: 5df4e62312f3d9990b79dae36e4ef5758cd4ff16 URL: http://source.winehq.org/git/wine.git/?a=commit;h=5df4e62312f3d9990b79dae36e...
Author: Alexandre Julliard julliard@winehq.org Date: Tue Jan 22 20:07:50 2008 +0100
winex11: Abstract the server part of SetWindowPos into a separate function.
---
dlls/winex11.drv/winpos.c | 109 +++++++++++++++++++++++--------------------- 1 files changed, 57 insertions(+), 52 deletions(-)
diff --git a/dlls/winex11.drv/winpos.c b/dlls/winex11.drv/winpos.c index 37c36ec..e975e5e 100644 --- a/dlls/winex11.drv/winpos.c +++ b/dlls/winex11.drv/winpos.c @@ -234,6 +234,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.@) */ BOOL X11DRV_SetWindowPos( HWND hwnd, HWND insert_after, const RECT *rectWindow, @@ -241,9 +290,8 @@ BOOL X11DRV_SetWindowPos( HWND hwnd, HWND insert_after, const RECT *rectWindow, { Display *display = thread_display(); struct x11drv_win_data *data; - RECT new_whole_rect, old_client_rect, visible_rect; - WND *win; - DWORD old_style, new_style, new_ex_style; + RECT new_whole_rect, visible_rect; + DWORD old_style, new_style; BOOL ret, make_managed = 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 (!(win = WIN_GetPtr( hwnd ))) return FALSE; - if (win == WND_DESKTOP || win == WND_OTHER_PROCESS) - { - 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 ((ret = set_server_window_pos( hwnd, insert_after, rectWindow, rectClient, swp_flags, + valid_rects, &visible_rect ))) { if (data->whole_window == DefaultRootWindow(gdi_display)) { 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; }
+ new_style = GetWindowLongW( hwnd, GWL_STYLE ); new_whole_rect = *rectWindow; X11DRV_window_to_X_rect( data, &new_whole_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))) { RECT rect; - UnionRect( &rect, rectWindow, &win->rectWindow ); + UnionRect( &rect, rectWindow, &data->window_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", 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 );
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; }