Wintab32 (Patch 2 of 8) -- Expose more XInput events through the wintab api.

Robert North 7ownq0k402 at sneakemail.com
Fri Jan 21 12:34:37 CST 2005


This set of patches works towards better quality painting in Painter5.
Tested on Painter5 & Photoshop 6.

Note: I'm aware that this doesn't use Jeremy's X11 event timing code.
Patch No. 8 will fix this.

Changelog:
* Don't post messages on Wine message queue, if tablet context flags 
posting are disabled.
* When posting messages on Wine message queue, use message base stored 
in tablet context, not the default message base.
* Ensure that X11 Proximity events put messages onto Wintab message queue.

-------------- next part --------------
Index: dlls/x11drv/wintab.c
===================================================================
--- dlls/x11drv/wintab.c	(revision 153)
+++ dlls/x11drv/wintab.c	(revision 155)
@@ -647,9 +647,23 @@
     else if ((event->type == proximity_in_type) ||
              (event->type == proximity_out_type))
     {
+        XProximityNotifyEvent *proximity = (XProximityNotifyEvent *) event;
+
         TRACE_(event)("Received tablet proximity event\n");
         TRACE("Received tablet proximity event\n");
         gMsgPacket.pkStatus = (event->type==proximity_out_type)?TPS_PROXIMITY:0;
+        gMsgPacket.pkTime = proximity->time;
+        gMsgPacket.pkSerialNumber = gSerial++;
+        gMsgPacket.pkCursor = proximity->deviceid;
+        gMsgPacket.pkX = proximity->axis_data[0];
+        gMsgPacket.pkY = proximity->axis_data[1];
+        gMsgPacket.pkOrientation.orAzimuth =
+                    figure_deg(proximity->axis_data[3],proximity->axis_data[4]);
+        gMsgPacket.pkOrientation.orAltitude = 1000 - 15 * max
+                    (abs(proximity->axis_data[3]),abs(proximity->axis_data[4]));
+        gMsgPacket.pkNormalPressure = proximity->axis_data[2];
+        gMsgPacket.pkButtons = get_button_state(proximity->deviceid);
+
         SendMessageW(hwndTabletDefault, WT_PROXIMITY,
                      (event->type==proximity_out_type)?0:1, (LPARAM)hwnd);
     }
Index: dlls/wintab32/context.c
===================================================================
--- dlls/wintab32/context.c	(revision 153)
+++ dlls/wintab32/context.c	(revision 155)
@@ -219,7 +219,7 @@
                 {
                     ptr->ActiveCursor = packet->pkCursor;
                     if (ptr->context.lcOptions & CXO_CSRMESSAGES)
-                        TABLET_PostTabletMessage(ptr, WT_CSRCHANGE,
+                        TABLET_PostTabletMessage(ptr, _WT_CSRCHANGE(ptr->context.lcMsgBase),
                           (WPARAM)packet->pkSerialNumber, (LPARAM)ptr->handle,
                             FALSE);
                 }
@@ -419,12 +419,12 @@
 
     pAttachEventQueueToTablet(hWnd);
 
-    TABLET_PostTabletMessage(newcontext, WT_CTXOPEN, (WPARAM)newcontext->handle,
+    TABLET_PostTabletMessage(newcontext, _WT_CTXOPEN(newcontext->context.lcMsgBase), (WPARAM)newcontext->handle,
                       newcontext->context.lcStatus, TRUE);
 
     newcontext->context.lcStatus = CXS_ONTOP;
 
-    TABLET_PostTabletMessage(newcontext, WT_CTXOVERLAP,
+    TABLET_PostTabletMessage(newcontext, _WT_CTXOVERLAP(newcontext->context.lcMsgBase),
                             (WPARAM)newcontext->handle,
                             newcontext->context.lcStatus, TRUE);
 
@@ -474,7 +474,7 @@
 
     LeaveCriticalSection(&csTablet);
 
-    TABLET_PostTabletMessage(context, WT_CTXCLOSE, (WPARAM)context->handle,
+    TABLET_PostTabletMessage(context, _WT_CTXCLOSE(context->context.lcMsgBase), (WPARAM)context->handle,
                       context->context.lcStatus,TRUE);
 
     HeapFree(GetProcessHeap(),0,context->PacketQueue);
Index: dlls/wintab32/wintab32.c
===================================================================
--- dlls/wintab32/wintab32.c	(revision 153)
+++ dlls/wintab32/wintab32.c	(revision 155)
@@ -123,17 +123,19 @@
                 LPOPENCONTEXT handler;
                 pGetCurrentPacket(&packet);
                 handler = AddPacketToContextQueue(&packet,(HWND)lParam);
-                if (handler)
-                    TABLET_PostTabletMessage(handler, WT_PACKET,
+                if (handler && handler->context.lcOptions & CXO_MESSAGES)
+                    TABLET_PostTabletMessage(handler, _WT_PACKET(handler->context.lcMsgBase),
                                 (WPARAM)packet.pkSerialNumber,
                                 (LPARAM)handler->handle, FALSE);
                 break;
             }
         case WT_PROXIMITY:
             {
+                WTPACKET packet;
                 LPOPENCONTEXT handler;
                 LPARAM prox;
-                handler = FindOpenContext((HWND)lParam);
+                pGetCurrentPacket(&packet);
+                handler = AddPacketToContextQueue(&packet,(HWND)lParam);
                 if (handler)
                 {
                     prox = MAKELPARAM( wParam, 1 );


More information about the wine-patches mailing list