wineandroid: Implement SetLayeredWindowAttributes.

Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Alexandre Julliard 2017-06-07 11:26:37 +02:00
parent d61bcb9a2f
commit 52f53fe82e
2 changed files with 65 additions and 0 deletions

View File

@ -761,6 +761,27 @@ failed:
return NULL; return NULL;
} }
/***********************************************************************
* set_surface_layered
*/
static void set_surface_layered( struct window_surface *window_surface, BYTE alpha, COLORREF color_key )
{
struct android_window_surface *surface = get_android_surface( window_surface );
COLORREF prev_key;
BYTE prev_alpha;
if (window_surface->funcs != &android_surface_funcs) return; /* we may get the null surface */
window_surface->funcs->lock( window_surface );
prev_key = surface->color_key;
prev_alpha = surface->alpha;
surface->alpha = alpha;
set_color_key( surface, color_key );
if (alpha != prev_alpha || surface->color_key != prev_key) /* refresh */
*window_surface->funcs->get_bounds( window_surface ) = surface->header.rect;
window_surface->funcs->unlock( window_surface );
}
static WNDPROC desktop_orig_wndproc; static WNDPROC desktop_orig_wndproc;
@ -977,6 +998,30 @@ void CDECL ANDROID_WindowPosChanged( HWND hwnd, HWND insert_after, UINT swp_flag
} }
/***********************************************************************
* ANDROID_SetWindowStyle
*/
void CDECL ANDROID_SetWindowStyle( HWND hwnd, INT offset, STYLESTRUCT *style )
{
struct android_win_data *data;
DWORD changed = style->styleNew ^ style->styleOld;
if (hwnd == GetDesktopWindow()) return;
if (!(data = get_win_data( hwnd ))) return;
if (offset == GWL_EXSTYLE && (changed & WS_EX_LAYERED)) /* changing WS_EX_LAYERED resets attributes */
{
if (is_argb_surface( data->surface ))
{
if (data->surface) window_surface_release( data->surface );
data->surface = NULL;
}
else if (data->surface) set_surface_layered( data->surface, 255, CLR_INVALID );
}
release_win_data( data );
}
/*********************************************************************** /***********************************************************************
* ANDROID_SetWindowRgn * ANDROID_SetWindowRgn
*/ */
@ -993,6 +1038,24 @@ void CDECL ANDROID_SetWindowRgn( HWND hwnd, HRGN hrgn, BOOL redraw )
} }
/***********************************************************************
* ANDROID_SetLayeredWindowAttributes
*/
void CDECL ANDROID_SetLayeredWindowAttributes( HWND hwnd, COLORREF key, BYTE alpha, DWORD flags )
{
struct android_win_data *data;
if (!(flags & LWA_ALPHA)) alpha = 255;
if (!(flags & LWA_COLORKEY)) key = CLR_INVALID;
if ((data = get_win_data( hwnd )))
{
if (data->surface) set_surface_layered( data->surface, alpha, key );
release_win_data( data );
}
}
/********************************************************************** /**********************************************************************
* ANDROID_WindowMessage * ANDROID_WindowMessage
*/ */

View File

@ -9,7 +9,9 @@
@ cdecl CreateWindow(long) ANDROID_CreateWindow @ cdecl CreateWindow(long) ANDROID_CreateWindow
@ cdecl DestroyWindow(long) ANDROID_DestroyWindow @ cdecl DestroyWindow(long) ANDROID_DestroyWindow
@ cdecl MsgWaitForMultipleObjectsEx(long ptr long long long) ANDROID_MsgWaitForMultipleObjectsEx @ cdecl MsgWaitForMultipleObjectsEx(long ptr long long long) ANDROID_MsgWaitForMultipleObjectsEx
@ cdecl SetLayeredWindowAttributes(long long long long) ANDROID_SetLayeredWindowAttributes
@ cdecl SetWindowRgn(long long long) ANDROID_SetWindowRgn @ cdecl SetWindowRgn(long long long) ANDROID_SetWindowRgn
@ cdecl SetWindowStyle(ptr long ptr) ANDROID_SetWindowStyle
@ cdecl WindowMessage(long long long long) ANDROID_WindowMessage @ cdecl WindowMessage(long long long long) ANDROID_WindowMessage
@ cdecl WindowPosChanging(long long long ptr ptr ptr ptr) ANDROID_WindowPosChanging @ cdecl WindowPosChanging(long long long ptr ptr ptr ptr) ANDROID_WindowPosChanging
@ cdecl WindowPosChanged(long long long ptr ptr ptr ptr ptr) ANDROID_WindowPosChanged @ cdecl WindowPosChanged(long long long ptr ptr ptr ptr ptr) ANDROID_WindowPosChanged