Alistair Leslie-Hughes : winex11: Implement PK_CHANGE for wintab.

Alexandre Julliard julliard at winehq.org
Wed Apr 10 15:19:59 CDT 2019


Module: wine
Branch: master
Commit: 0652a2ccc967c6d1ca04c67f58112ff491ab9a62
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=0652a2ccc967c6d1ca04c67f58112ff491ab9a62

Author: Alistair Leslie-Hughes <leslie_alistair at hotmail.com>
Date:   Wed Apr 10 03:42:53 2019 +0000

winex11: Implement PK_CHANGE for wintab.

Based on a patch by Eriks Dobelis.

Signed-off-by: Alistair Leslie-Hughes <leslie_alistair at hotmail.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/winex11.drv/wintab.c | 39 +++++++++++++++++++++++++++++++++++++++
 dlls/wintab32/context.c   |  1 +
 2 files changed, 40 insertions(+)

diff --git a/dlls/winex11.drv/wintab.c b/dlls/winex11.drv/wintab.c
index 48fcb22..486c356 100644
--- a/dlls/winex11.drv/wintab.c
+++ b/dlls/winex11.drv/wintab.c
@@ -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;
 }
 
diff --git a/dlls/wintab32/context.c b/dlls/wintab32/context.c
index 2993c47..095e258 100644
--- a/dlls/wintab32/context.c
+++ b/dlls/wintab32/context.c
@@ -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,




More information about the wine-cvs mailing list