win32u: Use NtUserSelectPalette instead of GDISelectPalette.

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:43 +01:00 committed by Alexandre Julliard
parent 41eac6e25c
commit f359c7f60c
8 changed files with 16 additions and 19 deletions

View File

@ -2097,8 +2097,7 @@ static UINT WINAPI realize_palette( HDC hdc )
/* Pointers to USER implementation of SelectPalette/RealizePalette */ /* Pointers to USER implementation of SelectPalette/RealizePalette */
/* they will be patched by USER on startup */ /* they will be patched by USER on startup */
extern HPALETTE WINAPI GDISelectPalette( HDC hdc, HPALETTE hpal, WORD wBkg ); HPALETTE (WINAPI *pfnSelectPalette)( HDC hdc, HPALETTE hpal, WORD bkgnd ) = NtUserSelectPalette;
HPALETTE (WINAPI *pfnSelectPalette)( HDC hdc, HPALETTE hpal, WORD bkgnd ) = GDISelectPalette;
UINT (WINAPI *pfnRealizePalette)( HDC hdc ) = realize_palette; UINT (WINAPI *pfnRealizePalette)( HDC hdc ) = realize_palette;
/*********************************************************************** /***********************************************************************

View File

@ -481,7 +481,7 @@ static BOOL reset_dc_state( HDC hdc )
NtGdiSelectFont( hdc, get_stock_object( SYSTEM_FONT )); NtGdiSelectFont( hdc, get_stock_object( SYSTEM_FONT ));
NtGdiSelectPen( hdc, get_stock_object( BLACK_PEN )); NtGdiSelectPen( hdc, get_stock_object( BLACK_PEN ));
NtGdiSetVirtualResolution( hdc, 0, 0, 0, 0 ); NtGdiSetVirtualResolution( hdc, 0, 0, 0, 0 );
GDISelectPalette( hdc, get_stock_object( DEFAULT_PALETTE ), FALSE ); NtUserSelectPalette( hdc, get_stock_object( DEFAULT_PALETTE ), FALSE );
NtGdiSetBoundsRect( hdc, NULL, DCB_DISABLE ); NtGdiSetBoundsRect( hdc, NULL, DCB_DISABLE );
NtGdiAbortPath( hdc ); NtGdiAbortPath( hdc );
@ -689,7 +689,7 @@ BOOL WINAPI NtGdiRestoreDC( HDC hdc, INT level )
NtGdiSelectPen( hdc, dcs->hPen ); NtGdiSelectPen( hdc, dcs->hPen );
set_bk_color( dc, dcs->attr->background_color); set_bk_color( dc, dcs->attr->background_color);
set_text_color( dc, dcs->attr->text_color); set_text_color( dc, dcs->attr->text_color);
GDISelectPalette( hdc, dcs->hPalette, FALSE ); NtUserSelectPalette( hdc, dcs->hPalette, FALSE );
dc->saved_dc = dcs->saved_dc; dc->saved_dc = dcs->saved_dc;
dcs->saved_dc = 0; dcs->saved_dc = 0;

View File

@ -1183,12 +1183,12 @@ static struct unix_funcs unix_funcs =
NtUserIsClipboardFormatAvailable, NtUserIsClipboardFormatAvailable,
NtUserMapVirtualKeyEx, NtUserMapVirtualKeyEx,
NtUserScrollDC, NtUserScrollDC,
NtUserSelectPalette,
NtUserShowCursor, NtUserShowCursor,
NtUserToUnicodeEx, NtUserToUnicodeEx,
NtUserUnregisterHotKey, NtUserUnregisterHotKey,
NtUserVkKeyScanEx, NtUserVkKeyScanEx,
GDISelectPalette,
GetDCHook, GetDCHook,
MirrorRgn, MirrorRgn,
SetDCHook, SetDCHook,

View File

@ -399,7 +399,6 @@ extern BOOL PATH_RestorePath( DC *dst, DC *src ) DECLSPEC_HIDDEN;
extern POINT *GDI_Bezier( const POINT *Points, INT count, INT *nPtsOut ) DECLSPEC_HIDDEN; extern POINT *GDI_Bezier( const POINT *Points, INT count, INT *nPtsOut ) DECLSPEC_HIDDEN;
/* palette.c */ /* palette.c */
extern HPALETTE WINAPI GDISelectPalette( HDC hdc, HPALETTE hpal, WORD wBkg) DECLSPEC_HIDDEN;
extern HPALETTE PALETTE_Init(void) DECLSPEC_HIDDEN; extern HPALETTE PALETTE_Init(void) DECLSPEC_HIDDEN;
extern UINT get_palette_entries( HPALETTE hpalette, UINT start, UINT count, extern UINT get_palette_entries( HPALETTE hpalette, UINT start, UINT count,
PALETTEENTRY *entries ) DECLSPEC_HIDDEN; PALETTEENTRY *entries ) DECLSPEC_HIDDEN;

View File

@ -513,15 +513,17 @@ static BOOL PALETTE_DeleteObject( HGDIOBJ handle )
/*********************************************************************** /***********************************************************************
* GDISelectPalette (Not a Windows API) * NtUserSelectPalette (win32u.@)
*/ */
HPALETTE WINAPI GDISelectPalette( HDC hdc, HPALETTE hpal, WORD wBkg) HPALETTE WINAPI NtUserSelectPalette( HDC hdc, HPALETTE hpal, WORD bkg )
{ {
HPALETTE ret = 0; HPALETTE ret = 0;
DC *dc; DC *dc;
TRACE("%p %p\n", hdc, hpal ); TRACE("%p %p\n", hdc, hpal );
/* FIXME: move primary palette handling from user32 */
if (get_gdi_object_type(hpal) != NTGDI_OBJ_PAL) if (get_gdi_object_type(hpal) != NTGDI_OBJ_PAL)
{ {
WARN("invalid selected palette %p\n",hpal); WARN("invalid selected palette %p\n",hpal);
@ -531,7 +533,7 @@ HPALETTE WINAPI GDISelectPalette( HDC hdc, HPALETTE hpal, WORD wBkg)
{ {
ret = dc->hPalette; ret = dc->hPalette;
dc->hPalette = hpal; dc->hPalette = hpal;
if (!wBkg) hPrimaryPalette = hpal; if (!bkg) hPrimaryPalette = hpal;
release_dc_ptr( dc ); release_dc_ptr( dc );
} }
return ret; return ret;

View File

@ -1157,7 +1157,7 @@
@ stub NtUserSBGetParms @ stub NtUserSBGetParms
@ stdcall NtUserScrollDC(long long long ptr ptr long ptr) @ stdcall NtUserScrollDC(long long long ptr ptr long ptr)
@ stub NtUserScrollWindowEx @ stub NtUserScrollWindowEx
@ stub NtUserSelectPalette @ stdcall NtUserSelectPalette(long long long)
@ stub NtUserSendEventMessage @ stub NtUserSendEventMessage
@ stub NtUserSendInput @ stub NtUserSendInput
@ stub NtUserSendInteractiveControlHapticsReport @ stub NtUserSendInteractiveControlHapticsReport
@ -1324,7 +1324,6 @@
@ stdcall GetDCHook(long ptr) @ stdcall GetDCHook(long ptr)
@ stdcall SetDCHook(long ptr long) @ stdcall SetDCHook(long ptr long)
@ stdcall SetHookFlags(long long) @ stdcall SetHookFlags(long long)
@ stdcall GDISelectPalette(long long long)
@ cdecl __wine_make_gdi_object_system(long long) @ cdecl __wine_make_gdi_object_system(long long)
@ cdecl __wine_set_visible_region(long long ptr ptr ptr) @ cdecl __wine_set_visible_region(long long ptr ptr ptr)

View File

@ -215,6 +215,7 @@ struct unix_funcs
UINT (WINAPI *pNtUserMapVirtualKeyEx)( UINT code, UINT type, HKL layout ); UINT (WINAPI *pNtUserMapVirtualKeyEx)( UINT code, UINT type, HKL layout );
BOOL (WINAPI *pNtUserScrollDC)( HDC hdc, INT dx, INT dy, const RECT *scroll, const RECT *clip, BOOL (WINAPI *pNtUserScrollDC)( HDC hdc, INT dx, INT dy, const RECT *scroll, const RECT *clip,
HRGN ret_update_rgn, RECT *update_rect ); HRGN ret_update_rgn, RECT *update_rect );
HPALETTE (WINAPI *pNtUserSelectPalette)( HDC hdc, HPALETTE hpal, WORD bkg );
INT (WINAPI *pNtUserShowCursor)( BOOL show ); INT (WINAPI *pNtUserShowCursor)( BOOL show );
INT (WINAPI *pNtUserToUnicodeEx)( UINT virt, UINT scan, const BYTE *state, INT (WINAPI *pNtUserToUnicodeEx)( UINT virt, UINT scan, const BYTE *state,
WCHAR *str, int size, UINT flags, HKL layout ); WCHAR *str, int size, UINT flags, HKL layout );
@ -222,7 +223,6 @@ struct unix_funcs
WORD (WINAPI *pNtUserVkKeyScanEx)( WCHAR chr, HKL layout ); WORD (WINAPI *pNtUserVkKeyScanEx)( WCHAR chr, HKL layout );
/* Wine-specific functions */ /* Wine-specific functions */
HPALETTE (WINAPI *pGDISelectPalette)( HDC hdc, HPALETTE hpal, WORD bkg );
DWORD_PTR (WINAPI *pGetDCHook)( HDC hdc, DCHOOKPROC *proc ); DWORD_PTR (WINAPI *pGetDCHook)( HDC hdc, DCHOOKPROC *proc );
BOOL (WINAPI *pMirrorRgn)( HWND hwnd, HRGN hrgn ); BOOL (WINAPI *pMirrorRgn)( HWND hwnd, HRGN hrgn );
BOOL (WINAPI *pSetDCHook)( HDC hdc, DCHOOKPROC proc, DWORD_PTR data ); BOOL (WINAPI *pSetDCHook)( HDC hdc, DCHOOKPROC proc, DWORD_PTR data );
@ -241,8 +241,6 @@ struct unix_funcs
struct window_surface *surface ); struct window_surface *surface );
}; };
HPALETTE WINAPI GDISelectPalette( HDC hdc, HPALETTE hpal, WORD wBkg );
extern RECT get_virtual_screen_rect(void) DECLSPEC_HIDDEN; extern RECT get_virtual_screen_rect(void) DECLSPEC_HIDDEN;
extern void wrappers_init( unixlib_handle_t handle ) DECLSPEC_HIDDEN; extern void wrappers_init( unixlib_handle_t handle ) DECLSPEC_HIDDEN;

View File

@ -681,6 +681,11 @@ BOOL WINAPI NtUserScrollDC( HDC hdc, INT dx, INT dy, const RECT *scroll, const R
return unix_funcs->pNtUserScrollDC( hdc, dx, dy, scroll, clip, ret_update_rgn, update_rect ); return unix_funcs->pNtUserScrollDC( hdc, dx, dy, scroll, clip, ret_update_rgn, update_rect );
} }
HPALETTE WINAPI NtUserSelectPalette( HDC hdc, HPALETTE hpal, WORD bkg )
{
return unix_funcs->pNtUserSelectPalette( hdc, hpal, bkg );
}
INT WINAPI NtUserShowCursor( BOOL show ) INT WINAPI NtUserShowCursor( BOOL show )
{ {
return unix_funcs->pNtUserShowCursor( show ); return unix_funcs->pNtUserShowCursor( show );
@ -702,11 +707,6 @@ WORD WINAPI NtUserVkKeyScanEx( WCHAR chr, HKL layout )
return unix_funcs->pNtUserVkKeyScanEx( chr, layout ); return unix_funcs->pNtUserVkKeyScanEx( chr, layout );
} }
HPALETTE WINAPI GDISelectPalette( HDC hdc, HPALETTE hpal, WORD bkg )
{
return unix_funcs->pGDISelectPalette( hdc, hpal, bkg );
}
DWORD_PTR WINAPI GetDCHook( HDC hdc, DCHOOKPROC *proc ) DWORD_PTR WINAPI GetDCHook( HDC hdc, DCHOOKPROC *proc )
{ {
return unix_funcs->pGetDCHook( hdc, proc ); return unix_funcs->pGetDCHook( hdc, proc );