Commit 0652a2cc authored by Alistair Leslie-Hughes's avatar Alistair Leslie-Hughes Committed by Alexandre Julliard

winex11: Implement PK_CHANGE for wintab.

Based on a patch by Eriks Dobelis. Signed-off-by: 's avatarAlistair Leslie-Hughes <leslie_alistair@hotmail.com> Signed-off-by: 's avatarAlexandre Julliard <julliard@winehq.org>
parent 4c7ffaec
......@@ -267,6 +267,7 @@ static int proximity_out_type;
static HWND hwndTabletDefault;
static WTPACKET gMsgPacket;
static DWORD gSerial;
static WTPACKET last_packet;
/* Reference: http://www.wacomeng.com/devsupport/ibmpc/gddevpc.html
*
......@@ -839,6 +840,40 @@ static int cursor_from_device(DWORD deviceid, LPWTI_CURSORS_INFO *cursorp)
return -1;
}
static DWORD get_changed_state( WTPACKET *pkt)
{
DWORD change = 0;
if (pkt->pkX != last_packet.pkX)
change |= PK_X;
if (pkt->pkY != last_packet.pkY)
change |= PK_Y;
if (pkt->pkZ != last_packet.pkZ)
change |= PK_Z;
if (pkt->pkSerialNumber != last_packet.pkSerialNumber)
change |= PK_SERIAL_NUMBER;
if (pkt->pkTime != last_packet.pkTime)
change |= PK_TIME;
if (pkt->pkNormalPressure != last_packet.pkNormalPressure)
change |= PK_NORMAL_PRESSURE;
if (pkt->pkTangentPressure != last_packet.pkTangentPressure)
change |= PK_TANGENT_PRESSURE;
if (pkt->pkCursor != last_packet.pkCursor)
change |= PK_CURSOR;
if (pkt->pkButtons != last_packet.pkButtons)
change |= PK_BUTTONS;
if (pkt->pkOrientation.orAzimuth != last_packet.pkOrientation.orAzimuth ||
pkt->pkOrientation.orAltitude != last_packet.pkOrientation.orAltitude ||
pkt->pkOrientation.orTwist != last_packet.pkOrientation.orTwist)
change |= PK_ORIENTATION;
if (pkt->pkRotation.roPitch != last_packet.pkRotation.roPitch ||
pkt->pkRotation.roRoll != last_packet.pkRotation.roRoll ||
pkt->pkRotation.roYaw != last_packet.pkRotation.roYaw)
change |= PK_ROTATION;
return change;
}
static BOOL motion_event( HWND hwnd, XEvent *event )
{
XDeviceMotionEvent *motion = (XDeviceMotionEvent *)event;
......@@ -865,7 +900,9 @@ static BOOL motion_event( HWND hwnd, XEvent *event )
* (gMsgPacket.pkStatus & TPS_INVERT?-1:1));
gMsgPacket.pkNormalPressure = motion->axis_data[2];
gMsgPacket.pkButtons = get_button_state(curnum);
gMsgPacket.pkChanged = get_changed_state(&gMsgPacket);
SendMessageW(hwndTabletDefault,WT_PACKET,gMsgPacket.pkSerialNumber,(LPARAM)hwnd);
last_packet = gMsgPacket;
return TRUE;
}
......@@ -895,7 +932,9 @@ static BOOL button_event( HWND hwnd, XEvent *event )
* (gMsgPacket.pkStatus & TPS_INVERT?-1:1));
gMsgPacket.pkNormalPressure = button->axis_data[2];
gMsgPacket.pkButtons = get_button_state(curnum);
gMsgPacket.pkChanged = get_changed_state(&gMsgPacket);
SendMessageW(hwndTabletDefault,WT_PACKET,gMsgPacket.pkSerialNumber,(LPARAM)hwnd);
last_packet = gMsgPacket;
return TRUE;
}
......
......@@ -215,6 +215,7 @@ LPOPENCONTEXT AddPacketToContextQueue(LPWTPACKET packet, HWND hwnd)
packet->pkContext = ptr->handle;
/* translate packet data to the context */
packet->pkChanged = packet->pkChanged & ptr->context.lcPktData;
/* Scale as per documentation */
packet->pkY = ScaleForContext(packet->pkY, ptr->context.lcInOrgY,
......
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