server: Implemented the server side of Get/SetLayeredWindowAttributes.

This commit is contained in:
Alexandre Julliard 2008-09-12 15:30:47 +02:00
parent 2f11213168
commit 05b4181cac
6 changed files with 161 additions and 9 deletions

View File

@ -3321,21 +3321,46 @@ BOOL WINAPI SwitchDesktop( HDESK hDesktop)
/*****************************************************************************
* SetLayeredWindowAttributes (USER32.@)
*/
BOOL WINAPI SetLayeredWindowAttributes( HWND hWnd, COLORREF rgbKey,
BYTE bAlpha, DWORD dwFlags )
BOOL WINAPI SetLayeredWindowAttributes( HWND hwnd, COLORREF key, BYTE alpha, DWORD flags )
{
FIXME("(%p,0x%.8x,%d,%d): stub!\n", hWnd, rgbKey, bAlpha, dwFlags);
return TRUE;
BOOL ret;
FIXME("(%p,%08x,%d,%x): stub!\n", hwnd, key, alpha, flags);
SERVER_START_REQ( set_window_layered_info )
{
req->handle = hwnd;
req->color_key = key;
req->alpha = alpha;
req->flags = flags;
ret = !wine_server_call_err( req );
}
SERVER_END_REQ;
return ret;
}
/*****************************************************************************
* GetLayeredWindowAttributes (USER32.@)
*/
BOOL WINAPI GetLayeredWindowAttributes( HWND hWnd, COLORREF *prgbKey,
BYTE *pbAlpha, DWORD *pdwFlags )
BOOL WINAPI GetLayeredWindowAttributes( HWND hwnd, COLORREF *key, BYTE *alpha, DWORD *flags )
{
FIXME("(%p,%p,%p,%p): stub!\n", hWnd, prgbKey, pbAlpha, pdwFlags);
return FALSE;
BOOL ret;
SERVER_START_REQ( get_window_layered_info )
{
req->handle = hwnd;
if ((ret = !wine_server_call_err( req )))
{
if (key) *key = reply->color_key;
if (alpha) *alpha = reply->alpha;
if (flags) *flags = reply->flags;
}
}
SERVER_END_REQ;
return ret;
}
/*****************************************************************************

View File

@ -4267,6 +4267,36 @@ struct add_fd_completion_reply
};
struct get_window_layered_info_request
{
struct request_header __header;
user_handle_t handle;
};
struct get_window_layered_info_reply
{
struct reply_header __header;
unsigned int color_key;
unsigned int alpha;
unsigned int flags;
};
struct set_window_layered_info_request
{
struct request_header __header;
user_handle_t handle;
unsigned int color_key;
unsigned int alpha;
unsigned int flags;
};
struct set_window_layered_info_reply
{
struct reply_header __header;
};
enum request
{
REQ_new_process,
@ -4501,6 +4531,8 @@ enum request
REQ_query_completion,
REQ_set_completion_info,
REQ_add_fd_completion,
REQ_get_window_layered_info,
REQ_set_window_layered_info,
REQ_NB_REQUESTS
};
@ -4740,6 +4772,8 @@ union generic_request
struct query_completion_request query_completion_request;
struct set_completion_info_request set_completion_info_request;
struct add_fd_completion_request add_fd_completion_request;
struct get_window_layered_info_request get_window_layered_info_request;
struct set_window_layered_info_request set_window_layered_info_request;
};
union generic_reply
{
@ -4977,8 +5011,10 @@ union generic_reply
struct query_completion_reply query_completion_reply;
struct set_completion_info_reply set_completion_info_reply;
struct add_fd_completion_reply add_fd_completion_reply;
struct get_window_layered_info_reply get_window_layered_info_reply;
struct set_window_layered_info_reply set_window_layered_info_reply;
};
#define SERVER_PROTOCOL_VERSION 341
#define SERVER_PROTOCOL_VERSION 342
#endif /* __WINE_WINE_SERVER_PROTOCOL_H */

View File

@ -3058,3 +3058,22 @@ enum message_type
unsigned int status; /* completion status */
unsigned long information; /* IO_STATUS_BLOCK Information */
@END
/* Retrieve layered info for a window */
@REQ(get_window_layered_info)
user_handle_t handle; /* handle to the window */
@REPLY
unsigned int color_key; /* color key */
unsigned int alpha; /* alpha (0..255) */
unsigned int flags; /* LWA_* flags */
@END
/* Set layered info for a window */
@REQ(set_window_layered_info)
user_handle_t handle; /* handle to the window */
unsigned int color_key; /* color key */
unsigned int alpha; /* alpha (0..255) */
unsigned int flags; /* LWA_* flags */
@END

View File

@ -343,6 +343,8 @@ DECL_HANDLER(remove_completion);
DECL_HANDLER(query_completion);
DECL_HANDLER(set_completion_info);
DECL_HANDLER(add_fd_completion);
DECL_HANDLER(get_window_layered_info);
DECL_HANDLER(set_window_layered_info);
#ifdef WANT_REQUEST_HANDLERS
@ -581,6 +583,8 @@ static const req_handler req_handlers[REQ_NB_REQUESTS] =
(req_handler)req_query_completion,
(req_handler)req_set_completion_info,
(req_handler)req_add_fd_completion,
(req_handler)req_get_window_layered_info,
(req_handler)req_set_window_layered_info,
};
#endif /* WANT_REQUEST_HANDLERS */

View File

@ -3773,6 +3773,26 @@ static void dump_add_fd_completion_request( const struct add_fd_completion_reque
fprintf( stderr, " information=%lx", req->information );
}
static void dump_get_window_layered_info_request( const struct get_window_layered_info_request *req )
{
fprintf( stderr, " handle=%p", req->handle );
}
static void dump_get_window_layered_info_reply( const struct get_window_layered_info_reply *req )
{
fprintf( stderr, " color_key=%08x,", req->color_key );
fprintf( stderr, " alpha=%08x,", req->alpha );
fprintf( stderr, " flags=%08x", req->flags );
}
static void dump_set_window_layered_info_request( const struct set_window_layered_info_request *req )
{
fprintf( stderr, " handle=%p,", req->handle );
fprintf( stderr, " color_key=%08x,", req->color_key );
fprintf( stderr, " alpha=%08x,", req->alpha );
fprintf( stderr, " flags=%08x", req->flags );
}
static const dump_func req_dumpers[REQ_NB_REQUESTS] = {
(dump_func)dump_new_process_request,
(dump_func)dump_get_new_process_info_request,
@ -4006,6 +4026,8 @@ static const dump_func req_dumpers[REQ_NB_REQUESTS] = {
(dump_func)dump_query_completion_request,
(dump_func)dump_set_completion_info_request,
(dump_func)dump_add_fd_completion_request,
(dump_func)dump_get_window_layered_info_request,
(dump_func)dump_set_window_layered_info_request,
};
static const dump_func reply_dumpers[REQ_NB_REQUESTS] = {
@ -4241,6 +4263,8 @@ static const dump_func reply_dumpers[REQ_NB_REQUESTS] = {
(dump_func)dump_query_completion_reply,
(dump_func)0,
(dump_func)0,
(dump_func)dump_get_window_layered_info_reply,
(dump_func)0,
};
static const char * const req_names[REQ_NB_REQUESTS] = {
@ -4476,6 +4500,8 @@ static const char * const req_names[REQ_NB_REQUESTS] = {
"query_completion",
"set_completion_info",
"add_fd_completion",
"get_window_layered_info",
"set_window_layered_info",
};
static const struct

View File

@ -79,6 +79,10 @@ struct window
void* instance; /* creator instance */
unsigned int is_unicode : 1; /* ANSI or unicode */
unsigned int is_linked : 1; /* is it linked into the parent z-order list? */
unsigned int is_layered : 1; /* has layered info been set? */
unsigned int color_key; /* color key for a layered window */
unsigned int alpha; /* alpha value for a layered window */
unsigned int layered_flags; /* flags for a layered window */
unsigned long user_data; /* user-specific data */
WCHAR *text; /* window caption text */
unsigned int paint_flags; /* various painting flags */
@ -479,6 +483,7 @@ static struct window *create_window( struct window *parent, struct window *owner
win->instance = NULL;
win->is_unicode = 1;
win->is_linked = 0;
win->is_layered = 0;
win->user_data = 0;
win->text = NULL;
win->paint_flags = 0;
@ -1873,6 +1878,7 @@ DECL_HANDLER(set_window_info)
/* WS_EX_TOPMOST can only be changed for unlinked windows */
if (!win->is_linked) win->ex_style = req->ex_style;
else win->ex_style = (req->ex_style & ~WS_EX_TOPMOST) | (win->ex_style & WS_EX_TOPMOST);
if (!(win->ex_style & WS_EX_LAYERED)) win->is_layered = 0;
}
if (req->flags & SET_WIN_ID) win->id = req->id;
if (req->flags & SET_WIN_INSTANCE) win->instance = req->instance;
@ -2468,3 +2474,39 @@ DECL_HANDLER(set_global_windows)
progman_window = new_progman_window;
taskman_window = new_taskman_window;
}
/* retrieve layered info for a window */
DECL_HANDLER(get_window_layered_info)
{
struct window *win = get_window( req->handle );
if (!win) return;
if (win->is_layered)
{
reply->color_key = win->color_key;
reply->alpha = win->alpha;
reply->flags = win->layered_flags;
}
else set_win32_error( ERROR_INVALID_WINDOW_HANDLE );
}
/* set layered info for a window */
DECL_HANDLER(set_window_layered_info)
{
struct window *win = get_window( req->handle );
if (!win) return;
if (win->ex_style & WS_EX_LAYERED)
{
if (req->flags & LWA_ALPHA) win->alpha = req->alpha;
else if (!win->is_layered) win->alpha = 0; /* alpha init value is 0 */
win->color_key = req->color_key;
win->layered_flags = req->flags;
win->is_layered = 1;
}
else set_win32_error( ERROR_INVALID_WINDOW_HANDLE );
}