server: Add a request to return clipboard information.

Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Alexandre Julliard 2016-08-23 16:29:00 +09:00
parent b4991f20cb
commit 79d2e0a9be
6 changed files with 74 additions and 12 deletions

View File

@ -227,10 +227,9 @@ HWND WINAPI GetClipboardOwner(void)
{
HWND hWndOwner = 0;
SERVER_START_REQ( set_clipboard_info )
SERVER_START_REQ( get_clipboard_info )
{
req->flags = 0;
if (!wine_server_call_err( req )) hWndOwner = wine_server_ptr_handle( reply->old_owner );
if (!wine_server_call_err( req )) hWndOwner = wine_server_ptr_handle( reply->owner );
}
SERVER_END_REQ;
@ -247,10 +246,9 @@ HWND WINAPI GetOpenClipboardWindow(void)
{
HWND hWndOpen = 0;
SERVER_START_REQ( set_clipboard_info )
SERVER_START_REQ( get_clipboard_info )
{
req->flags = 0;
if (!wine_server_call_err( req )) hWndOpen = wine_server_ptr_handle( reply->old_clipboard );
if (!wine_server_call_err( req )) hWndOpen = wine_server_ptr_handle( reply->window );
}
SERVER_END_REQ;
@ -292,10 +290,9 @@ HWND WINAPI GetClipboardViewer(void)
{
HWND hWndViewer = 0;
SERVER_START_REQ( set_clipboard_info )
SERVER_START_REQ( get_clipboard_info )
{
req->flags = 0;
if (!wine_server_call_err( req )) hWndViewer = wine_server_ptr_handle( reply->old_viewer );
if (!wine_server_call_err( req )) hWndViewer = wine_server_ptr_handle( reply->viewer );
}
SERVER_END_REQ;
@ -461,9 +458,8 @@ DWORD WINAPI GetClipboardSequenceNumber(VOID)
{
DWORD seqno = 0;
SERVER_START_REQ( set_clipboard_info )
SERVER_START_REQ( get_clipboard_info )
{
req->flags = 0;
if (!wine_server_call_err( req )) seqno = reply->seqno;
}
SERVER_END_REQ;

View File

@ -4526,6 +4526,22 @@ struct empty_clipboard_reply
struct get_clipboard_info_request
{
struct request_header __header;
char __pad_12[4];
};
struct get_clipboard_info_reply
{
struct reply_header __header;
user_handle_t window;
user_handle_t owner;
user_handle_t viewer;
unsigned int seqno;
};
struct set_clipboard_viewer_request
{
struct request_header __header;
@ -5674,6 +5690,7 @@ enum request
REQ_close_clipboard,
REQ_set_clipboard_info,
REQ_empty_clipboard,
REQ_get_clipboard_info,
REQ_set_clipboard_viewer,
REQ_open_token,
REQ_set_global_windows,
@ -5957,6 +5974,7 @@ union generic_request
struct close_clipboard_request close_clipboard_request;
struct set_clipboard_info_request set_clipboard_info_request;
struct empty_clipboard_request empty_clipboard_request;
struct get_clipboard_info_request get_clipboard_info_request;
struct set_clipboard_viewer_request set_clipboard_viewer_request;
struct open_token_request open_token_request;
struct set_global_windows_request set_global_windows_request;
@ -6238,6 +6256,7 @@ union generic_reply
struct close_clipboard_reply close_clipboard_reply;
struct set_clipboard_info_reply set_clipboard_info_reply;
struct empty_clipboard_reply empty_clipboard_reply;
struct get_clipboard_info_reply get_clipboard_info_reply;
struct set_clipboard_viewer_reply set_clipboard_viewer_reply;
struct open_token_reply open_token_reply;
struct set_global_windows_reply set_global_windows_reply;
@ -6298,6 +6317,6 @@ union generic_reply
struct terminate_job_reply terminate_job_reply;
};
#define SERVER_PROTOCOL_VERSION 511
#define SERVER_PROTOCOL_VERSION 512
#endif /* __WINE_WINE_SERVER_PROTOCOL_H */

View File

@ -248,6 +248,20 @@ DECL_HANDLER(empty_clipboard)
}
/* Get clipboard information */
DECL_HANDLER(get_clipboard_info)
{
struct clipboard *clipboard = get_process_clipboard();
if (!clipboard) return;
reply->window = clipboard->open_win;
reply->owner = clipboard->owner_win;
reply->viewer = clipboard->viewer;
reply->seqno = get_seqno( clipboard );
}
/* set the clipboard viewer window */
DECL_HANDLER(set_clipboard_viewer)
{

View File

@ -3199,6 +3199,16 @@ enum caret_state
@END
/* Get clipboard information */
@REQ(get_clipboard_info)
@REPLY
user_handle_t window; /* clipboard window */
user_handle_t owner; /* clipboard owner */
user_handle_t viewer; /* clipboard viewer */
unsigned int seqno; /* current sequence number */
@END
/* Set the clipboard viewer window */
@REQ(set_clipboard_viewer)
user_handle_t viewer; /* clipboard viewer */

View File

@ -330,6 +330,7 @@ DECL_HANDLER(open_clipboard);
DECL_HANDLER(close_clipboard);
DECL_HANDLER(set_clipboard_info);
DECL_HANDLER(empty_clipboard);
DECL_HANDLER(get_clipboard_info);
DECL_HANDLER(set_clipboard_viewer);
DECL_HANDLER(open_token);
DECL_HANDLER(set_global_windows);
@ -612,6 +613,7 @@ static const req_handler req_handlers[REQ_NB_REQUESTS] =
(req_handler)req_close_clipboard,
(req_handler)req_set_clipboard_info,
(req_handler)req_empty_clipboard,
(req_handler)req_get_clipboard_info,
(req_handler)req_set_clipboard_viewer,
(req_handler)req_open_token,
(req_handler)req_set_global_windows,
@ -2035,6 +2037,12 @@ C_ASSERT( FIELD_OFFSET(struct set_clipboard_info_reply, old_viewer) == 20 );
C_ASSERT( FIELD_OFFSET(struct set_clipboard_info_reply, seqno) == 24 );
C_ASSERT( sizeof(struct set_clipboard_info_reply) == 32 );
C_ASSERT( sizeof(struct empty_clipboard_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, owner) == 12 );
C_ASSERT( FIELD_OFFSET(struct get_clipboard_info_reply, viewer) == 16 );
C_ASSERT( FIELD_OFFSET(struct get_clipboard_info_reply, seqno) == 20 );
C_ASSERT( sizeof(struct get_clipboard_info_reply) == 24 );
C_ASSERT( FIELD_OFFSET(struct set_clipboard_viewer_request, viewer) == 12 );
C_ASSERT( FIELD_OFFSET(struct set_clipboard_viewer_request, previous) == 16 );
C_ASSERT( sizeof(struct set_clipboard_viewer_request) == 24 );

View File

@ -3774,6 +3774,18 @@ static void dump_empty_clipboard_request( const struct empty_clipboard_request *
{
}
static void dump_get_clipboard_info_request( const struct get_clipboard_info_request *req )
{
}
static void dump_get_clipboard_info_reply( const struct get_clipboard_info_reply *req )
{
fprintf( stderr, " window=%08x", req->window );
fprintf( stderr, ", owner=%08x", req->owner );
fprintf( stderr, ", viewer=%08x", req->viewer );
fprintf( stderr, ", seqno=%08x", req->seqno );
}
static void dump_set_clipboard_viewer_request( const struct set_clipboard_viewer_request *req )
{
fprintf( stderr, " viewer=%08x", req->viewer );
@ -4613,6 +4625,7 @@ static const dump_func req_dumpers[REQ_NB_REQUESTS] = {
(dump_func)dump_close_clipboard_request,
(dump_func)dump_set_clipboard_info_request,
(dump_func)dump_empty_clipboard_request,
(dump_func)dump_get_clipboard_info_request,
(dump_func)dump_set_clipboard_viewer_request,
(dump_func)dump_open_token_request,
(dump_func)dump_set_global_windows_request,
@ -4892,6 +4905,7 @@ static const dump_func reply_dumpers[REQ_NB_REQUESTS] = {
(dump_func)dump_close_clipboard_reply,
(dump_func)dump_set_clipboard_info_reply,
NULL,
(dump_func)dump_get_clipboard_info_reply,
(dump_func)dump_set_clipboard_viewer_reply,
(dump_func)dump_open_token_reply,
(dump_func)dump_set_global_windows_reply,
@ -5171,6 +5185,7 @@ static const char * const req_names[REQ_NB_REQUESTS] = {
"close_clipboard",
"set_clipboard_info",
"empty_clipboard",
"get_clipboard_info",
"set_clipboard_viewer",
"open_token",
"set_global_windows",