win32u: Introduce new NtUserNotifyIMEStatus syscall.

This commit is contained in:
Rémi Bernon 2023-05-09 13:04:52 +02:00 committed by Alexandre Julliard
parent e2674379c5
commit 56d0b870b6
14 changed files with 51 additions and 58 deletions

View file

@ -716,6 +716,10 @@ static SHORT nulldrv_VkKeyScanEx( WCHAR ch, HKL layout )
return -256; /* use default implementation */
}
static void nulldrv_NotifyIMEStatus( HWND hwnd, UINT status )
{
}
static LRESULT nulldrv_DesktopWindowProc( HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam )
{
return default_window_proc( hwnd, msg, wparam, lparam, FALSE );
@ -1070,6 +1074,11 @@ static SHORT loaderdrv_VkKeyScanEx( WCHAR ch, HKL layout )
return load_driver()->pVkKeyScanEx( ch, layout );
}
static void loaderdrv_NotifyIMEStatus( HWND hwnd, UINT status )
{
return load_driver()->pNotifyIMEStatus( hwnd, status );
}
static LONG loaderdrv_ChangeDisplaySettings( LPDEVMODEW displays, LPCWSTR primary_name, HWND hwnd,
DWORD flags, LPVOID lparam )
{
@ -1176,6 +1185,7 @@ static const struct user_driver_funcs lazy_load_driver =
loaderdrv_ToUnicodeEx,
loaderdrv_UnregisterHotKey,
loaderdrv_VkKeyScanEx,
loaderdrv_NotifyIMEStatus,
/* cursor/icon functions */
nulldrv_DestroyCursorIcon,
loaderdrv_SetCursor,
@ -1255,6 +1265,7 @@ void __wine_set_user_driver( const struct user_driver_funcs *funcs, UINT version
SET_USER_FUNC(ToUnicodeEx);
SET_USER_FUNC(UnregisterHotKey);
SET_USER_FUNC(VkKeyScanEx);
SET_USER_FUNC(NotifyIMEStatus);
SET_USER_FUNC(DestroyCursorIcon);
SET_USER_FUNC(SetCursor);
SET_USER_FUNC(GetCursorPos);

View file

@ -421,6 +421,14 @@ NTSTATUS WINAPI NtUserBuildHimcList( UINT thread_id, UINT count, HIMC *buffer, U
return STATUS_SUCCESS;
}
/*****************************************************************************
* NtUserNotifyIMEStatus (win32u.@)
*/
void WINAPI NtUserNotifyIMEStatus( HWND hwnd, UINT status )
{
user_driver->pNotifyIMEStatus( hwnd, status );
}
BOOL WINAPI DECLSPEC_HIDDEN ImmProcessKey( HWND hwnd, HKL hkl, UINT vkey, LPARAM key_data, DWORD unknown )
{
struct imm_process_key_params params =

View file

@ -233,6 +233,7 @@ static void * const syscalls[] =
NtUserMessageCall,
NtUserMoveWindow,
NtUserMsgWaitForMultipleObjectsEx,
NtUserNotifyIMEStatus,
NtUserNotifyWinEvent,
NtUserOpenClipboard,
NtUserOpenDesktop,

View file

@ -1087,7 +1087,7 @@
@ stdcall -syscall NtUserMoveWindow(long long long long long long)
@ stdcall -syscall NtUserMsgWaitForMultipleObjectsEx(long ptr long long long)
@ stub NtUserNavigateFocus
@ stub NtUserNotifyIMEStatus
@ stdcall -syscall NtUserNotifyIMEStatus(long long)
@ stub NtUserNotifyProcessCreate
@ stdcall -syscall NtUserNotifyWinEvent(long long long long)
@ stdcall -syscall NtUserOpenClipboard(long long)

View file

@ -531,7 +531,6 @@ UINT WINAPI ImeToAsciiEx (UINT uVKey, UINT uScanCode, const LPBYTE lpbKeyState,
BOOL WINAPI NotifyIME(HIMC hIMC, DWORD dwAction, DWORD dwIndex, DWORD dwValue)
{
struct xim_preedit_state_params preedit_params;
BOOL bRet = FALSE;
LPINPUTCONTEXT lpIMC;
@ -572,16 +571,13 @@ BOOL WINAPI NotifyIME(HIMC hIMC, DWORD dwAction, DWORD dwIndex, DWORD dwValue)
}
break;
case IMC_SETOPENSTATUS:
bRet = TRUE;
preedit_params.hwnd = lpIMC->hWnd;
preedit_params.open = lpIMC->fOpen;
X11DRV_CALL( xim_preedit_state, &preedit_params );
if (!lpIMC->fOpen)
{
X11DRV_CALL( xim_reset, lpIMC->hWnd );
input_context_reset_comp_str( lpIMC );
ime_set_composition_status( hIMC, FALSE );
}
NtUserNotifyIMEStatus( lpIMC->hWnd, lpIMC->fOpen );
bRet = TRUE;
break;
default: FIXME("Unknown\n"); break;
}

View file

@ -398,6 +398,7 @@ static const struct user_driver_funcs x11drv_funcs =
.pMapVirtualKeyEx = X11DRV_MapVirtualKeyEx,
.pToUnicodeEx = X11DRV_ToUnicodeEx,
.pVkKeyScanEx = X11DRV_VkKeyScanEx,
.pNotifyIMEStatus = X11DRV_NotifyIMEStatus,
.pDestroyCursorIcon = X11DRV_DestroyCursorIcon,
.pSetCursor = X11DRV_SetCursor,
.pGetCursorPos = X11DRV_GetCursorPos,

View file

@ -31,8 +31,6 @@ enum x11drv_funcs
unix_tablet_get_packet,
unix_tablet_info,
unix_tablet_load_info,
unix_xim_preedit_state,
unix_xim_reset,
unix_funcs_count,
};

View file

@ -209,6 +209,7 @@ extern UINT X11DRV_MapVirtualKeyEx( UINT code, UINT map_type, HKL hkl ) DECLSPEC
extern INT X11DRV_ToUnicodeEx( UINT virtKey, UINT scanCode, const BYTE *lpKeyState,
LPWSTR bufW, int bufW_size, UINT flags, HKL hkl ) DECLSPEC_HIDDEN;
extern SHORT X11DRV_VkKeyScanEx( WCHAR wChar, HKL hkl ) DECLSPEC_HIDDEN;
extern void X11DRV_NotifyIMEStatus( HWND hwnd, UINT status ) DECLSPEC_HIDDEN;
extern void X11DRV_DestroyCursorIcon( HCURSOR handle ) DECLSPEC_HIDDEN;
extern void X11DRV_SetCursor( HCURSOR handle ) DECLSPEC_HIDDEN;
extern BOOL X11DRV_SetCursorPos( INT x, INT y ) DECLSPEC_HIDDEN;
@ -848,8 +849,6 @@ extern NTSTATUS x11drv_tablet_attach_queue( void *arg ) DECLSPEC_HIDDEN;
extern NTSTATUS x11drv_tablet_get_packet( void *arg ) DECLSPEC_HIDDEN;
extern NTSTATUS x11drv_tablet_load_info( void *arg ) DECLSPEC_HIDDEN;
extern NTSTATUS x11drv_tablet_info( void *arg ) DECLSPEC_HIDDEN;
extern NTSTATUS x11drv_xim_preedit_state( void *arg ) DECLSPEC_HIDDEN;
extern NTSTATUS x11drv_xim_reset( void *arg ) DECLSPEC_HIDDEN;
extern NTSTATUS x11drv_client_func( enum x11drv_client_funcs func, const void *params,
ULONG size ) DECLSPEC_HIDDEN;

View file

@ -1330,8 +1330,6 @@ const unixlib_entry_t __wine_unix_call_funcs[] =
x11drv_tablet_get_packet,
x11drv_tablet_info,
x11drv_tablet_load_info,
x11drv_xim_preedit_state,
x11drv_xim_reset,
};
@ -1408,20 +1406,6 @@ static NTSTATUS x11drv_wow64_tablet_info( void *arg )
return x11drv_tablet_info( &params );
}
static NTSTATUS x11drv_wow64_xim_preedit_state( void *arg )
{
struct
{
ULONG hwnd;
BOOL open;
} *params32 = arg;
struct xim_preedit_state_params params;
params.hwnd = UlongToHandle( params32->hwnd );
params.open = params32->open;
return x11drv_xim_preedit_state( &params );
}
const unixlib_entry_t __wine_unix_call_wow64_funcs[] =
{
x11drv_create_desktop,
@ -1434,8 +1418,6 @@ const unixlib_entry_t __wine_unix_call_wow64_funcs[] =
x11drv_wow64_tablet_get_packet,
x11drv_wow64_tablet_info,
x11drv_tablet_load_info,
x11drv_wow64_xim_preedit_state,
x11drv_xim_reset,
};
C_ASSERT( ARRAYSIZE(__wine_unix_call_wow64_funcs) == unix_funcs_count );

View file

@ -260,42 +260,26 @@ static int xic_status_draw( XIC xic, XPointer user, XPointer arg )
return 0;
}
NTSTATUS x11drv_xim_reset( void *hwnd )
/***********************************************************************
* NotifyIMEStatus (X11DRV.@)
*/
void X11DRV_NotifyIMEStatus( HWND hwnd, UINT status )
{
XIC ic = X11DRV_get_ic(hwnd);
if (ic)
{
char* leftover;
TRACE("Forcing Reset %p\n",ic);
leftover = XmbResetIC(ic);
XFree(leftover);
}
return 0;
}
NTSTATUS x11drv_xim_preedit_state( void *arg )
{
struct xim_preedit_state_params *params = arg;
XIC ic;
XIMPreeditState state;
XIMPreeditState state = status ? XIMPreeditEnable : XIMPreeditDisable;
XVaNestedList attr;
XIC xic;
ic = X11DRV_get_ic( params->hwnd );
if (!ic)
return 0;
TRACE( "hwnd %p, status %#x\n", hwnd, status );
if (params->open)
state = XIMPreeditEnable;
else
state = XIMPreeditDisable;
if (!(xic = X11DRV_get_ic( hwnd ))) return;
attr = XVaCreateNestedList(0, XNPreeditState, state, NULL);
if (attr != NULL)
if ((attr = XVaCreateNestedList( 0, XNPreeditState, state, NULL )))
{
XSetICValues(ic, XNPreeditAttributes, attr, NULL);
XFree(attr);
XSetICValues( xic, XNPreeditAttributes, attr, NULL );
XFree( attr );
}
return 0;
if (!status) XFree( XmbResetIC( xic ) );
}
/***********************************************************************

View file

@ -219,6 +219,7 @@
SYSCALL_ENTRY( NtUserMessageCall ) \
SYSCALL_ENTRY( NtUserMoveWindow ) \
SYSCALL_ENTRY( NtUserMsgWaitForMultipleObjectsEx ) \
SYSCALL_ENTRY( NtUserNotifyIMEStatus ) \
SYSCALL_ENTRY( NtUserNotifyWinEvent ) \
SYSCALL_ENTRY( NtUserOpenClipboard ) \
SYSCALL_ENTRY( NtUserOpenDesktop ) \

View file

@ -3154,6 +3154,15 @@ NTSTATUS WINAPI wow64_NtUserMsgWaitForMultipleObjectsEx( UINT *args )
return NtUserMsgWaitForMultipleObjectsEx( count, handles, timeout, mask, flags );
}
NTSTATUS WINAPI wow64_NtUserNotifyIMEStatus( UINT *args )
{
HWND hwnd = get_handle( &args );
ULONG status = get_ulong( &args );
NtUserNotifyIMEStatus( hwnd, status );
return 0;
}
NTSTATUS WINAPI wow64_NtUserNotifyWinEvent( UINT *args )
{
DWORD event = get_ulong( &args );

View file

@ -817,6 +817,7 @@ LRESULT WINAPI NtUserMessageCall( HWND hwnd, UINT msg, WPARAM wparam, LPARAM lpa
BOOL WINAPI NtUserMoveWindow( HWND hwnd, INT x, INT y, INT cx, INT cy, BOOL repaint );
DWORD WINAPI NtUserMsgWaitForMultipleObjectsEx( DWORD count, const HANDLE *handles,
DWORD timeout, DWORD mask, DWORD flags );
void WINAPI NtUserNotifyIMEStatus( HWND hwnd, UINT status );
void WINAPI NtUserNotifyWinEvent( DWORD event, HWND hwnd, LONG object_id, LONG child_id );
HWINSTA WINAPI NtUserOpenWindowStation( OBJECT_ATTRIBUTES *attr, ACCESS_MASK access );
BOOL WINAPI NtUserOpenClipboard( HWND hwnd, ULONG unk );

View file

@ -287,6 +287,8 @@ struct user_driver_funcs
INT (*pToUnicodeEx)(UINT,UINT,const BYTE *,LPWSTR,int,UINT,HKL);
void (*pUnregisterHotKey)(HWND, UINT, UINT);
SHORT (*pVkKeyScanEx)(WCHAR, HKL);
/* IME functions */
void (*pNotifyIMEStatus)(HWND,UINT);
/* cursor/icon functions */
void (*pDestroyCursorIcon)(HCURSOR);
void (*pSetCursor)(HCURSOR);