user32: Implemented UpdateLayeredWindow and UpdateLayeredWindowIndirect.

This commit is contained in:
Alexandre Julliard 2008-09-16 16:30:19 +02:00
parent aef7723c3e
commit e4cba25ac7
3 changed files with 80 additions and 8 deletions

View File

@ -727,6 +727,7 @@
# @ stub UnregisterMessagePumpHook # @ stub UnregisterMessagePumpHook
# @ stub UnregisterUserApiHook # @ stub UnregisterUserApiHook
@ stdcall UpdateLayeredWindow(long long ptr ptr long ptr long ptr long) @ stdcall UpdateLayeredWindow(long long ptr ptr long ptr long ptr long)
@ stdcall UpdateLayeredWindowIndirect(long ptr)
@ stub UpdatePerUserSystemParameters @ stub UpdatePerUserSystemParameters
@ stdcall UpdateWindow(long) @ stdcall UpdateWindow(long)
@ stdcall User32InitializeImmEntryTable(ptr) @ stdcall User32InitializeImmEntryTable(ptr)

View File

@ -3368,6 +3368,66 @@ BOOL WINAPI GetLayeredWindowAttributes( HWND hwnd, COLORREF *key, BYTE *alpha, D
return ret; return ret;
} }
/*****************************************************************************
* UpdateLayeredWindowIndirect (USER32.@)
*/
BOOL WINAPI UpdateLayeredWindowIndirect( HWND hwnd, const UPDATELAYEREDWINDOWINFO *info )
{
BYTE alpha = 0xff;
if (!(info->dwFlags & ULW_EX_NORESIZE) && (info->pptDst || info->psize))
{
int x = 0, y = 0, cx = 0, cy = 0;
DWORD flags = SWP_NOSIZE | SWP_NOMOVE | SWP_NOZORDER | SWP_NOACTIVATE | SWP_NOREDRAW | SWP_NOSENDCHANGING;
if (info->pptDst)
{
x = info->pptDst->x;
y = info->pptDst->y;
flags &= ~SWP_NOMOVE;
}
if (info->psize)
{
cx = info->psize->cx;
cy = info->psize->cy;
flags &= ~SWP_NOSIZE;
}
TRACE( "moving window %p pos %d,%d %dx%x\n", hwnd, x, y, cx, cy );
SetWindowPos( hwnd, 0, x, y, cx, cy, flags );
}
if (info->hdcSrc)
{
RECT rect;
HDC hdc = GetDCEx( hwnd, 0, DCX_CACHE );
if (hdc)
{
int x = 0, y = 0;
GetClientRect( hwnd, &rect );
if (info->pptSrc)
{
x = info->pptSrc->x;
y = info->pptSrc->y;
}
/* FIXME: intersect rect with info->prcDirty */
TRACE( "copying window %p pos %d,%d\n", hwnd, x, y );
BitBlt( hdc, rect.left, rect.top, rect.right, rect.bottom,
info->hdcSrc, rect.left + x, rect.top + y, SRCCOPY );
ReleaseDC( hwnd, hdc );
}
}
if (info->pblend && !(info->dwFlags & ULW_OPAQUE)) alpha = info->pblend->SourceConstantAlpha;
TRACE( "setting window %p alpha %u\n", hwnd, alpha );
USER_Driver->pSetLayeredWindowAttributes( hwnd, info->crKey, alpha,
info->dwFlags & (LWA_ALPHA | LWA_COLORKEY) );
return TRUE;
}
/***************************************************************************** /*****************************************************************************
* UpdateLayeredWindow (USER32.@) * UpdateLayeredWindow (USER32.@)
*/ */
@ -3375,14 +3435,19 @@ BOOL WINAPI UpdateLayeredWindow( HWND hwnd, HDC hdcDst, POINT *pptDst, SIZE *psi
HDC hdcSrc, POINT *pptSrc, COLORREF crKey, BLENDFUNCTION *pblend, HDC hdcSrc, POINT *pptSrc, COLORREF crKey, BLENDFUNCTION *pblend,
DWORD dwFlags) DWORD dwFlags)
{ {
static int once; UPDATELAYEREDWINDOWINFO info;
if (!once)
{ info.cbSize = sizeof(info);
once = 1; info.hdcDst = hdcDst;
FIXME("(%p,%p,%p,%p,%p,%p,0x%08x,%p,%d): stub!\n", info.pptDst = pptDst;
hwnd, hdcDst, pptDst, psize, hdcSrc, pptSrc, crKey, pblend, dwFlags); info.psize = psize;
} info.hdcSrc = hdcSrc;
return 0; info.pptSrc = pptSrc;
info.crKey = crKey;
info.pblend = pblend;
info.dwFlags = dwFlags;
info.prcDirty = NULL;
return UpdateLayeredWindowIndirect( hwnd, &info );
} }
/* 64bit versions */ /* 64bit versions */

View File

@ -3300,6 +3300,12 @@ typedef struct {
#define LWA_COLORKEY 0x00000001 #define LWA_COLORKEY 0x00000001
#define LWA_ALPHA 0x00000002 #define LWA_ALPHA 0x00000002
/* UpdateLayeredWindow() flags */
#define ULW_COLORKEY 0x00000001
#define ULW_ALPHA 0x00000002
#define ULW_OPAQUE 0x00000004
#define ULW_EX_NORESIZE 0x00000008
/* ShowWindow() codes */ /* ShowWindow() codes */
#define SW_HIDE 0 #define SW_HIDE 0
#define SW_SHOWNORMAL 1 #define SW_SHOWNORMAL 1