Commit 170cb0d9 authored by Jacek Caban's avatar Jacek Caban Committed by Alexandre Julliard

win32u: Move NtUserCountClipboardFormats implementation from user32.

parent 694b1b47
...@@ -927,27 +927,6 @@ done: ...@@ -927,27 +927,6 @@ done:
/************************************************************************** /**************************************************************************
* CountClipboardFormats (USER32.@)
*/
INT WINAPI CountClipboardFormats(void)
{
INT count = 0;
USER_Driver->pUpdateClipboard();
SERVER_START_REQ( get_clipboard_formats )
{
wine_server_call( req );
count = reply->count;
}
SERVER_END_REQ;
TRACE("returning %d\n", count);
return count;
}
/**************************************************************************
* EnumClipboardFormats (USER32.@) * EnumClipboardFormats (USER32.@)
*/ */
UINT WINAPI EnumClipboardFormats( UINT format ) UINT WINAPI EnumClipboardFormats( UINT format )
...@@ -1107,7 +1086,7 @@ INT WINAPI GetPriorityClipboardFormat(UINT *list, INT nCount) ...@@ -1107,7 +1086,7 @@ INT WINAPI GetPriorityClipboardFormat(UINT *list, INT nCount)
TRACE( "%p %u\n", list, nCount ); TRACE( "%p %u\n", list, nCount );
if(CountClipboardFormats() == 0) if (NtUserCountClipboardFormats() == 0)
return 0; return 0;
for (i = 0; i < nCount; i++) for (i = 0; i < nCount; i++)
......
...@@ -83,7 +83,7 @@ ...@@ -83,7 +83,7 @@
@ stdcall CopyIcon(long) @ stdcall CopyIcon(long)
@ stdcall CopyImage(long long long long long) @ stdcall CopyImage(long long long long long)
@ stdcall CopyRect(ptr ptr) @ stdcall CopyRect(ptr ptr)
@ stdcall CountClipboardFormats() @ stdcall CountClipboardFormats() NtUserCountClipboardFormats
@ stdcall CreateAcceleratorTableA(ptr long) @ stdcall CreateAcceleratorTableA(ptr long)
@ stdcall CreateAcceleratorTableW(ptr long) @ stdcall CreateAcceleratorTableW(ptr long)
@ stdcall CreateCaret(long long long long) @ stdcall CreateCaret(long long long long)
......
...@@ -11,6 +11,7 @@ C_SRCS = \ ...@@ -11,6 +11,7 @@ C_SRCS = \
bitblt.c \ bitblt.c \
bitmap.c \ bitmap.c \
brush.c \ brush.c \
clipboard.c \
clipping.c \ clipping.c \
dc.c \ dc.c \
dib.c \ dib.c \
......
/*
* WIN32 clipboard implementation
*
* Copyright 1994 Martin Ayotte
* Copyright 1996 Alex Korobka
* Copyright 1999 Noel Borthwick
* Copyright 2003 Ulrich Czekalla for CodeWeavers
* Copyright 2016 Alexandre Julliard
*
* 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*
*/
#if 0
#pragma makedep unix
#endif
#include "win32u_private.h"
#include "wine/server.h"
#include "wine/debug.h"
WINE_DEFAULT_DEBUG_CHANNEL(clipboard);
/**************************************************************************
* NtUserCountClipboardFormats (win32u.@)
*/
INT WINAPI NtUserCountClipboardFormats(void)
{
INT count = 0;
user_driver->pUpdateClipboard();
SERVER_START_REQ( get_clipboard_formats )
{
wine_server_call( req );
count = reply->count;
}
SERVER_END_REQ;
TRACE( "returning %d\n", count );
return count;
}
...@@ -56,7 +56,7 @@ struct d3dkmt_device ...@@ -56,7 +56,7 @@ struct d3dkmt_device
struct list entry; /* List entry */ struct list entry; /* List entry */
}; };
static const struct user_driver_funcs *user_driver; static const struct user_driver_funcs lazy_load_driver;
static struct list d3dkmt_adapters = LIST_INIT( d3dkmt_adapters ); static struct list d3dkmt_adapters = LIST_INIT( d3dkmt_adapters );
static struct list d3dkmt_devices = LIST_INIT( d3dkmt_devices ); static struct list d3dkmt_devices = LIST_INIT( d3dkmt_devices );
...@@ -70,9 +70,10 @@ static pthread_mutex_t driver_lock = PTHREAD_MUTEX_INITIALIZER; ...@@ -70,9 +70,10 @@ static pthread_mutex_t driver_lock = PTHREAD_MUTEX_INITIALIZER;
*/ */
const struct gdi_dc_funcs *get_display_driver(void) const struct gdi_dc_funcs *get_display_driver(void)
{ {
if (!user_driver) if (user_driver == &lazy_load_driver)
{ {
if (!user_callbacks || !user_callbacks->pGetDesktopWindow() || !user_driver) if (!user_callbacks || !user_callbacks->pGetDesktopWindow() ||
user_driver == &lazy_load_driver)
{ {
static struct user_driver_funcs empty_funcs; static struct user_driver_funcs empty_funcs;
WARN( "failed to load the display driver, falling back to null driver\n" ); WARN( "failed to load the display driver, falling back to null driver\n" );
...@@ -123,7 +124,7 @@ static BOOL CDECL nulldrv_Chord( PHYSDEV dev, INT left, INT top, INT right, INT ...@@ -123,7 +124,7 @@ static BOOL CDECL nulldrv_Chord( PHYSDEV dev, INT left, INT top, INT right, INT
static BOOL CDECL nulldrv_CreateCompatibleDC( PHYSDEV orig, PHYSDEV *pdev ) static BOOL CDECL nulldrv_CreateCompatibleDC( PHYSDEV orig, PHYSDEV *pdev )
{ {
if (!user_driver || !user_driver->dc_funcs.pCreateCompatibleDC) return TRUE; if (!user_driver->dc_funcs.pCreateCompatibleDC) return TRUE;
return user_driver->dc_funcs.pCreateCompatibleDC( NULL, pdev ); return user_driver->dc_funcs.pCreateCompatibleDC( NULL, pdev );
} }
...@@ -989,6 +990,31 @@ static void CDECL nulldrv_ThreadDetach( void ) ...@@ -989,6 +990,31 @@ static void CDECL nulldrv_ThreadDetach( void )
{ {
} }
/**********************************************************************
* Lazy loading user driver
*
* Initial driver used before another driver is loaded.
* Each entry point simply loads the real driver and chains to it.
*/
static const struct user_driver_funcs *load_driver(void)
{
get_display_driver();
return user_driver;
}
static void CDECL loaderdrv_UpdateClipboard(void)
{
load_driver()->pUpdateClipboard();
}
static const struct user_driver_funcs lazy_load_driver =
{
.pUpdateClipboard = loaderdrv_UpdateClipboard,
};
const struct user_driver_funcs *user_driver = &lazy_load_driver;
/****************************************************************************** /******************************************************************************
* __wine_set_display_driver (win32u.@) * __wine_set_display_driver (win32u.@)
*/ */
......
...@@ -1167,6 +1167,7 @@ static struct unix_funcs unix_funcs = ...@@ -1167,6 +1167,7 @@ static struct unix_funcs unix_funcs =
NtGdiUnrealizeObject, NtGdiUnrealizeObject,
NtGdiUpdateColors, NtGdiUpdateColors,
NtGdiWidenPath, NtGdiWidenPath,
NtUserCountClipboardFormats,
GDIRealizePalette, GDIRealizePalette,
GDISelectPalette, GDISelectPalette,
......
...@@ -803,7 +803,7 @@ ...@@ -803,7 +803,7 @@
@ stub NtUserConsoleControl @ stub NtUserConsoleControl
@ stub NtUserConvertMemHandle @ stub NtUserConvertMemHandle
@ stub NtUserCopyAcceleratorTable @ stub NtUserCopyAcceleratorTable
@ stub NtUserCountClipboardFormats @ stdcall NtUserCountClipboardFormats()
@ stub NtUserCreateAcceleratorTable @ stub NtUserCreateAcceleratorTable
@ stub NtUserCreateActivationGroup @ stub NtUserCreateActivationGroup
@ stub NtUserCreateActivationObject @ stub NtUserCreateActivationObject
......
...@@ -194,6 +194,7 @@ struct unix_funcs ...@@ -194,6 +194,7 @@ struct unix_funcs
BOOL (WINAPI *pNtGdiUnrealizeObject)( HGDIOBJ obj ); BOOL (WINAPI *pNtGdiUnrealizeObject)( HGDIOBJ obj );
BOOL (WINAPI *pNtGdiUpdateColors)( HDC hdc ); BOOL (WINAPI *pNtGdiUpdateColors)( HDC hdc );
BOOL (WINAPI *pNtGdiWidenPath)( HDC hdc ); BOOL (WINAPI *pNtGdiWidenPath)( HDC hdc );
INT (WINAPI *pNtUserCountClipboardFormats)(void);
/* Wine-specific functions */ /* Wine-specific functions */
UINT (WINAPI *pGDIRealizePalette)( HDC hdc ); UINT (WINAPI *pGDIRealizePalette)( HDC hdc );
...@@ -229,6 +230,8 @@ extern HKEY reg_open_key( HKEY root, const WCHAR *name, ULONG name_len ) DECLSPE ...@@ -229,6 +230,8 @@ extern HKEY reg_open_key( HKEY root, const WCHAR *name, ULONG name_len ) DECLSPE
extern ULONG query_reg_ascii_value( HKEY hkey, const char *name, extern ULONG query_reg_ascii_value( HKEY hkey, const char *name,
KEY_VALUE_PARTIAL_INFORMATION *info, ULONG size ) DECLSPEC_HIDDEN; KEY_VALUE_PARTIAL_INFORMATION *info, ULONG size ) DECLSPEC_HIDDEN;
extern const struct user_driver_funcs *user_driver DECLSPEC_HIDDEN;
static inline WCHAR *win32u_wcsrchr( const WCHAR *str, WCHAR ch ) static inline WCHAR *win32u_wcsrchr( const WCHAR *str, WCHAR ch )
{ {
WCHAR *ret = NULL; WCHAR *ret = NULL;
......
...@@ -596,6 +596,11 @@ NTSTATUS WINAPI NtGdiDdDDISetVidPnSourceOwner( const D3DKMT_SETVIDPNSOURCEOWNER ...@@ -596,6 +596,11 @@ NTSTATUS WINAPI NtGdiDdDDISetVidPnSourceOwner( const D3DKMT_SETVIDPNSOURCEOWNER
return unix_funcs->pNtGdiDdDDISetVidPnSourceOwner( desc ); return unix_funcs->pNtGdiDdDDISetVidPnSourceOwner( desc );
} }
INT WINAPI NtUserCountClipboardFormats(void)
{
return unix_funcs->pNtUserCountClipboardFormats();
}
UINT WINAPI GDIRealizePalette( HDC hdc ) UINT WINAPI GDIRealizePalette( HDC hdc )
{ {
return unix_funcs->pGDIRealizePalette( hdc ); return unix_funcs->pGDIRealizePalette( hdc );
......
...@@ -25,6 +25,7 @@ ...@@ -25,6 +25,7 @@
BOOL WINAPI NtUserCloseDesktop( HDESK handle ); BOOL WINAPI NtUserCloseDesktop( HDESK handle );
BOOL WINAPI NtUserCloseWindowStation( HWINSTA handle ); BOOL WINAPI NtUserCloseWindowStation( HWINSTA handle );
INT WINAPI NtUserCountClipboardFormats(void);
HDESK WINAPI NtUserCreateDesktopEx( OBJECT_ATTRIBUTES *attr, UNICODE_STRING *device, HDESK WINAPI NtUserCreateDesktopEx( OBJECT_ATTRIBUTES *attr, UNICODE_STRING *device,
DEVMODEW *devmode, DWORD flags, ACCESS_MASK access, DEVMODEW *devmode, DWORD flags, ACCESS_MASK access,
ULONG heap_size ); ULONG heap_size );
......
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