Commit 0ccb9fea authored by Alexandre Julliard's avatar Alexandre Julliard

Store the original GDI palette functions in pfnSelectPalette and

pfnRealizePalette so that USER doesn't have to import them.
parent 034e4df6
...@@ -133,6 +133,22 @@ UINT16 WINAPI GlobalGetAtomName16(ATOM nAtom, LPSTR lpBuffer, INT16 nSize) ...@@ -133,6 +133,22 @@ UINT16 WINAPI GlobalGetAtomName16(ATOM nAtom, LPSTR lpBuffer, INT16 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) * LoadImage (USER.389)
* *
*/ */
......
...@@ -48,6 +48,9 @@ WINE_LOOK TWEAK_WineLook = WIN31_LOOK; ...@@ -48,6 +48,9 @@ WINE_LOOK TWEAK_WineLook = WIN31_LOOK;
WORD USER_HeapSel = 0; /* USER heap selector */ 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 HMODULE graphics_driver;
static DWORD exiting_thread_id; static DWORD exiting_thread_id;
...@@ -168,9 +171,11 @@ static void palette_init(void) ...@@ -168,9 +171,11 @@ static void palette_init(void)
ERR( "cannot get GDI32 handle\n" ); ERR( "cannot get GDI32 handle\n" );
return; 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" ); 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" ); else ERR( "cannot find pfnRealizePalette in GDI32\n" );
} }
......
...@@ -140,6 +140,8 @@ extern HBRUSH CACHE_GetPattern55AABrush(void); ...@@ -140,6 +140,8 @@ extern HBRUSH CACHE_GetPattern55AABrush(void);
/* syscolor.c */ /* syscolor.c */
extern HPEN SYSCOLOR_GetPen( INT index ); extern HPEN SYSCOLOR_GetPen( INT index );
extern HPALETTE WINAPI SelectPalette( HDC hDC, HPALETTE hPal, BOOL bForceBackground );
extern DWORD USER16_AlertableWait; extern DWORD USER16_AlertableWait;
/* HANDLE16 <-> HANDLE conversions */ /* HANDLE16 <-> HANDLE conversions */
......
...@@ -53,8 +53,8 @@ static const struct gdi_obj_funcs palette_funcs = ...@@ -53,8 +53,8 @@ static const struct gdi_obj_funcs palette_funcs =
/* 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 */
HPALETTE (WINAPI *pfnSelectPalette)(HDC hdc, HPALETTE hpal, WORD bkgnd ) = NULL; HPALETTE (WINAPI *pfnSelectPalette)(HDC hdc, HPALETTE hpal, WORD bkgnd ) = GDISelectPalette;
UINT (WINAPI *pfnRealizePalette)(HDC hdc) = NULL; UINT (WINAPI *pfnRealizePalette)(HDC hdc) = GDIRealizePalette;
static UINT SystemPaletteUse = SYSPAL_STATIC; /* currently not considered */ static UINT SystemPaletteUse = SYSPAL_STATIC; /* currently not considered */
......
...@@ -23,6 +23,7 @@ ...@@ -23,6 +23,7 @@
#include "windef.h" #include "windef.h"
#include "wingdi.h" #include "wingdi.h"
#include "wine/winuser16.h" #include "wine/winuser16.h"
#include "wownt32.h"
#include "wine/unicode.h" #include "wine/unicode.h"
#include "wine/server.h" #include "wine/server.h"
#include "gdi.h" #include "gdi.h"
...@@ -56,6 +57,8 @@ WINE_DECLARE_DEBUG_CHANNEL(nonclient); ...@@ -56,6 +57,8 @@ WINE_DECLARE_DEBUG_CHANNEL(nonclient);
/* Last COLOR id */ /* Last COLOR id */
#define COLOR_MAX COLOR_GRADIENTINACTIVECAPTION #define COLOR_MAX COLOR_GRADIENTINACTIVECAPTION
HPALETTE (WINAPI *pfnGDISelectPalette)(HDC hdc, HPALETTE hpal, WORD bkgnd ) = NULL;
UINT (WINAPI *pfnGDIRealizePalette)(HDC hdc) = NULL;
/* ### start build ### */ /* ### start build ### */
extern WORD CALLBACK PAINTING_CallTo16_word_wlwww(DRAWSTATEPROC16,WORD,LONG,WORD,WORD,WORD); 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 ...@@ -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, HPALETTE WINAPI SelectPalette( HDC hDC, HPALETTE hPal, BOOL bForceBackground )
BOOL16 bForceBackground )
{ {
WORD wBkgPalette = 1; WORD wBkgPalette = 1;
...@@ -1451,19 +1453,19 @@ HPALETTE16 WINAPI SelectPalette16( HDC16 hDC, HPALETTE16 hPal, ...@@ -1451,19 +1453,19 @@ HPALETTE16 WINAPI SelectPalette16( HDC16 hDC, HPALETTE16 hPal,
if (hForeground == hwnd || IsChild(hForeground,hwnd)) wBkgPalette = 0; if (hForeground == hwnd || IsChild(hForeground,hwnd)) wBkgPalette = 0;
} }
} }
return GDISelectPalette16( hDC, hPal, wBkgPalette); return pfnGDISelectPalette( hDC, hPal, wBkgPalette);
} }
/*********************************************************************** /***********************************************************************
* RealizePalette (USER.283) * UserRealizePalette (USER32.@)
*/ */
UINT16 WINAPI RealizePalette16( HDC16 hDC ) UINT WINAPI UserRealizePalette( HDC hDC )
{ {
UINT16 realized = GDIRealizePalette16( hDC ); UINT realized = pfnGDIRealizePalette( hDC );
/* do not send anything if no colors were changed */ /* do not send anything if no colors were changed */
if (realized && IsDCCurrentPalette16( hDC )) if (realized && IsDCCurrentPalette16( HDC_16(hDC) ))
{ {
/* send palette change notification */ /* send palette change notification */
HWND hWnd = WindowFromDC( hDC ); HWND hWnd = WindowFromDC( hDC );
...@@ -1471,12 +1473,3 @@ UINT16 WINAPI RealizePalette16( HDC16 hDC ) ...@@ -1471,12 +1473,3 @@ UINT16 WINAPI RealizePalette16( HDC16 hDC )
} }
return realized; return realized;
} }
/***********************************************************************
* UserRealizePalette (USER32.@)
*/
UINT WINAPI UserRealizePalette( HDC hDC )
{
return RealizePalette16( hDC );
}
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