winex11.drv: Implement XIMPreEditCaretCallback.
This commit is contained in:
parent
937432ac17
commit
c52ce9bccc
|
@ -1032,6 +1032,8 @@ static LRESULT WINAPI EditWndProc_common( HWND hwnd, UINT msg,
|
|||
break;
|
||||
|
||||
case WM_IME_COMPOSITION:
|
||||
{
|
||||
int caret_pos = es->selection_end;
|
||||
if (es->composition_len == 0)
|
||||
{
|
||||
if (es->selection_start != es->selection_end)
|
||||
|
@ -1043,7 +1045,9 @@ static LRESULT WINAPI EditWndProc_common( HWND hwnd, UINT msg,
|
|||
es->composition_start = es->selection_end;
|
||||
}
|
||||
EDIT_ImeComposition(hwnd,lParam,es);
|
||||
EDIT_SetCaretPos(es, caret_pos, es->flags & EF_AFTER_WRAP);
|
||||
break;
|
||||
}
|
||||
|
||||
case WM_IME_ENDCOMPOSITION:
|
||||
es->composition_len= 0;
|
||||
|
|
|
@ -30,6 +30,7 @@
|
|||
#include "winnls.h"
|
||||
#include "x11drv.h"
|
||||
#include "imm.h"
|
||||
#include "ddk/imm.h"
|
||||
#include "wine/debug.h"
|
||||
|
||||
WINE_DEFAULT_DEBUG_CHANNEL(x11drv);
|
||||
|
@ -39,6 +40,17 @@ WINE_DEFAULT_DEBUG_CHANNEL(x11drv);
|
|||
|
||||
BOOL ximInComposeMode=FALSE;
|
||||
|
||||
typedef struct tagInputContextData
|
||||
{
|
||||
BOOL bInternalState;
|
||||
BOOL bRead;
|
||||
BOOL bInComposition;
|
||||
HFONT textfont;
|
||||
|
||||
DWORD dwLock;
|
||||
INPUTCONTEXT IMC;
|
||||
} InputContextData;
|
||||
|
||||
static HIMC root_context;
|
||||
static XIMStyle ximStyle = 0;
|
||||
static XIMStyle ximStyleRoot = 0;
|
||||
|
@ -56,6 +68,7 @@ static HIMC (WINAPI *pImmCreateContext)(void);
|
|||
static VOID (WINAPI *pImmSetOpenStatus)(HIMC,BOOL);
|
||||
static BOOL (WINAPI *pImmSetCompositionString)(HIMC, DWORD, LPWSTR,
|
||||
DWORD, LPWSTR, DWORD);
|
||||
static LONG (WINAPI *pImmGetCompositionString)(HIMC, DWORD, LPVOID, DWORD);
|
||||
static VOID (WINAPI *pImmNotifyIME)(HIMC, DWORD, DWORD, DWORD);
|
||||
|
||||
/* WINE specific messages from the xim in x11drv level */
|
||||
|
@ -92,6 +105,11 @@ static void LoadImmDll(void)
|
|||
if (!pImmSetCompositionString)
|
||||
WARN("IMM: pImmSetCompositionStringW not found in DLL\n");
|
||||
|
||||
pImmGetCompositionString =(void *)GetProcAddress(hImmDll, "ImmGetCompositionStringW");
|
||||
|
||||
if (!pImmGetCompositionString)
|
||||
WARN("IMM: pImmGetCompositionStringW not found in DLL\n");
|
||||
|
||||
pImmNotifyIME = (void *)GetProcAddress( hImmDll, "ImmNotifyIME");
|
||||
|
||||
if (!pImmNotifyIME)
|
||||
|
@ -310,7 +328,44 @@ static void XIMPreEditDrawCallback(XIM ic, XPointer client_data,
|
|||
static void XIMPreEditCaretCallback(XIC ic, XPointer client_data,
|
||||
XIMPreeditCaretCallbackStruct *P_C)
|
||||
{
|
||||
FIXME("PreeditCaretCalback %p\n",ic);
|
||||
TRACE("PreeditCaretCallback %p\n",ic);
|
||||
|
||||
if (P_C)
|
||||
{
|
||||
int pos = pImmGetCompositionString(root_context, GCS_CURSORPOS, NULL, 0);
|
||||
TRACE("pos: %d\n", pos);
|
||||
switch(P_C->direction)
|
||||
{
|
||||
case XIMForwardChar:
|
||||
case XIMForwardWord:
|
||||
pos++;
|
||||
break;
|
||||
case XIMBackwardChar:
|
||||
case XIMBackwardWord:
|
||||
pos--;
|
||||
break;
|
||||
case XIMLineStart:
|
||||
pos = 0;
|
||||
break;
|
||||
case XIMAbsolutePosition:
|
||||
pos = P_C->position;
|
||||
break;
|
||||
case XIMDontChange:
|
||||
P_C->position = pos;
|
||||
return;
|
||||
case XIMCaretUp:
|
||||
case XIMCaretDown:
|
||||
case XIMPreviousLine:
|
||||
case XIMNextLine:
|
||||
case XIMLineEnd:
|
||||
FIXME("Not implemented\n");
|
||||
break;
|
||||
}
|
||||
SendMessageW(((InputContextData*)root_context)->IMC.hWnd,
|
||||
EM_SETSEL, pos, pos);
|
||||
P_C->position = pos;
|
||||
}
|
||||
TRACE("Finished\n");
|
||||
}
|
||||
|
||||
void X11DRV_ForceXIMReset(HWND hwnd)
|
||||
|
|
Loading…
Reference in New Issue