Moved palette functions to user_main.c and removed
windows/painting.c.
This commit is contained in:
parent
cd2b2bd99a
commit
56ef1fec30
|
@ -29,7 +29,6 @@ C_SRCS = \
|
|||
$(TOPOBJDIR)/windows/msgbox.c \
|
||||
$(TOPOBJDIR)/windows/multimon.c \
|
||||
$(TOPOBJDIR)/windows/nonclient.c \
|
||||
$(TOPOBJDIR)/windows/painting.c \
|
||||
$(TOPOBJDIR)/windows/queue.c \
|
||||
$(TOPOBJDIR)/windows/rect.c \
|
||||
$(TOPOBJDIR)/windows/scroll.c \
|
||||
|
|
|
@ -42,8 +42,9 @@ USER_DRIVER USER_Driver;
|
|||
WORD USER_HeapSel = 0; /* USER heap selector */
|
||||
HMODULE user32_module = 0;
|
||||
|
||||
extern HPALETTE (WINAPI *pfnGDISelectPalette)(HDC hdc, HPALETTE hpal, WORD bkgnd );
|
||||
extern UINT (WINAPI *pfnGDIRealizePalette)(HDC hdc);
|
||||
static HPALETTE (WINAPI *pfnGDISelectPalette)( HDC hdc, HPALETTE hpal, WORD bkgnd );
|
||||
static UINT (WINAPI *pfnGDIRealizePalette)( HDC hdc );
|
||||
static HPALETTE hPrimaryPalette;
|
||||
|
||||
static HMODULE graphics_driver;
|
||||
static DWORD exiting_thread_id;
|
||||
|
@ -135,6 +136,50 @@ static BOOL load_driver(void)
|
|||
}
|
||||
|
||||
|
||||
/***********************************************************************
|
||||
* UserSelectPalette (Not a Windows API)
|
||||
*/
|
||||
static HPALETTE WINAPI UserSelectPalette( HDC hDC, HPALETTE hPal, BOOL bForceBackground )
|
||||
{
|
||||
WORD wBkgPalette = 1;
|
||||
|
||||
if (!bForceBackground && (hPal != GetStockObject(DEFAULT_PALETTE)))
|
||||
{
|
||||
HWND hwnd = WindowFromDC( hDC );
|
||||
if (hwnd)
|
||||
{
|
||||
HWND hForeground = GetForegroundWindow();
|
||||
/* set primary palette if it's related to current active */
|
||||
if (hForeground == hwnd || IsChild(hForeground,hwnd))
|
||||
{
|
||||
wBkgPalette = 0;
|
||||
hPrimaryPalette = hPal;
|
||||
}
|
||||
}
|
||||
}
|
||||
return pfnGDISelectPalette( hDC, hPal, wBkgPalette);
|
||||
}
|
||||
|
||||
|
||||
/***********************************************************************
|
||||
* UserRealizePalette (USER32.@)
|
||||
*/
|
||||
UINT WINAPI UserRealizePalette( HDC hDC )
|
||||
{
|
||||
UINT realized = pfnGDIRealizePalette( hDC );
|
||||
|
||||
/* do not send anything if no colors were changed */
|
||||
if (realized && GetCurrentObject( hDC, OBJ_PAL ) == hPrimaryPalette)
|
||||
{
|
||||
/* send palette change notification */
|
||||
HWND hWnd = WindowFromDC( hDC );
|
||||
if (hWnd) SendMessageTimeoutW( HWND_BROADCAST, WM_PALETTECHANGED, (WPARAM)hWnd, 0,
|
||||
SMTO_ABORTIFHUNG, 2000, NULL );
|
||||
}
|
||||
return realized;
|
||||
}
|
||||
|
||||
|
||||
/***********************************************************************
|
||||
* palette_init
|
||||
*
|
||||
|
@ -150,7 +195,7 @@ static void palette_init(void)
|
|||
return;
|
||||
}
|
||||
if ((ptr = (void**)GetProcAddress( module, "pfnSelectPalette" )))
|
||||
pfnGDISelectPalette = InterlockedExchangePointer( ptr, SelectPalette );
|
||||
pfnGDISelectPalette = InterlockedExchangePointer( ptr, UserSelectPalette );
|
||||
else ERR( "cannot find pfnSelectPalette in GDI32\n" );
|
||||
if ((ptr = (void**)GetProcAddress( module, "pfnRealizePalette" )))
|
||||
pfnGDIRealizePalette = InterlockedExchangePointer( ptr, UserRealizePalette );
|
||||
|
|
|
@ -156,8 +156,6 @@ extern INT SYSMETRICS_Set( INT index, INT value );
|
|||
extern void SYSPARAMS_GetDoubleClickSize( INT *width, INT *height );
|
||||
extern INT SYSPARAMS_GetMouseButtonSwap( void );
|
||||
|
||||
extern HPALETTE WINAPI SelectPalette( HDC hDC, HPALETTE hPal, BOOL bForceBackground );
|
||||
|
||||
extern BOOL CLIPBOARD_ReleaseOwner(void);
|
||||
|
||||
extern DWORD USER16_AlertableWait;
|
||||
|
|
|
@ -1,84 +0,0 @@
|
|||
/*
|
||||
* Window painting functions
|
||||
*
|
||||
* Copyright 1993, 1994, 1995 Alexandre Julliard
|
||||
* 1999 Alex Korobka
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
#include "wine/port.h"
|
||||
|
||||
#include <stdarg.h>
|
||||
#include <string.h>
|
||||
#include "windef.h"
|
||||
#include "winbase.h"
|
||||
#include "wingdi.h"
|
||||
#include "wine/winuser16.h"
|
||||
#include "wownt32.h"
|
||||
#include "wine/unicode.h"
|
||||
#include "wine/server.h"
|
||||
#include "user.h"
|
||||
#include "win.h"
|
||||
#include "message.h"
|
||||
#include "dce.h"
|
||||
#include "wine/debug.h"
|
||||
|
||||
WINE_DEFAULT_DEBUG_CHANNEL(win);
|
||||
WINE_DECLARE_DEBUG_CHANNEL(nonclient);
|
||||
|
||||
HPALETTE (WINAPI *pfnGDISelectPalette)(HDC hdc, HPALETTE hpal, WORD bkgnd ) = NULL;
|
||||
UINT (WINAPI *pfnGDIRealizePalette)(HDC hdc) = NULL;
|
||||
|
||||
|
||||
/***********************************************************************
|
||||
* SelectPalette (Not a Windows API)
|
||||
*/
|
||||
HPALETTE WINAPI SelectPalette( HDC hDC, HPALETTE hPal, BOOL bForceBackground )
|
||||
{
|
||||
WORD wBkgPalette = 1;
|
||||
|
||||
if (!bForceBackground && (hPal != GetStockObject(DEFAULT_PALETTE)))
|
||||
{
|
||||
HWND hwnd = WindowFromDC( hDC );
|
||||
if (hwnd)
|
||||
{
|
||||
HWND hForeground = GetForegroundWindow();
|
||||
/* set primary palette if it's related to current active */
|
||||
if (hForeground == hwnd || IsChild(hForeground,hwnd)) wBkgPalette = 0;
|
||||
}
|
||||
}
|
||||
return pfnGDISelectPalette( hDC, hPal, wBkgPalette);
|
||||
}
|
||||
|
||||
|
||||
/***********************************************************************
|
||||
* UserRealizePalette (USER32.@)
|
||||
*/
|
||||
UINT WINAPI UserRealizePalette( HDC 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) SendMessageTimeoutW( HWND_BROADCAST, WM_PALETTECHANGED, (WPARAM)hWnd, 0,
|
||||
SMTO_ABORTIFHUNG, 2000, NULL );
|
||||
}
|
||||
return realized;
|
||||
}
|
Loading…
Reference in New Issue