Load the USER driver on demand instead of at user32 load time.

Provide a fallback implementation for all the functions to avoid
having to check for NULL functions everywhere.
This commit is contained in:
Alexandre Julliard 2005-07-18 15:14:56 +00:00
parent bb72a06e54
commit 15ec968724
16 changed files with 836 additions and 295 deletions

View File

@ -31,6 +31,7 @@ C_SRCS = \
desktop.c \
dialog.c \
dialog16.c \
driver.c \
driver16.c \
edit.c \
exticon.c \

View File

@ -228,14 +228,7 @@ static BOOL CLIPBOARD_CloseClipboard(void)
*/
UINT WINAPI RegisterClipboardFormatW(LPCWSTR FormatName)
{
UINT wFormatID = 0;
TRACE("%s\n", debugstr_w(FormatName));
if (USER_Driver.pRegisterClipboardFormat)
wFormatID = USER_Driver.pRegisterClipboardFormat(FormatName);
return wFormatID;
return USER_Driver->pRegisterClipboardFormat(FormatName);
}
@ -263,14 +256,7 @@ UINT WINAPI RegisterClipboardFormatA(LPCSTR formatName)
*/
INT WINAPI GetClipboardFormatNameW(UINT wFormat, LPWSTR retStr, INT maxlen)
{
INT len = 0;
TRACE("%04x,%p,%d\n", wFormat, retStr, maxlen);
if (USER_Driver.pGetClipboardFormatName)
len = USER_Driver.pGetClipboardFormatName(wFormat, retStr, maxlen);
return len;
return USER_Driver->pGetClipboardFormatName(wFormat, retStr, maxlen);
}
@ -326,8 +312,7 @@ BOOL WINAPI CloseClipboard(void)
{
HWND hWndViewer = GetClipboardViewer();
if (USER_Driver.pEndClipboardUpdate)
USER_Driver.pEndClipboardUpdate();
USER_Driver->pEndClipboardUpdate();
if (hWndViewer)
SendMessageW(hWndViewer, WM_DRAWCLIPBOARD, 0, 0);
@ -378,12 +363,10 @@ BOOL WINAPI EmptyClipboard(void)
/* Acquire the selection. This will notify the previous owner
* to clear it's cache. */
if (USER_Driver.pAcquireClipboard)
USER_Driver.pAcquireClipboard(cbinfo.hWndOpen);
USER_Driver->pAcquireClipboard(cbinfo.hWndOpen);
/* Empty the local cache */
if (USER_Driver.pEmptyClipboard)
USER_Driver.pEmptyClipboard(FALSE);
USER_Driver->pEmptyClipboard(FALSE);
bCBHasChanged = TRUE;
@ -522,8 +505,7 @@ HANDLE16 WINAPI SetClipboardData16(UINT16 wFormat, HANDLE16 hData)
return 0;
}
if (USER_Driver.pSetClipboardData &&
USER_Driver.pSetClipboardData(wFormat, hData, 0, cbinfo.flags & CB_OWNER))
if (USER_Driver->pSetClipboardData(wFormat, hData, 0, cbinfo.flags & CB_OWNER))
{
hResult = hData;
bCBHasChanged = TRUE;
@ -552,8 +534,7 @@ HANDLE WINAPI SetClipboardData(UINT wFormat, HANDLE hData)
return 0;
}
if (USER_Driver.pSetClipboardData &&
USER_Driver.pSetClipboardData(wFormat, 0, hData, cbinfo.flags & CB_OWNER))
if (USER_Driver->pSetClipboardData(wFormat, 0, hData, cbinfo.flags & CB_OWNER))
{
hResult = hData;
bCBHasChanged = TRUE;
@ -568,11 +549,7 @@ HANDLE WINAPI SetClipboardData(UINT wFormat, HANDLE hData)
*/
INT WINAPI CountClipboardFormats(void)
{
INT count = 0;
if (USER_Driver.pCountClipboardFormats)
count = USER_Driver.pCountClipboardFormats();
INT count = USER_Driver->pCountClipboardFormats();
TRACE("returning %d\n", count);
return count;
}
@ -583,7 +560,6 @@ INT WINAPI CountClipboardFormats(void)
*/
UINT WINAPI EnumClipboardFormats(UINT wFormat)
{
UINT wFmt = 0;
CLIPBOARDINFO cbinfo;
TRACE("(%04X)\n", wFormat);
@ -595,11 +571,7 @@ UINT WINAPI EnumClipboardFormats(UINT wFormat)
SetLastError(ERROR_CLIPBOARD_NOT_OPEN);
return 0;
}
if (USER_Driver.pEnumClipboardFormats)
wFmt = USER_Driver.pEnumClipboardFormats(wFormat);
return wFmt;
return USER_Driver->pEnumClipboardFormats(wFormat);
}
@ -608,11 +580,7 @@ UINT WINAPI EnumClipboardFormats(UINT wFormat)
*/
BOOL WINAPI IsClipboardFormatAvailable(UINT wFormat)
{
BOOL bret = FALSE;
if (USER_Driver.pIsClipboardFormatAvailable)
bret = USER_Driver.pIsClipboardFormatAvailable(wFormat);
BOOL bret = USER_Driver->pIsClipboardFormatAvailable(wFormat);
TRACE("%04x, returning %d\n", wFormat, bret);
return bret;
}
@ -634,8 +602,7 @@ HANDLE16 WINAPI GetClipboardData16(UINT16 wFormat)
return 0;
}
if (USER_Driver.pGetClipboardData)
USER_Driver.pGetClipboardData(wFormat, &hData, NULL);
if (!USER_Driver->pGetClipboardData(wFormat, &hData, NULL)) hData = 0;
return hData;
}
@ -659,8 +626,7 @@ HANDLE WINAPI GetClipboardData(UINT wFormat)
return 0;
}
if (USER_Driver.pGetClipboardData)
USER_Driver.pGetClipboardData(wFormat, NULL, &hData);
if (!USER_Driver->pGetClipboardData(wFormat, NULL, &hData)) hData = 0;
TRACE("returning %p\n", hData);
return hData;

View File

@ -1480,9 +1480,9 @@ HCURSOR WINAPI SetCursor( HCURSOR hCursor /* [in] Handle of cursor to show */ )
hOldCursor = thread_info->cursor;
thread_info->cursor = hCursor;
/* Change the cursor shape only if it is visible */
if (thread_info->cursor_count >= 0 && USER_Driver.pSetCursor)
if (thread_info->cursor_count >= 0)
{
USER_Driver.pSetCursor( (CURSORICONINFO*)GlobalLock16(HCURSOR_16(hCursor)) );
USER_Driver->pSetCursor( (CURSORICONINFO*)GlobalLock16(HCURSOR_16(hCursor)) );
GlobalUnlock16(HCURSOR_16(hCursor));
}
return hOldCursor;
@ -1499,16 +1499,16 @@ INT WINAPI ShowCursor( BOOL bShow )
if (bShow)
{
if (++thread_info->cursor_count == 0 && USER_Driver.pSetCursor) /* Show it */
if (++thread_info->cursor_count == 0) /* Show it */
{
USER_Driver.pSetCursor((CURSORICONINFO*)GlobalLock16(HCURSOR_16(thread_info->cursor)));
USER_Driver->pSetCursor((CURSORICONINFO*)GlobalLock16(HCURSOR_16(thread_info->cursor)));
GlobalUnlock16(HCURSOR_16(thread_info->cursor));
}
}
else
{
if (--thread_info->cursor_count == -1 && USER_Driver.pSetCursor) /* Hide it */
USER_Driver.pSetCursor( NULL );
if (--thread_info->cursor_count == -1) /* Hide it */
USER_Driver->pSetCursor( NULL );
}
return thread_info->cursor_count;
}

View File

@ -108,7 +108,7 @@ static void DEFWND_SetTextA( HWND hwnd, LPCSTR text )
ERR("Not enough memory for window text\n");
WIN_ReleasePtr( wndPtr );
if (USER_Driver.pSetWindowText) USER_Driver.pSetWindowText( hwnd, textW );
USER_Driver->pSetWindowText( hwnd, textW );
}
/***********************************************************************
@ -143,7 +143,7 @@ static void DEFWND_SetTextW( HWND hwnd, LPCWSTR text )
text = wndPtr->text;
WIN_ReleasePtr( wndPtr );
if (USER_Driver.pSetWindowText) USER_Driver.pSetWindowText( hwnd, text );
USER_Driver->pSetWindowText( hwnd, text );
}
/***********************************************************************
@ -669,8 +669,7 @@ static LRESULT DEFWND_DefWinProc( HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPa
}
WIN_ReleasePtr( wndPtr );
if (USER_Driver.pSetWindowIcon)
USER_Driver.pSetWindowIcon( hwnd, wParam, (HICON)lParam );
USER_Driver->pSetWindowIcon( hwnd, wParam, (HICON)lParam );
SetWindowPos(hwnd, 0, 0, 0, 0, 0, SWP_FRAMECHANGED | SWP_NOSIZE |
SWP_NOMOVE | SWP_NOACTIVATE | SWP_NOZORDER);

View File

@ -52,7 +52,7 @@ WORD WINAPI DISPLAY_Inquire(LPCURSORINFO16 lpCursorInfo)
*/
VOID WINAPI DISPLAY_SetCursor( struct tagCURSORICONINFO *lpCursor )
{
if (USER_Driver.pSetCursor) USER_Driver.pSetCursor(lpCursor);
USER_Driver->pSetCursor(lpCursor);
}
/***********************************************************************
@ -60,7 +60,7 @@ VOID WINAPI DISPLAY_SetCursor( struct tagCURSORICONINFO *lpCursor )
*/
VOID WINAPI DISPLAY_MoveCursor( WORD wAbsX, WORD wAbsY )
{
if (USER_Driver.pSetCursorPos) USER_Driver.pSetCursorPos(wAbsX, wAbsY);
USER_Driver->pSetCursorPos(wAbsX, wAbsY);
}
/***********************************************************************

757
dlls/user/driver.c Normal file
View File

@ -0,0 +1,757 @@
/*
* USER driver support
*
* Copyright 2000, 2005 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include <stdarg.h>
#include <stdio.h>
#include "windef.h"
#include "winbase.h"
#include "winuser.h"
#include "user_private.h"
#include "wine/debug.h"
WINE_DEFAULT_DEBUG_CHANNEL(user);
static const USER_DRIVER null_driver, lazy_load_driver;
const USER_DRIVER *USER_Driver = &lazy_load_driver;
/* load the graphics driver */
static const USER_DRIVER *load_driver(void)
{
char buffer[MAX_PATH], libname[32], *name, *next;
HKEY hkey;
void *ptr;
HMODULE graphics_driver;
USER_DRIVER *driver, *prev;
strcpy( buffer, "x11,tty" ); /* default value */
/* @@ Wine registry key: HKCU\Software\Wine\Drivers */
if (!RegOpenKeyA( HKEY_CURRENT_USER, "Software\\Wine\\Drivers", &hkey ))
{
DWORD type, count = sizeof(buffer);
RegQueryValueExA( hkey, "Graphics", 0, &type, (LPBYTE) buffer, &count );
RegCloseKey( hkey );
}
name = buffer;
while (name)
{
next = strchr( name, ',' );
if (next) *next++ = 0;
snprintf( libname, sizeof(libname), "wine%s.drv", name );
if ((graphics_driver = LoadLibraryA( libname )) != 0) break;
name = next;
}
if (!graphics_driver)
{
MESSAGE( "wine: Could not load graphics driver '%s'.\n", buffer );
if (!strcasecmp( buffer, "x11" ))
MESSAGE( "Make sure that your X server is running and that $DISPLAY is set correctly.\n" );
ExitProcess(1);
}
driver = HeapAlloc( GetProcessHeap(), 0, sizeof(*driver) );
memcpy( driver, &null_driver, sizeof(*driver) );
#define GET_USER_FUNC(name) \
do { if ((ptr = GetProcAddress( graphics_driver, #name ))) driver->p##name = ptr; } while(0)
GET_USER_FUNC(ActivateKeyboardLayout);
GET_USER_FUNC(Beep);
GET_USER_FUNC(GetAsyncKeyState);
GET_USER_FUNC(GetKeyNameText);
GET_USER_FUNC(GetKeyboardLayout);
GET_USER_FUNC(GetKeyboardLayoutList);
GET_USER_FUNC(GetKeyboardLayoutName);
GET_USER_FUNC(LoadKeyboardLayout);
GET_USER_FUNC(MapVirtualKeyEx);
GET_USER_FUNC(SendInput);
GET_USER_FUNC(ToUnicodeEx);
GET_USER_FUNC(UnloadKeyboardLayout);
GET_USER_FUNC(VkKeyScanEx);
GET_USER_FUNC(SetCursor);
GET_USER_FUNC(GetCursorPos);
GET_USER_FUNC(SetCursorPos);
GET_USER_FUNC(GetScreenSaveActive);
GET_USER_FUNC(SetScreenSaveActive);
GET_USER_FUNC(AcquireClipboard);
GET_USER_FUNC(EmptyClipboard);
GET_USER_FUNC(SetClipboardData);
GET_USER_FUNC(GetClipboardData);
GET_USER_FUNC(CountClipboardFormats);
GET_USER_FUNC(EnumClipboardFormats);
GET_USER_FUNC(IsClipboardFormatAvailable);
GET_USER_FUNC(RegisterClipboardFormat);
GET_USER_FUNC(GetClipboardFormatName);
GET_USER_FUNC(EndClipboardUpdate);
GET_USER_FUNC(ResetSelectionOwner);
GET_USER_FUNC(ChangeDisplaySettingsEx);
GET_USER_FUNC(EnumDisplaySettingsEx);
GET_USER_FUNC(CreateDesktopWindow);
GET_USER_FUNC(CreateWindow);
GET_USER_FUNC(DestroyWindow);
GET_USER_FUNC(GetDCEx);
GET_USER_FUNC(MsgWaitForMultipleObjectsEx);
GET_USER_FUNC(ReleaseDC);
GET_USER_FUNC(ScrollDC);
GET_USER_FUNC(SetFocus);
GET_USER_FUNC(SetParent);
GET_USER_FUNC(SetWindowPos);
GET_USER_FUNC(SetWindowRgn);
GET_USER_FUNC(SetWindowIcon);
GET_USER_FUNC(SetWindowStyle);
GET_USER_FUNC(SetWindowText);
GET_USER_FUNC(ShowWindow);
GET_USER_FUNC(SysCommandSizeMove);
GET_USER_FUNC(WindowFromDC);
GET_USER_FUNC(WindowMessage);
#undef GET_USER_FUNC
prev = InterlockedCompareExchangePointer( (void **)&USER_Driver, driver, (void *)&lazy_load_driver );
if (prev != &lazy_load_driver)
{
/* another thread beat us to it */
HeapFree( GetProcessHeap(), 0, driver );
FreeLibrary( graphics_driver );
driver = prev;
}
return driver;
}
/**********************************************************************
* Null user driver
*
* These are fallbacks for entry points that are not implemented in the real driver.
*/
static HKL nulldrv_ActivateKeyboardLayout( HKL layout, UINT flags )
{
return 0;
}
static void nulldrv_Beep(void)
{
}
static SHORT nulldrv_GetAsyncKeyState( INT key )
{
return 0;
}
static INT nulldrv_GetKeyNameText( LONG lparam, LPWSTR buffer, INT size )
{
return 0;
}
static HKL nulldrv_GetKeyboardLayout( DWORD layout )
{
return 0;
}
static UINT nulldrv_GetKeyboardLayoutList( INT count, HKL *layouts )
{
return 0;
}
static BOOL nulldrv_GetKeyboardLayoutName( LPWSTR name )
{
return FALSE;
}
static HKL nulldrv_LoadKeyboardLayout( LPCWSTR name, UINT flags )
{
return 0;
}
static UINT nulldrv_MapVirtualKeyEx( UINT code, UINT type, HKL layout )
{
return 0;
}
static UINT nulldrv_SendInput( UINT count, LPINPUT inputs, int size )
{
return 0;
}
static INT nulldrv_ToUnicodeEx( UINT virt, UINT scan, LPBYTE state, LPWSTR str,
int size, UINT flags, HKL layout )
{
return 0;
}
static BOOL nulldrv_UnloadKeyboardLayout( HKL layout )
{
return 0;
}
static SHORT nulldrv_VkKeyScanEx( WCHAR ch, HKL layout )
{
return -1;
}
static void nulldrv_SetCursor( struct tagCURSORICONINFO *info )
{
}
static BOOL nulldrv_GetCursorPos( LPPOINT pt )
{
return FALSE;
}
static BOOL nulldrv_SetCursorPos( INT x, INT y )
{
return FALSE;
}
static BOOL nulldrv_GetScreenSaveActive(void)
{
return FALSE;
}
static void nulldrv_SetScreenSaveActive( BOOL on )
{
}
static void nulldrv_AcquireClipboard( HWND hwnd )
{
}
static BOOL nulldrv_CountClipboardFormats(void)
{
return 0;
}
static void nulldrv_EmptyClipboard( BOOL keepunowned )
{
}
static void nulldrv_EndClipboardUpdate(void)
{
}
static UINT nulldrv_EnumClipboardFormats( UINT format )
{
return 0;
}
static BOOL nulldrv_GetClipboardData( UINT format, HANDLE16 *h16, HANDLE *h32 )
{
return FALSE;
}
static INT nulldrv_GetClipboardFormatName( UINT format, LPWSTR buffer, UINT len )
{
return FALSE;
}
static BOOL nulldrv_IsClipboardFormatAvailable( UINT format )
{
return FALSE;
}
static UINT nulldrv_RegisterClipboardFormat( LPCWSTR name )
{
return 0;
}
static void nulldrv_ResetSelectionOwner( HWND hwnd, BOOL flag )
{
}
static BOOL nulldrv_SetClipboardData( UINT format, HANDLE16 h16, HANDLE h32, BOOL owner )
{
return FALSE;
}
static LONG nulldrv_ChangeDisplaySettingsEx( LPCWSTR name, LPDEVMODEW mode, HWND hwnd,
DWORD flags, LPVOID lparam )
{
return DISP_CHANGE_FAILED;
}
static BOOL nulldrv_EnumDisplaySettingsEx( LPCWSTR name, DWORD num, LPDEVMODEW mode, DWORD flags )
{
return FALSE;
}
static BOOL nulldrv_CreateDesktopWindow( HWND hwnd )
{
return TRUE;
}
static BOOL nulldrv_CreateWindow( HWND hwnd, CREATESTRUCTA *cs, BOOL unicode )
{
return TRUE;
}
static void nulldrv_DestroyWindow( HWND hwnd )
{
}
static HDC nulldrv_GetDCEx( HWND hwnd, HRGN hrgn, DWORD flags )
{
return 0;
}
static DWORD nulldrv_MsgWaitForMultipleObjectsEx( DWORD count, const HANDLE *handles, DWORD timeout,
DWORD mask, DWORD flags )
{
return WaitForMultipleObjectsEx( count, handles, flags & MWMO_WAITALL,
timeout, flags & MWMO_ALERTABLE );
}
static INT nulldrv_ReleaseDC( HWND hwnd, HDC hdc, BOOL end_paint )
{
return 0;
}
static BOOL nulldrv_ScrollDC( HDC hdc, INT dx, INT dy, const RECT *scroll, const RECT *clip,
HRGN hrgn, LPRECT update )
{
return FALSE;
}
static void nulldrv_SetFocus( HWND hwnd )
{
}
static HWND nulldrv_SetParent( HWND hwnd, HWND parent )
{
return 0;
}
static BOOL nulldrv_SetWindowPos( WINDOWPOS *pos )
{
return FALSE;
}
static int nulldrv_SetWindowRgn( HWND hwnd, HRGN hrgn, BOOL redraw )
{
return 1;
}
static void nulldrv_SetWindowIcon( HWND hwnd, UINT type, HICON icon )
{
}
static void nulldrv_SetWindowStyle( HWND hwnd, DWORD old_style )
{
}
static void nulldrv_SetWindowText( HWND hwnd, LPCWSTR text )
{
}
static BOOL nulldrv_ShowWindow( HWND hwnd, INT cmd )
{
return FALSE;
}
static void nulldrv_SysCommandSizeMove( HWND hwnd, WPARAM wparam )
{
}
static HWND nulldrv_WindowFromDC( HDC hdc )
{
return 0;
}
static LRESULT nulldrv_WindowMessage( HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam )
{
return 0;
}
static const USER_DRIVER null_driver =
{
/* keyboard functions */
nulldrv_ActivateKeyboardLayout,
nulldrv_Beep,
nulldrv_GetAsyncKeyState,
nulldrv_GetKeyNameText,
nulldrv_GetKeyboardLayout,
nulldrv_GetKeyboardLayoutList,
nulldrv_GetKeyboardLayoutName,
nulldrv_LoadKeyboardLayout,
nulldrv_MapVirtualKeyEx,
nulldrv_SendInput,
nulldrv_ToUnicodeEx,
nulldrv_UnloadKeyboardLayout,
nulldrv_VkKeyScanEx,
/* mouse functions */
nulldrv_SetCursor,
nulldrv_GetCursorPos,
nulldrv_SetCursorPos,
/* screen saver functions */
nulldrv_GetScreenSaveActive,
nulldrv_SetScreenSaveActive,
/* clipboard functions */
nulldrv_AcquireClipboard,
nulldrv_CountClipboardFormats,
nulldrv_EmptyClipboard,
nulldrv_EndClipboardUpdate,
nulldrv_EnumClipboardFormats,
nulldrv_GetClipboardData,
nulldrv_GetClipboardFormatName,
nulldrv_IsClipboardFormatAvailable,
nulldrv_RegisterClipboardFormat,
nulldrv_ResetSelectionOwner,
nulldrv_SetClipboardData,
/* display modes */
nulldrv_ChangeDisplaySettingsEx,
nulldrv_EnumDisplaySettingsEx,
/* windowing functions */
nulldrv_CreateDesktopWindow,
nulldrv_CreateWindow,
nulldrv_DestroyWindow,
nulldrv_GetDCEx,
nulldrv_MsgWaitForMultipleObjectsEx,
nulldrv_ReleaseDC,
nulldrv_ScrollDC,
nulldrv_SetFocus,
nulldrv_SetParent,
nulldrv_SetWindowPos,
nulldrv_SetWindowRgn,
nulldrv_SetWindowIcon,
nulldrv_SetWindowStyle,
nulldrv_SetWindowText,
nulldrv_ShowWindow,
nulldrv_SysCommandSizeMove,
nulldrv_WindowFromDC,
nulldrv_WindowMessage
};
/**********************************************************************
* 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 HKL loaderdrv_ActivateKeyboardLayout( HKL layout, UINT flags )
{
return load_driver()->pActivateKeyboardLayout( layout, flags );
}
static void loaderdrv_Beep(void)
{
load_driver()->pBeep();
}
static SHORT loaderdrv_GetAsyncKeyState( INT key )
{
return load_driver()->pGetAsyncKeyState( key );
}
static INT loaderdrv_GetKeyNameText( LONG lparam, LPWSTR buffer, INT size )
{
return load_driver()->pGetKeyNameText( lparam, buffer, size );
}
static HKL loaderdrv_GetKeyboardLayout( DWORD layout )
{
return load_driver()->pGetKeyboardLayout( layout );
}
static UINT loaderdrv_GetKeyboardLayoutList( INT count, HKL *layouts )
{
return load_driver()->pGetKeyboardLayoutList( count, layouts );
}
static BOOL loaderdrv_GetKeyboardLayoutName( LPWSTR name )
{
return load_driver()->pGetKeyboardLayoutName( name );
}
static HKL loaderdrv_LoadKeyboardLayout( LPCWSTR name, UINT flags )
{
return load_driver()->pLoadKeyboardLayout( name, flags );
}
static UINT loaderdrv_MapVirtualKeyEx( UINT code, UINT type, HKL layout )
{
return load_driver()->pMapVirtualKeyEx( code, type, layout );
}
static UINT loaderdrv_SendInput( UINT count, LPINPUT inputs, int size )
{
return load_driver()->pSendInput( count, inputs, size );
}
static INT loaderdrv_ToUnicodeEx( UINT virt, UINT scan, LPBYTE state, LPWSTR str,
int size, UINT flags, HKL layout )
{
return load_driver()->pToUnicodeEx( virt, scan, state, str, size, flags, layout );
}
static BOOL loaderdrv_UnloadKeyboardLayout( HKL layout )
{
return load_driver()->pUnloadKeyboardLayout( layout );
}
static SHORT loaderdrv_VkKeyScanEx( WCHAR ch, HKL layout )
{
return load_driver()->pVkKeyScanEx( ch, layout );
}
static void loaderdrv_SetCursor( struct tagCURSORICONINFO *info )
{
load_driver()->pSetCursor( info );
}
static BOOL loaderdrv_GetCursorPos( LPPOINT pt )
{
return load_driver()->pGetCursorPos( pt );
}
static BOOL loaderdrv_SetCursorPos( INT x, INT y )
{
return load_driver()->pSetCursorPos( x, y );
}
static BOOL loaderdrv_GetScreenSaveActive(void)
{
return load_driver()->pGetScreenSaveActive();
}
static void loaderdrv_SetScreenSaveActive( BOOL on )
{
load_driver()->pSetScreenSaveActive( on );
}
static void loaderdrv_AcquireClipboard( HWND hwnd )
{
load_driver()->pAcquireClipboard( hwnd );
}
static BOOL loaderdrv_CountClipboardFormats(void)
{
return load_driver()->pCountClipboardFormats();
}
static void loaderdrv_EmptyClipboard( BOOL keepunowned )
{
load_driver()->pEmptyClipboard( keepunowned );
}
static void loaderdrv_EndClipboardUpdate(void)
{
load_driver()->pEndClipboardUpdate();
}
static UINT loaderdrv_EnumClipboardFormats( UINT format )
{
return load_driver()->pEnumClipboardFormats( format );
}
static BOOL loaderdrv_GetClipboardData( UINT format, HANDLE16 *h16, HANDLE *h32 )
{
return load_driver()->pGetClipboardData( format, h16, h32 );
}
static INT loaderdrv_GetClipboardFormatName( UINT format, LPWSTR buffer, UINT len )
{
return load_driver()->pGetClipboardFormatName( format, buffer, len );
}
static BOOL loaderdrv_IsClipboardFormatAvailable( UINT format )
{
return load_driver()->pIsClipboardFormatAvailable( format );
}
static UINT loaderdrv_RegisterClipboardFormat( LPCWSTR name )
{
return load_driver()->pRegisterClipboardFormat( name );
}
static void loaderdrv_ResetSelectionOwner( HWND hwnd, BOOL flag )
{
load_driver()->pResetSelectionOwner( hwnd, flag );
}
static BOOL loaderdrv_SetClipboardData( UINT format, HANDLE16 h16, HANDLE h32, BOOL owner )
{
return load_driver()->pSetClipboardData( format, h16, h32, owner );
}
static LONG loaderdrv_ChangeDisplaySettingsEx( LPCWSTR name, LPDEVMODEW mode, HWND hwnd,
DWORD flags, LPVOID lparam )
{
return load_driver()->pChangeDisplaySettingsEx( name, mode, hwnd, flags, lparam );
}
static BOOL loaderdrv_EnumDisplaySettingsEx( LPCWSTR name, DWORD num, LPDEVMODEW mode, DWORD flags )
{
return load_driver()->pEnumDisplaySettingsEx( name, num, mode, flags );
}
static BOOL loaderdrv_CreateDesktopWindow( HWND hwnd )
{
return load_driver()->pCreateDesktopWindow( hwnd );
}
static BOOL loaderdrv_CreateWindow( HWND hwnd, CREATESTRUCTA *cs, BOOL unicode )
{
return load_driver()->pCreateWindow( hwnd, cs, unicode );
}
static void loaderdrv_DestroyWindow( HWND hwnd )
{
load_driver()->pDestroyWindow( hwnd );
}
static HDC loaderdrv_GetDCEx( HWND hwnd, HRGN hrgn, DWORD flags )
{
return load_driver()->pGetDCEx( hwnd, hrgn, flags );
}
static DWORD loaderdrv_MsgWaitForMultipleObjectsEx( DWORD count, const HANDLE *handles, DWORD timeout,
DWORD mask, DWORD flags )
{
return load_driver()->pMsgWaitForMultipleObjectsEx( count, handles, timeout, mask, flags );
}
static INT loaderdrv_ReleaseDC( HWND hwnd, HDC hdc, BOOL end_paint )
{
return load_driver()->pReleaseDC( hwnd, hdc, end_paint );
}
static BOOL loaderdrv_ScrollDC( HDC hdc, INT dx, INT dy, const RECT *scroll, const RECT *clip,
HRGN hrgn, LPRECT update )
{
return load_driver()->pScrollDC( hdc, dx, dy, scroll, clip, hrgn, update );
}
static void loaderdrv_SetFocus( HWND hwnd )
{
load_driver()->pSetFocus( hwnd );
}
static HWND loaderdrv_SetParent( HWND hwnd, HWND parent )
{
return load_driver()->pSetParent( hwnd, parent );
}
static BOOL loaderdrv_SetWindowPos( WINDOWPOS *pos )
{
return load_driver()->pSetWindowPos( pos );
}
static int loaderdrv_SetWindowRgn( HWND hwnd, HRGN hrgn, BOOL redraw )
{
return load_driver()->pSetWindowRgn( hwnd, hrgn, redraw );
}
static void loaderdrv_SetWindowIcon( HWND hwnd, UINT type, HICON icon )
{
load_driver()->pSetWindowIcon( hwnd, type, icon );
}
static void loaderdrv_SetWindowStyle( HWND hwnd, DWORD old_style )
{
load_driver()->pSetWindowStyle( hwnd, old_style );
}
static void loaderdrv_SetWindowText( HWND hwnd, LPCWSTR text )
{
load_driver()->pSetWindowText( hwnd, text );
}
static BOOL loaderdrv_ShowWindow( HWND hwnd, INT cmd )
{
return load_driver()->pShowWindow( hwnd, cmd );
}
static void loaderdrv_SysCommandSizeMove( HWND hwnd, WPARAM wparam )
{
load_driver()->pSysCommandSizeMove( hwnd, wparam );
}
static HWND loaderdrv_WindowFromDC( HDC hdc )
{
return load_driver()->pWindowFromDC( hdc );
}
static LRESULT loaderdrv_WindowMessage( HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam )
{
return load_driver()->pWindowMessage( hwnd, msg, wparam, lparam );
}
static const USER_DRIVER lazy_load_driver =
{
/* keyboard functions */
loaderdrv_ActivateKeyboardLayout,
loaderdrv_Beep,
loaderdrv_GetAsyncKeyState,
loaderdrv_GetKeyNameText,
loaderdrv_GetKeyboardLayout,
loaderdrv_GetKeyboardLayoutList,
loaderdrv_GetKeyboardLayoutName,
loaderdrv_LoadKeyboardLayout,
loaderdrv_MapVirtualKeyEx,
loaderdrv_SendInput,
loaderdrv_ToUnicodeEx,
loaderdrv_UnloadKeyboardLayout,
loaderdrv_VkKeyScanEx,
/* mouse functions */
loaderdrv_SetCursor,
loaderdrv_GetCursorPos,
loaderdrv_SetCursorPos,
/* screen saver functions */
loaderdrv_GetScreenSaveActive,
loaderdrv_SetScreenSaveActive,
/* clipboard functions */
loaderdrv_AcquireClipboard,
loaderdrv_CountClipboardFormats,
loaderdrv_EmptyClipboard,
loaderdrv_EndClipboardUpdate,
loaderdrv_EnumClipboardFormats,
loaderdrv_GetClipboardData,
loaderdrv_GetClipboardFormatName,
loaderdrv_IsClipboardFormatAvailable,
loaderdrv_RegisterClipboardFormat,
loaderdrv_ResetSelectionOwner,
loaderdrv_SetClipboardData,
/* display modes */
loaderdrv_ChangeDisplaySettingsEx,
loaderdrv_EnumDisplaySettingsEx,
/* windowing functions */
loaderdrv_CreateDesktopWindow,
loaderdrv_CreateWindow,
loaderdrv_DestroyWindow,
loaderdrv_GetDCEx,
loaderdrv_MsgWaitForMultipleObjectsEx,
loaderdrv_ReleaseDC,
loaderdrv_ScrollDC,
loaderdrv_SetFocus,
loaderdrv_SetParent,
loaderdrv_SetWindowPos,
loaderdrv_SetWindowRgn,
loaderdrv_SetWindowIcon,
loaderdrv_SetWindowStyle,
loaderdrv_SetWindowText,
loaderdrv_ShowWindow,
loaderdrv_SysCommandSizeMove,
loaderdrv_WindowFromDC,
loaderdrv_WindowMessage
};

View File

@ -63,7 +63,7 @@ static HWND set_focus_window( HWND hwnd )
}
if (IsWindow(hwnd))
{
if (USER_Driver.pSetFocus) USER_Driver.pSetFocus(hwnd);
USER_Driver->pSetFocus(hwnd);
SendMessageW( hwnd, WM_SETFOCUS, (WPARAM)previous, 0 );
}
return previous;

View File

@ -80,8 +80,7 @@ static WORD get_key_state(void)
*/
UINT WINAPI SendInput( UINT count, LPINPUT inputs, int size )
{
if (USER_Driver.pSendInput) return USER_Driver.pSendInput( count, inputs, size );
return 0;
return USER_Driver->pSendInput( count, inputs, size );
}
@ -127,8 +126,8 @@ void WINAPI mouse_event( DWORD dwFlags, DWORD dx, DWORD dy,
*/
BOOL WINAPI GetCursorPos( POINT *pt )
{
if (pt && USER_Driver.pGetCursorPos) return USER_Driver.pGetCursorPos( pt );
return FALSE;
if (!pt) return FALSE;
return USER_Driver->pGetCursorPos( pt );
}
@ -150,8 +149,7 @@ BOOL WINAPI GetCursorInfo( PCURSORINFO pci )
*/
BOOL WINAPI SetCursorPos( INT x, INT y )
{
if (USER_Driver.pSetCursorPos) return USER_Driver.pSetCursorPos( x, y );
return FALSE;
return USER_Driver->pSetCursorPos( x, y );
}
@ -215,8 +213,7 @@ HWND WINAPI GetCapture(void)
*/
SHORT WINAPI GetAsyncKeyState(INT nKey)
{
if (USER_Driver.pGetAsyncKeyState) return USER_Driver.pGetAsyncKeyState( nKey );
return 0;
return USER_Driver->pGetAsyncKeyState( nKey );
}
@ -228,8 +225,7 @@ DWORD WINAPI GetQueueStatus( UINT flags )
DWORD ret = 0;
/* check for pending X events */
if (USER_Driver.pMsgWaitForMultipleObjectsEx)
USER_Driver.pMsgWaitForMultipleObjectsEx( 0, NULL, 0, QS_ALLINPUT, 0 );
USER_Driver->pMsgWaitForMultipleObjectsEx( 0, NULL, 0, QS_ALLINPUT, 0 );
SERVER_START_REQ( get_queue_status )
{
@ -250,8 +246,7 @@ BOOL WINAPI GetInputState(void)
DWORD ret = 0;
/* check for pending X events */
if (USER_Driver.pMsgWaitForMultipleObjectsEx)
USER_Driver.pMsgWaitForMultipleObjectsEx( 0, NULL, 0, QS_INPUT, 0 );
USER_Driver->pMsgWaitForMultipleObjectsEx( 0, NULL, 0, QS_INPUT, 0 );
SERVER_START_REQ( get_queue_status )
{
@ -430,9 +425,7 @@ WORD WINAPI VkKeyScanExA(CHAR cChar, HKL dwhkl)
*/
WORD WINAPI VkKeyScanExW(WCHAR cChar, HKL dwhkl)
{
if (USER_Driver.pVkKeyScanEx)
return USER_Driver.pVkKeyScanEx(cChar, dwhkl);
return -1;
return USER_Driver->pVkKeyScanEx(cChar, dwhkl);
}
/**********************************************************************
@ -495,9 +488,7 @@ UINT WINAPI MapVirtualKeyExW(UINT code, UINT maptype, HKL hkl)
{
TRACE_(keyboard)("(%d, %d, %p)\n", code, maptype, hkl);
if (USER_Driver.pMapVirtualKeyEx)
return USER_Driver.pMapVirtualKeyEx(code, maptype, hkl);
return 0;
return USER_Driver->pMapVirtualKeyEx(code, maptype, hkl);
}
/****************************************************************************
@ -517,9 +508,7 @@ UINT WINAPI GetKBCodePage(void)
*/
HKL WINAPI GetKeyboardLayout(DWORD dwLayout)
{
if (USER_Driver.pGetKeyboardLayout)
return USER_Driver.pGetKeyboardLayout(dwLayout);
return 0;
return USER_Driver->pGetKeyboardLayout(dwLayout);
}
/****************************************************************************
@ -539,9 +528,7 @@ BOOL WINAPI GetKeyboardLayoutNameA(LPSTR pszKLID)
*/
BOOL WINAPI GetKeyboardLayoutNameW(LPWSTR pwszKLID)
{
if (USER_Driver.pGetKeyboardLayoutName)
return USER_Driver.pGetKeyboardLayoutName(pwszKLID);
return FALSE;
return USER_Driver->pGetKeyboardLayoutName(pwszKLID);
}
/****************************************************************************
@ -568,9 +555,7 @@ INT WINAPI GetKeyNameTextA(LONG lParam, LPSTR lpBuffer, INT nSize)
*/
INT WINAPI GetKeyNameTextW(LONG lParam, LPWSTR lpBuffer, INT nSize)
{
if (USER_Driver.pGetKeyNameText)
return USER_Driver.pGetKeyNameText( lParam, lpBuffer, nSize );
return 0;
return USER_Driver->pGetKeyNameText( lParam, lpBuffer, nSize );
}
/****************************************************************************
@ -588,9 +573,7 @@ INT WINAPI ToUnicode(UINT virtKey, UINT scanCode, LPBYTE lpKeyState,
INT WINAPI ToUnicodeEx(UINT virtKey, UINT scanCode, LPBYTE lpKeyState,
LPWSTR lpwStr, int size, UINT flags, HKL hkl)
{
if (USER_Driver.pToUnicodeEx)
return USER_Driver.pToUnicodeEx(virtKey, scanCode, lpKeyState, lpwStr, size, flags, hkl);
return 0;
return USER_Driver->pToUnicodeEx(virtKey, scanCode, lpKeyState, lpwStr, size, flags, hkl);
}
/****************************************************************************
@ -625,9 +608,7 @@ HKL WINAPI ActivateKeyboardLayout(HKL hLayout, UINT flags)
{
TRACE_(keyboard)("(%p, %d)\n", hLayout, flags);
if (USER_Driver.pActivateKeyboardLayout)
return USER_Driver.pActivateKeyboardLayout(hLayout, flags);
return 0;
return USER_Driver->pActivateKeyboardLayout(hLayout, flags);
}
@ -641,9 +622,7 @@ UINT WINAPI GetKeyboardLayoutList(INT nBuff, HKL *layouts)
{
TRACE_(keyboard)("(%d,%p)\n",nBuff,layouts);
if (USER_Driver.pGetKeyboardLayoutList)
return USER_Driver.pGetKeyboardLayoutList(nBuff, layouts);
return 0;
return USER_Driver->pGetKeyboardLayoutList(nBuff, layouts);
}
@ -672,9 +651,7 @@ HKL WINAPI LoadKeyboardLayoutW(LPCWSTR pwszKLID, UINT Flags)
{
TRACE_(keyboard)("(%s, %d)\n", debugstr_w(pwszKLID), Flags);
if (USER_Driver.pLoadKeyboardLayout)
return USER_Driver.pLoadKeyboardLayout(pwszKLID, Flags);
return 0;
return USER_Driver->pLoadKeyboardLayout(pwszKLID, Flags);
}
/***********************************************************************
@ -701,9 +678,7 @@ BOOL WINAPI UnloadKeyboardLayout(HKL hkl)
{
TRACE_(keyboard)("(%p)\n", hkl);
if (USER_Driver.pUnloadKeyboardLayout)
return USER_Driver.pUnloadKeyboardLayout(hkl);
return 0;
return USER_Driver->pUnloadKeyboardLayout(hkl);
}
typedef struct __TRACKINGLIST {

View File

@ -1155,9 +1155,7 @@ static LRESULT handle_internal_message( HWND hwnd, UINT msg, WPARAM wparam, LPAR
case WM_WINE_DESTROYWINDOW:
return WIN_DestroyWindow( hwnd );
case WM_WINE_SETWINDOWPOS:
if (USER_Driver.pSetWindowPos)
return USER_Driver.pSetWindowPos( (WINDOWPOS *)lparam );
return 0;
return USER_Driver->pSetWindowPos( (WINDOWPOS *)lparam );
case WM_WINE_SHOWWINDOW:
return ShowWindow( hwnd, wparam );
case WM_WINE_SETPARENT:
@ -1174,10 +1172,7 @@ static LRESULT handle_internal_message( HWND hwnd, UINT msg, WPARAM wparam, LPAR
return HOOK_CallHooks( WH_MOUSE_LL, HC_ACTION, wparam, lparam, TRUE );
default:
if (msg >= WM_WINE_FIRST_DRIVER_MSG && msg <= WM_WINE_LAST_DRIVER_MSG)
{
if (!USER_Driver.pWindowMessage) return 0;
return USER_Driver.pWindowMessage( hwnd, msg, wparam, lparam );
}
return USER_Driver->pWindowMessage( hwnd, msg, wparam, lparam );
FIXME( "unknown internal message %x\n", msg );
return 0;
}
@ -2135,13 +2130,8 @@ static void wait_message_reply( UINT flags )
/* now wait for it */
ReleaseThunkLock( &dwlc );
if (USER_Driver.pMsgWaitForMultipleObjectsEx)
res = USER_Driver.pMsgWaitForMultipleObjectsEx( 1, &server_queue,
res = USER_Driver->pMsgWaitForMultipleObjectsEx( 1, &server_queue,
INFINITE, QS_ALLINPUT, 0 );
else
res = WaitForSingleObject( server_queue, INFINITE );
if (dwlc) RestoreThunkLock( dwlc );
}
}
@ -2692,8 +2682,7 @@ BOOL WINAPI PeekMessageW( MSG *msg_out, HWND hwnd, UINT first, UINT last, UINT f
USER_CheckNotLock();
/* check for graphics events */
if (USER_Driver.pMsgWaitForMultipleObjectsEx)
USER_Driver.pMsgWaitForMultipleObjectsEx( 0, NULL, 0, QS_ALLINPUT, 0 );
USER_Driver->pMsgWaitForMultipleObjectsEx( 0, NULL, 0, QS_ALLINPUT, 0 );
hwnd = WIN_GetFullHandle( hwnd );
@ -2795,11 +2784,7 @@ BOOL WINAPI GetMessageW( MSG *msg, HWND hwnd, UINT first, UINT last )
GetCurrentThreadId(), mask, wake_bits, changed_bits );
ReleaseThunkLock( &dwlc );
if (USER_Driver.pMsgWaitForMultipleObjectsEx)
USER_Driver.pMsgWaitForMultipleObjectsEx( 1, &server_queue, INFINITE,
QS_ALLINPUT, 0 );
else
WaitForSingleObject( server_queue, INFINITE );
USER_Driver->pMsgWaitForMultipleObjectsEx( 1, &server_queue, INFINITE, QS_ALLINPUT, 0 );
if (dwlc) RestoreThunkLock( dwlc );
}
@ -3120,14 +3105,8 @@ DWORD WINAPI MsgWaitForMultipleObjectsEx( DWORD count, CONST HANDLE *pHandles,
handles[count] = get_server_queue_handle();
ReleaseThunkLock( &lock );
if (USER_Driver.pMsgWaitForMultipleObjectsEx)
{
ret = USER_Driver.pMsgWaitForMultipleObjectsEx( count+1, handles, timeout, mask, flags );
ret = USER_Driver->pMsgWaitForMultipleObjectsEx( count+1, handles, timeout, mask, flags );
if (ret == count+1) ret = count; /* pretend the msg queue is ready */
}
else
ret = WaitForMultipleObjectsEx( count+1, handles, flags & MWMO_WAITALL,
timeout, flags & MWMO_ALERTABLE );
if (lock) RestoreThunkLock( lock );
return ret;
}
@ -3294,7 +3273,7 @@ BOOL WINAPI MessageBeep( UINT i )
{
BOOL active = TRUE;
SystemParametersInfoA( SPI_GETBEEP, 0, &active, FALSE );
if (active && USER_Driver.pBeep) USER_Driver.pBeep();
if (active) USER_Driver->pBeep();
return TRUE;
}

View File

@ -1552,8 +1552,7 @@ LONG NC_HandleSysCommand( HWND hwnd, WPARAM wParam, LPARAM lParam )
{
case SC_SIZE:
case SC_MOVE:
if (USER_Driver.pSysCommandSizeMove)
USER_Driver.pSysCommandSizeMove( hwnd, wParam );
USER_Driver->pSysCommandSizeMove( hwnd, wParam );
break;
case SC_MINIMIZE:

View File

@ -263,7 +263,7 @@ static BOOL send_erase( HWND hwnd, UINT flags, HRGN client_rgn,
{
if (need_erase && hwnd != GetDesktopWindow()) /* FIXME: mark it as needing erase again */
RedrawWindow( hwnd, clip_rect, 0, RDW_INVALIDATE | RDW_ERASE | RDW_NOCHILDREN );
USER_Driver.pReleaseDC( hwnd, hdc, TRUE );
USER_Driver->pReleaseDC( hwnd, hdc, TRUE );
}
}
@ -412,7 +412,7 @@ HDC WINAPI BeginPaint( HWND hwnd, PAINTSTRUCT *lps )
BOOL WINAPI EndPaint( HWND hwnd, const PAINTSTRUCT *lps )
{
if (!lps) return FALSE;
if (USER_Driver.pReleaseDC) USER_Driver.pReleaseDC( hwnd, lps->hdc, TRUE );
USER_Driver->pReleaseDC( hwnd, lps->hdc, TRUE );
ShowCaret( hwnd );
return TRUE;
}
@ -426,8 +426,7 @@ HDC WINAPI GetDCEx( HWND hwnd, HRGN hrgnClip, DWORD flags )
if (!hwnd) hwnd = GetDesktopWindow();
else hwnd = WIN_GetFullHandle( hwnd );
if (USER_Driver.pGetDCEx) return USER_Driver.pGetDCEx( hwnd, hrgnClip, flags );
return 0;
return USER_Driver->pGetDCEx( hwnd, hrgnClip, flags );
}
@ -467,8 +466,7 @@ HDC WINAPI GetWindowDC( HWND hwnd )
*/
INT WINAPI ReleaseDC( HWND hwnd, HDC hdc )
{
if (USER_Driver.pReleaseDC) return USER_Driver.pReleaseDC( hwnd, hdc, FALSE );
return 0;
return USER_Driver->pReleaseDC( hwnd, hdc, FALSE );
}
@ -477,8 +475,7 @@ INT WINAPI ReleaseDC( HWND hwnd, HDC hdc )
*/
HWND WINAPI WindowFromDC( HDC hDC )
{
if (USER_Driver.pWindowFromDC) return USER_Driver.pWindowFromDC( hDC );
return 0;
return USER_Driver->pWindowFromDC( hDC );
}
@ -862,7 +859,5 @@ BOOL WINAPI ScrollDC( HDC hdc, INT dx, INT dy, const RECT *lprcScroll,
const RECT *lprcClip, HRGN hrgnUpdate, LPRECT lprcUpdate )
{
if (USER_Driver.pScrollDC)
return USER_Driver.pScrollDC( hdc, dx, dy, lprcScroll, lprcClip, hrgnUpdate, lprcUpdate );
return FALSE;
return USER_Driver->pScrollDC( hdc, dx, dy, lprcScroll, lprcClip, hrgnUpdate, lprcUpdate );
}

View File

@ -1135,10 +1135,7 @@ BOOL WINAPI SystemParametersInfoW( UINT uiAction, UINT uiParam,
case SPI_GETSCREENSAVEACTIVE: /* 16 */
if (!pvParam) return FALSE;
if (USER_Driver.pGetScreenSaveActive)
*(BOOL *)pvParam = USER_Driver.pGetScreenSaveActive();
else
*(BOOL *)pvParam = FALSE;
*(BOOL *)pvParam = USER_Driver->pGetScreenSaveActive();
break;
case SPI_SETSCREENSAVEACTIVE: /* 17 */
@ -1146,8 +1143,7 @@ BOOL WINAPI SystemParametersInfoW( UINT uiAction, UINT uiParam,
WCHAR buf[5];
wsprintfW(buf, CSu, uiParam);
if (USER_Driver.pSetScreenSaveActive)
USER_Driver.pSetScreenSaveActive( uiParam );
USER_Driver->pSetScreenSaveActive( uiParam );
/* saved value does not affect Wine */
SYSPARAMS_Save( SPI_SETSCREENSAVEACTIVE_REGKEY,
SPI_SETSCREENSAVEACTIVE_VALNAME,
@ -2633,9 +2629,7 @@ LONG WINAPI ChangeDisplaySettingsExA( LPCSTR devname, LPDEVMODEA devmode, HWND h
LONG WINAPI ChangeDisplaySettingsExW( LPCWSTR devname, LPDEVMODEW devmode, HWND hwnd,
DWORD flags, LPVOID lparam )
{
/* Pass the request on to the driver */
if (!USER_Driver.pChangeDisplaySettingsEx) return DISP_CHANGE_FAILED;
return USER_Driver.pChangeDisplaySettingsEx( devname, devmode, hwnd, flags, lparam );
return USER_Driver->pChangeDisplaySettingsEx( devname, devmode, hwnd, flags, lparam );
}
@ -2695,7 +2689,5 @@ BOOL WINAPI EnumDisplaySettingsExA(LPCSTR lpszDeviceName, DWORD iModeNum,
BOOL WINAPI EnumDisplaySettingsExW(LPCWSTR lpszDeviceName, DWORD iModeNum,
LPDEVMODEW lpDevMode, DWORD dwFlags)
{
/* Pass the request on to the driver */
if (!USER_Driver.pEnumDisplaySettingsEx) return FALSE;
return USER_Driver.pEnumDisplaySettingsEx(lpszDeviceName, iModeNum, lpDevMode, dwFlags);
return USER_Driver->pEnumDisplaySettingsEx(lpszDeviceName, iModeNum, lpDevMode, dwFlags);
}

View File

@ -35,8 +35,6 @@
WINE_DEFAULT_DEBUG_CHANNEL(graphics);
USER_DRIVER USER_Driver;
WORD USER_HeapSel = 0; /* USER heap selector */
HMODULE user32_module = 0;
@ -53,99 +51,10 @@ static HPALETTE (WINAPI *pfnGDISelectPalette)( HDC hdc, HPALETTE hpal, WORD bkgn
static UINT (WINAPI *pfnGDIRealizePalette)( HDC hdc );
static HPALETTE hPrimaryPalette;
static HMODULE graphics_driver;
static DWORD exiting_thread_id;
extern void WDML_NotifyThreadDetach(void);
#define GET_USER_FUNC(name) USER_Driver.p##name = (void*)GetProcAddress( graphics_driver, #name )
/* load the graphics driver */
static BOOL load_driver(void)
{
char buffer[MAX_PATH], libname[32], *name, *next;
HKEY hkey;
strcpy( buffer, "x11,tty" ); /* default value */
/* @@ Wine registry key: HKCU\Software\Wine\Drivers */
if (!RegOpenKeyA( HKEY_CURRENT_USER, "Software\\Wine\\Drivers", &hkey ))
{
DWORD type, count = sizeof(buffer);
RegQueryValueExA( hkey, "Graphics", 0, &type, (LPBYTE) buffer, &count );
RegCloseKey( hkey );
}
name = buffer;
while (name)
{
next = strchr( name, ',' );
if (next) *next++ = 0;
snprintf( libname, sizeof(libname), "wine%s.drv", name );
if ((graphics_driver = LoadLibraryA( libname )) != 0) break;
name = next;
}
if (!graphics_driver)
{
MESSAGE( "wine: Could not load graphics driver '%s'.\n", buffer );
if (!strcasecmp( buffer, "x11" ))
MESSAGE( "Make sure that your X server is running and that $DISPLAY is set correctly.\n" );
ExitProcess(1);
}
GET_USER_FUNC(ActivateKeyboardLayout);
GET_USER_FUNC(Beep);
GET_USER_FUNC(GetAsyncKeyState);
GET_USER_FUNC(GetKeyNameText);
GET_USER_FUNC(GetKeyboardLayout);
GET_USER_FUNC(GetKeyboardLayoutList);
GET_USER_FUNC(GetKeyboardLayoutName);
GET_USER_FUNC(LoadKeyboardLayout);
GET_USER_FUNC(MapVirtualKeyEx);
GET_USER_FUNC(SendInput);
GET_USER_FUNC(ToUnicodeEx);
GET_USER_FUNC(UnloadKeyboardLayout);
GET_USER_FUNC(VkKeyScanEx);
GET_USER_FUNC(SetCursor);
GET_USER_FUNC(GetCursorPos);
GET_USER_FUNC(SetCursorPos);
GET_USER_FUNC(GetScreenSaveActive);
GET_USER_FUNC(SetScreenSaveActive);
GET_USER_FUNC(AcquireClipboard);
GET_USER_FUNC(EmptyClipboard);
GET_USER_FUNC(SetClipboardData);
GET_USER_FUNC(GetClipboardData);
GET_USER_FUNC(CountClipboardFormats);
GET_USER_FUNC(EnumClipboardFormats);
GET_USER_FUNC(IsClipboardFormatAvailable);
GET_USER_FUNC(RegisterClipboardFormat);
GET_USER_FUNC(GetClipboardFormatName);
GET_USER_FUNC(EndClipboardUpdate);
GET_USER_FUNC(ResetSelectionOwner);
GET_USER_FUNC(ChangeDisplaySettingsEx);
GET_USER_FUNC(EnumDisplaySettingsEx);
GET_USER_FUNC(CreateDesktopWindow);
GET_USER_FUNC(CreateWindow);
GET_USER_FUNC(DestroyWindow);
GET_USER_FUNC(GetDCEx);
GET_USER_FUNC(MsgWaitForMultipleObjectsEx);
GET_USER_FUNC(ReleaseDC);
GET_USER_FUNC(ScrollDC);
GET_USER_FUNC(SetFocus);
GET_USER_FUNC(SetParent);
GET_USER_FUNC(SetWindowPos);
GET_USER_FUNC(SetWindowRgn);
GET_USER_FUNC(SetWindowIcon);
GET_USER_FUNC(SetWindowStyle);
GET_USER_FUNC(SetWindowText);
GET_USER_FUNC(ShowWindow);
GET_USER_FUNC(SysCommandSizeMove);
GET_USER_FUNC(WindowFromDC);
GET_USER_FUNC(WindowMessage);
return TRUE;
}
/***********************************************************************
* USER_Lock
@ -261,9 +170,6 @@ static BOOL process_attach(void)
/* some Win9x dlls expect keyboard to be loaded */
if (GetVersion() & 0x80000000) LoadLibrary16( "keyboard.drv" );
/* Load the graphics driver */
if (!load_driver()) return FALSE;
/* Initialize system colors and metrics */
SYSPARAMS_Init();
@ -308,15 +214,6 @@ static void thread_detach(void)
}
/**********************************************************************
* process_detach
*/
static void process_detach(void)
{
memset(&USER_Driver, 0, sizeof(USER_Driver));
FreeLibrary(graphics_driver);
}
/***********************************************************************
* UserClientDllInitialize (USER32.@)
*
@ -331,9 +228,6 @@ BOOL WINAPI DllMain( HINSTANCE inst, DWORD reason, LPVOID reserved )
user32_module = inst;
ret = process_attach();
break;
case DLL_PROCESS_DETACH:
process_detach();
break;
case DLL_THREAD_DETACH:
thread_detach();
break;

View File

@ -157,7 +157,7 @@ typedef struct tagUSER_DRIVER {
LRESULT (*pWindowMessage)(HWND,UINT,WPARAM,LPARAM);
} USER_DRIVER;
extern USER_DRIVER USER_Driver;
extern const USER_DRIVER *USER_Driver;
struct received_message_info;
struct hook16_queue_info;

View File

@ -462,7 +462,7 @@ ULONG WIN_SetStyle( HWND hwnd, ULONG set_bits, ULONG clear_bits )
}
SERVER_END_REQ;
WIN_ReleasePtr( win );
if (ok && USER_Driver.pSetWindowStyle) USER_Driver.pSetWindowStyle( hwnd, old_style );
if (ok) USER_Driver->pSetWindowStyle( hwnd, old_style );
return old_style;
}
@ -575,7 +575,7 @@ LRESULT WIN_DestroyWindow( HWND hwnd )
if (menu) DestroyMenu( menu );
if (sys_menu) DestroyMenu( sys_menu );
if (USER_Driver.pDestroyWindow) USER_Driver.pDestroyWindow( hwnd );
USER_Driver->pDestroyWindow( hwnd );
free_window_handle( hwnd );
return 0;
@ -1041,7 +1041,7 @@ static HWND WIN_CreateWindowEx( CREATESTRUCTA *cs, ATOM classAtom,
else SetWindowLongPtrW( hwnd, GWLP_ID, (ULONG_PTR)cs->hMenu );
WIN_ReleasePtr( wndPtr );
if (!USER_Driver.pCreateWindow || !USER_Driver.pCreateWindow( hwnd, cs, unicode))
if (!USER_Driver->pCreateWindow( hwnd, cs, unicode))
{
WIN_DestroyWindow( hwnd );
return 0;
@ -1267,8 +1267,7 @@ static void WIN_SendDestroyMsg( HWND hwnd )
if (hwnd == info.hwndCaret) DestroyCaret();
if (hwnd == info.hwndActive) WINPOS_ActivateOtherWindow( hwnd );
}
if (USER_Driver.pResetSelectionOwner)
USER_Driver.pResetSelectionOwner( hwnd, TRUE );
USER_Driver->pResetSelectionOwner( hwnd, TRUE );
/*
* Send the WM_DESTROY to the window.
@ -1334,8 +1333,7 @@ BOOL WINAPI DestroyWindow( HWND hwnd )
if (!IsWindow(hwnd)) return TRUE;
if (USER_Driver.pResetSelectionOwner)
USER_Driver.pResetSelectionOwner( hwnd, FALSE ); /* before the window is unmapped */
USER_Driver->pResetSelectionOwner( hwnd, FALSE ); /* before the window is unmapped */
/* Hide the window */
if (GetWindowLongW( hwnd, GWL_STYLE ) & WS_VISIBLE)
@ -1549,7 +1547,7 @@ HWND WINAPI GetDesktopWindow(void)
if (!wine_server_call( req )) thread_info->desktop = reply->handle;
}
SERVER_END_REQ;
if (!thread_info->desktop || !USER_Driver.pCreateDesktopWindow( thread_info->desktop ))
if (!thread_info->desktop || !USER_Driver->pCreateDesktopWindow( thread_info->desktop ))
ERR( "failed to create desktop window\n" );
}
return thread_info->desktop;
@ -2075,8 +2073,7 @@ static LONG_PTR WIN_SetWindowLong( HWND hwnd, INT offset, LONG_PTR newval,
if (!ok) return 0;
if (offset == GWL_STYLE && USER_Driver.pSetWindowStyle)
USER_Driver.pSetWindowStyle( hwnd, retval );
if (offset == GWL_STYLE) USER_Driver->pSetWindowStyle( hwnd, retval );
if (offset == GWL_STYLE || offset == GWL_EXSTYLE)
SendMessageW( hwnd, WM_STYLECHANGED, offset, (LPARAM)&style );
@ -2520,10 +2517,7 @@ HWND WINAPI SetParent( HWND hwnd, HWND parent )
if (!(full_handle = WIN_IsCurrentThread( hwnd )))
return (HWND)SendMessageW( hwnd, WM_WINE_SETPARENT, (WPARAM)parent, 0 );
if (USER_Driver.pSetParent)
return USER_Driver.pSetParent( full_handle, parent );
return 0;
return USER_Driver->pSetParent( full_handle, parent );
}

View File

@ -265,8 +265,7 @@ int WINAPI SetWindowRgn( HWND hwnd, HRGN hrgn, BOOL bRedraw )
SERVER_END_REQ;
}
if (ret && USER_Driver.pSetWindowRgn)
ret = USER_Driver.pSetWindowRgn( hwnd, hrgn, bRedraw );
if (ret) ret = USER_Driver->pSetWindowRgn( hwnd, hrgn, bRedraw );
if (ret && bRedraw) RedrawWindow( hwnd, NULL, 0, RDW_FRAME | RDW_INVALIDATE | RDW_ERASE );
return ret;
@ -836,11 +835,8 @@ BOOL WINAPI ShowWindowAsync( HWND hwnd, INT cmd )
}
if ((full_handle = WIN_IsCurrentThread( hwnd )))
{
if (USER_Driver.pShowWindow)
return USER_Driver.pShowWindow( full_handle, cmd );
return FALSE;
}
return USER_Driver->pShowWindow( full_handle, cmd );
return SendNotifyMessageW( hwnd, WM_WINE_SHOWWINDOW, cmd, 0 );
}
@ -858,11 +854,8 @@ BOOL WINAPI ShowWindow( HWND hwnd, INT cmd )
return FALSE;
}
if ((full_handle = WIN_IsCurrentThread( hwnd )))
{
if (USER_Driver.pShowWindow)
return USER_Driver.pShowWindow( full_handle, cmd );
return FALSE;
}
return USER_Driver->pShowWindow( full_handle, cmd );
return SendMessageW( hwnd, WM_WINE_SHOWWINDOW, cmd, 0 );
}
@ -1209,11 +1202,8 @@ BOOL WINAPI SetWindowPos( HWND hwnd, HWND hwndInsertAfter,
winpos.cy = cy;
winpos.flags = flags;
if (WIN_IsCurrentThread( hwnd ))
{
if (USER_Driver.pSetWindowPos)
return USER_Driver.pSetWindowPos( &winpos );
return FALSE;
}
return USER_Driver->pSetWindowPos( &winpos );
return SendMessageW( winpos.hwnd, WM_WINE_SETWINDOWPOS, 0, (LPARAM)&winpos );
}
@ -1343,7 +1333,7 @@ BOOL WINAPI EndDeferWindowPos( HDWP hdwp )
if (!pDWP) return FALSE;
for (i = 0, winpos = pDWP->winPos; i < pDWP->actualCount; i++, winpos++)
{
if (!USER_Driver.pSetWindowPos || !(res = USER_Driver.pSetWindowPos( winpos ))) break;
if (!(res = USER_Driver->pSetWindowPos( winpos ))) break;
}
USER_HEAP_FREE( hdwp );
return res;