Commit bc7c5218 authored by Mikolaj Zalewski's avatar Mikolaj Zalewski Committed by Alexandre Julliard

wintab32: Store the context internally as Unicode, implement WTOpenW and WTGetW.

parent 29a63472
......@@ -46,6 +46,14 @@ static BOOL gLoaded;
static LPOPENCONTEXT gOpenContexts;
static HCTX gTopContext = (HCTX)0xc00;
static void LOGCONTEXTAtoW(const LOGCONTEXTA *in, LOGCONTEXTW *out)
{
MultiByteToWideChar(CP_ACP, 0, in->lcName, -1, out->lcName, LCNAMELEN);
out->lcName[LCNAMELEN - 1] = 0;
/* we use the fact that the fields after lcName are the same in LOGCONTEXTA and W */
memcpy(&out->lcOptions, &in->lcOptions, sizeof(LOGCONTEXTA) - FIELD_OFFSET(LOGCONTEXTA, lcOptions));
}
static void LOGCONTEXTWtoA(const LOGCONTEXTW *in, LOGCONTEXTA *out)
{
WideCharToMultiByte(CP_ACP, 0, in->lcName, LCNAMELEN, out->lcName, LCNAMELEN, NULL, NULL);
......@@ -114,7 +122,7 @@ static inline void DUMPPACKET(WTPACKET packet)
packet.pkRotation.roRoll, packet.pkRotation.roYaw);
}
static inline void DUMPCONTEXT(LOGCONTEXTA lc)
static inline void DUMPCONTEXT(LOGCONTEXTW lc)
{
CHAR mmsg[4000];
CHAR bits[100];
......@@ -122,7 +130,7 @@ static inline void DUMPCONTEXT(LOGCONTEXTA lc)
CHAR bits2[100];
sprintf(mmsg,"%s, %x, %x, %x, %x, %x, %x, %x%s, %x%s, %x%s, %x, %x, %i, %i, %i, %i ,%i, %i, %i, %i, %i,%i, %i, %i, %i, %i, %i, %i, %i, %i, %i, %i %i %i",
debugstr_a(lc.lcName), lc.lcOptions, lc.lcStatus, lc.lcLocks, lc.lcMsgBase,
wine_dbgstr_w(lc.lcName), lc.lcOptions, lc.lcStatus, lc.lcLocks, lc.lcMsgBase,
lc.lcDevice, lc.lcPktRate, (UINT)lc.lcPktData, DUMPBITS(lc.lcPktData,bits),
(UINT)lc.lcPktMode, DUMPBITS(lc.lcPktMode,bits1), (UINT)lc.lcMoveMask,
DUMPBITS(lc.lcMoveMask,bits2), (INT)lc.lcBtnDnMask, (INT)lc.lcBtnUpMask,
......@@ -452,9 +460,9 @@ UINT WINAPI WTInfoW(UINT wCategory, UINT nIndex, LPVOID lpOutput)
}
/***********************************************************************
* WTOpenA (WINTAB32.21)
* WTOpenW (WINTAB32.2021)
*/
HCTX WINAPI WTOpenA(HWND hWnd, LPLOGCONTEXTA lpLogCtx, BOOL fEnable)
HCTX WINAPI WTOpenW(HWND hWnd, LPLOGCONTEXTW lpLogCtx, BOOL fEnable)
{
LPOPENCONTEXT newcontext;
......@@ -462,7 +470,7 @@ HCTX WINAPI WTOpenA(HWND hWnd, LPLOGCONTEXTA lpLogCtx, BOOL fEnable)
DUMPCONTEXT(*lpLogCtx);
newcontext = HeapAlloc(GetProcessHeap(), 0 , sizeof(OPENCONTEXT));
memcpy(&(newcontext->context),lpLogCtx,sizeof(LOGCONTEXTA));
memcpy(&(newcontext->context),lpLogCtx,sizeof(LOGCONTEXTW));
newcontext->hwndOwner = hWnd;
newcontext->enabled = fEnable;
newcontext->ActiveCursor = -1;
......@@ -491,15 +499,14 @@ HCTX WINAPI WTOpenA(HWND hWnd, LPLOGCONTEXTA lpLogCtx, BOOL fEnable)
}
/***********************************************************************
* WTOpenW (WINTAB32.1021)
* WTOpenA (WINTAB32.21)
*/
HCTX WINAPI WTOpenW(HWND hWnd, LPLOGCONTEXTW lpLogCtx, BOOL fEnable)
HCTX WINAPI WTOpenA(HWND hWnd, LPLOGCONTEXTA lpLogCtx, BOOL fEnable)
{
FIXME("(%p, %p, %u): stub\n", hWnd, lpLogCtx, fEnable);
SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
LOGCONTEXTW logCtxW;
return NULL;
LOGCONTEXTAtoW(lpLogCtx, &logCtxW);
return WTOpenW(hWnd, &logCtxW, fEnable);
}
/***********************************************************************
......@@ -686,7 +693,7 @@ BOOL WINAPI WTGetA(HCTX hCtx, LPLOGCONTEXTA lpLogCtx)
EnterCriticalSection(&csTablet);
context = TABLET_FindOpenContext(hCtx);
memmove(lpLogCtx,&context->context,sizeof(LOGCONTEXTA));
LOGCONTEXTWtoA(&context->context, lpLogCtx);
LeaveCriticalSection(&csTablet);
return TRUE;
......@@ -697,11 +704,18 @@ BOOL WINAPI WTGetA(HCTX hCtx, LPLOGCONTEXTA lpLogCtx)
*/
BOOL WINAPI WTGetW(HCTX hCtx, LPLOGCONTEXTW lpLogCtx)
{
FIXME("(%p, %p): stub\n", hCtx, lpLogCtx);
LPOPENCONTEXT context;
SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
TRACE("(%p, %p)\n", hCtx, lpLogCtx);
return FALSE;
if (!hCtx) return 0;
EnterCriticalSection(&csTablet);
context = TABLET_FindOpenContext(hCtx);
memmove(lpLogCtx,&context->context,sizeof(LOGCONTEXTW));
LeaveCriticalSection(&csTablet);
return TRUE;
}
/***********************************************************************
......
......@@ -136,7 +136,7 @@ typedef struct tagWTPACKET {
typedef struct tagOPENCONTEXT
{
HCTX handle;
LOGCONTEXTA context;
LOGCONTEXTW context;
HWND hwndOwner;
BOOL enabled;
INT ActiveCursor;
......
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