win32u: Use NtUserCallOneParam instead of GDIRealizePalette.

Signed-off-by: Jacek Caban <jacek@codeweavers.com>
Signed-off-by: Huw Davies <huw@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Jacek Caban 2021-12-03 12:56:30 +01:00 committed by Alexandre Julliard
parent 72e3c91380
commit 41eac6e25c
9 changed files with 46 additions and 16 deletions

View File

@ -22,7 +22,7 @@
*/
#include "gdi_private.h"
#include "winternl.h"
#include "ntuser.h"
#include "ddrawgdi.h"
#include "winnls.h"
@ -2090,12 +2090,16 @@ BOOL WINAPI ScaleWindowExtEx( HDC hdc, INT x_num, INT x_denom,
return NtGdiScaleWindowExtEx( hdc, x_num, x_denom, y_num, y_denom, size );
}
static UINT WINAPI realize_palette( HDC hdc )
{
return NtUserCallOneParam( HandleToUlong(hdc), NtUserRealizePalette );
}
/* Pointers to USER implementation of SelectPalette/RealizePalette */
/* they will be patched by USER on startup */
extern HPALETTE WINAPI GDISelectPalette( HDC hdc, HPALETTE hpal, WORD wBkg );
extern UINT WINAPI GDIRealizePalette( HDC hdc );
HPALETTE (WINAPI *pfnSelectPalette)( HDC hdc, HPALETTE hpal, WORD bkgnd ) = GDISelectPalette;
UINT (WINAPI *pfnRealizePalette)( HDC hdc ) = GDIRealizePalette;
UINT (WINAPI *pfnRealizePalette)( HDC hdc ) = realize_palette;
/***********************************************************************
* SelectPalette (GDI32.@)

View File

@ -1168,6 +1168,7 @@ static struct unix_funcs unix_funcs =
NtGdiUpdateColors,
NtGdiWidenPath,
NtUserActivateKeyboardLayout,
NtUserCallOneParam,
NtUserCallTwoParam,
NtUserChangeDisplaySettings,
NtUserCountClipboardFormats,
@ -1187,7 +1188,6 @@ static struct unix_funcs unix_funcs =
NtUserUnregisterHotKey,
NtUserVkKeyScanEx,
GDIRealizePalette,
GDISelectPalette,
GetDCHook,
MirrorRgn,

View File

@ -403,6 +403,7 @@ extern HPALETTE WINAPI GDISelectPalette( HDC hdc, HPALETTE hpal, WORD wBkg) DECL
extern HPALETTE PALETTE_Init(void) DECLSPEC_HIDDEN;
extern UINT get_palette_entries( HPALETTE hpalette, UINT start, UINT count,
PALETTEENTRY *entries ) DECLSPEC_HIDDEN;
extern UINT realize_palette( HDC hdc ) DECLSPEC_HIDDEN;
/* pen.c */
extern HPEN create_pen( INT style, INT width, COLORREF color ) DECLSPEC_HIDDEN;

View File

@ -539,16 +539,17 @@ HPALETTE WINAPI GDISelectPalette( HDC hdc, HPALETTE hpal, WORD wBkg)
/***********************************************************************
* GDIRealizePalette (Not a Windows API)
* realize_palette
*/
UINT WINAPI GDIRealizePalette( HDC hdc )
UINT realize_palette( HDC hdc )
{
UINT realized = 0;
DC* dc = get_dc_ptr( hdc );
TRACE( "%p\n", hdc );
if (!dc) return 0;
TRACE("%p...\n", hdc );
/* FIXME: move primary palette handling from user32 */
if( dc->hPalette == get_stock_object( DEFAULT_PALETTE ))
{

View File

@ -1657,6 +1657,24 @@ void sysparams_init(void)
}
}
/***********************************************************************
* NtUserCallOneParam (win32u.@)
*/
ULONG_PTR WINAPI NtUserCallOneParam( ULONG_PTR arg, ULONG code )
{
switch(code)
{
case NtUserRealizePalette:
return realize_palette( UlongToHandle(arg) );
default:
FIXME( "invalid code %u\n", code );
return 0;
}
}
/***********************************************************************
* NtUserCallTwoParam (win32u.@)
*/
ULONG_PTR WINAPI NtUserCallTwoParam( ULONG_PTR arg1, ULONG_PTR arg2, ULONG code )
{
switch(code)

View File

@ -779,7 +779,7 @@
@ stub NtUserCallMsgFilter
@ stub NtUserCallNextHookEx
@ stub NtUserCallNoParam
@ stub NtUserCallOneParam
@ stdcall NtUserCallOneParam(long long)
@ stdcall NtUserCallTwoParam(long long long)
@ stub NtUserCanBrokerForceForeground
@ stub NtUserChangeClipboardChain
@ -1325,7 +1325,6 @@
@ stdcall SetDCHook(long ptr long)
@ stdcall SetHookFlags(long long)
@ stdcall GDISelectPalette(long long long)
@ stdcall GDIRealizePalette(long)
@ cdecl __wine_make_gdi_object_system(long long)
@ cdecl __wine_set_visible_region(long long ptr ptr ptr)

View File

@ -195,6 +195,7 @@ struct unix_funcs
BOOL (WINAPI *pNtGdiUpdateColors)( HDC hdc );
BOOL (WINAPI *pNtGdiWidenPath)( HDC hdc );
HKL (WINAPI *pNtUserActivateKeyboardLayout)( HKL layout, UINT flags );
ULONG_PTR (WINAPI *pNtUserCallOneParam)( ULONG_PTR arg, ULONG code );
ULONG_PTR (WINAPI *pNtUserCallTwoParam)( ULONG_PTR arg1, ULONG_PTR arg2, ULONG code );
LONG (WINAPI *pNtUserChangeDisplaySettings)( UNICODE_STRING *devname, DEVMODEW *devmode, HWND hwnd,
DWORD flags, void *lparam );
@ -221,7 +222,6 @@ struct unix_funcs
WORD (WINAPI *pNtUserVkKeyScanEx)( WCHAR chr, HKL layout );
/* Wine-specific functions */
UINT (WINAPI *pGDIRealizePalette)( HDC hdc );
HPALETTE (WINAPI *pGDISelectPalette)( HDC hdc, HPALETTE hpal, WORD bkg );
DWORD_PTR (WINAPI *pGetDCHook)( HDC hdc, DCHOOKPROC *proc );
BOOL (WINAPI *pMirrorRgn)( HWND hwnd, HRGN hrgn );
@ -241,7 +241,6 @@ struct unix_funcs
struct window_surface *surface );
};
UINT WINAPI GDIRealizePalette( HDC hdc );
HPALETTE WINAPI GDISelectPalette( HDC hdc, HPALETTE hpal, WORD wBkg );
extern RECT get_virtual_screen_rect(void) DECLSPEC_HIDDEN;

View File

@ -601,6 +601,11 @@ HKL WINAPI NtUserActivateKeyboardLayout( HKL layout, UINT flags )
return unix_funcs->pNtUserActivateKeyboardLayout( layout, flags );
}
ULONG_PTR WINAPI NtUserCallOneParam( ULONG_PTR arg, ULONG code )
{
return unix_funcs->pNtUserCallOneParam( arg, code );
}
ULONG_PTR WINAPI NtUserCallTwoParam( ULONG_PTR arg1, ULONG_PTR arg2, ULONG code )
{
return unix_funcs->pNtUserCallTwoParam( arg1, arg2, code );
@ -697,11 +702,6 @@ WORD WINAPI NtUserVkKeyScanEx( WCHAR chr, HKL layout )
return unix_funcs->pNtUserVkKeyScanEx( chr, layout );
}
UINT WINAPI GDIRealizePalette( HDC hdc )
{
return unix_funcs->pGDIRealizePalette( hdc );
}
HPALETTE WINAPI GDISelectPalette( HDC hdc, HPALETTE hpal, WORD bkg )
{
return unix_funcs->pGDISelectPalette( hdc, hpal, bkg );

View File

@ -39,6 +39,12 @@ struct enum_display_monitor_params
LPARAM lparam;
};
/* NtUserCallOneParam codes, not compatible with Windows */
enum
{
NtUserRealizePalette,
};
/* NtUserCallTwoParam codes, not compatible with Windows */
enum
{
@ -78,6 +84,7 @@ C_ASSERT( sizeof(struct user_thread_info) <= sizeof(((TEB *)0)->Win32ClientInfo)
HKL WINAPI NtUserActivateKeyboardLayout( HKL layout, UINT flags );
BOOL WINAPI NtUserAddClipboardFormatListener( HWND hwnd );
BOOL WINAPI NtUserAttachThreadInput( DWORD from, DWORD to, BOOL attach );
ULONG_PTR WINAPI NtUserCallOneParam( ULONG_PTR arg, ULONG code );
ULONG_PTR WINAPI NtUserCallTwoParam( ULONG_PTR arg1, ULONG_PTR arg2, ULONG code );
LONG WINAPI NtUserChangeDisplaySettings( UNICODE_STRING *devname, DEVMODEW *devmode, HWND hwnd,
DWORD flags, void *lparam );
@ -128,6 +135,7 @@ BOOL WINAPI NtUserRemoveClipboardFormatListener( HWND hwnd );
HANDLE WINAPI NtUserRemoveProp( HWND hwnd, const WCHAR *str );
BOOL WINAPI NtUserScrollDC( HDC hdc, INT dx, INT dy, const RECT *scroll, const RECT *clip,
HRGN ret_update_rgn, RECT *update_rect );
HPALETTE WINAPI NtUserSelectPalette( HDC hdc, HPALETTE palette, WORD force_background );
BOOL WINAPI NtUserSetKeyboardState( BYTE *state );
BOOL WINAPI NtUserSetProcessWindowStation( HWINSTA handle );
BOOL WINAPI NtUserSetProp( HWND hwnd, const WCHAR *str, HANDLE handle );