Commit 15ec9687 authored by Alexandre Julliard's avatar Alexandre Julliard

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.
parent bb72a06e
...@@ -31,6 +31,7 @@ C_SRCS = \ ...@@ -31,6 +31,7 @@ C_SRCS = \
desktop.c \ desktop.c \
dialog.c \ dialog.c \
dialog16.c \ dialog16.c \
driver.c \
driver16.c \ driver16.c \
edit.c \ edit.c \
exticon.c \ exticon.c \
......
...@@ -228,14 +228,7 @@ static BOOL CLIPBOARD_CloseClipboard(void) ...@@ -228,14 +228,7 @@ static BOOL CLIPBOARD_CloseClipboard(void)
*/ */
UINT WINAPI RegisterClipboardFormatW(LPCWSTR FormatName) UINT WINAPI RegisterClipboardFormatW(LPCWSTR FormatName)
{ {
UINT wFormatID = 0; return USER_Driver->pRegisterClipboardFormat(FormatName);
TRACE("%s\n", debugstr_w(FormatName));
if (USER_Driver.pRegisterClipboardFormat)
wFormatID = USER_Driver.pRegisterClipboardFormat(FormatName);
return wFormatID;
} }
...@@ -263,14 +256,7 @@ UINT WINAPI RegisterClipboardFormatA(LPCSTR formatName) ...@@ -263,14 +256,7 @@ UINT WINAPI RegisterClipboardFormatA(LPCSTR formatName)
*/ */
INT WINAPI GetClipboardFormatNameW(UINT wFormat, LPWSTR retStr, INT maxlen) INT WINAPI GetClipboardFormatNameW(UINT wFormat, LPWSTR retStr, INT maxlen)
{ {
INT len = 0; return USER_Driver->pGetClipboardFormatName(wFormat, retStr, maxlen);
TRACE("%04x,%p,%d\n", wFormat, retStr, maxlen);
if (USER_Driver.pGetClipboardFormatName)
len = USER_Driver.pGetClipboardFormatName(wFormat, retStr, maxlen);
return len;
} }
...@@ -326,8 +312,7 @@ BOOL WINAPI CloseClipboard(void) ...@@ -326,8 +312,7 @@ BOOL WINAPI CloseClipboard(void)
{ {
HWND hWndViewer = GetClipboardViewer(); HWND hWndViewer = GetClipboardViewer();
if (USER_Driver.pEndClipboardUpdate) USER_Driver->pEndClipboardUpdate();
USER_Driver.pEndClipboardUpdate();
if (hWndViewer) if (hWndViewer)
SendMessageW(hWndViewer, WM_DRAWCLIPBOARD, 0, 0); SendMessageW(hWndViewer, WM_DRAWCLIPBOARD, 0, 0);
...@@ -378,12 +363,10 @@ BOOL WINAPI EmptyClipboard(void) ...@@ -378,12 +363,10 @@ BOOL WINAPI EmptyClipboard(void)
/* Acquire the selection. This will notify the previous owner /* Acquire the selection. This will notify the previous owner
* to clear it's cache. */ * to clear it's cache. */
if (USER_Driver.pAcquireClipboard) USER_Driver->pAcquireClipboard(cbinfo.hWndOpen);
USER_Driver.pAcquireClipboard(cbinfo.hWndOpen);
/* Empty the local cache */ /* Empty the local cache */
if (USER_Driver.pEmptyClipboard) USER_Driver->pEmptyClipboard(FALSE);
USER_Driver.pEmptyClipboard(FALSE);
bCBHasChanged = TRUE; bCBHasChanged = TRUE;
...@@ -522,8 +505,7 @@ HANDLE16 WINAPI SetClipboardData16(UINT16 wFormat, HANDLE16 hData) ...@@ -522,8 +505,7 @@ HANDLE16 WINAPI SetClipboardData16(UINT16 wFormat, HANDLE16 hData)
return 0; return 0;
} }
if (USER_Driver.pSetClipboardData && if (USER_Driver->pSetClipboardData(wFormat, hData, 0, cbinfo.flags & CB_OWNER))
USER_Driver.pSetClipboardData(wFormat, hData, 0, cbinfo.flags & CB_OWNER))
{ {
hResult = hData; hResult = hData;
bCBHasChanged = TRUE; bCBHasChanged = TRUE;
...@@ -552,8 +534,7 @@ HANDLE WINAPI SetClipboardData(UINT wFormat, HANDLE hData) ...@@ -552,8 +534,7 @@ HANDLE WINAPI SetClipboardData(UINT wFormat, HANDLE hData)
return 0; return 0;
} }
if (USER_Driver.pSetClipboardData && if (USER_Driver->pSetClipboardData(wFormat, 0, hData, cbinfo.flags & CB_OWNER))
USER_Driver.pSetClipboardData(wFormat, 0, hData, cbinfo.flags & CB_OWNER))
{ {
hResult = hData; hResult = hData;
bCBHasChanged = TRUE; bCBHasChanged = TRUE;
...@@ -568,11 +549,7 @@ HANDLE WINAPI SetClipboardData(UINT wFormat, HANDLE hData) ...@@ -568,11 +549,7 @@ HANDLE WINAPI SetClipboardData(UINT wFormat, HANDLE hData)
*/ */
INT WINAPI CountClipboardFormats(void) INT WINAPI CountClipboardFormats(void)
{ {
INT count = 0; INT count = USER_Driver->pCountClipboardFormats();
if (USER_Driver.pCountClipboardFormats)
count = USER_Driver.pCountClipboardFormats();
TRACE("returning %d\n", count); TRACE("returning %d\n", count);
return count; return count;
} }
...@@ -583,7 +560,6 @@ INT WINAPI CountClipboardFormats(void) ...@@ -583,7 +560,6 @@ INT WINAPI CountClipboardFormats(void)
*/ */
UINT WINAPI EnumClipboardFormats(UINT wFormat) UINT WINAPI EnumClipboardFormats(UINT wFormat)
{ {
UINT wFmt = 0;
CLIPBOARDINFO cbinfo; CLIPBOARDINFO cbinfo;
TRACE("(%04X)\n", wFormat); TRACE("(%04X)\n", wFormat);
...@@ -595,11 +571,7 @@ UINT WINAPI EnumClipboardFormats(UINT wFormat) ...@@ -595,11 +571,7 @@ UINT WINAPI EnumClipboardFormats(UINT wFormat)
SetLastError(ERROR_CLIPBOARD_NOT_OPEN); SetLastError(ERROR_CLIPBOARD_NOT_OPEN);
return 0; return 0;
} }
return USER_Driver->pEnumClipboardFormats(wFormat);
if (USER_Driver.pEnumClipboardFormats)
wFmt = USER_Driver.pEnumClipboardFormats(wFormat);
return wFmt;
} }
...@@ -608,11 +580,7 @@ UINT WINAPI EnumClipboardFormats(UINT wFormat) ...@@ -608,11 +580,7 @@ UINT WINAPI EnumClipboardFormats(UINT wFormat)
*/ */
BOOL WINAPI IsClipboardFormatAvailable(UINT wFormat) BOOL WINAPI IsClipboardFormatAvailable(UINT wFormat)
{ {
BOOL bret = FALSE; BOOL bret = USER_Driver->pIsClipboardFormatAvailable(wFormat);
if (USER_Driver.pIsClipboardFormatAvailable)
bret = USER_Driver.pIsClipboardFormatAvailable(wFormat);
TRACE("%04x, returning %d\n", wFormat, bret); TRACE("%04x, returning %d\n", wFormat, bret);
return bret; return bret;
} }
...@@ -634,8 +602,7 @@ HANDLE16 WINAPI GetClipboardData16(UINT16 wFormat) ...@@ -634,8 +602,7 @@ HANDLE16 WINAPI GetClipboardData16(UINT16 wFormat)
return 0; return 0;
} }
if (USER_Driver.pGetClipboardData) if (!USER_Driver->pGetClipboardData(wFormat, &hData, NULL)) hData = 0;
USER_Driver.pGetClipboardData(wFormat, &hData, NULL);
return hData; return hData;
} }
...@@ -659,8 +626,7 @@ HANDLE WINAPI GetClipboardData(UINT wFormat) ...@@ -659,8 +626,7 @@ HANDLE WINAPI GetClipboardData(UINT wFormat)
return 0; return 0;
} }
if (USER_Driver.pGetClipboardData) if (!USER_Driver->pGetClipboardData(wFormat, NULL, &hData)) hData = 0;
USER_Driver.pGetClipboardData(wFormat, NULL, &hData);
TRACE("returning %p\n", hData); TRACE("returning %p\n", hData);
return hData; return hData;
......
...@@ -1480,9 +1480,9 @@ HCURSOR WINAPI SetCursor( HCURSOR hCursor /* [in] Handle of cursor to show */ ) ...@@ -1480,9 +1480,9 @@ HCURSOR WINAPI SetCursor( HCURSOR hCursor /* [in] Handle of cursor to show */ )
hOldCursor = thread_info->cursor; hOldCursor = thread_info->cursor;
thread_info->cursor = hCursor; thread_info->cursor = hCursor;
/* Change the cursor shape only if it is visible */ /* 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)); GlobalUnlock16(HCURSOR_16(hCursor));
} }
return hOldCursor; return hOldCursor;
...@@ -1499,16 +1499,16 @@ INT WINAPI ShowCursor( BOOL bShow ) ...@@ -1499,16 +1499,16 @@ INT WINAPI ShowCursor( BOOL bShow )
if (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)); GlobalUnlock16(HCURSOR_16(thread_info->cursor));
} }
} }
else else
{ {
if (--thread_info->cursor_count == -1 && USER_Driver.pSetCursor) /* Hide it */ if (--thread_info->cursor_count == -1) /* Hide it */
USER_Driver.pSetCursor( NULL ); USER_Driver->pSetCursor( NULL );
} }
return thread_info->cursor_count; return thread_info->cursor_count;
} }
......
...@@ -108,7 +108,7 @@ static void DEFWND_SetTextA( HWND hwnd, LPCSTR text ) ...@@ -108,7 +108,7 @@ static void DEFWND_SetTextA( HWND hwnd, LPCSTR text )
ERR("Not enough memory for window text\n"); ERR("Not enough memory for window text\n");
WIN_ReleasePtr( wndPtr ); 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 ) ...@@ -143,7 +143,7 @@ static void DEFWND_SetTextW( HWND hwnd, LPCWSTR text )
text = wndPtr->text; text = wndPtr->text;
WIN_ReleasePtr( wndPtr ); 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 ...@@ -669,8 +669,7 @@ static LRESULT DEFWND_DefWinProc( HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPa
} }
WIN_ReleasePtr( wndPtr ); 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 | SetWindowPos(hwnd, 0, 0, 0, 0, 0, SWP_FRAMECHANGED | SWP_NOSIZE |
SWP_NOMOVE | SWP_NOACTIVATE | SWP_NOZORDER); SWP_NOMOVE | SWP_NOACTIVATE | SWP_NOZORDER);
......
...@@ -52,7 +52,7 @@ WORD WINAPI DISPLAY_Inquire(LPCURSORINFO16 lpCursorInfo) ...@@ -52,7 +52,7 @@ WORD WINAPI DISPLAY_Inquire(LPCURSORINFO16 lpCursorInfo)
*/ */
VOID WINAPI DISPLAY_SetCursor( struct tagCURSORICONINFO *lpCursor ) 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 ) ...@@ -60,7 +60,7 @@ VOID WINAPI DISPLAY_SetCursor( struct tagCURSORICONINFO *lpCursor )
*/ */
VOID WINAPI DISPLAY_MoveCursor( WORD wAbsX, WORD wAbsY ) VOID WINAPI DISPLAY_MoveCursor( WORD wAbsX, WORD wAbsY )
{ {
if (USER_Driver.pSetCursorPos) USER_Driver.pSetCursorPos(wAbsX, wAbsY); USER_Driver->pSetCursorPos(wAbsX, wAbsY);
} }
/*********************************************************************** /***********************************************************************
......
...@@ -63,7 +63,7 @@ static HWND set_focus_window( HWND hwnd ) ...@@ -63,7 +63,7 @@ static HWND set_focus_window( HWND hwnd )
} }
if (IsWindow(hwnd)) if (IsWindow(hwnd))
{ {
if (USER_Driver.pSetFocus) USER_Driver.pSetFocus(hwnd); USER_Driver->pSetFocus(hwnd);
SendMessageW( hwnd, WM_SETFOCUS, (WPARAM)previous, 0 ); SendMessageW( hwnd, WM_SETFOCUS, (WPARAM)previous, 0 );
} }
return previous; return previous;
......
...@@ -80,8 +80,7 @@ static WORD get_key_state(void) ...@@ -80,8 +80,7 @@ static WORD get_key_state(void)
*/ */
UINT WINAPI SendInput( UINT count, LPINPUT inputs, int size ) UINT WINAPI SendInput( UINT count, LPINPUT inputs, int size )
{ {
if (USER_Driver.pSendInput) return USER_Driver.pSendInput( count, inputs, size ); return USER_Driver->pSendInput( count, inputs, size );
return 0;
} }
...@@ -127,8 +126,8 @@ void WINAPI mouse_event( DWORD dwFlags, DWORD dx, DWORD dy, ...@@ -127,8 +126,8 @@ void WINAPI mouse_event( DWORD dwFlags, DWORD dx, DWORD dy,
*/ */
BOOL WINAPI GetCursorPos( POINT *pt ) BOOL WINAPI GetCursorPos( POINT *pt )
{ {
if (pt && USER_Driver.pGetCursorPos) return USER_Driver.pGetCursorPos( pt ); if (!pt) return FALSE;
return FALSE; return USER_Driver->pGetCursorPos( pt );
} }
...@@ -150,8 +149,7 @@ BOOL WINAPI GetCursorInfo( PCURSORINFO pci ) ...@@ -150,8 +149,7 @@ BOOL WINAPI GetCursorInfo( PCURSORINFO pci )
*/ */
BOOL WINAPI SetCursorPos( INT x, INT y ) BOOL WINAPI SetCursorPos( INT x, INT y )
{ {
if (USER_Driver.pSetCursorPos) return USER_Driver.pSetCursorPos( x, y ); return USER_Driver->pSetCursorPos( x, y );
return FALSE;
} }
...@@ -215,8 +213,7 @@ HWND WINAPI GetCapture(void) ...@@ -215,8 +213,7 @@ HWND WINAPI GetCapture(void)
*/ */
SHORT WINAPI GetAsyncKeyState(INT nKey) SHORT WINAPI GetAsyncKeyState(INT nKey)
{ {
if (USER_Driver.pGetAsyncKeyState) return USER_Driver.pGetAsyncKeyState( nKey ); return USER_Driver->pGetAsyncKeyState( nKey );
return 0;
} }
...@@ -228,8 +225,7 @@ DWORD WINAPI GetQueueStatus( UINT flags ) ...@@ -228,8 +225,7 @@ DWORD WINAPI GetQueueStatus( UINT flags )
DWORD ret = 0; DWORD ret = 0;
/* check for pending X events */ /* 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 ) SERVER_START_REQ( get_queue_status )
{ {
...@@ -250,8 +246,7 @@ BOOL WINAPI GetInputState(void) ...@@ -250,8 +246,7 @@ BOOL WINAPI GetInputState(void)
DWORD ret = 0; DWORD ret = 0;
/* check for pending X events */ /* 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 ) SERVER_START_REQ( get_queue_status )
{ {
...@@ -430,9 +425,7 @@ WORD WINAPI VkKeyScanExA(CHAR cChar, HKL dwhkl) ...@@ -430,9 +425,7 @@ WORD WINAPI VkKeyScanExA(CHAR cChar, HKL dwhkl)
*/ */
WORD WINAPI VkKeyScanExW(WCHAR cChar, HKL dwhkl) WORD WINAPI VkKeyScanExW(WCHAR cChar, HKL dwhkl)
{ {
if (USER_Driver.pVkKeyScanEx) return USER_Driver->pVkKeyScanEx(cChar, dwhkl);
return USER_Driver.pVkKeyScanEx(cChar, dwhkl);
return -1;
} }
/********************************************************************** /**********************************************************************
...@@ -495,9 +488,7 @@ UINT WINAPI MapVirtualKeyExW(UINT code, UINT maptype, HKL hkl) ...@@ -495,9 +488,7 @@ UINT WINAPI MapVirtualKeyExW(UINT code, UINT maptype, HKL hkl)
{ {
TRACE_(keyboard)("(%d, %d, %p)\n", code, maptype, hkl); TRACE_(keyboard)("(%d, %d, %p)\n", code, maptype, hkl);
if (USER_Driver.pMapVirtualKeyEx) return USER_Driver->pMapVirtualKeyEx(code, maptype, hkl);
return USER_Driver.pMapVirtualKeyEx(code, maptype, hkl);
return 0;
} }
/**************************************************************************** /****************************************************************************
...@@ -517,9 +508,7 @@ UINT WINAPI GetKBCodePage(void) ...@@ -517,9 +508,7 @@ UINT WINAPI GetKBCodePage(void)
*/ */
HKL WINAPI GetKeyboardLayout(DWORD dwLayout) HKL WINAPI GetKeyboardLayout(DWORD dwLayout)
{ {
if (USER_Driver.pGetKeyboardLayout) return USER_Driver->pGetKeyboardLayout(dwLayout);
return USER_Driver.pGetKeyboardLayout(dwLayout);
return 0;
} }
/**************************************************************************** /****************************************************************************
...@@ -539,9 +528,7 @@ BOOL WINAPI GetKeyboardLayoutNameA(LPSTR pszKLID) ...@@ -539,9 +528,7 @@ BOOL WINAPI GetKeyboardLayoutNameA(LPSTR pszKLID)
*/ */
BOOL WINAPI GetKeyboardLayoutNameW(LPWSTR pwszKLID) BOOL WINAPI GetKeyboardLayoutNameW(LPWSTR pwszKLID)
{ {
if (USER_Driver.pGetKeyboardLayoutName) return USER_Driver->pGetKeyboardLayoutName(pwszKLID);
return USER_Driver.pGetKeyboardLayoutName(pwszKLID);
return FALSE;
} }
/**************************************************************************** /****************************************************************************
...@@ -568,9 +555,7 @@ INT WINAPI GetKeyNameTextA(LONG lParam, LPSTR lpBuffer, INT nSize) ...@@ -568,9 +555,7 @@ INT WINAPI GetKeyNameTextA(LONG lParam, LPSTR lpBuffer, INT nSize)
*/ */
INT WINAPI GetKeyNameTextW(LONG lParam, LPWSTR lpBuffer, INT nSize) INT WINAPI GetKeyNameTextW(LONG lParam, LPWSTR lpBuffer, INT nSize)
{ {
if (USER_Driver.pGetKeyNameText) return USER_Driver->pGetKeyNameText( lParam, lpBuffer, nSize );
return USER_Driver.pGetKeyNameText( lParam, lpBuffer, nSize );
return 0;
} }
/**************************************************************************** /****************************************************************************
...@@ -588,9 +573,7 @@ INT WINAPI ToUnicode(UINT virtKey, UINT scanCode, LPBYTE lpKeyState, ...@@ -588,9 +573,7 @@ INT WINAPI ToUnicode(UINT virtKey, UINT scanCode, LPBYTE lpKeyState,
INT WINAPI ToUnicodeEx(UINT virtKey, UINT scanCode, LPBYTE lpKeyState, INT WINAPI ToUnicodeEx(UINT virtKey, UINT scanCode, LPBYTE lpKeyState,
LPWSTR lpwStr, int size, UINT flags, HKL hkl) LPWSTR lpwStr, int size, UINT flags, HKL hkl)
{ {
if (USER_Driver.pToUnicodeEx) return USER_Driver->pToUnicodeEx(virtKey, scanCode, lpKeyState, lpwStr, size, flags, hkl);
return USER_Driver.pToUnicodeEx(virtKey, scanCode, lpKeyState, lpwStr, size, flags, hkl);
return 0;
} }
/**************************************************************************** /****************************************************************************
...@@ -625,9 +608,7 @@ HKL WINAPI ActivateKeyboardLayout(HKL hLayout, UINT flags) ...@@ -625,9 +608,7 @@ HKL WINAPI ActivateKeyboardLayout(HKL hLayout, UINT flags)
{ {
TRACE_(keyboard)("(%p, %d)\n", hLayout, flags); TRACE_(keyboard)("(%p, %d)\n", hLayout, flags);
if (USER_Driver.pActivateKeyboardLayout) return USER_Driver->pActivateKeyboardLayout(hLayout, flags);
return USER_Driver.pActivateKeyboardLayout(hLayout, flags);
return 0;
} }
...@@ -641,9 +622,7 @@ UINT WINAPI GetKeyboardLayoutList(INT nBuff, HKL *layouts) ...@@ -641,9 +622,7 @@ UINT WINAPI GetKeyboardLayoutList(INT nBuff, HKL *layouts)
{ {
TRACE_(keyboard)("(%d,%p)\n",nBuff,layouts); TRACE_(keyboard)("(%d,%p)\n",nBuff,layouts);
if (USER_Driver.pGetKeyboardLayoutList) return USER_Driver->pGetKeyboardLayoutList(nBuff, layouts);
return USER_Driver.pGetKeyboardLayoutList(nBuff, layouts);
return 0;
} }
...@@ -672,9 +651,7 @@ HKL WINAPI LoadKeyboardLayoutW(LPCWSTR pwszKLID, UINT Flags) ...@@ -672,9 +651,7 @@ HKL WINAPI LoadKeyboardLayoutW(LPCWSTR pwszKLID, UINT Flags)
{ {
TRACE_(keyboard)("(%s, %d)\n", debugstr_w(pwszKLID), Flags); TRACE_(keyboard)("(%s, %d)\n", debugstr_w(pwszKLID), Flags);
if (USER_Driver.pLoadKeyboardLayout) return USER_Driver->pLoadKeyboardLayout(pwszKLID, Flags);
return USER_Driver.pLoadKeyboardLayout(pwszKLID, Flags);
return 0;
} }
/*********************************************************************** /***********************************************************************
...@@ -701,9 +678,7 @@ BOOL WINAPI UnloadKeyboardLayout(HKL hkl) ...@@ -701,9 +678,7 @@ BOOL WINAPI UnloadKeyboardLayout(HKL hkl)
{ {
TRACE_(keyboard)("(%p)\n", hkl); TRACE_(keyboard)("(%p)\n", hkl);
if (USER_Driver.pUnloadKeyboardLayout) return USER_Driver->pUnloadKeyboardLayout(hkl);
return USER_Driver.pUnloadKeyboardLayout(hkl);
return 0;
} }
typedef struct __TRACKINGLIST { typedef struct __TRACKINGLIST {
......
...@@ -1155,9 +1155,7 @@ static LRESULT handle_internal_message( HWND hwnd, UINT msg, WPARAM wparam, LPAR ...@@ -1155,9 +1155,7 @@ static LRESULT handle_internal_message( HWND hwnd, UINT msg, WPARAM wparam, LPAR
case WM_WINE_DESTROYWINDOW: case WM_WINE_DESTROYWINDOW:
return WIN_DestroyWindow( hwnd ); return WIN_DestroyWindow( hwnd );
case WM_WINE_SETWINDOWPOS: case WM_WINE_SETWINDOWPOS:
if (USER_Driver.pSetWindowPos) return USER_Driver->pSetWindowPos( (WINDOWPOS *)lparam );
return USER_Driver.pSetWindowPos( (WINDOWPOS *)lparam );
return 0;
case WM_WINE_SHOWWINDOW: case WM_WINE_SHOWWINDOW:
return ShowWindow( hwnd, wparam ); return ShowWindow( hwnd, wparam );
case WM_WINE_SETPARENT: case WM_WINE_SETPARENT:
...@@ -1174,10 +1172,7 @@ static LRESULT handle_internal_message( HWND hwnd, UINT msg, WPARAM wparam, LPAR ...@@ -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 ); return HOOK_CallHooks( WH_MOUSE_LL, HC_ACTION, wparam, lparam, TRUE );
default: default:
if (msg >= WM_WINE_FIRST_DRIVER_MSG && msg <= WM_WINE_LAST_DRIVER_MSG) if (msg >= WM_WINE_FIRST_DRIVER_MSG && msg <= WM_WINE_LAST_DRIVER_MSG)
{ return USER_Driver->pWindowMessage( hwnd, msg, wparam, lparam );
if (!USER_Driver.pWindowMessage) return 0;
return USER_Driver.pWindowMessage( hwnd, msg, wparam, lparam );
}
FIXME( "unknown internal message %x\n", msg ); FIXME( "unknown internal message %x\n", msg );
return 0; return 0;
} }
...@@ -2135,13 +2130,8 @@ static void wait_message_reply( UINT flags ) ...@@ -2135,13 +2130,8 @@ static void wait_message_reply( UINT flags )
/* now wait for it */ /* now wait for it */
ReleaseThunkLock( &dwlc ); ReleaseThunkLock( &dwlc );
res = USER_Driver->pMsgWaitForMultipleObjectsEx( 1, &server_queue,
if (USER_Driver.pMsgWaitForMultipleObjectsEx) INFINITE, QS_ALLINPUT, 0 );
res = USER_Driver.pMsgWaitForMultipleObjectsEx( 1, &server_queue,
INFINITE, QS_ALLINPUT, 0 );
else
res = WaitForSingleObject( server_queue, INFINITE );
if (dwlc) RestoreThunkLock( dwlc ); if (dwlc) RestoreThunkLock( dwlc );
} }
} }
...@@ -2692,8 +2682,7 @@ BOOL WINAPI PeekMessageW( MSG *msg_out, HWND hwnd, UINT first, UINT last, UINT f ...@@ -2692,8 +2682,7 @@ BOOL WINAPI PeekMessageW( MSG *msg_out, HWND hwnd, UINT first, UINT last, UINT f
USER_CheckNotLock(); USER_CheckNotLock();
/* check for graphics events */ /* 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 ); hwnd = WIN_GetFullHandle( hwnd );
...@@ -2795,11 +2784,7 @@ BOOL WINAPI GetMessageW( MSG *msg, HWND hwnd, UINT first, UINT last ) ...@@ -2795,11 +2784,7 @@ BOOL WINAPI GetMessageW( MSG *msg, HWND hwnd, UINT first, UINT last )
GetCurrentThreadId(), mask, wake_bits, changed_bits ); GetCurrentThreadId(), mask, wake_bits, changed_bits );
ReleaseThunkLock( &dwlc ); ReleaseThunkLock( &dwlc );
if (USER_Driver.pMsgWaitForMultipleObjectsEx) USER_Driver->pMsgWaitForMultipleObjectsEx( 1, &server_queue, INFINITE, QS_ALLINPUT, 0 );
USER_Driver.pMsgWaitForMultipleObjectsEx( 1, &server_queue, INFINITE,
QS_ALLINPUT, 0 );
else
WaitForSingleObject( server_queue, INFINITE );
if (dwlc) RestoreThunkLock( dwlc ); if (dwlc) RestoreThunkLock( dwlc );
} }
...@@ -3120,14 +3105,8 @@ DWORD WINAPI MsgWaitForMultipleObjectsEx( DWORD count, CONST HANDLE *pHandles, ...@@ -3120,14 +3105,8 @@ DWORD WINAPI MsgWaitForMultipleObjectsEx( DWORD count, CONST HANDLE *pHandles,
handles[count] = get_server_queue_handle(); handles[count] = get_server_queue_handle();
ReleaseThunkLock( &lock ); ReleaseThunkLock( &lock );
if (USER_Driver.pMsgWaitForMultipleObjectsEx) ret = USER_Driver->pMsgWaitForMultipleObjectsEx( count+1, handles, timeout, mask, flags );
{ if (ret == count+1) ret = count; /* pretend the msg queue is ready */
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 ); if (lock) RestoreThunkLock( lock );
return ret; return ret;
} }
...@@ -3294,7 +3273,7 @@ BOOL WINAPI MessageBeep( UINT i ) ...@@ -3294,7 +3273,7 @@ BOOL WINAPI MessageBeep( UINT i )
{ {
BOOL active = TRUE; BOOL active = TRUE;
SystemParametersInfoA( SPI_GETBEEP, 0, &active, FALSE ); SystemParametersInfoA( SPI_GETBEEP, 0, &active, FALSE );
if (active && USER_Driver.pBeep) USER_Driver.pBeep(); if (active) USER_Driver->pBeep();
return TRUE; return TRUE;
} }
......
...@@ -1552,8 +1552,7 @@ LONG NC_HandleSysCommand( HWND hwnd, WPARAM wParam, LPARAM lParam ) ...@@ -1552,8 +1552,7 @@ LONG NC_HandleSysCommand( HWND hwnd, WPARAM wParam, LPARAM lParam )
{ {
case SC_SIZE: case SC_SIZE:
case SC_MOVE: case SC_MOVE:
if (USER_Driver.pSysCommandSizeMove) USER_Driver->pSysCommandSizeMove( hwnd, wParam );
USER_Driver.pSysCommandSizeMove( hwnd, wParam );
break; break;
case SC_MINIMIZE: case SC_MINIMIZE:
......
...@@ -263,7 +263,7 @@ static BOOL send_erase( HWND hwnd, UINT flags, HRGN client_rgn, ...@@ -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 */ if (need_erase && hwnd != GetDesktopWindow()) /* FIXME: mark it as needing erase again */
RedrawWindow( hwnd, clip_rect, 0, RDW_INVALIDATE | RDW_ERASE | RDW_NOCHILDREN ); 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 ) ...@@ -412,7 +412,7 @@ HDC WINAPI BeginPaint( HWND hwnd, PAINTSTRUCT *lps )
BOOL WINAPI EndPaint( HWND hwnd, const PAINTSTRUCT *lps ) BOOL WINAPI EndPaint( HWND hwnd, const PAINTSTRUCT *lps )
{ {
if (!lps) return FALSE; if (!lps) return FALSE;
if (USER_Driver.pReleaseDC) USER_Driver.pReleaseDC( hwnd, lps->hdc, TRUE ); USER_Driver->pReleaseDC( hwnd, lps->hdc, TRUE );
ShowCaret( hwnd ); ShowCaret( hwnd );
return TRUE; return TRUE;
} }
...@@ -426,8 +426,7 @@ HDC WINAPI GetDCEx( HWND hwnd, HRGN hrgnClip, DWORD flags ) ...@@ -426,8 +426,7 @@ HDC WINAPI GetDCEx( HWND hwnd, HRGN hrgnClip, DWORD flags )
if (!hwnd) hwnd = GetDesktopWindow(); if (!hwnd) hwnd = GetDesktopWindow();
else hwnd = WIN_GetFullHandle( hwnd ); else hwnd = WIN_GetFullHandle( hwnd );
if (USER_Driver.pGetDCEx) return USER_Driver.pGetDCEx( hwnd, hrgnClip, flags ); return USER_Driver->pGetDCEx( hwnd, hrgnClip, flags );
return 0;
} }
...@@ -467,8 +466,7 @@ HDC WINAPI GetWindowDC( HWND hwnd ) ...@@ -467,8 +466,7 @@ HDC WINAPI GetWindowDC( HWND hwnd )
*/ */
INT WINAPI ReleaseDC( HWND hwnd, HDC hdc ) INT WINAPI ReleaseDC( HWND hwnd, HDC hdc )
{ {
if (USER_Driver.pReleaseDC) return USER_Driver.pReleaseDC( hwnd, hdc, FALSE ); return USER_Driver->pReleaseDC( hwnd, hdc, FALSE );
return 0;
} }
...@@ -477,8 +475,7 @@ INT WINAPI ReleaseDC( HWND hwnd, HDC hdc ) ...@@ -477,8 +475,7 @@ INT WINAPI ReleaseDC( HWND hwnd, HDC hdc )
*/ */
HWND WINAPI WindowFromDC( HDC hDC ) HWND WINAPI WindowFromDC( HDC hDC )
{ {
if (USER_Driver.pWindowFromDC) return USER_Driver.pWindowFromDC( hDC ); return USER_Driver->pWindowFromDC( hDC );
return 0;
} }
...@@ -862,7 +859,5 @@ BOOL WINAPI ScrollDC( HDC hdc, INT dx, INT dy, const RECT *lprcScroll, ...@@ -862,7 +859,5 @@ BOOL WINAPI ScrollDC( HDC hdc, INT dx, INT dy, const RECT *lprcScroll,
const RECT *lprcClip, HRGN hrgnUpdate, LPRECT lprcUpdate ) const RECT *lprcClip, HRGN hrgnUpdate, LPRECT lprcUpdate )
{ {
if (USER_Driver.pScrollDC) return USER_Driver->pScrollDC( hdc, dx, dy, lprcScroll, lprcClip, hrgnUpdate, lprcUpdate );
return USER_Driver.pScrollDC( hdc, dx, dy, lprcScroll, lprcClip, hrgnUpdate, lprcUpdate );
return FALSE;
} }
...@@ -1135,10 +1135,7 @@ BOOL WINAPI SystemParametersInfoW( UINT uiAction, UINT uiParam, ...@@ -1135,10 +1135,7 @@ BOOL WINAPI SystemParametersInfoW( UINT uiAction, UINT uiParam,
case SPI_GETSCREENSAVEACTIVE: /* 16 */ case SPI_GETSCREENSAVEACTIVE: /* 16 */
if (!pvParam) return FALSE; if (!pvParam) return FALSE;
if (USER_Driver.pGetScreenSaveActive) *(BOOL *)pvParam = USER_Driver->pGetScreenSaveActive();
*(BOOL *)pvParam = USER_Driver.pGetScreenSaveActive();
else
*(BOOL *)pvParam = FALSE;
break; break;
case SPI_SETSCREENSAVEACTIVE: /* 17 */ case SPI_SETSCREENSAVEACTIVE: /* 17 */
...@@ -1146,8 +1143,7 @@ BOOL WINAPI SystemParametersInfoW( UINT uiAction, UINT uiParam, ...@@ -1146,8 +1143,7 @@ BOOL WINAPI SystemParametersInfoW( UINT uiAction, UINT uiParam,
WCHAR buf[5]; WCHAR buf[5];
wsprintfW(buf, CSu, uiParam); wsprintfW(buf, CSu, uiParam);
if (USER_Driver.pSetScreenSaveActive) USER_Driver->pSetScreenSaveActive( uiParam );
USER_Driver.pSetScreenSaveActive( uiParam );
/* saved value does not affect Wine */ /* saved value does not affect Wine */
SYSPARAMS_Save( SPI_SETSCREENSAVEACTIVE_REGKEY, SYSPARAMS_Save( SPI_SETSCREENSAVEACTIVE_REGKEY,
SPI_SETSCREENSAVEACTIVE_VALNAME, SPI_SETSCREENSAVEACTIVE_VALNAME,
...@@ -2633,9 +2629,7 @@ LONG WINAPI ChangeDisplaySettingsExA( LPCSTR devname, LPDEVMODEA devmode, HWND h ...@@ -2633,9 +2629,7 @@ LONG WINAPI ChangeDisplaySettingsExA( LPCSTR devname, LPDEVMODEA devmode, HWND h
LONG WINAPI ChangeDisplaySettingsExW( LPCWSTR devname, LPDEVMODEW devmode, HWND hwnd, LONG WINAPI ChangeDisplaySettingsExW( LPCWSTR devname, LPDEVMODEW devmode, HWND hwnd,
DWORD flags, LPVOID lparam ) DWORD flags, LPVOID lparam )
{ {
/* Pass the request on to the driver */ return USER_Driver->pChangeDisplaySettingsEx( devname, devmode, hwnd, flags, lparam );
if (!USER_Driver.pChangeDisplaySettingsEx) return DISP_CHANGE_FAILED;
return USER_Driver.pChangeDisplaySettingsEx( devname, devmode, hwnd, flags, lparam );
} }
...@@ -2695,7 +2689,5 @@ BOOL WINAPI EnumDisplaySettingsExA(LPCSTR lpszDeviceName, DWORD iModeNum, ...@@ -2695,7 +2689,5 @@ BOOL WINAPI EnumDisplaySettingsExA(LPCSTR lpszDeviceName, DWORD iModeNum,
BOOL WINAPI EnumDisplaySettingsExW(LPCWSTR lpszDeviceName, DWORD iModeNum, BOOL WINAPI EnumDisplaySettingsExW(LPCWSTR lpszDeviceName, DWORD iModeNum,
LPDEVMODEW lpDevMode, DWORD dwFlags) LPDEVMODEW lpDevMode, DWORD dwFlags)
{ {
/* Pass the request on to the driver */ return USER_Driver->pEnumDisplaySettingsEx(lpszDeviceName, iModeNum, lpDevMode, dwFlags);
if (!USER_Driver.pEnumDisplaySettingsEx) return FALSE;
return USER_Driver.pEnumDisplaySettingsEx(lpszDeviceName, iModeNum, lpDevMode, dwFlags);
} }
...@@ -35,8 +35,6 @@ ...@@ -35,8 +35,6 @@
WINE_DEFAULT_DEBUG_CHANNEL(graphics); WINE_DEFAULT_DEBUG_CHANNEL(graphics);
USER_DRIVER USER_Driver;
WORD USER_HeapSel = 0; /* USER heap selector */ WORD USER_HeapSel = 0; /* USER heap selector */
HMODULE user32_module = 0; HMODULE user32_module = 0;
...@@ -53,99 +51,10 @@ static HPALETTE (WINAPI *pfnGDISelectPalette)( HDC hdc, HPALETTE hpal, WORD bkgn ...@@ -53,99 +51,10 @@ static HPALETTE (WINAPI *pfnGDISelectPalette)( HDC hdc, HPALETTE hpal, WORD bkgn
static UINT (WINAPI *pfnGDIRealizePalette)( HDC hdc ); static UINT (WINAPI *pfnGDIRealizePalette)( HDC hdc );
static HPALETTE hPrimaryPalette; static HPALETTE hPrimaryPalette;
static HMODULE graphics_driver;
static DWORD exiting_thread_id; static DWORD exiting_thread_id;
extern void WDML_NotifyThreadDetach(void); 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 * USER_Lock
...@@ -261,9 +170,6 @@ static BOOL process_attach(void) ...@@ -261,9 +170,6 @@ static BOOL process_attach(void)
/* some Win9x dlls expect keyboard to be loaded */ /* some Win9x dlls expect keyboard to be loaded */
if (GetVersion() & 0x80000000) LoadLibrary16( "keyboard.drv" ); if (GetVersion() & 0x80000000) LoadLibrary16( "keyboard.drv" );
/* Load the graphics driver */
if (!load_driver()) return FALSE;
/* Initialize system colors and metrics */ /* Initialize system colors and metrics */
SYSPARAMS_Init(); SYSPARAMS_Init();
...@@ -308,15 +214,6 @@ static void thread_detach(void) ...@@ -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.@) * UserClientDllInitialize (USER32.@)
* *
...@@ -331,9 +228,6 @@ BOOL WINAPI DllMain( HINSTANCE inst, DWORD reason, LPVOID reserved ) ...@@ -331,9 +228,6 @@ BOOL WINAPI DllMain( HINSTANCE inst, DWORD reason, LPVOID reserved )
user32_module = inst; user32_module = inst;
ret = process_attach(); ret = process_attach();
break; break;
case DLL_PROCESS_DETACH:
process_detach();
break;
case DLL_THREAD_DETACH: case DLL_THREAD_DETACH:
thread_detach(); thread_detach();
break; break;
......
...@@ -157,7 +157,7 @@ typedef struct tagUSER_DRIVER { ...@@ -157,7 +157,7 @@ typedef struct tagUSER_DRIVER {
LRESULT (*pWindowMessage)(HWND,UINT,WPARAM,LPARAM); LRESULT (*pWindowMessage)(HWND,UINT,WPARAM,LPARAM);
} USER_DRIVER; } USER_DRIVER;
extern USER_DRIVER USER_Driver; extern const USER_DRIVER *USER_Driver;
struct received_message_info; struct received_message_info;
struct hook16_queue_info; struct hook16_queue_info;
......
...@@ -462,7 +462,7 @@ ULONG WIN_SetStyle( HWND hwnd, ULONG set_bits, ULONG clear_bits ) ...@@ -462,7 +462,7 @@ ULONG WIN_SetStyle( HWND hwnd, ULONG set_bits, ULONG clear_bits )
} }
SERVER_END_REQ; SERVER_END_REQ;
WIN_ReleasePtr( win ); 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; return old_style;
} }
...@@ -575,7 +575,7 @@ LRESULT WIN_DestroyWindow( HWND hwnd ) ...@@ -575,7 +575,7 @@ LRESULT WIN_DestroyWindow( HWND hwnd )
if (menu) DestroyMenu( menu ); if (menu) DestroyMenu( menu );
if (sys_menu) DestroyMenu( sys_menu ); if (sys_menu) DestroyMenu( sys_menu );
if (USER_Driver.pDestroyWindow) USER_Driver.pDestroyWindow( hwnd ); USER_Driver->pDestroyWindow( hwnd );
free_window_handle( hwnd ); free_window_handle( hwnd );
return 0; return 0;
...@@ -1041,7 +1041,7 @@ static HWND WIN_CreateWindowEx( CREATESTRUCTA *cs, ATOM classAtom, ...@@ -1041,7 +1041,7 @@ static HWND WIN_CreateWindowEx( CREATESTRUCTA *cs, ATOM classAtom,
else SetWindowLongPtrW( hwnd, GWLP_ID, (ULONG_PTR)cs->hMenu ); else SetWindowLongPtrW( hwnd, GWLP_ID, (ULONG_PTR)cs->hMenu );
WIN_ReleasePtr( wndPtr ); WIN_ReleasePtr( wndPtr );
if (!USER_Driver.pCreateWindow || !USER_Driver.pCreateWindow( hwnd, cs, unicode)) if (!USER_Driver->pCreateWindow( hwnd, cs, unicode))
{ {
WIN_DestroyWindow( hwnd ); WIN_DestroyWindow( hwnd );
return 0; return 0;
...@@ -1267,8 +1267,7 @@ static void WIN_SendDestroyMsg( HWND hwnd ) ...@@ -1267,8 +1267,7 @@ static void WIN_SendDestroyMsg( HWND hwnd )
if (hwnd == info.hwndCaret) DestroyCaret(); if (hwnd == info.hwndCaret) DestroyCaret();
if (hwnd == info.hwndActive) WINPOS_ActivateOtherWindow( hwnd ); 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. * Send the WM_DESTROY to the window.
...@@ -1334,8 +1333,7 @@ BOOL WINAPI DestroyWindow( HWND hwnd ) ...@@ -1334,8 +1333,7 @@ BOOL WINAPI DestroyWindow( HWND hwnd )
if (!IsWindow(hwnd)) return TRUE; 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 */ /* Hide the window */
if (GetWindowLongW( hwnd, GWL_STYLE ) & WS_VISIBLE) if (GetWindowLongW( hwnd, GWL_STYLE ) & WS_VISIBLE)
...@@ -1549,7 +1547,7 @@ HWND WINAPI GetDesktopWindow(void) ...@@ -1549,7 +1547,7 @@ HWND WINAPI GetDesktopWindow(void)
if (!wine_server_call( req )) thread_info->desktop = reply->handle; if (!wine_server_call( req )) thread_info->desktop = reply->handle;
} }
SERVER_END_REQ; 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" ); ERR( "failed to create desktop window\n" );
} }
return thread_info->desktop; return thread_info->desktop;
...@@ -2075,8 +2073,7 @@ static LONG_PTR WIN_SetWindowLong( HWND hwnd, INT offset, LONG_PTR newval, ...@@ -2075,8 +2073,7 @@ static LONG_PTR WIN_SetWindowLong( HWND hwnd, INT offset, LONG_PTR newval,
if (!ok) return 0; if (!ok) return 0;
if (offset == GWL_STYLE && USER_Driver.pSetWindowStyle) if (offset == GWL_STYLE) USER_Driver->pSetWindowStyle( hwnd, retval );
USER_Driver.pSetWindowStyle( hwnd, retval );
if (offset == GWL_STYLE || offset == GWL_EXSTYLE) if (offset == GWL_STYLE || offset == GWL_EXSTYLE)
SendMessageW( hwnd, WM_STYLECHANGED, offset, (LPARAM)&style ); SendMessageW( hwnd, WM_STYLECHANGED, offset, (LPARAM)&style );
...@@ -2520,10 +2517,7 @@ HWND WINAPI SetParent( HWND hwnd, HWND parent ) ...@@ -2520,10 +2517,7 @@ HWND WINAPI SetParent( HWND hwnd, HWND parent )
if (!(full_handle = WIN_IsCurrentThread( hwnd ))) if (!(full_handle = WIN_IsCurrentThread( hwnd )))
return (HWND)SendMessageW( hwnd, WM_WINE_SETPARENT, (WPARAM)parent, 0 ); return (HWND)SendMessageW( hwnd, WM_WINE_SETPARENT, (WPARAM)parent, 0 );
if (USER_Driver.pSetParent) return USER_Driver->pSetParent( full_handle, parent );
return USER_Driver.pSetParent( full_handle, parent );
return 0;
} }
......
...@@ -265,8 +265,7 @@ int WINAPI SetWindowRgn( HWND hwnd, HRGN hrgn, BOOL bRedraw ) ...@@ -265,8 +265,7 @@ int WINAPI SetWindowRgn( HWND hwnd, HRGN hrgn, BOOL bRedraw )
SERVER_END_REQ; SERVER_END_REQ;
} }
if (ret && USER_Driver.pSetWindowRgn) if (ret) ret = USER_Driver->pSetWindowRgn( hwnd, hrgn, bRedraw );
ret = USER_Driver.pSetWindowRgn( hwnd, hrgn, bRedraw );
if (ret && bRedraw) RedrawWindow( hwnd, NULL, 0, RDW_FRAME | RDW_INVALIDATE | RDW_ERASE ); if (ret && bRedraw) RedrawWindow( hwnd, NULL, 0, RDW_FRAME | RDW_INVALIDATE | RDW_ERASE );
return ret; return ret;
...@@ -836,11 +835,8 @@ BOOL WINAPI ShowWindowAsync( HWND hwnd, INT cmd ) ...@@ -836,11 +835,8 @@ BOOL WINAPI ShowWindowAsync( HWND hwnd, INT cmd )
} }
if ((full_handle = WIN_IsCurrentThread( hwnd ))) if ((full_handle = WIN_IsCurrentThread( hwnd )))
{ return USER_Driver->pShowWindow( full_handle, cmd );
if (USER_Driver.pShowWindow)
return USER_Driver.pShowWindow( full_handle, cmd );
return FALSE;
}
return SendNotifyMessageW( hwnd, WM_WINE_SHOWWINDOW, cmd, 0 ); return SendNotifyMessageW( hwnd, WM_WINE_SHOWWINDOW, cmd, 0 );
} }
...@@ -858,11 +854,8 @@ BOOL WINAPI ShowWindow( HWND hwnd, INT cmd ) ...@@ -858,11 +854,8 @@ BOOL WINAPI ShowWindow( HWND hwnd, INT cmd )
return FALSE; return FALSE;
} }
if ((full_handle = WIN_IsCurrentThread( hwnd ))) if ((full_handle = WIN_IsCurrentThread( hwnd )))
{ return USER_Driver->pShowWindow( full_handle, cmd );
if (USER_Driver.pShowWindow)
return USER_Driver.pShowWindow( full_handle, cmd );
return FALSE;
}
return SendMessageW( hwnd, WM_WINE_SHOWWINDOW, cmd, 0 ); return SendMessageW( hwnd, WM_WINE_SHOWWINDOW, cmd, 0 );
} }
...@@ -1209,11 +1202,8 @@ BOOL WINAPI SetWindowPos( HWND hwnd, HWND hwndInsertAfter, ...@@ -1209,11 +1202,8 @@ BOOL WINAPI SetWindowPos( HWND hwnd, HWND hwndInsertAfter,
winpos.cy = cy; winpos.cy = cy;
winpos.flags = flags; winpos.flags = flags;
if (WIN_IsCurrentThread( hwnd )) if (WIN_IsCurrentThread( hwnd ))
{ return USER_Driver->pSetWindowPos( &winpos );
if (USER_Driver.pSetWindowPos)
return USER_Driver.pSetWindowPos( &winpos );
return FALSE;
}
return SendMessageW( winpos.hwnd, WM_WINE_SETWINDOWPOS, 0, (LPARAM)&winpos ); return SendMessageW( winpos.hwnd, WM_WINE_SETWINDOWPOS, 0, (LPARAM)&winpos );
} }
...@@ -1343,7 +1333,7 @@ BOOL WINAPI EndDeferWindowPos( HDWP hdwp ) ...@@ -1343,7 +1333,7 @@ BOOL WINAPI EndDeferWindowPos( HDWP hdwp )
if (!pDWP) return FALSE; if (!pDWP) return FALSE;
for (i = 0, winpos = pDWP->winPos; i < pDWP->actualCount; i++, winpos++) 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 ); USER_HEAP_FREE( hdwp );
return res; return res;
......
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