*/}}
Browse Source

high mouse move event rate

YimingWu 3 months ago
parent
commit
ec2a7375f3
1 changed files with 20 additions and 1 deletions
  1. 20 1
      la_kernel.c

+ 20 - 1
la_kernel.c

@@ -7560,6 +7560,7 @@ static void la_RecordWacomMotions(XIRawEvent *event)
 LRESULT CALLBACK LA_WindowProc(HWND hwnd, UINT message, WPARAM wparam, LPARAM lparam) {
     static uint32_t ch = 0; static int lead = 0;
     static wchar_t buf[10] = { 0 }; int adv;
+    static DWORD LastMove = 0;
     char mbuf[10] = { 0 }; uint32_t uchar=0;
     short wheelmark = 0;
     int  WheelDir = 0;
@@ -7569,14 +7570,32 @@ LRESULT CALLBACK LA_WindowProc(HWND hwnd, UINT message, WPARAM wparam, LPARAM lp
     PACKET pkt;
     static POINT ptOld, ptNew;
     static UINT prsOld, prsNew, vkey;
+    MOUSEMOVEPOINT mmp = { 0 }; POINT pt; static POINT ptLast={0};
+    MOUSEMOVEPOINT mmpBuf[64];
     if (!hwnd) return DefWindowProc(hwnd, message, wparam, lparam);
     switch (message) {
     case WM_PAINT:
         //SwapBuffers(GetDC(hwnd));
         break;
     case WM_MOUSEMOVE:
-        la_SendMouseEvent(hwnd, LA_MOUSEMOVE, PARAM_2_FROM(lparam));
+        pt.x= LOWORD(lparam); pt.y = HIWORD(lparam);
+        ClientToScreen(hwnd, &pt);
+        mmp.x = pt.x; mmp.y = pt.y;
+        int numPoints = GetMouseMovePointsEx(sizeof(MOUSEMOVEPOINT), &mmp, mmpBuf, 64, GMMP_USE_DISPLAY_POINTS);
+        int i;
+        for(i = 0; i < numPoints; i++){
+            if(mmpBuf[i].time < LastMove){ break; }
+            if(mmpBuf[i].time == LastMove && mmpBuf[i].x==ptLast.x && mmpBuf[i].y==ptLast.y){ break; }
+        }
+        while(i){
+            pt.x = mmpBuf[i].x; pt.y = mmpBuf[i].y; ptLast = pt;
+            if (!ScreenToClient(hwnd, &pt));
+            la_SendMouseEvent(hwnd, LA_MOUSEMOVE, pt.x, pt.y);
+            i--;
+        }
+        //la_SendMouseEvent(hwnd, LA_MOUSEMOVE, PARAM_2_FROM(lparam));
         MAIN.IsPen = 0;
+        LastMove = GetMessageTime();
         break;
 
     case WM_LBUTTONDOWN: la_SendMouseEvent(hwnd, LA_L_MOUSE_DOWN, PARAM_2_FROM(lparam)); break;