e_mod_rdp : add mouse scale varibales in E_Rdp_Output. 59/269659/8
authordyamy-lee <dyamy.lee@samsung.com>
Thu, 20 Jan 2022 01:26:49 +0000 (10:26 +0900)
committerdyamy-lee <dyamy.lee@samsung.com>
Thu, 27 Jan 2022 08:57:06 +0000 (17:57 +0900)
            prev_x, prev_y moves to E_Rdp_Output for removing global variable, and multiple mouse_scale

Change-Id: I8a9bedd5c97239cd53ac7716ac8a61a26f8c2daa

src/e_mod_rdp.c

index f58a530..78472ff 100644 (file)
@@ -68,6 +68,15 @@ struct _E_Rdp_Output
    uint32_t w;
    uint32_t h;
 
+   uint32_t primary_w;
+   uint32_t primary_h;
+
+   float mouse_scale_w;
+   float mouse_scale_h;
+
+   uint32_t prev_x;
+   uint32_t prev_y;
+
    struct wl_list peers;
 };
 
@@ -945,6 +954,9 @@ e_rdp_peer_activate(freerdp_peer *client)
           }
      }
 
+   output->mouse_scale_w = (float)output->primary_w / output->w;
+   output->mouse_scale_h = (float)output->primary_h / output->h;
+
    rfx_context_reset(peerCtx->rfx_context, output->w, output->h);
    nsc_context_reset(peerCtx->nsc_context, output->w, output->h);
    if (peersItem->flags & RDP_PEER_ACTIVATED)
@@ -1017,7 +1029,6 @@ e_rdp_input_synchronize_event(rdpInput *input, UINT32 flags)
 static BOOL
 e_rdp_mouse_event(rdpInput *input, UINT16 flags, UINT16 x, UINT16 y)
 {
-   static int prev_w, prev_h;
    int e_output_w, e_output_h;
    int move_x = 0, move_y = 0;
    uint32_t button = 0;
@@ -1034,10 +1045,10 @@ e_rdp_mouse_event(rdpInput *input, UINT16 flags, UINT16 x, UINT16 y)
         if (x < e_output_w && y < e_output_h)
           {
              state = E_INFO_EVENT_STATE_MOTION;
-             move_x = (int)(x - prev_w);
-             move_y = (int)(y - prev_h);
-             prev_w = x;
-             prev_h = y;
+             move_x = (int)((int)(x - output->prev_x) * output->mouse_scale_w);
+             move_y = (int)((int)(y - output->prev_y) * output->mouse_scale_h);
+             output->prev_x = x;
+             output->prev_y = y;
           }
      }
 
@@ -1409,6 +1420,8 @@ e_rdp_output_create(void)
      {
         if (emode->current)
           {
+             output->primary_w = emode->w;
+             output->primary_h = emode->h;
              output->w = emode->w / 2;
              output->h = emode->h / 2;
              mode = EINA_TRUE;
@@ -1421,6 +1434,8 @@ e_rdp_output_create(void)
         output->h = E_RDP_HEIGHT;
      }
 
+   output->prev_x = output->prev_y = 0;
+
    wl_list_init(&output->peers);
 
    return output;