server: Set the visible rect in the set_window_pos request again.

This essentially reverts 2f69329a37.
We really need the visible rect to be set atomically with the rest of
the window position info.
This commit is contained in:
Alexandre Julliard 2008-07-03 20:33:12 +02:00
parent 531ff0be26
commit 0f9484a124
6 changed files with 26 additions and 137 deletions

View File

@ -1880,7 +1880,7 @@ BOOL set_window_pos( HWND hwnd, HWND insert_after, UINT swp_flags,
{
WND *win;
BOOL ret;
RECT visible_rect, old_visible_rect, old_window_rect;
RECT visible_rect, old_window_rect;
visible_rect = *window_rect;
USER_Driver->pWindowPosChanging( hwnd, insert_after, swp_flags,
@ -1903,18 +1903,18 @@ BOOL set_window_pos( HWND hwnd, HWND insert_after, UINT swp_flags,
req->client.top = client_rect->top;
req->client.right = client_rect->right;
req->client.bottom = client_rect->bottom;
if (!IsRectEmpty( &valid_rects[0] ))
wine_server_add_data( req, valid_rects, 2 * sizeof(*valid_rects) );
if (memcmp( window_rect, &visible_rect, sizeof(RECT) ) || !IsRectEmpty( &valid_rects[0] ))
{
wine_server_add_data( req, &visible_rect, sizeof(visible_rect) );
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 = *window_rect;
win->rectClient = *client_rect;
old_visible_rect.left = reply->visible.left;
old_visible_rect.top = reply->visible.top;
old_visible_rect.right = reply->visible.right;
old_visible_rect.bottom = reply->visible.bottom;
}
}
SERVER_END_REQ;
@ -1922,23 +1922,6 @@ BOOL set_window_pos( HWND hwnd, HWND insert_after, UINT swp_flags,
if (ret)
{
if (memcmp( &visible_rect, &old_visible_rect, sizeof(RECT) ))
{
TRACE( "%p: need to update visible rect %s -> %s\n", hwnd,
wine_dbgstr_rect(&visible_rect), wine_dbgstr_rect(&old_visible_rect) );
SERVER_START_REQ( set_window_visible_rect )
{
req->handle = hwnd;
req->flags = swp_flags;
req->visible.left = visible_rect.left;
req->visible.top = visible_rect.top;
req->visible.right = visible_rect.right;
req->visible.bottom = visible_rect.bottom;
wine_server_call( req );
}
SERVER_END_REQ;
}
if (((swp_flags & SWP_AGG_NOPOSCHANGE) != SWP_AGG_NOPOSCHANGE) ||
(swp_flags & (SWP_HIDEWINDOW | SWP_SHOWWINDOW | SWP_STATECHANGED)))
invalidate_dce( hwnd, &old_window_rect );

View File

@ -2967,21 +2967,6 @@ struct set_window_pos_reply
struct reply_header __header;
unsigned int new_style;
unsigned int new_ex_style;
rectangle_t visible;
};
struct set_window_visible_rect_request
{
struct request_header __header;
unsigned int flags;
user_handle_t handle;
rectangle_t visible;
};
struct set_window_visible_rect_reply
{
struct reply_header __header;
};
@ -4434,7 +4419,6 @@ enum request
REQ_get_window_children_from_point,
REQ_get_window_tree,
REQ_set_window_pos,
REQ_set_window_visible_rect,
REQ_get_window_rectangles,
REQ_get_window_text,
REQ_set_window_text,
@ -4674,7 +4658,6 @@ union generic_request
struct get_window_children_from_point_request get_window_children_from_point_request;
struct get_window_tree_request get_window_tree_request;
struct set_window_pos_request set_window_pos_request;
struct set_window_visible_rect_request set_window_visible_rect_request;
struct get_window_rectangles_request get_window_rectangles_request;
struct get_window_text_request get_window_text_request;
struct set_window_text_request set_window_text_request;
@ -4912,7 +4895,6 @@ union generic_reply
struct get_window_children_from_point_reply get_window_children_from_point_reply;
struct get_window_tree_reply get_window_tree_reply;
struct set_window_pos_reply set_window_pos_reply;
struct set_window_visible_rect_reply set_window_visible_rect_reply;
struct get_window_rectangles_reply get_window_rectangles_reply;
struct get_window_text_reply get_window_text_reply;
struct set_window_text_reply set_window_text_reply;
@ -4997,6 +4979,6 @@ union generic_reply
struct add_fd_completion_reply add_fd_completion_reply;
};
#define SERVER_PROTOCOL_VERSION 340
#define SERVER_PROTOCOL_VERSION 341
#endif /* __WINE_WINE_SERVER_PROTOCOL_H */

View File

@ -2187,15 +2187,6 @@ enum message_type
@REPLY
unsigned int new_style; /* new window style */
unsigned int new_ex_style; /* new window extended style */
rectangle_t visible; /* new visible rectangle */
@END
/* Set the visible rectangle of a window */
@REQ(set_window_visible_rect)
unsigned int flags; /* SWP_* flags */
user_handle_t handle; /* handle to the window */
rectangle_t visible; /* visible rectangle */
@END

View File

@ -261,7 +261,6 @@ DECL_HANDLER(get_window_children);
DECL_HANDLER(get_window_children_from_point);
DECL_HANDLER(get_window_tree);
DECL_HANDLER(set_window_pos);
DECL_HANDLER(set_window_visible_rect);
DECL_HANDLER(get_window_rectangles);
DECL_HANDLER(get_window_text);
DECL_HANDLER(set_window_text);
@ -500,7 +499,6 @@ static const req_handler req_handlers[REQ_NB_REQUESTS] =
(req_handler)req_get_window_children_from_point,
(req_handler)req_get_window_tree,
(req_handler)req_set_window_pos,
(req_handler)req_set_window_visible_rect,
(req_handler)req_get_window_rectangles,
(req_handler)req_get_window_text,
(req_handler)req_set_window_text,

View File

@ -2721,17 +2721,7 @@ static void dump_set_window_pos_request( const struct set_window_pos_request *re
static void dump_set_window_pos_reply( const struct set_window_pos_reply *req )
{
fprintf( stderr, " new_style=%08x,", req->new_style );
fprintf( stderr, " new_ex_style=%08x,", req->new_ex_style );
fprintf( stderr, " visible=" );
dump_rectangle( &req->visible );
}
static void dump_set_window_visible_rect_request( const struct set_window_visible_rect_request *req )
{
fprintf( stderr, " flags=%08x,", req->flags );
fprintf( stderr, " handle=%p,", req->handle );
fprintf( stderr, " visible=" );
dump_rectangle( &req->visible );
fprintf( stderr, " new_ex_style=%08x", req->new_ex_style );
}
static void dump_get_window_rectangles_request( const struct get_window_rectangles_request *req )
@ -3934,7 +3924,6 @@ static const dump_func req_dumpers[REQ_NB_REQUESTS] = {
(dump_func)dump_get_window_children_from_point_request,
(dump_func)dump_get_window_tree_request,
(dump_func)dump_set_window_pos_request,
(dump_func)dump_set_window_visible_rect_request,
(dump_func)dump_get_window_rectangles_request,
(dump_func)dump_get_window_text_request,
(dump_func)dump_set_window_text_request,
@ -4170,7 +4159,6 @@ static const dump_func reply_dumpers[REQ_NB_REQUESTS] = {
(dump_func)dump_get_window_children_from_point_reply,
(dump_func)dump_get_window_tree_reply,
(dump_func)dump_set_window_pos_reply,
(dump_func)0,
(dump_func)dump_get_window_rectangles_reply,
(dump_func)dump_get_window_text_reply,
(dump_func)0,
@ -4406,7 +4394,6 @@ static const char * const req_names[REQ_NB_REQUESTS] = {
"get_window_children_from_point",
"get_window_tree",
"set_window_pos",
"set_window_visible_rect",
"get_window_rectangles",
"get_window_text",
"set_window_text",

View File

@ -1525,10 +1525,12 @@ static struct region *expose_window( struct window *win, const rectangle_t *old_
/* set the window and client rectangles, updating the update region if necessary */
static void set_window_pos( struct window *win, struct window *previous,
unsigned int swp_flags, const rectangle_t *window_rect,
const rectangle_t *client_rect, const rectangle_t *valid_rects )
const rectangle_t *client_rect, const rectangle_t *visible_rect,
const rectangle_t *valid_rects )
{
struct region *old_vis_rgn = NULL, *exposed_rgn = NULL;
const rectangle_t old_window_rect = win->window_rect;
const rectangle_t old_visible_rect = win->visible_rect;
const rectangle_t old_client_rect = win->client_rect;
rectangle_t rect;
int client_changed, frame_changed;
@ -1541,26 +1543,12 @@ static void set_window_pos( struct window *win, struct window *previous,
/* set the new window info before invalidating anything */
win->window_rect = *window_rect;
win->visible_rect = *visible_rect;
win->client_rect = *client_rect;
if (!(swp_flags & SWP_NOZORDER) && win->parent) link_window( win, previous );
if (swp_flags & SWP_SHOWWINDOW) win->style |= WS_VISIBLE;
else if (swp_flags & SWP_HIDEWINDOW) win->style &= ~WS_VISIBLE;
/* assume the visible rect stays at the same offset from the window rect */
win->visible_rect.left += window_rect->left - old_window_rect.left;
win->visible_rect.top += window_rect->top - old_window_rect.top;
win->visible_rect.right += window_rect->right - old_window_rect.right;
win->visible_rect.bottom += window_rect->bottom - old_window_rect.bottom;
/* but don't make it smaller than the client rect */
if (win->visible_rect.left > client_rect->left)
win->visible_rect.left = max( window_rect->left, client_rect->left );
if (win->visible_rect.top > client_rect->top)
win->visible_rect.top = max( window_rect->top, client_rect->top );
if (win->visible_rect.right < client_rect->right)
win->visible_rect.right = min( window_rect->right, client_rect->right );
if (win->visible_rect.bottom < client_rect->bottom)
win->visible_rect.bottom = min( window_rect->bottom, client_rect->bottom );
/* if the window is not visible, everything is easy */
if (!visible) return;
@ -1614,7 +1602,8 @@ static void set_window_pos( struct window *win, struct window *previous,
if (swp_flags & SWP_NOCOPYBITS)
{
frame_changed = ((swp_flags & SWP_FRAMECHANGED) ||
memcmp( window_rect, &old_window_rect, sizeof(old_window_rect) ));
memcmp( window_rect, &old_window_rect, sizeof(old_window_rect) ) ||
memcmp( visible_rect, &old_visible_rect, sizeof(old_visible_rect) ));
client_changed = memcmp( client_rect, &old_client_rect, sizeof(old_client_rect) );
}
else
@ -1624,7 +1613,11 @@ static void set_window_pos( struct window *win, struct window *previous,
int y_offset = window_rect->top - old_window_rect.top;
frame_changed = ((swp_flags & SWP_FRAMECHANGED) ||
window_rect->right - old_window_rect.right != x_offset ||
window_rect->bottom - old_window_rect.bottom != y_offset);
window_rect->bottom - old_window_rect.bottom != y_offset ||
visible_rect->left - old_visible_rect.left != x_offset ||
visible_rect->right - old_visible_rect.right != x_offset ||
visible_rect->top - old_visible_rect.top != y_offset ||
visible_rect->bottom - old_visible_rect.bottom != y_offset);
client_changed = (client_rect->left - old_client_rect.left != x_offset ||
client_rect->right - old_client_rect.right != x_offset ||
client_rect->top - old_client_rect.top != y_offset ||
@ -1672,45 +1665,6 @@ done:
clear_error(); /* we ignore out of memory errors once the new rects have been set */
}
/* set the window visible rect */
static void set_window_visible_rect( struct window *win, const rectangle_t *visible_rect,
unsigned int swp_flags )
{
struct region *old_vis_rgn = NULL, *exposed_rgn = NULL;
const rectangle_t old_visible_rect = win->visible_rect;
if (!memcmp( visible_rect, &old_visible_rect, sizeof(old_visible_rect) )) return;
/* if the window is not visible, everything is easy */
if (!is_visible( win ) || (swp_flags & SWP_NOREDRAW))
{
win->visible_rect = *visible_rect;
return;
}
if (!(old_vis_rgn = get_visible_region( win, DCX_WINDOW ))) return;
win->visible_rect = *visible_rect;
/* expose anything revealed by the change */
exposed_rgn = expose_window( win, &win->window_rect, old_vis_rgn );
if (exposed_rgn)
{
/* subtract the client rect from the total window rect */
set_region_rect( exposed_rgn, &win->window_rect );
set_region_rect( old_vis_rgn, &win->client_rect );
if (subtract_region( exposed_rgn, exposed_rgn, old_vis_rgn ))
{
if (!is_desktop_window(win))
offset_region( exposed_rgn, -win->client_rect.left, -win->client_rect.top );
redraw_window( win, exposed_rgn, 1, RDW_INVALIDATE | RDW_FRAME | RDW_NOCHILDREN );
}
free_region( exposed_rgn );
}
free_region( old_vis_rgn );
clear_error(); /* we ignore out of memory errors once the new rect has been set */
}
/* set the window region, updating the update region if necessary */
static void set_window_region( struct window *win, struct region *region, int redraw )
@ -2061,7 +2015,7 @@ DECL_HANDLER(get_window_tree)
/* set the position and Z order of a window */
DECL_HANDLER(set_window_pos)
{
const rectangle_t *valid_rects = NULL;
const rectangle_t *visible_rect = NULL, *valid_rects = NULL;
struct window *previous = NULL;
struct window *win = get_window( req->handle );
unsigned int flags = req->flags;
@ -2105,19 +2059,13 @@ DECL_HANDLER(set_window_pos)
return;
}
if (get_req_data_size() >= 2 * sizeof(rectangle_t)) valid_rects = get_req_data();
set_window_pos( win, previous, flags, &req->window, &req->client, valid_rects );
if (get_req_data_size() >= sizeof(rectangle_t)) visible_rect = get_req_data();
if (get_req_data_size() >= 3 * sizeof(rectangle_t)) valid_rects = visible_rect + 1;
if (!visible_rect) visible_rect = &req->window;
set_window_pos( win, previous, flags, &req->window, &req->client, visible_rect, valid_rects );
reply->new_style = win->style;
reply->new_ex_style = win->ex_style;
reply->visible = win->visible_rect;
}
/* set the visible rectangle of a window */
DECL_HANDLER(set_window_visible_rect)
{
struct window *win = get_window( req->handle );
if (win) set_window_visible_rect( win, &req->visible, req->flags );
}