continued Win32 tablet hackery

This commit is contained in:
Mike Erwin 2010-08-14 21:01:09 +00:00
parent 7428380cc3
commit 91e2a55171
5 changed files with 248 additions and 173 deletions

@ -35,6 +35,7 @@ GHOST_Buttons::GHOST_Buttons()
clear();
}
GHOST_Buttons::~GHOST_Buttons() {}
bool GHOST_Buttons::get(GHOST_TButtonMask mask) const
{
@ -73,7 +74,5 @@ void GHOST_Buttons::clear()
bool GHOST_Buttons::anyDown() const
{
return m_ButtonLeft || m_ButtonMiddle || m_ButtonRight;
return m_ButtonLeft || m_ButtonMiddle || m_ButtonRight;
}
GHOST_Buttons::~GHOST_Buttons() {}

@ -247,6 +247,9 @@ bool GHOST_SystemWin32::processEvents(bool waitForEvent)
}
} while (waitForEvent && !anyProcessed);
if (m_tabletManager->processPackets())
anyProcessed = true;
return anyProcessed;
}
@ -500,15 +503,28 @@ void GHOST_SystemWin32::processModifierKeys(GHOST_IWindow *window)
bool eventIsFromTablet()
{
// bool IsFromPen = ((GetMessageExtraInfo() & 0xFF515700) == 0xFF515700); // this only works on TabletPCs
return GetMessageExtraInfo() & 0x7f; // true for tablet mouse, not just pen
// this (apparently) gives the packet serial number, which only tablet events have
return GetMessageExtraInfo() != 0;
// bool IsFromPen = ((GetMessageExtraInfo() & 0xFF515700) == 0xFF515700); // this only works on TabletPCs
// static int all_magic = 0;
// int magic = GetMessageExtraInfo();
// all_magic |= magic;
// printf("from tablet? %08x %08x\n", magic, all_magic);
// return magic & 0x7f; // true for tablet mouse, not just pen
}
GHOST_EventButton* GHOST_SystemWin32::processButtonEvent(GHOST_TEventType type, GHOST_IWindow *window, GHOST_TButtonMask mask)
{
puts("ghost button event");
// if (eventIsFromTablet())
// return NULL;
if (eventIsFromTablet())
return NULL;
static GHOST_Buttons buttons;
if (type == GHOST_kEventButtonUp && !buttons.get(mask))
// discard rogue button up events (probably from tablet)
return NULL;
buttons.set(mask, type == GHOST_kEventButtonDown);
printf("system button %d %s\n", mask, (type == GHOST_kEventButtonDown) ? "down" : (type == GHOST_kEventButtonUp) ? "up" : "???");
return new GHOST_EventButton (getSystem()->getMilliSeconds(), type, window, mask);
}
@ -516,6 +532,8 @@ GHOST_EventButton* GHOST_SystemWin32::processButtonEvent(GHOST_TEventType type,
GHOST_EventCursor* GHOST_SystemWin32::processCursorEvent(GHOST_TEventType type, GHOST_IWindow *Iwindow, int x_screen, int y_screen)
{
printf("system cursor (%d,%d)\n", x_screen, y_screen);
GHOST_SystemWin32 * system = ((GHOST_SystemWin32 * ) getSystem());
GHOST_WindowWin32 * window = ( GHOST_WindowWin32 * ) Iwindow;
@ -933,10 +951,11 @@ bool GHOST_SystemWin32::handleEvent(GHOST_WindowWin32* window, UINT msg, WPARAM
// Tablet events, processed
////////////////////////////////////////////////////////////////////////
case WT_PACKET:
puts("WT_PACKET");
m_tabletManager->processPackets(window);
break;
case WT_CSRCHANGE:
m_tabletManager->changeTool((HCTX)lParam, wParam);
m_tabletManager->changeTool(window, wParam);
break;
case WT_PROXIMITY:
if (LOWORD(lParam) == 0)
@ -1034,8 +1053,10 @@ bool GHOST_SystemWin32::handleEvent(GHOST_WindowWin32* window, UINT msg, WPARAM
GetRawInputData((HRAWINPUT)lParam, RID_INPUT, raw_ptr, &rawSize, sizeof(RAWINPUTHEADER));
eventSent |= processRawInput(raw, window);
// necessary?
// DefRawInputProc(&raw_ptr, 1, sizeof(RAWINPUTHEADER));
if (processRawInput(raw, window))
eventSent = true;
// else
// DefRawInputProc(&raw_ptr, 1, sizeof(RAWINPUTHEADER));
#if 0
#define RAWCOUNT 10
@ -1067,7 +1088,7 @@ bool GHOST_SystemWin32::handleEvent(GHOST_WindowWin32* window, UINT msg, WPARAM
}
// clear processed events from the queue
DefRawInputProc((RAWINPUT**)&rawBuffer, n, sizeof(RAWINPUTHEADER));
// DefRawInputProc((RAWINPUT**)&rawBuffer, n, sizeof(RAWINPUTHEADER));
}
}
#endif

@ -11,14 +11,28 @@
#include <math.h>
#define PACKETDATA PK_CURSOR | PK_X | PK_Y | PK_BUTTONS | PK_NORMAL_PRESSURE | PK_ORIENTATION
#define PACKETMODE PK_BUTTONS
#define PACKETMODE 0 /*PK_BUTTONS*/
// #define PACKETTILT PKEXT_ABSOLUTE
#include "pktdef.h"
#define MAX_QUEUE_SIZE 100
static void print(AXIS const& t, char const* label = NULL)
{
const char* unitName[] = {"dinosaur","inch","cm","circle"};
if (label)
printf("%s: ", label);
printf("%d to %d, %d.%d per %s\n",
t.axMin, t.axMax,
HIWORD(t.axResolution), LOWORD(t.axResolution),
unitName[t.axUnits]);
}
GHOST_TabletManagerWin32::GHOST_TabletManagerWin32()
: activeWindow(NULL)
{
dropTool();
@ -46,56 +60,45 @@ GHOST_TabletManagerWin32::GHOST_TabletManagerWin32()
if (func_Info(WTI_DEVICES, DVC_NAME, tabletName))
puts(tabletName);
puts("active tablet area");
AXIS xRange, yRange;
func_Info(WTI_DEVICES, DVC_X, &xRange);
func_Info(WTI_DEVICES, DVC_Y, &yRange);
print(xRange,"x"); print(yRange,"y");
printf("active area: %dx%d\n", xRange.axMax, yRange.axMax);
func_Info(WTI_DEVICES, DVC_NCSRTYPES, &cursorCount);
func_Info(WTI_DEVICES, DVC_FIRSTCSR, &cursorBase);
puts("pressure sensitivity");
AXIS pressureRange;
hasPressure = func_Info(WTI_DEVICES, DVC_NPRESSURE, &pressureRange);// && pressureRange.axMax != 0;
print(pressureRange);
printf("pressure sensitivity: ");
if (hasPressure)
{
printf("%d to %d\n", pressureRange.axMin, pressureRange.axMax);
pressureScale = 1.f / pressureRange.axMax;
}
else
{
printf("none\n");
pressureScale = 0.f;
}
printf("tilt sensitivity:\n");
puts("tilt sensitivity");
AXIS tiltRange[3];
hasTilt = func_Info(WTI_DEVICES, DVC_ORIENTATION, tiltRange);
if (hasTilt)
{
// leave this code in place to help support tablets I haven't tested
const char* axisName[] = {"azimuth","altitude","twist"};
for (int i = 0; i < 3; ++i)
print(tiltRange[i], axisName[i]);
// cheat by using available data from Intuos4. test on other tablets!!!
azimuthScale = 1.f / HIWORD(tiltRange[1].axResolution);
altitudeScale = 1.f / tiltRange[1].axMax;
// leave this code in place to help support tablets I haven't tested
const char* axisName[] = {"azimuth","altitude","twist"};
const char* unitName[] = {NULL,"inch","cm","circle"};
for (int i = 0; i < 3; ++i)
{
AXIS const& t = tiltRange[i];
if (t.axResolution)
printf("%s: %d to %d values per %d.%d %s\n",
axisName[i], t.axMin, t.axMax,
HIWORD(t.axResolution), LOWORD(t.axResolution),
unitName[t.axUnits]);
}
}
else
{
printf("none\n");
puts("none");
azimuthScale = altitudeScale = 0.f;
}
#if 0 // WTX_TILT -- cartesian tilt extension, no conversion needed
@ -106,7 +109,6 @@ GHOST_TabletManagerWin32::GHOST_TabletManagerWin32()
UINT extensionCount;
func_Info(WTI_INTERFACE, IFC_NEXTENSIONS, &extensionCount);
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);
func_Info(WTI_EXTENSIONS + i, EXT_TAG, &tag);
@ -119,17 +121,17 @@ GHOST_TabletManagerWin32::GHOST_TabletManagerWin32()
if (hasTilt)
{
func_Info(WTI_EXTENSIONS + tag, EXT_MASK, &tiltMask);
AXIS tiltRange[2];
func_Info(WTI_EXTENSIONS + tag, EXT_AXES, tiltRange);
printf("%d to %d along x\n", tiltRange[0].axMin, tiltRange[0].axMax);
printf("%d to %d along y\n", tiltRange[1].axMin, tiltRange[1].axMax);
print("x", tiltRange[0]);
print("y", tiltRange[1]);
tiltScaleX = 1.f / tiltRange[0].axMax;
tiltScaleY = 1.f / tiltRange[1].axMax;
func_Info(WTI_EXTENSIONS + tag, EXT_MASK, &tiltMask);
}
else
{
printf("none\n");
puts("none");
tiltScaleX = tiltScaleY = 0.f;
}
#endif // WTX_TILT
@ -165,18 +167,27 @@ void GHOST_TabletManagerWin32::openForWindow(GHOST_WindowWin32* window)
// set up context
LOGCONTEXT archetype;
// func_Info(WTI_DEFSYSCTX, 0, &archetype);
func_Info(WTI_DEFCONTEXT, 0, &archetype);
func_Info(WTI_DEFSYSCTX, 0, &archetype);
// func_Info(WTI_DEFCONTEXT, 0, &archetype);
strcpy(archetype.lcName, "blender special");
archetype.lcPktData = PACKETDATA;
archetype.lcPktMode = PACKETMODE;
// archetype.lcOptions |= CXO_MESSAGES | CXO_CSRMESSAGES;
archetype.lcOptions |= CXO_SYSTEM | CXO_MESSAGES | CXO_CSRMESSAGES;
WTPKT packetData = PACKETDATA;
if (!hasPressure)
packetData &= ~PK_NORMAL_PRESSURE;
if (!hasTilt)
packetData &= ~PK_ORIENTATION;
archetype.lcPktData = packetData;
archetype.lcPktMode = PACKETMODE;
archetype.lcOptions |= /*CXO_MESSAGES |*/ CXO_CSRMESSAGES;
// archetype.lcOptions |= CXO_SYSTEM | CXO_MESSAGES | CXO_CSRMESSAGES;
#if PACKETMODE & PK_BUTTONS
// we want first 5 buttons
archetype.lcBtnDnMask = 0x1f;
archetype.lcBtnUpMask = 0x1f;
#endif
// BEGIN derived from Wacom's TILTTEST.C:
AXIS TabletX, TabletY;
@ -259,16 +270,23 @@ void GHOST_TabletManagerWin32::convertTilt(ORIENTATION const& ort, TabletToolDat
data.tilt_y = sin(M_PI/2.0 - azmRad) * vecLen;
}
void GHOST_TabletManagerWin32::processPackets(GHOST_WindowWin32* window)
bool GHOST_TabletManagerWin32::processPackets(GHOST_WindowWin32* window)
{
if (window == NULL)
window = activeWindow;
HCTX context = contextForWindow(window);
bool anyProcessed = false;
if (context)
{
// PACKET packet;
// func_Packet(context, serialNumber, &packet);
PACKET packets[MAX_QUEUE_SIZE];
int n = func_PacketsGet(context, MAX_QUEUE_SIZE, packets);
// printf("processing %d packets\n", n);
// printf("processing %d packets\n", n);
for (int i = 0; i < n; ++i)
{
PACKET const& packet = packets[i];
@ -277,15 +295,20 @@ void GHOST_TabletManagerWin32::processPackets(GHOST_WindowWin32* window)
int y = packet.pkY;
if (activeTool.type == TABLET_MOUSE)
if (x == prevMouseX && y == prevMouseY)
if (x == prevMouseX && y == prevMouseY && packet.pkButtons == prevButtons)
// don't send any "mouse hasn't moved" events
continue;
else {
prevMouseX = x;
prevMouseY = y;
}
// every packet from a WT_PACKET message comes from the same tool
anyProcessed = true;
// Since we're using a digitizing context, we need to
// move the on-screen cursor ourselves.
// SetCursorPos(x, y);
switch (activeTool.type)
{
case TABLET_MOUSE:
@ -316,108 +339,159 @@ void GHOST_TabletManagerWin32::processPackets(GHOST_WindowWin32* window)
if (activeTool.hasTilt)
{
// ORIENTATION const& tilt = packet.pkOrientation;
// printf(" /%d,%d/", tilt.orAzimuth, tilt.orAltitude);
convertTilt(packet.pkOrientation, data);
// data.tilt_x = tiltScaleX * packet.pkTilt.tiltX;
// data.tilt_y = tiltScaleY * packet.pkTilt.tiltY;
printf(" /%.2f,%.2f/", data.tilt_x, data.tilt_y);
}
putchar('\n');
ORIENTATION const& o = packet.pkOrientation;
// at this point, construct a GHOST event and push it into the queue!
// (having trouble with Wacom mouse scaling, so ignore it for now)
// if (activeTool.type == TABLET_PEN || activeTool.type == TABLET_ERASER)
{
GHOST_System* system = (GHOST_System*) GHOST_ISystem::getSystem();
if (packet.pkButtons)
if (o.orAzimuth || o.orAltitude)
{
// which button?
GHOST_TButtonMask e_button;
int buttonNumber = LOWORD(packet.pkButtons);
e_button = (GHOST_TButtonMask) buttonNumber;
// pressed or released?
GHOST_TEventType e_action;
int buttonAction = HIWORD(packet.pkButtons);
if (buttonAction == TBN_DOWN)
e_action = GHOST_kEventButtonDown;
else
e_action = GHOST_kEventButtonUp;
printf("button %d %s\n", buttonNumber, buttonAction == TBN_DOWN ? "down" : "up");
GHOST_EventButton* e = new GHOST_EventButton(system->getMilliSeconds(), e_action, window, e_button);
// system->pushEvent(e);
convertTilt(o, data);
printf(" /%d,%d/", o.orAzimuth, o.orAltitude);
printf(" /%.2f,%.2f/", data.tilt_x, data.tilt_y);
if (fabs(data.tilt_x) < 0.001 && fabs(data.tilt_x) < 0.001)
{
// really should fix the initial test for activeTool.hasTilt,
// not apply a band-aid here.
data.tool.hasTilt = false;
data.tilt_x = 0.f;
data.tilt_y = 0.f;
}
}
else
data.tool.hasTilt = false;
// data.tilt_x = tiltScaleX * packet.pkTilt.tiltX;
// data.tilt_y = tiltScaleY * packet.pkTilt.tiltY;
}
// at this point, construct a GHOST event and push it into the queue!
GHOST_System* system = (GHOST_System*) GHOST_ISystem::getSystem();
// any buttons changed?
#if PACKETMODE & PK_BUTTONS
// relative buttons mode
if (packet.pkButtons)
{
// which button?
GHOST_TButtonMask e_button;
int buttonNumber = LOWORD(packet.pkButtons);
e_button = (GHOST_TButtonMask) buttonNumber;
// pressed or released?
GHOST_TEventType e_action;
int buttonAction = HIWORD(packet.pkButtons);
if (buttonAction == TBN_DOWN)
e_action = GHOST_kEventButtonDown;
else
e_action = GHOST_kEventButtonUp;
printf(" button %d %s\n", buttonNumber, buttonAction == TBN_DOWN ? "down" : "up");
GHOST_EventButton* e = new GHOST_EventButton(system->getMilliSeconds(), e_action, window, e_button);
system->pushEvent(e);
}
#else
// absolute buttons mode
UINT diff = prevButtons ^ packet.pkButtons;
if (diff)
{
for (int i = 0; i < 32 /*GHOST_kButtonNumMasks*/; ++i)
{
GHOST_EventCursor* e = new GHOST_EventCursor(system->getMilliSeconds(), GHOST_kEventCursorMove, window, x, y);
UINT mask = 1 << i;
// use older TabletData struct for testing until mine is in place
GHOST_TabletData& e_data = ((GHOST_TEventCursorData*) e->getData())->tablet;
e_data.Active = (GHOST_TTabletMode) data.tool.type;
e_data.Pressure = data.pressure;
e_data.Xtilt = data.tilt_x;
e_data.Ytilt = data.tilt_y;
if (diff & mask)
{
GHOST_TButtonMask e_button = (GHOST_TButtonMask) i;
GHOST_TEventType e_action = (packet.pkButtons & mask) ? GHOST_kEventButtonDown : GHOST_kEventButtonUp;
// system->pushEvent(e);
GHOST_EventButton* e = new GHOST_EventButton(system->getMilliSeconds(), e_action, window, e_button);
GHOST_TabletData& e_data = ((GHOST_TEventButtonData*) e->getData())->tablet;
e_data.Active = (GHOST_TTabletMode) data.tool.type;
e_data.Pressure = data.pressure;
e_data.Xtilt = data.tilt_x;
e_data.Ytilt = data.tilt_y;
printf(" button %d %s\n", i, (e_action == GHOST_kEventButtonDown) ? "down" : "up");
system->pushEvent(e);
}
}
prevButtons = packet.pkButtons;
}
#endif
else
{
GHOST_EventCursor* e = new GHOST_EventCursor(system->getMilliSeconds(), GHOST_kEventCursorMove, window, x, y);
// use older TabletData struct for testing until mine is in place
GHOST_TabletData& e_data = ((GHOST_TEventCursorData*) e->getData())->tablet;
e_data.Active = (GHOST_TTabletMode) data.tool.type;
e_data.Pressure = data.pressure;
e_data.Xtilt = data.tilt_x;
e_data.Ytilt = data.tilt_y;
puts(" move");
system->pushEvent(e);
}
}
}
return anyProcessed;
}
void GHOST_TabletManagerWin32::changeTool(HCTX context, UINT serialNumber)
void GHOST_TabletManagerWin32::changeTool(GHOST_WindowWin32* window, UINT serialNumber)
{
puts("-- changing tool --");
dropTool();
PACKET packet;
func_Packet(context, serialNumber, &packet);
UINT cursor = (packet.pkCursor - cursorBase) % cursorCount;
HCTX context = contextForWindow(window);
// printf("%d mod %d = %d\n", packet.pkCursor - cursorBase, cursorCount, cursor);
switch (cursor)
if (context)
{
case 0: // older Intuos tablets can track two cursors at once
case 3: // so we test for both here
activeTool.type = TABLET_MOUSE;
break;
case 1:
case 4:
activeTool.type = TABLET_PEN;
break;
case 2:
case 5:
activeTool.type = TABLET_ERASER;
break;
default:
activeTool.type = TABLET_NONE;
activeWindow = window;
PACKET packet;
func_Packet(context, serialNumber, &packet);
UINT cursor = (packet.pkCursor - cursorBase) % cursorCount;
// printf("%d mod %d = %d\n", packet.pkCursor - cursorBase, cursorCount, cursor);
switch (cursor)
{
case 0: // older Intuos tablets can track two cursors at once
case 3: // so we test for both here
activeTool.type = TABLET_MOUSE;
break;
case 1:
case 4:
activeTool.type = TABLET_PEN;
break;
case 2:
case 5:
activeTool.type = TABLET_ERASER;
break;
default:
activeTool.type = TABLET_NONE;
}
WTPKT toolData;
func_Info(WTI_CURSORS + packet.pkCursor, CSR_PKTDATA, &toolData);
activeTool.hasPressure = toolData & PK_NORMAL_PRESSURE;
activeTool.hasTilt = toolData & PK_ORIENTATION;
// activeTool.hasTilt = toolData & tiltMask;
if (activeTool.hasPressure)
puts(" - pressure");
if (activeTool.hasTilt)
puts(" - tilt");
// and just for fun:
if (toolData & PK_BUTTONS)
puts(" - buttons");
}
WTPKT toolData;
func_Info(WTI_CURSORS + cursor, CSR_PKTDATA, &toolData);
activeTool.hasPressure = toolData & PK_NORMAL_PRESSURE;
activeTool.hasTilt = toolData & PK_ORIENTATION;
// activeTool.hasTilt = toolData & tiltMask;
if (activeTool.hasPressure)
puts(" - pressure");
if (activeTool.hasTilt)
puts(" - tilt");
// and just for fun:
if (toolData & PK_BUTTONS)
puts(" - buttons");
}
void GHOST_TabletManagerWin32::dropTool()
@ -427,4 +501,7 @@ void GHOST_TabletManagerWin32::dropTool()
activeTool.hasTilt = false;
prevMouseX = prevMouseY = 0;
prevButtons = 0;
activeWindow = NULL;
}

@ -69,15 +69,16 @@ class GHOST_TabletManagerWin32
UINT cursorCount;
UINT cursorBase;
// candidate for a base class:
// book-keeping
std::map<GHOST_WindowWin32*,HCTX> contexts;
HCTX contextForWindow(GHOST_WindowWin32*);
GHOST_WindowWin32* activeWindow;
TabletTool activeTool;
int prevMouseX;
int prevMouseY;
// book-keeping
std::map<GHOST_WindowWin32*,HCTX> contexts;
HCTX contextForWindow(GHOST_WindowWin32*);
UINT prevButtons;
void convertTilt(ORIENTATION const&, TabletToolData&);
@ -90,9 +91,11 @@ public:
void openForWindow(GHOST_WindowWin32*);
void closeForWindow(GHOST_WindowWin32*);
void processPackets(GHOST_WindowWin32*);
// returns whether any packets resulted in GHOST events
bool processPackets(GHOST_WindowWin32* = NULL);
// void processPacket(GHOST_WindowWin32*, UINT serialNumber);
void changeTool(HCTX, UINT serialNumber);
void changeTool(GHOST_WindowWin32*, UINT serialNumber);
void dropTool();
};
@ -100,10 +103,10 @@ public:
The tablet manager is driven by the following Windows event processing code:
case WT_PACKET:
m_tabletManager->processPackets((HCTX)lParam);
m_tabletManager->processPackets(window);
break;
case WT_CSRCHANGE:
m_tabletManager->changeTool((HCTX)lParam, wParam);
m_tabletManager->changeTool(window, wParam);
break;
case WT_PROXIMITY:
if (LOWORD(lParam) == 0)

@ -1977,7 +1977,7 @@ int WM_modal_tweak_exit(wmEvent *evt, int tweak_event)
if(evt->val==tweak_modal)
return 1;
default:
/* this case is when modal callcback didnt get started with a tweak */
/* this case is when modal callback didnt get started with a tweak */
if(evt->val)
return 1;
}
@ -2062,28 +2062,6 @@ static int convert_key(GHOST_TKey key)
}
}
#if 0
/* adds customdata to event */
static void update_tablet_data(wmWindow *win, wmEvent *event)
{
const GHOST_TabletData *td= GHOST_GetTabletData(win->ghostwin);
/* if there's tablet data from an active tablet device then add it */
if ((td != NULL) && td->Active != GHOST_kTabletModeNone) {
struct wmTabletData *wmtab= MEM_mallocN(sizeof(wmTabletData), "customdata tablet");
wmtab->Active = (int)td->Active;
wmtab->Pressure = td->Pressure;
wmtab->Xtilt = td->Xtilt;
wmtab->Ytilt = td->Ytilt;
event->custom= EVT_DATA_TABLET;
event->customdata= wmtab;
event->customdatafree= 1;
}
}
#endif
/* adds customdata to event */
static void attach_tablet_data(wmEvent* event, const GHOST_TabletData* ghost)
{
@ -2100,7 +2078,7 @@ static void attach_tablet_data(wmEvent* event, const GHOST_TabletData* ghost)
event->customdata = data;
event->customdatafree = 1;
printf("+ pressure = %.2f tilt = %.2f %2f\n", data->Pressure, data->Xtilt, data->Ytilt);
// printf("+ pressure = %.2f tilt = %.2f %.2f\n", data->Pressure, data->Xtilt, data->Ytilt);
}
}
@ -2165,7 +2143,7 @@ static wmWindow *wm_event_cursor_other_windows(wmWindowManager *wm, wmWindow *wi
}
/* windows store own event queues, no bContext here */
/* time is in 1000s of seconds (or milliseconds?), from ghost */
/* time is in milliseconds, from ghost */
void wm_event_add_ghostevent(wmWindowManager *wm, wmWindow *win, int type, int time, void *customdata)
{
wmWindow *owin;
@ -2205,7 +2183,6 @@ void wm_event_add_ghostevent(wmWindowManager *wm, wmWindow *win, int type, int t
lastevent->type = INBETWEEN_MOUSEMOVE;
attach_tablet_data(&event, &(cd->tablet));
// update_tablet_data(win, &event);
wm_event_add(win, &event);
/* also add to other window if event is there, this makes overdraws disappear nicely */
@ -2218,7 +2195,6 @@ void wm_event_add_ghostevent(wmWindowManager *wm, wmWindow *win, int type, int t
oevent.y=owin->eventstate->y= event.y;
oevent.type= MOUSEMOVE;
// update_tablet_data(owin, &oevent);
wm_event_add(owin, &oevent);
}
}
@ -2263,7 +2239,8 @@ void wm_event_add_ghostevent(wmWindowManager *wm, wmWindow *win, int type, int t
case GHOST_kEventButtonDown:
case GHOST_kEventButtonUp: {
GHOST_TEventButtonData *bd= customdata;
event.val= (type==GHOST_kEventButtonDown) ? KM_PRESS:KM_RELEASE; /* Note!, this starts as 0/1 but later is converted to KM_PRESS/KM_RELEASE by tweak */
event.val= (type==GHOST_kEventButtonDown) ? KM_PRESS:KM_RELEASE;
/* Note!, this starts as 0/1 but later is converted to KM_PRESS/KM_RELEASE by tweak */
if (bd->button == GHOST_kButtonMaskLeft)
event.type= LEFTMOUSE;
@ -2287,12 +2264,10 @@ void wm_event_add_ghostevent(wmWindowManager *wm, wmWindow *win, int type, int t
oevent.val= event.val;
attach_tablet_data(&oevent, &(bd->tablet));
// update_tablet_data(owin, &oevent);
wm_event_add(owin, &oevent);
}
else {
attach_tablet_data(&event, &(bd->tablet));
// update_tablet_data(win, &event);
wm_event_add(win, &event);
}