Commit b308b9cb authored by Jacek Caban's avatar Jacek Caban Committed by Alexandre Julliard

win32u: Move NtUserSetWindowRgn implementation from user32.

parent 929052a9
......@@ -116,10 +116,6 @@ static void CDECL nulldrv_SetParent( HWND hwnd, HWND parent, HWND old_parent )
{
}
static void CDECL nulldrv_SetWindowRgn( HWND hwnd, HRGN hrgn, BOOL redraw )
{
}
static void CDECL nulldrv_SetWindowIcon( HWND hwnd, UINT type, HICON icon )
{
}
......@@ -196,11 +192,6 @@ static void CDECL loaderdrv_SetLayeredWindowAttributes( HWND hwnd, COLORREF key,
load_driver()->pSetLayeredWindowAttributes( hwnd, key, alpha, flags );
}
static void CDECL loaderdrv_SetWindowRgn( HWND hwnd, HRGN hrgn, BOOL redraw )
{
load_driver()->pSetWindowRgn( hwnd, hrgn, redraw );
}
static BOOL CDECL loaderdrv_UpdateLayeredWindow( HWND hwnd, const UPDATELAYEREDWINDOWINFO *info,
const RECT *window_rect )
{
......@@ -245,7 +236,7 @@ static struct user_driver_funcs lazy_load_driver =
nulldrv_SetFocus,
loaderdrv_SetLayeredWindowAttributes,
nulldrv_SetParent,
loaderdrv_SetWindowRgn,
NULL,
nulldrv_SetWindowIcon,
nulldrv_SetWindowStyle,
nulldrv_SetWindowText,
......@@ -292,7 +283,6 @@ void CDECL __wine_set_user_driver( const struct user_driver_funcs *funcs, UINT v
SET_USER_FUNC(SetFocus);
SET_USER_FUNC(SetLayeredWindowAttributes);
SET_USER_FUNC(SetParent);
SET_USER_FUNC(SetWindowRgn);
SET_USER_FUNC(SetWindowIcon);
SET_USER_FUNC(SetWindowStyle);
SET_USER_FUNC(SetWindowText);
......
......@@ -726,7 +726,7 @@
@ stdcall SetWindowLongW(long long long)
@ stdcall SetWindowPlacement(long ptr)
@ stdcall SetWindowPos(long long long long long long long)
@ stdcall SetWindowRgn(long long long)
@ stdcall SetWindowRgn(long long long) NtUserSetWindowRgn
@ stdcall SetWindowStationUser(long long)
@ stdcall SetWindowTextA(long str)
@ stdcall SetWindowTextW(long wstr)
......
......@@ -139,6 +139,7 @@ static const struct user_callbacks user_funcs =
RedrawWindow,
SendMessageTimeoutW,
SendMessageW,
SetWindowPos,
WaitForInputIdle,
WindowFromDC,
free_dce,
......
......@@ -123,61 +123,6 @@ int WINAPI GetWindowRgnBox( HWND hwnd, LPRECT prect )
return ret;
}
/***********************************************************************
* SetWindowRgn (USER32.@)
*/
int WINAPI SetWindowRgn( HWND hwnd, HRGN hrgn, BOOL bRedraw )
{
static const RECT empty_rect;
BOOL ret;
if (hrgn)
{
RGNDATA *data;
DWORD size;
if (!(size = GetRegionData( hrgn, 0, NULL ))) return FALSE;
if (!(data = HeapAlloc( GetProcessHeap(), 0, size ))) return FALSE;
if (!GetRegionData( hrgn, size, data ))
{
HeapFree( GetProcessHeap(), 0, data );
return FALSE;
}
SERVER_START_REQ( set_window_region )
{
req->window = wine_server_user_handle( hwnd );
req->redraw = (bRedraw != 0);
if (data->rdh.nCount)
wine_server_add_data( req, data->Buffer, data->rdh.nCount * sizeof(RECT) );
else
wine_server_add_data( req, &empty_rect, sizeof(empty_rect) );
ret = !wine_server_call_err( req );
}
SERVER_END_REQ;
HeapFree( GetProcessHeap(), 0, data );
}
else /* clear existing region */
{
SERVER_START_REQ( set_window_region )
{
req->window = wine_server_user_handle( hwnd );
req->redraw = (bRedraw != 0);
ret = !wine_server_call_err( req );
}
SERVER_END_REQ;
}
if (ret)
{
UINT swp_flags = SWP_NOSIZE|SWP_NOMOVE|SWP_NOZORDER|SWP_NOACTIVATE|SWP_FRAMECHANGED|SWP_NOCLIENTSIZE|SWP_NOCLIENTMOVE;
if (!bRedraw) swp_flags |= SWP_NOREDRAW;
USER_Driver->pSetWindowRgn( hwnd, hrgn, bRedraw );
SetWindowPos( hwnd, 0, 0, 0, 0, 0, swp_flags );
if (hrgn) DeleteObject( hrgn );
}
return ret;
}
/***********************************************************************
* GetClientRect (USER32.@)
......
......@@ -1137,6 +1137,11 @@ static void CDECL loaderdrv_FlashWindowEx( FLASHWINFO *info )
load_driver()->pFlashWindowEx( info );
}
static void CDECL loaderdrv_SetWindowRgn( HWND hwnd, HRGN hrgn, BOOL redraw )
{
load_driver()->pSetWindowRgn( hwnd, hrgn, redraw );
}
static const struct vulkan_funcs * CDECL loaderdrv_wine_get_vulkan_driver( UINT version )
{
return load_driver()->pwine_get_vulkan_driver( version );
......@@ -1169,6 +1174,7 @@ static const struct user_driver_funcs lazy_load_driver =
/* windowing functions */
.pCreateDesktopWindow = loaderdrv_CreateDesktopWindow,
.pFlashWindowEx = loaderdrv_FlashWindowEx,
.pSetWindowRgn = loaderdrv_SetWindowRgn,
.pMsgWaitForMultipleObjectsEx = nulldrv_MsgWaitForMultipleObjectsEx,
.pScrollDC = nulldrv_ScrollDC,
.pWindowMessage = nulldrv_WindowMessage,
......
......@@ -1188,6 +1188,8 @@ static struct unix_funcs unix_funcs =
NtUserSetCursorIconData,
NtUserSetCursorPos,
NtUserSetSysColors,
NtUserSetWindowPos,
NtUserSetWindowRgn,
NtUserShowCursor,
NtUserSystemParametersInfo,
NtUserSystemParametersInfoForDpi,
......
......@@ -33,6 +33,7 @@ struct user_callbacks
BOOL (WINAPI *pRedrawWindow)( HWND, const RECT*, HRGN, UINT );
LRESULT (WINAPI *pSendMessageTimeoutW)( HWND, UINT, WPARAM, LPARAM, UINT, UINT, PDWORD_PTR );
LRESULT (WINAPI *pSendMessageW)( HWND, UINT, WPARAM, LPARAM );
BOOL (WINAPI *pSetWindowPos)( HWND, HWND, INT, INT, INT, INT, UINT );
DWORD (WINAPI *pWaitForInputIdle)( HANDLE, DWORD );
HWND (WINAPI *pWindowFromDC)( HDC );
void (WINAPI *free_dce)( struct dce *dce, HWND hwnd );
......
......@@ -1249,8 +1249,8 @@
@ stub NtUserSetWindowLong
@ stub NtUserSetWindowLongPtr
@ stub NtUserSetWindowPlacement
@ stub NtUserSetWindowPos
@ stub NtUserSetWindowRgn
@ stdcall NtUserSetWindowPos(long long long long long long long)
@ stdcall NtUserSetWindowRgn(long long long)
@ stub NtUserSetWindowRgnEx
@ stub NtUserSetWindowShowState
@ stub NtUserSetWindowStationUser
......
......@@ -234,6 +234,8 @@ struct unix_funcs
UNICODE_STRING *res_name, struct cursoricon_desc *desc );
BOOL (WINAPI *pNtUserSetCursorPos)( INT x, INT y );
BOOL (WINAPI *pNtUserSetSysColors)( INT count, const INT *colors, const COLORREF *values );
BOOL (WINAPI *pNtUserSetWindowPos)( HWND hwnd, HWND after, INT x, INT y, INT cx, INT cy, UINT flags );
int (WINAPI *pNtUserSetWindowRgn)( HWND hwnd, HRGN hrgn, BOOL redraw );
INT (WINAPI *pNtUserShowCursor)( BOOL show );
BOOL (WINAPI *pNtUserSystemParametersInfo)( UINT action, UINT val, PVOID ptr, UINT winini );
BOOL (WINAPI *pNtUserSystemParametersInfoForDpi)( UINT action, UINT val, PVOID ptr,
......
......@@ -1211,6 +1211,71 @@ int WINAPI NtUserGetWindowRgnEx( HWND hwnd, HRGN hrgn, UINT unk )
return ret;
}
/***********************************************************************
* NtUserSetWindowRgn (win32u.@)
*/
int WINAPI NtUserSetWindowRgn( HWND hwnd, HRGN hrgn, BOOL redraw )
{
static const RECT empty_rect;
BOOL ret;
if (hrgn)
{
RGNDATA *data;
DWORD size;
if (!(size = NtGdiGetRegionData( hrgn, 0, NULL ))) return FALSE;
if (!(data = malloc( size ))) return FALSE;
if (!NtGdiGetRegionData( hrgn, size, data ))
{
free( data );
return FALSE;
}
SERVER_START_REQ( set_window_region )
{
req->window = wine_server_user_handle( hwnd );
req->redraw = redraw != 0;
if (data->rdh.nCount)
wine_server_add_data( req, data->Buffer, data->rdh.nCount * sizeof(RECT) );
else
wine_server_add_data( req, &empty_rect, sizeof(empty_rect) );
ret = !wine_server_call_err( req );
}
SERVER_END_REQ;
free( data );
}
else /* clear existing region */
{
SERVER_START_REQ( set_window_region )
{
req->window = wine_server_user_handle( hwnd );
req->redraw = redraw != 0;
ret = !wine_server_call_err( req );
}
SERVER_END_REQ;
}
if (ret)
{
UINT swp_flags = SWP_NOSIZE|SWP_NOMOVE|SWP_NOZORDER|SWP_NOACTIVATE|SWP_FRAMECHANGED|
SWP_NOCLIENTSIZE|SWP_NOCLIENTMOVE;
if (!redraw) swp_flags |= SWP_NOREDRAW;
user_driver->pSetWindowRgn( hwnd, hrgn, redraw );
NtUserSetWindowPos( hwnd, 0, 0, 0, 0, 0, swp_flags );
if (hrgn) NtGdiDeleteObjectApp( hrgn );
}
return ret;
}
/*******************************************************************
* NtUserSetWindowPos (win32u.@)
*/
BOOL WINAPI NtUserSetWindowPos( HWND hwnd, HWND after, INT x, INT y, INT cx, INT cy, UINT flags )
{
/* FIXME: move implementation from user32 */
return user_callbacks && user_callbacks->pSetWindowPos( hwnd, after, x, y, cx, cy, flags );
}
/*****************************************************************************
* NtUserGetLayeredWindowAttributes (win32u.@)
*/
......
......@@ -940,6 +940,18 @@ BOOL WINAPI NtUserSetSysColors( INT count, const INT *colors, const COLORREF *va
return unix_funcs->pNtUserSetSysColors( count, colors, values );
}
BOOL WINAPI NtUserSetWindowPos( HWND hwnd, HWND after, INT x, INT y, INT cx, INT cy, UINT flags )
{
if (!unix_funcs) return 0;
return unix_funcs->pNtUserSetWindowPos( hwnd, after, x, y, cx, cy, flags );
}
int WINAPI NtUserSetWindowRgn( HWND hwnd, HRGN hrgn, BOOL redraw )
{
if (!unix_funcs) return 0;
return unix_funcs->pNtUserSetWindowRgn( hwnd, hrgn, redraw );
}
INT WINAPI NtUserShowCursor( BOOL show )
{
if (!unix_funcs) return 0;
......
......@@ -367,6 +367,8 @@ BOOL WINAPI NtUserSetProcessWindowStation( HWINSTA handle );
BOOL WINAPI NtUserSetProp( HWND hwnd, const WCHAR *str, HANDLE handle );
BOOL WINAPI NtUserSetSysColors( INT count, const INT *colors, const COLORREF *values );
BOOL WINAPI NtUserSetThreadDesktop( HDESK handle );
BOOL WINAPI NtUserSetWindowPos( HWND hwnd, HWND after, INT x, INT y, INT cx, INT cy, UINT flags );
int WINAPI NtUserSetWindowRgn( HWND hwnd, HRGN hrgn, BOOL redraw );
HHOOK WINAPI NtUserSetWindowsHookEx( HINSTANCE inst, UNICODE_STRING *module, DWORD tid, INT id,
HOOKPROC proc, BOOL ansi );
HWINEVENTHOOK WINAPI NtUserSetWinEventHook( DWORD event_min, DWORD event_max, HMODULE inst,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment