wintab32: Store the context internally as Unicode, implement WTOpenW and WTGetW.
This commit is contained in:
parent
29a634728d
commit
bc7c5218c7
|
@ -46,6 +46,14 @@ static BOOL gLoaded;
|
||||||
static LPOPENCONTEXT gOpenContexts;
|
static LPOPENCONTEXT gOpenContexts;
|
||||||
static HCTX gTopContext = (HCTX)0xc00;
|
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)
|
static void LOGCONTEXTWtoA(const LOGCONTEXTW *in, LOGCONTEXTA *out)
|
||||||
{
|
{
|
||||||
WideCharToMultiByte(CP_ACP, 0, in->lcName, LCNAMELEN, out->lcName, LCNAMELEN, NULL, NULL);
|
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);
|
packet.pkRotation.roRoll, packet.pkRotation.roYaw);
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline void DUMPCONTEXT(LOGCONTEXTA lc)
|
static inline void DUMPCONTEXT(LOGCONTEXTW lc)
|
||||||
{
|
{
|
||||||
CHAR mmsg[4000];
|
CHAR mmsg[4000];
|
||||||
CHAR bits[100];
|
CHAR bits[100];
|
||||||
|
@ -122,7 +130,7 @@ static inline void DUMPCONTEXT(LOGCONTEXTA lc)
|
||||||
CHAR bits2[100];
|
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",
|
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),
|
lc.lcDevice, lc.lcPktRate, (UINT)lc.lcPktData, DUMPBITS(lc.lcPktData,bits),
|
||||||
(UINT)lc.lcPktMode, DUMPBITS(lc.lcPktMode,bits1), (UINT)lc.lcMoveMask,
|
(UINT)lc.lcPktMode, DUMPBITS(lc.lcPktMode,bits1), (UINT)lc.lcMoveMask,
|
||||||
DUMPBITS(lc.lcMoveMask,bits2), (INT)lc.lcBtnDnMask, (INT)lc.lcBtnUpMask,
|
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;
|
LPOPENCONTEXT newcontext;
|
||||||
|
|
||||||
|
@ -462,7 +470,7 @@ HCTX WINAPI WTOpenA(HWND hWnd, LPLOGCONTEXTA lpLogCtx, BOOL fEnable)
|
||||||
DUMPCONTEXT(*lpLogCtx);
|
DUMPCONTEXT(*lpLogCtx);
|
||||||
|
|
||||||
newcontext = HeapAlloc(GetProcessHeap(), 0 , sizeof(OPENCONTEXT));
|
newcontext = HeapAlloc(GetProcessHeap(), 0 , sizeof(OPENCONTEXT));
|
||||||
memcpy(&(newcontext->context),lpLogCtx,sizeof(LOGCONTEXTA));
|
memcpy(&(newcontext->context),lpLogCtx,sizeof(LOGCONTEXTW));
|
||||||
newcontext->hwndOwner = hWnd;
|
newcontext->hwndOwner = hWnd;
|
||||||
newcontext->enabled = fEnable;
|
newcontext->enabled = fEnable;
|
||||||
newcontext->ActiveCursor = -1;
|
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);
|
LOGCONTEXTW logCtxW;
|
||||||
|
|
||||||
SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
|
LOGCONTEXTAtoW(lpLogCtx, &logCtxW);
|
||||||
|
return WTOpenW(hWnd, &logCtxW, fEnable);
|
||||||
return NULL;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************************
|
/***********************************************************************
|
||||||
|
@ -686,7 +693,7 @@ BOOL WINAPI WTGetA(HCTX hCtx, LPLOGCONTEXTA lpLogCtx)
|
||||||
|
|
||||||
EnterCriticalSection(&csTablet);
|
EnterCriticalSection(&csTablet);
|
||||||
context = TABLET_FindOpenContext(hCtx);
|
context = TABLET_FindOpenContext(hCtx);
|
||||||
memmove(lpLogCtx,&context->context,sizeof(LOGCONTEXTA));
|
LOGCONTEXTWtoA(&context->context, lpLogCtx);
|
||||||
LeaveCriticalSection(&csTablet);
|
LeaveCriticalSection(&csTablet);
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
@ -697,11 +704,18 @@ BOOL WINAPI WTGetA(HCTX hCtx, LPLOGCONTEXTA lpLogCtx)
|
||||||
*/
|
*/
|
||||||
BOOL WINAPI WTGetW(HCTX hCtx, LPLOGCONTEXTW 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
|
typedef struct tagOPENCONTEXT
|
||||||
{
|
{
|
||||||
HCTX handle;
|
HCTX handle;
|
||||||
LOGCONTEXTA context;
|
LOGCONTEXTW context;
|
||||||
HWND hwndOwner;
|
HWND hwndOwner;
|
||||||
BOOL enabled;
|
BOOL enabled;
|
||||||
INT ActiveCursor;
|
INT ActiveCursor;
|
||||||
|
|
Loading…
Reference in New Issue