Module: wine Branch: master Commit: bc7c5218c7e8fbebfe19ae28b79ca724050fbd9a URL: http://source.winehq.org/git/wine.git/?a=commit;h=bc7c5218c7e8fbebfe19ae28b7...
Author: Mikolaj Zalewski mikolajz@google.com Date: Thu Sep 20 13:02:10 2007 -0700
wintab32: Store the context internally as Unicode, implement WTOpenW and WTGetW.
---
dlls/wintab32/context.c | 44 +++++++++++++++++++++++++------------- dlls/wintab32/wintab_internal.h | 2 +- 2 files changed, 30 insertions(+), 16 deletions(-)
diff --git a/dlls/wintab32/context.c b/dlls/wintab32/context.c index 4c08083..cb85e08 100644 --- a/dlls/wintab32/context.c +++ b/dlls/wintab32/context.c @@ -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; }
/*********************************************************************** diff --git a/dlls/wintab32/wintab_internal.h b/dlls/wintab32/wintab_internal.h index 71a68ab..1c8636d 100644 --- a/dlls/wintab32/wintab_internal.h +++ b/dlls/wintab32/wintab_internal.h @@ -136,7 +136,7 @@ typedef struct tagWTPACKET { typedef struct tagOPENCONTEXT { HCTX handle; - LOGCONTEXTA context; + LOGCONTEXTW context; HWND hwndOwner; BOOL enabled; INT ActiveCursor;