Fix pointer bounce problem 74/277474/2
authorJunkyeong Kim <jk0430.kim@samsung.com>
Thu, 7 Jul 2022 08:11:22 +0000 (17:11 +0900)
committerJunkyeong Kim <jk0430.kim@samsung.com>
Fri, 8 Jul 2022 02:32:44 +0000 (11:32 +0900)
If rdp client mouse event comes twice before e_pointer update done,
it makes pointer bounce problem.
So in this case use first mouse event calibrated coordinate
to get move_x and move_y instead e_pointer coordinate.

Change-Id: I3f7beea2719a59f9c04522361e244e87c4fe15da
Signed-off-by: Junkyeong Kim <jk0430.kim@samsung.com>
src/e_mod_rdp.c

index 163b871..bd2f3bc 100644 (file)
@@ -111,6 +111,11 @@ struct _E_Rdp_Output
    int mouse_x;
    int mouse_y;
 
+   int e_pointer_prev_x;
+   int e_pointer_prev_y;
+   int cal_x_pre;
+   int cal_y_pre;
+
    struct wl_list peers;
 };
 
@@ -1912,8 +1917,21 @@ e_rdp_mouse_event(rdpInput *input, UINT16 flags, UINT16 x, UINT16 y)
 
              cal_x = _e_rdp_get_pointer_x(output, x);
              cal_y = _e_rdp_get_pointer_y(output, y);
-             move_x = cal_x - e_comp->pointer->x;
-             move_y = cal_y - e_comp->pointer->y;
+             if (output->e_pointer_prev_x == e_comp->pointer->x &&
+                 output->e_pointer_prev_y == e_comp->pointer->y)
+               {
+                  move_x = cal_x - output->cal_x_pre;
+                  move_y = cal_y - output->cal_y_pre;
+               }
+             else
+               {
+                  move_x = cal_x - e_comp->pointer->x;
+                  move_y = cal_y - e_comp->pointer->y;
+               }
+             output->e_pointer_prev_x = e_comp->pointer->x;
+             output->e_pointer_prev_y = e_comp->pointer->y;
+             output->cal_x_pre = cal_x;
+             output->cal_y_pre = cal_y;
           }
      }
 
@@ -2355,6 +2373,9 @@ e_rdp_output_create(void)
 
    wl_list_init(&output->peers);
 
+   output->e_pointer_prev_x = -1;
+   output->e_pointer_prev_y = -1;
+
    return output;
 }