Minor cleanup of Windows tablet code.

This commit is contained in:
Mike Erwin 2010-08-12 14:02:38 +00:00
parent 1232bb6923
commit fc5c4d98f4
3 changed files with 26 additions and 10 deletions

@ -932,22 +932,17 @@ bool GHOST_SystemWin32::handleEvent(GHOST_WindowWin32* window, UINT msg, WPARAM
// Tablet events, processed // Tablet events, processed
//////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////
case WT_PACKET: case WT_PACKET:
// puts("WT_PACKET");
// window->processWin32TabletEvent(wParam, lParam);
m_tabletManager->processPackets((HCTX)lParam); m_tabletManager->processPackets((HCTX)lParam);
break; break;
case WT_CSRCHANGE: case WT_CSRCHANGE:
m_tabletManager->changeTool((HCTX)lParam, wParam); m_tabletManager->changeTool((HCTX)lParam, wParam);
break; break;
case WT_PROXIMITY: case WT_PROXIMITY:
// description was weird.. give me numbers!
// printf("prox: %d %d\n", LOWORD(lParam), HIWORD(lParam));
if (LOWORD(lParam) == 0) if (LOWORD(lParam) == 0)
{ {
puts("-- dropping tool --"); puts("-- dropping tool --");
m_tabletManager->dropTool(); m_tabletManager->dropTool();
} }
// window->processWin32TabletInitEvent();
break; break;
//////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////

@ -1,3 +1,6 @@
// safe & friendly WinTab wrapper
// by Mike Erwin, July 2010
#include "GHOST_TabletManagerWin32.h" #include "GHOST_TabletManagerWin32.h"
#include "GHOST_WindowWin32.h" #include "GHOST_WindowWin32.h"
#include <stdio.h> #include <stdio.h>
@ -73,8 +76,6 @@ GHOST_TabletManagerWin32::GHOST_TabletManagerWin32()
// cheat by using available data from Intuos4. test on other tablets!!! // cheat by using available data from Intuos4. test on other tablets!!!
azimuthScale = 1.f / HIWORD(tiltRange[1].axResolution); azimuthScale = 1.f / HIWORD(tiltRange[1].axResolution);
altitudeScale = 1.f / tiltRange[1].axMax; altitudeScale = 1.f / tiltRange[1].axMax;
printf("azi scale %f\n", azimuthScale);
printf("alt scale %f\n", altitudeScale);
// leave this code in place to help support tablets I haven't tested // leave this code in place to help support tablets I haven't tested
const char* axisName[] = {"azimuth","altitude","twist"}; const char* axisName[] = {"azimuth","altitude","twist"};
@ -101,8 +102,8 @@ GHOST_TabletManagerWin32::GHOST_TabletManagerWin32()
UINT tag = 0; UINT tag = 0;
UINT extensionCount; UINT extensionCount;
func_Info(WTI_INTERFACE, IFC_NEXTENSIONS, &extensionCount); func_Info(WTI_INTERFACE, IFC_NEXTENSIONS, &extensionCount);
// for (UINT i = 0; func_Info(WTI_EXTENSIONS + i, EXT_TAG, &tag); ++i)
for (UINT i = 0; i < extensionCount; ++i) for (UINT i = 0; i < extensionCount; ++i)
// for (UINT i = 0; func_Info(WTI_EXTENSIONS + i, EXT_TAG, &tag); ++i)
{ {
printf("trying extension %d\n", i); printf("trying extension %d\n", i);
func_Info(WTI_EXTENSIONS + i, EXT_TAG, &tag); func_Info(WTI_EXTENSIONS + i, EXT_TAG, &tag);
@ -299,6 +300,8 @@ void GHOST_TabletManagerWin32::processPackets(HCTX context)
} }
putchar('\n'); putchar('\n');
// at this point, construct a GHOST event and push it into the queue!
} }
} }
@ -312,7 +315,7 @@ void GHOST_TabletManagerWin32::changeTool(HCTX context, UINT serialNumber)
func_Packet(context, serialNumber, &packet); func_Packet(context, serialNumber, &packet);
UINT cursor = (packet.pkCursor - cursorBase) % cursorCount; UINT cursor = (packet.pkCursor - cursorBase) % cursorCount;
printf("%d mod %d = %d\n", packet.pkCursor - cursorBase, cursorCount, cursor); // printf("%d mod %d = %d\n", packet.pkCursor - cursorBase, cursorCount, cursor);
switch (cursor) switch (cursor)
{ {

@ -1,4 +1,4 @@
// safe & friendly Wintab wrapper // safe & friendly WinTab wrapper
// by Mike Erwin, July 2010 // by Mike Erwin, July 2010
#ifndef GHOST_TABLET_MANAGER_WIN32_H #ifndef GHOST_TABLET_MANAGER_WIN32_H
@ -96,4 +96,22 @@ public:
void dropTool(); void dropTool();
}; };
/*
The tablet manager is driven by the following Windows event processing code:
case WT_PACKET:
m_tabletManager->processPackets((HCTX)lParam);
break;
case WT_CSRCHANGE:
m_tabletManager->changeTool((HCTX)lParam, wParam);
break;
case WT_PROXIMITY:
if (LOWORD(lParam) == 0)
{
puts("-- dropping tool --");
m_tabletManager->dropTool();
}
break;
*/
#endif #endif