Commit 08f677ca authored by Jacek Caban's avatar Jacek Caban Committed by Alexandre Julliard

win32u: Move ntgdi implementation from gdi32.

parent 7757f4ee
EXTRADEFS = -D_GDI32_ EXTRADEFS = -D_GDI32_
MODULE = gdi32.dll MODULE = gdi32.dll
UNIXLIB = gdi32.so
IMPORTLIB = gdi32 IMPORTLIB = gdi32
IMPORTS = advapi32 IMPORTS = advapi32 win32u
EXTRAINCL = $(FREETYPE_CFLAGS) $(FONTCONFIG_CFLAGS)
EXTRALIBS = $(CARBON_LIBS) $(APPKIT_LIBS) $(PTHREAD_LIBS) -lm
DELAYIMPORTS = setupapi DELAYIMPORTS = setupapi
C_SRCS = \ C_SRCS = \
bitblt.c \
bitmap.c \
brush.c \
clipping.c \
dc.c \
dib.c \
dibdrv/bitblt.c \
dibdrv/dc.c \
dibdrv/graphics.c \
dibdrv/objects.c \
dibdrv/opengl.c \
dibdrv/primitives.c \
driver.c \
emfdc.c \ emfdc.c \
emfdrv.c \
enhmetafile.c \ enhmetafile.c \
font.c \
freetype.c \
gdidc.c \ gdidc.c \
gdiobj.c \
icm.c \ icm.c \
mapping.c \
metadc.c \ metadc.c \
metafile.c \ metafile.c \
objects.c \ objects.c \
opengl.c \ opengl.c \
opentype.c \
painting.c \
palette.c \
path.c \
pen.c \
printdrv.c \
region.c \
text.c \ text.c \
uniscribe/bidi.c \ uniscribe/bidi.c \
uniscribe/bracket.c \ uniscribe/bracket.c \
...@@ -53,11 +25,7 @@ C_SRCS = \ ...@@ -53,11 +25,7 @@ C_SRCS = \
uniscribe/opentype.c \ uniscribe/opentype.c \
uniscribe/shape.c \ uniscribe/shape.c \
uniscribe/shaping.c \ uniscribe/shaping.c \
uniscribe/usp10.c \ uniscribe/usp10.c
vertical.c \
vulkan.c \
wrappers.c
RC_SRCS = gdi32.rc
font_EXTRADEFS = -DWINE_FONT_DIR=\"`${MAKEDEP} -R ${datadir}/wine ${fontdir}`\" RC_SRCS = gdi32.rc
...@@ -30,7 +30,6 @@ ...@@ -30,7 +30,6 @@
#include "initguid.h" #include "initguid.h"
#include "devguid.h" #include "devguid.h"
#include "setupapi.h" #include "setupapi.h"
#include "win32u_private.h"
#include "wine/rbtree.h" #include "wine/rbtree.h"
#include "wine/debug.h" #include "wine/debug.h"
...@@ -143,7 +142,6 @@ BOOL WINAPI DllMain( HINSTANCE inst, DWORD reason, LPVOID reserved ) ...@@ -143,7 +142,6 @@ BOOL WINAPI DllMain( HINSTANCE inst, DWORD reason, LPVOID reserved )
DisableThreadLibraryCalls( inst ); DisableThreadLibraryCalls( inst );
gdi32_module = inst; gdi32_module = inst;
wrappers_init();
return TRUE; return TRUE;
} }
......
MODULE = win32u.dll MODULE = win32u.dll
UNIXLIB = win32u.so UNIXLIB = win32u.so
IMPORTLIB = win32u IMPORTLIB = win32u
EXTRAINCL = $(FREETYPE_CFLAGS) $(FONTCONFIG_CFLAGS)
EXTRALIBS = $(CARBON_LIBS) $(APPKIT_LIBS) $(PTHREAD_LIBS) -lm
IMPORTS = ntdll winecrt0 IMPORTS = ntdll winecrt0
EXTRADLLFLAGS = -nodefaultlibs -Wb,--syscall-table,1 EXTRADLLFLAGS = -nodefaultlibs -Wb,--syscall-table,1
C_SRCS = \ C_SRCS = \
bitblt.c \
bitmap.c \
brush.c \
clipping.c \
dc.c \
dib.c \
dibdrv/bitblt.c \
dibdrv/dc.c \
dibdrv/graphics.c \
dibdrv/objects.c \
dibdrv/opengl.c \
dibdrv/primitives.c \
driver.c \
emfdrv.c \
font.c \
freetype.c \
gdiobj.c \
main.c \ main.c \
syscall.c mapping.c \
opentype.c \
painting.c \
palette.c \
path.c \
pen.c \
printdrv.c \
region.c \
syscall.c \
vertical.c \
vulkan.c \
wrappers.c
font_EXTRADEFS = -DWINE_FONT_DIR=\"`${MAKEDEP} -R ${datadir}/wine ${fontdir}`\"
...@@ -127,8 +127,6 @@ ...@@ -127,8 +127,6 @@
#include "wine/debug.h" #include "wine/debug.h"
#include "wine/list.h" #include "wine/list.h"
#include "resource.h"
#ifdef HAVE_FREETYPE #ifdef HAVE_FREETYPE
WINE_DEFAULT_DEBUG_CHANNEL(font); WINE_DEFAULT_DEBUG_CHANNEL(font);
......
...@@ -1130,7 +1130,6 @@ static struct unix_funcs unix_funcs = ...@@ -1130,7 +1130,6 @@ static struct unix_funcs unix_funcs =
NtGdiFillRgn, NtGdiFillRgn,
NtGdiFlattenPath, NtGdiFlattenPath,
NtGdiFontIsLinked, NtGdiFontIsLinked,
NtGdiFlush,
NtGdiFrameRgn, NtGdiFrameRgn,
NtGdiGetAndSetDCDword, NtGdiGetAndSetDCDword,
NtGdiGetAppClipBox, NtGdiGetAppClipBox,
...@@ -1251,7 +1250,7 @@ static struct unix_funcs unix_funcs = ...@@ -1251,7 +1250,7 @@ static struct unix_funcs unix_funcs =
__wine_set_visible_region, __wine_set_visible_region,
}; };
NTSTATUS initialize( void *args ) NTSTATUS gdi_init(void)
{ {
pthread_mutexattr_t attr; pthread_mutexattr_t attr;
unsigned int dpi; unsigned int dpi;
...@@ -1267,12 +1266,12 @@ NTSTATUS initialize( void *args ) ...@@ -1267,12 +1266,12 @@ NTSTATUS initialize( void *args )
dpi = font_init(); dpi = font_init();
init_stock_objects( dpi ); init_stock_objects( dpi );
user_callbacks = *(const struct user_callbacks **)args;
*(const struct unix_funcs **)args = &unix_funcs;
return 0; return 0;
} }
const unixlib_entry_t __wine_unix_call_funcs[] = NTSTATUS callbacks_init( void *args )
{ {
initialize user_callbacks = *(const struct user_callbacks **)args;
}; *(const struct unix_funcs **)args = &unix_funcs;
return 0;
}
...@@ -24,8 +24,8 @@ ...@@ -24,8 +24,8 @@
#define WIN32_NO_STATUS #define WIN32_NO_STATUS
#include "windef.h" #include "windef.h"
#include "winbase.h" #include "winbase.h"
#include "winnt.h" #include "ntgdi.h"
#include "winternl.h" #include "win32u_private.h"
#include "wine/unixlib.h" #include "wine/unixlib.h"
extern void *__wine_syscall_dispatcher DECLSPEC_HIDDEN; extern void *__wine_syscall_dispatcher DECLSPEC_HIDDEN;
...@@ -57,6 +57,7 @@ BOOL WINAPI DllMain( HINSTANCE inst, DWORD reason, void *reserved ) ...@@ -57,6 +57,7 @@ BOOL WINAPI DllMain( HINSTANCE inst, DWORD reason, void *reserved )
&win32u_handle, sizeof(win32u_handle), NULL )) &win32u_handle, sizeof(win32u_handle), NULL ))
{ {
__wine_unix_call( win32u_handle, 0, &__wine_syscall_dispatcher ); __wine_unix_call( win32u_handle, 0, &__wine_syscall_dispatcher );
wrappers_init( win32u_handle );
} }
break; break;
} }
......
...@@ -28,18 +28,10 @@ ...@@ -28,18 +28,10 @@
#define WIN32_NO_STATUS #define WIN32_NO_STATUS
#include "windef.h" #include "windef.h"
#include "winnt.h" #include "winnt.h"
#include "winternl.h" #include "ntgdi_private.h"
#include "wine/unixlib.h" #include "wine/unixlib.h"
/***********************************************************************
* NtGdiFlush (win32u.@)
*/
BOOL WINAPI NtGdiFlush(void)
{
return TRUE;
}
static void * const syscalls[] = static void * const syscalls[] =
{ {
NtGdiFlush, NtGdiFlush,
...@@ -57,7 +49,13 @@ static SYSTEM_SERVICE_TABLE syscall_table = ...@@ -57,7 +49,13 @@ static SYSTEM_SERVICE_TABLE syscall_table =
static NTSTATUS init( void *dispatcher ) static NTSTATUS init( void *dispatcher )
{ {
return ntdll_init_syscalls( 1, &syscall_table, dispatcher ); NTSTATUS status;
if ((status = ntdll_init_syscalls( 1, &syscall_table, dispatcher ))) return status;
return gdi_init();
} }
unixlib_entry_t __wine_unix_call_funcs[] = { init }; unixlib_entry_t __wine_unix_call_funcs[] =
{
init,
callbacks_init,
};
...@@ -21,8 +21,9 @@ ...@@ -21,8 +21,9 @@
#ifndef __WINE_WIN32U_PRIVATE #ifndef __WINE_WIN32U_PRIVATE
#define __WINE_WIN32U_PRIVATE #define __WINE_WIN32U_PRIVATE
#include "wine/gdi_driver.h"
#include "winuser.h" #include "winuser.h"
#include "wine/gdi_driver.h"
#include "wine/unixlib.h"
struct user_callbacks struct user_callbacks
{ {
...@@ -129,7 +130,6 @@ struct unix_funcs ...@@ -129,7 +130,6 @@ struct unix_funcs
BOOL (WINAPI *pNtGdiFillRgn)( HDC hdc, HRGN hrgn, HBRUSH hbrush ); BOOL (WINAPI *pNtGdiFillRgn)( HDC hdc, HRGN hrgn, HBRUSH hbrush );
BOOL (WINAPI *pNtGdiFlattenPath)( HDC hdc ); BOOL (WINAPI *pNtGdiFlattenPath)( HDC hdc );
BOOL (WINAPI *pNtGdiFontIsLinked)( HDC hdc ); BOOL (WINAPI *pNtGdiFontIsLinked)( HDC hdc );
BOOL (WINAPI *pNtGdiFlush)(void);
BOOL (WINAPI *pNtGdiFrameRgn)( HDC hdc, HRGN hrgn, HBRUSH brush, INT width, INT height ); BOOL (WINAPI *pNtGdiFrameRgn)( HDC hdc, HRGN hrgn, HBRUSH brush, INT width, INT height );
BOOL (WINAPI *pNtGdiGetAndSetDCDword)( HDC hdc, UINT method, DWORD value, DWORD *result ); BOOL (WINAPI *pNtGdiGetAndSetDCDword)( HDC hdc, UINT method, DWORD value, DWORD *result );
INT (WINAPI *pNtGdiGetAppClipBox)( HDC hdc, RECT *rect ); INT (WINAPI *pNtGdiGetAppClipBox)( HDC hdc, RECT *rect );
...@@ -296,7 +296,9 @@ struct unix_funcs ...@@ -296,7 +296,9 @@ struct unix_funcs
UINT WINAPI GDIRealizePalette( HDC hdc ); UINT WINAPI GDIRealizePalette( HDC hdc );
HPALETTE WINAPI GDISelectPalette( HDC hdc, HPALETTE hpal, WORD wBkg ); HPALETTE WINAPI GDISelectPalette( HDC hdc, HPALETTE hpal, WORD wBkg );
BOOL wrappers_init(void) DECLSPEC_HIDDEN; extern void wrappers_init( unixlib_handle_t handle ) DECLSPEC_HIDDEN;
extern NTSTATUS gdi_init(void) DECLSPEC_HIDDEN;
extern NTSTATUS callbacks_init( void *args ) DECLSPEC_HIDDEN;
static inline WCHAR *win32u_wcsrchr( const WCHAR *str, WCHAR ch ) static inline WCHAR *win32u_wcsrchr( const WCHAR *str, WCHAR ch )
......
...@@ -18,7 +18,10 @@ ...@@ -18,7 +18,10 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/ */
#include "gdi_private.h" #include <stdarg.h>
#include "windef.h"
#include "winbase.h"
#include "ntgdi.h"
#include "win32u_private.h" #include "win32u_private.h"
#include "wine/unixlib.h" #include "wine/unixlib.h"
#include "wine/debug.h" #include "wine/debug.h"
...@@ -314,11 +317,6 @@ BOOL WINAPI NtGdiFontIsLinked( HDC hdc ) ...@@ -314,11 +317,6 @@ BOOL WINAPI NtGdiFontIsLinked( HDC hdc )
return unix_funcs->pNtGdiFontIsLinked( hdc ); return unix_funcs->pNtGdiFontIsLinked( hdc );
} }
BOOL WINAPI NtGdiFlush(void)
{
return unix_funcs->pNtGdiFlush();
}
BOOL WINAPI NtGdiFrameRgn( HDC hdc, HRGN hrgn, HBRUSH brush, INT width, INT height ) BOOL WINAPI NtGdiFrameRgn( HDC hdc, HRGN hrgn, HBRUSH brush, INT width, INT height )
{ {
return unix_funcs->pNtGdiFrameRgn( hdc, hrgn, brush, width, height ); return unix_funcs->pNtGdiFrameRgn( hdc, hrgn, brush, width, height );
...@@ -1022,10 +1020,12 @@ struct opengl_funcs * CDECL __wine_get_wgl_driver( HDC hdc, UINT version ) ...@@ -1022,10 +1020,12 @@ struct opengl_funcs * CDECL __wine_get_wgl_driver( HDC hdc, UINT version )
void CDECL __wine_set_display_driver( HMODULE module ) void CDECL __wine_set_display_driver( HMODULE module )
{ {
void *wine_get_gdi_driver; void *wine_get_gdi_driver;
ANSI_STRING name_str;
if (!module) return; if (!module) return;
wine_get_gdi_driver = (void *)GetProcAddress( module, "wine_get_gdi_driver" ); RtlInitAnsiString( &name_str, "wine_get_gdi_driver" );
LdrGetProcedureAddress( module, &name_str, 0, &wine_get_gdi_driver );
if (!wine_get_gdi_driver) if (!wine_get_gdi_driver)
{ {
ERR( "Could not create graphics driver %p\n", module ); ERR( "Could not create graphics driver %p\n", module );
...@@ -1150,16 +1150,8 @@ static const struct user_callbacks user_callbacks = ...@@ -1150,16 +1150,8 @@ static const struct user_callbacks user_callbacks =
call_WindowFromDC, call_WindowFromDC,
}; };
BOOL wrappers_init(void) extern void wrappers_init( unixlib_handle_t handle )
{ {
unixlib_handle_t handle;
const void *args = &user_callbacks; const void *args = &user_callbacks;
if (!__wine_unix_call( handle, 1, &args )) unix_funcs = args;
if (NtQueryVirtualMemory( GetCurrentProcess(), gdi32_module, MemoryWineUnixFuncs,
&handle, sizeof(handle), NULL ))
return FALSE;
if (__wine_unix_call( handle, 0, &args )) return FALSE;
unix_funcs = args;
return TRUE;
} }
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