Commit d676bf24 authored by Alexandre Julliard's avatar Alexandre Julliard

user32: Add driver entry points for cursor creation and destruction, and pass…

user32: Add driver entry points for cursor creation and destruction, and pass the cursor handle to SetCursor.
parent 7746136f
......@@ -955,6 +955,7 @@ static HICON CURSORICON_CreateIconFromBMI( BITMAPINFO *bmi,
GetBitmapBits( hAndBits, sizeAnd, info + 1 );
GetBitmapBits( hXorBits, sizeXor, (char *)(info + 1) + sizeAnd );
release_icon_ptr( hObj, info );
USER_Driver->pCreateCursorIcon( hObj, info );
}
DeleteObject( hAndBits );
......@@ -1566,6 +1567,7 @@ HICON WINAPI CopyIcon( HICON hIcon )
memcpy( ptrNew, ptrOld, size );
release_icon_ptr( hIcon, ptrOld );
release_icon_ptr( hNew, ptrNew );
USER_Driver->pCreateCursorIcon( hNew, ptrNew );
return hNew;
}
......@@ -1578,7 +1580,10 @@ BOOL WINAPI DestroyIcon( HICON hIcon )
TRACE_(icon)("%p\n", hIcon );
if (CURSORICON_DelSharedIcon( hIcon ) == -1)
{
USER_Driver->pDestroyCursorIcon( hIcon );
free_icon_handle( hIcon );
}
return TRUE;
}
......@@ -1789,7 +1794,7 @@ HCURSOR WINAPI DECLSPEC_HOTPATCH SetCursor( HCURSOR hCursor /* [in] Handle of cu
CURSORICONINFO *info = get_icon_ptr( hCursor );
/* release before calling driver (FIXME) */
if (info) release_icon_ptr( hCursor, info );
USER_Driver->pSetCursor( info );
USER_Driver->pSetCursor( hCursor, info );
}
return hOldCursor;
}
......@@ -1822,9 +1827,9 @@ INT WINAPI DECLSPEC_HOTPATCH ShowCursor( BOOL bShow )
CURSORICONINFO *info = get_icon_ptr( cursor );
/* release before calling driver (FIXME) */
if (info) release_icon_ptr( cursor, info );
USER_Driver->pSetCursor( info );
USER_Driver->pSetCursor( cursor, info );
}
else USER_Driver->pSetCursor( NULL );
else USER_Driver->pSetCursor( 0, NULL );
}
return prev_count + increment;
}
......@@ -2195,6 +2200,7 @@ HICON WINAPI CreateIconIndirect(PICONINFO iconinfo)
}
}
release_icon_ptr( hObj, info );
USER_Driver->pCreateCursorIcon( hObj, info );
}
return hObj;
}
......
......@@ -84,6 +84,8 @@ static const USER_DRIVER *load_driver(void)
GET_USER_FUNC(ToUnicodeEx);
GET_USER_FUNC(UnloadKeyboardLayout);
GET_USER_FUNC(VkKeyScanEx);
GET_USER_FUNC(CreateCursorIcon);
GET_USER_FUNC(DestroyCursorIcon);
GET_USER_FUNC(SetCursor);
GET_USER_FUNC(GetCursorPos);
GET_USER_FUNC(SetCursorPos);
......@@ -215,7 +217,15 @@ static SHORT CDECL nulldrv_VkKeyScanEx( WCHAR ch, HKL layout )
return -1;
}
static void CDECL nulldrv_SetCursor( struct tagCURSORICONINFO *info )
static void CDECL nulldrv_CreateCursorIcon( HCURSOR cursor, struct tagCURSORICONINFO *info )
{
}
static void CDECL nulldrv_DestroyCursorIcon( HCURSOR cursor )
{
}
static void CDECL nulldrv_SetCursor( HCURSOR cursor, struct tagCURSORICONINFO *info )
{
}
......@@ -442,7 +452,9 @@ static USER_DRIVER null_driver =
nulldrv_ToUnicodeEx,
nulldrv_UnloadKeyboardLayout,
nulldrv_VkKeyScanEx,
/* mouse functions */
/* cursor/icon functions */
nulldrv_CreateCursorIcon,
nulldrv_DestroyCursorIcon,
nulldrv_SetCursor,
nulldrv_GetCursorPos,
nulldrv_SetCursorPos,
......@@ -558,9 +570,19 @@ static SHORT CDECL loaderdrv_VkKeyScanEx( WCHAR ch, HKL layout )
return load_driver()->pVkKeyScanEx( ch, layout );
}
static void CDECL loaderdrv_SetCursor( struct tagCURSORICONINFO *info )
static void CDECL loaderdrv_CreateCursorIcon( HCURSOR cursor, struct tagCURSORICONINFO *info )
{
load_driver()->pCreateCursorIcon( cursor, info );
}
static void CDECL loaderdrv_DestroyCursorIcon( HCURSOR cursor )
{
load_driver()->pDestroyCursorIcon( cursor );
}
static void CDECL loaderdrv_SetCursor( HCURSOR cursor, struct tagCURSORICONINFO *info )
{
load_driver()->pSetCursor( info );
load_driver()->pSetCursor( cursor, info );
}
static BOOL CDECL loaderdrv_GetCursorPos( LPPOINT pt )
......@@ -783,7 +805,9 @@ static USER_DRIVER lazy_load_driver =
loaderdrv_ToUnicodeEx,
loaderdrv_UnloadKeyboardLayout,
loaderdrv_VkKeyScanEx,
/* mouse functions */
/* cursor/icon functions */
loaderdrv_CreateCursorIcon,
loaderdrv_DestroyCursorIcon,
loaderdrv_SetCursor,
loaderdrv_GetCursorPos,
loaderdrv_SetCursorPos,
......
......@@ -67,8 +67,10 @@ typedef struct tagUSER_DRIVER {
INT (CDECL *pToUnicodeEx)(UINT, UINT, const BYTE *, LPWSTR, int, UINT, HKL);
BOOL (CDECL *pUnloadKeyboardLayout)(HKL);
SHORT (CDECL *pVkKeyScanEx)(WCHAR, HKL);
/* mouse functions */
void (CDECL *pSetCursor)(struct tagCURSORICONINFO *);
/* cursor/icon functions */
void (CDECL *pCreateCursorIcon)(HCURSOR,struct tagCURSORICONINFO *);
void (CDECL *pDestroyCursorIcon)(HCURSOR);
void (CDECL *pSetCursor)(HCURSOR,struct tagCURSORICONINFO *);
BOOL (CDECL *pGetCursorPos)(LPPOINT);
BOOL (CDECL *pSetCursorPos)(INT,INT);
BOOL (CDECL *pClipCursor)(LPCRECT);
......
......@@ -949,7 +949,7 @@ static Cursor create_cursor( Display *display, CURSORICONINFO *ptr )
/***********************************************************************
* SetCursor (X11DRV.@)
*/
void CDECL X11DRV_SetCursor( CURSORICONINFO *lpCursor )
void CDECL X11DRV_SetCursor( HCURSOR handle, CURSORICONINFO *lpCursor )
{
struct x11drv_thread_data *data = x11drv_init_thread_data();
Cursor cursor;
......
......@@ -73,7 +73,7 @@
@ cdecl ToUnicodeEx(long long ptr ptr long long long) X11DRV_ToUnicodeEx
@ cdecl UnloadKeyboardLayout(long) X11DRV_UnloadKeyboardLayout
@ cdecl VkKeyScanEx(long long) X11DRV_VkKeyScanEx
@ cdecl SetCursor(ptr) X11DRV_SetCursor
@ cdecl SetCursor(long ptr) X11DRV_SetCursor
@ cdecl GetCursorPos(ptr) X11DRV_GetCursorPos
@ cdecl SetCursorPos(long long) X11DRV_SetCursorPos
@ cdecl ClipCursor(ptr) X11DRV_ClipCursor
......
......@@ -784,7 +784,7 @@ extern void X11DRV_Clipboard_Cleanup(void);
extern void X11DRV_ResetSelectionOwner(void);
extern void CDECL X11DRV_SetFocus( HWND hwnd );
extern Cursor X11DRV_GetCursor( Display *display, struct tagCURSORICONINFO *ptr );
extern void CDECL X11DRV_SetCursor( struct tagCURSORICONINFO *lpCursor );
extern void CDECL X11DRV_SetCursor( HCURSOR cursor, struct tagCURSORICONINFO *lpCursor );
extern BOOL CDECL X11DRV_ClipCursor( LPCRECT clip );
extern void X11DRV_InitKeyboard( Display *display );
extern void X11DRV_send_keyboard_input( WORD wVk, WORD wScan, DWORD dwFlags, DWORD time,
......
......@@ -664,7 +664,7 @@ struct x11drv_thread_data *x11drv_init_thread_data(void)
TlsSetValue( thread_data_tls_index, data );
if (use_xim) X11DRV_SetupXIM();
X11DRV_SetCursor( NULL );
X11DRV_SetCursor( 0, NULL );
return data;
}
......
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