server: Return the owner window in the release_clipboard request.

Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Alexandre Julliard 2016-09-14 15:20:54 +09:00
parent c1f62c8985
commit 2bf890d95f
6 changed files with 16 additions and 7 deletions

View File

@ -453,18 +453,22 @@ static UINT get_clipboard_flags(void)
*/ */
void CLIPBOARD_ReleaseOwner( HWND hwnd ) void CLIPBOARD_ReleaseOwner( HWND hwnd )
{ {
HWND viewer = 0; HWND viewer = 0, owner = 0;
SendMessageW( hwnd, WM_RENDERALLFORMATS, 0, 0 ); SendMessageW( hwnd, WM_RENDERALLFORMATS, 0, 0 );
SERVER_START_REQ( release_clipboard ) SERVER_START_REQ( release_clipboard )
{ {
req->owner = wine_server_user_handle( hwnd ); req->owner = wine_server_user_handle( hwnd );
if (!wine_server_call( req )) viewer = wine_server_ptr_handle( reply->viewer ); if (!wine_server_call( req ))
{
viewer = wine_server_ptr_handle( reply->viewer );
owner = wine_server_ptr_handle( reply->owner );
}
} }
SERVER_END_REQ; SERVER_END_REQ;
if (viewer) SendNotifyMessageW( viewer, WM_DRAWCLIPBOARD, (WPARAM)GetClipboardOwner(), 0 ); if (viewer) SendNotifyMessageW( viewer, WM_DRAWCLIPBOARD, (WPARAM)owner, 0 );
} }

View File

@ -4536,7 +4536,7 @@ struct release_clipboard_reply
{ {
struct reply_header __header; struct reply_header __header;
user_handle_t viewer; user_handle_t viewer;
char __pad_12[4]; user_handle_t owner;
}; };
@ -6365,6 +6365,6 @@ union generic_reply
struct terminate_job_reply terminate_job_reply; struct terminate_job_reply terminate_job_reply;
}; };
#define SERVER_PROTOCOL_VERSION 515 #define SERVER_PROTOCOL_VERSION 516
#endif /* __WINE_WINE_SERVER_PROTOCOL_H */ #endif /* __WINE_WINE_SERVER_PROTOCOL_H */

View File

@ -353,9 +353,11 @@ DECL_HANDLER(release_clipboard)
if (!(owner = get_valid_window_handle( req->owner ))) return; if (!(owner = get_valid_window_handle( req->owner ))) return;
if (clipboard->owner_win == owner) if (clipboard->owner_win == owner)
{
reply->viewer = release_clipboard( clipboard ); reply->viewer = release_clipboard( clipboard );
else reply->owner = clipboard->owner_win;
set_error( STATUS_INVALID_OWNER ); }
else set_error( STATUS_INVALID_OWNER );
} }

View File

@ -3205,6 +3205,7 @@ enum caret_state
user_handle_t owner; /* clipboard owner to release */ user_handle_t owner; /* clipboard owner to release */
@REPLY @REPLY
user_handle_t viewer; /* first clipboard viewer */ user_handle_t viewer; /* first clipboard viewer */
user_handle_t owner; /* current clipboard owner */
@END @END

View File

@ -2046,6 +2046,7 @@ C_ASSERT( sizeof(struct empty_clipboard_request) == 16 );
C_ASSERT( FIELD_OFFSET(struct release_clipboard_request, owner) == 12 ); C_ASSERT( FIELD_OFFSET(struct release_clipboard_request, owner) == 12 );
C_ASSERT( sizeof(struct release_clipboard_request) == 16 ); C_ASSERT( sizeof(struct release_clipboard_request) == 16 );
C_ASSERT( FIELD_OFFSET(struct release_clipboard_reply, viewer) == 8 ); C_ASSERT( FIELD_OFFSET(struct release_clipboard_reply, viewer) == 8 );
C_ASSERT( FIELD_OFFSET(struct release_clipboard_reply, owner) == 12 );
C_ASSERT( sizeof(struct release_clipboard_reply) == 16 ); C_ASSERT( sizeof(struct release_clipboard_reply) == 16 );
C_ASSERT( sizeof(struct get_clipboard_info_request) == 16 ); C_ASSERT( sizeof(struct get_clipboard_info_request) == 16 );
C_ASSERT( FIELD_OFFSET(struct get_clipboard_info_reply, window) == 8 ); C_ASSERT( FIELD_OFFSET(struct get_clipboard_info_reply, window) == 8 );

View File

@ -3782,6 +3782,7 @@ static void dump_release_clipboard_request( const struct release_clipboard_reque
static void dump_release_clipboard_reply( const struct release_clipboard_reply *req ) static void dump_release_clipboard_reply( const struct release_clipboard_reply *req )
{ {
fprintf( stderr, " viewer=%08x", req->viewer ); fprintf( stderr, " viewer=%08x", req->viewer );
fprintf( stderr, ", owner=%08x", req->owner );
} }
static void dump_get_clipboard_info_request( const struct get_clipboard_info_request *req ) static void dump_get_clipboard_info_request( const struct get_clipboard_info_request *req )