Store the original GDI palette functions in pfnSelectPalette and

pfnRealizePalette so that USER doesn't have to import them.
This commit is contained in:
Alexandre Julliard 2002-10-18 04:05:49 +00:00
parent 034e4df6e7
commit 0ccb9feadc
5 changed files with 43 additions and 27 deletions

View File

@ -132,6 +132,22 @@ UINT16 WINAPI GlobalGetAtomName16(ATOM nAtom, LPSTR lpBuffer, INT16 nSize)
return GlobalGetAtomNameA(nAtom, lpBuffer, nSize);
}
/***********************************************************************
* SelectPalette (USER.282)
*/
HPALETTE16 WINAPI SelectPalette16( HDC16 hdc, HPALETTE16 hpal, BOOL16 bForceBackground )
{
return HPALETTE_16( SelectPalette( HDC_32(hdc), HPALETTE_32(hpal), bForceBackground ));
}
/***********************************************************************
* RealizePalette (USER.283)
*/
UINT16 WINAPI RealizePalette16( HDC16 hdc )
{
return UserRealizePalette( HDC_32(hdc) );
}
/***********************************************************************
* LoadImage (USER.389)
*

View File

@ -48,6 +48,9 @@ WINE_LOOK TWEAK_WineLook = WIN31_LOOK;
WORD USER_HeapSel = 0; /* USER heap selector */
extern HPALETTE (WINAPI *pfnGDISelectPalette)(HDC hdc, HPALETTE hpal, WORD bkgnd );
extern UINT (WINAPI *pfnGDIRealizePalette)(HDC hdc);
static HMODULE graphics_driver;
static DWORD exiting_thread_id;
@ -168,9 +171,11 @@ static void palette_init(void)
ERR( "cannot get GDI32 handle\n" );
return;
}
if ((ptr = (void**)GetProcAddress( module, "pfnSelectPalette" ))) *ptr = SelectPalette16;
if ((ptr = (void**)GetProcAddress( module, "pfnSelectPalette" )))
pfnGDISelectPalette = InterlockedExchangePointer( ptr, SelectPalette );
else ERR( "cannot find pfnSelectPalette in GDI32\n" );
if ((ptr = (void**)GetProcAddress( module, "pfnRealizePalette" ))) *ptr = UserRealizePalette;
if ((ptr = (void**)GetProcAddress( module, "pfnRealizePalette" )))
pfnGDIRealizePalette = InterlockedExchangePointer( ptr, UserRealizePalette );
else ERR( "cannot find pfnRealizePalette in GDI32\n" );
}

View File

@ -140,6 +140,8 @@ extern HBRUSH CACHE_GetPattern55AABrush(void);
/* syscolor.c */
extern HPEN SYSCOLOR_GetPen( INT index );
extern HPALETTE WINAPI SelectPalette( HDC hDC, HPALETTE hPal, BOOL bForceBackground );
extern DWORD USER16_AlertableWait;
/* HANDLE16 <-> HANDLE conversions */

View File

@ -53,8 +53,8 @@ static const struct gdi_obj_funcs palette_funcs =
/* Pointers to USER implementation of SelectPalette/RealizePalette */
/* they will be patched by USER on startup */
HPALETTE (WINAPI *pfnSelectPalette)(HDC hdc, HPALETTE hpal, WORD bkgnd ) = NULL;
UINT (WINAPI *pfnRealizePalette)(HDC hdc) = NULL;
HPALETTE (WINAPI *pfnSelectPalette)(HDC hdc, HPALETTE hpal, WORD bkgnd ) = GDISelectPalette;
UINT (WINAPI *pfnRealizePalette)(HDC hdc) = GDIRealizePalette;
static UINT SystemPaletteUse = SYSPAL_STATIC; /* currently not considered */

View File

@ -23,6 +23,7 @@
#include "windef.h"
#include "wingdi.h"
#include "wine/winuser16.h"
#include "wownt32.h"
#include "wine/unicode.h"
#include "wine/server.h"
#include "gdi.h"
@ -56,6 +57,8 @@ WINE_DECLARE_DEBUG_CHANNEL(nonclient);
/* Last COLOR id */
#define COLOR_MAX COLOR_GRADIENTINACTIVECAPTION
HPALETTE (WINAPI *pfnGDISelectPalette)(HDC hdc, HPALETTE hpal, WORD bkgnd ) = NULL;
UINT (WINAPI *pfnGDIRealizePalette)(HDC hdc) = NULL;
/* ### start build ### */
extern WORD CALLBACK PAINTING_CallTo16_word_wlwww(DRAWSTATEPROC16,WORD,LONG,WORD,WORD,WORD);
@ -1434,10 +1437,9 @@ BOOL16 WINAPI DrawState16( HDC16 hdc, HBRUSH16 hbr, DRAWSTATEPROC16 func, LPARAM
/***********************************************************************
* SelectPalette (USER.282)
* SelectPalette (Not a Windows API)
*/
HPALETTE16 WINAPI SelectPalette16( HDC16 hDC, HPALETTE16 hPal,
BOOL16 bForceBackground )
HPALETTE WINAPI SelectPalette( HDC hDC, HPALETTE hPal, BOOL bForceBackground )
{
WORD wBkgPalette = 1;
@ -1451,25 +1453,7 @@ HPALETTE16 WINAPI SelectPalette16( HDC16 hDC, HPALETTE16 hPal,
if (hForeground == hwnd || IsChild(hForeground,hwnd)) wBkgPalette = 0;
}
}
return GDISelectPalette16( hDC, hPal, wBkgPalette);
}
/***********************************************************************
* RealizePalette (USER.283)
*/
UINT16 WINAPI RealizePalette16( HDC16 hDC )
{
UINT16 realized = GDIRealizePalette16( hDC );
/* do not send anything if no colors were changed */
if (realized && IsDCCurrentPalette16( hDC ))
{
/* send palette change notification */
HWND hWnd = WindowFromDC( hDC );
if (hWnd) SendMessageA( HWND_BROADCAST, WM_PALETTECHANGED, (WPARAM)hWnd, 0L);
}
return realized;
return pfnGDISelectPalette( hDC, hPal, wBkgPalette);
}
@ -1478,5 +1462,14 @@ UINT16 WINAPI RealizePalette16( HDC16 hDC )
*/
UINT WINAPI UserRealizePalette( HDC hDC )
{
return RealizePalette16( hDC );
UINT realized = pfnGDIRealizePalette( hDC );
/* do not send anything if no colors were changed */
if (realized && IsDCCurrentPalette16( HDC_16(hDC) ))
{
/* send palette change notification */
HWND hWnd = WindowFromDC( hDC );
if (hWnd) SendMessageA( HWND_BROADCAST, WM_PALETTECHANGED, (WPARAM)hWnd, 0L);
}
return realized;
}