uint32_t prev_x;
uint32_t prev_y;
+ Ecore_Timer *mouse_cal_timer;
+ Eina_Bool calibration;
Eina_Bool cursor_changed;
double refresh_time;
return ECORE_CALLBACK_RENEW;
}
+static Eina_Bool
+_e_rdp_recal_timer(void *data)
+{
+ E_Rdp_Output *output;
+
+ EINA_SAFETY_ON_NULL_RETURN_VAL(data, ECORE_CALLBACK_CANCEL);
+
+ output = (E_Rdp_Output *)data;
+
+ output->calibration = EINA_TRUE;
+ output->mouse_cal_timer = NULL;
+
+ return ECORE_CALLBACK_CANCEL;
+}
+
static void
_e_rdp_free_keyfile(E_Rdp_Backend *b, rdpSettings *settings)
{
return VGA_TIME;
}
+static Eina_Bool
+_e_rdp_mouse_cal(E_Rdp_Output *output, int x, int y)
+{
+ int diff_x = 0;
+ int diff_y = 0;
+ Eina_Bool cal = EINA_FALSE;
+
+ if (!output->calibration)
+ {
+ if (output->mouse_cal_timer)
+ ecore_timer_del(output->mouse_cal_timer);
+ output->mouse_cal_timer = ecore_timer_add(2.0, _e_rdp_recal_timer, output);
+ return cal;
+ }
+
+ diff_x = (x * output->mouse_scale_w) - e_comp->pointer->x;
+ if (diff_x <= (-1 * ((int)output->primary_w / 2 - 10)) || diff_x >= (int)output->primary_w / 2 - 10)
+ cal = EINA_TRUE;
+
+ diff_y = (y * output->mouse_scale_h) - e_comp->pointer->y;
+ if (diff_y <= (-1 * ((int)output->primary_h / 2 - 10)) || diff_y >= (int)output->primary_h / 2 - 10)
+ cal = EINA_TRUE;
+
+ output->calibration = EINA_FALSE;
+
+ return cal;
+}
+
static BOOL
e_rdp_peer_capabilities(freerdp_peer *client)
{
output->buffer_changed = EINA_TRUE;
e_video_debug_display_primary_plane_set(EINA_TRUE);
+
+ output->prev_x = e_comp->pointer->x;
+ output->prev_y = e_comp->pointer->y;
}
else
{
int motionless = 0;
uint32_t button = 0;
uint32_t state = 0;
+ Eina_Bool mouse_cal = EINA_FALSE;
E_Rdp_Peer_Context *peerContext = (E_Rdp_Peer_Context *)input->context;
E_Rdp_Output *output = peerContext->rdpBackend->output;
state = E_INFO_EVENT_STATE_MOTION;
move_x = (int)((int)(x - output->prev_x) * output->mouse_scale_w);
move_y = (int)((int)(y - output->prev_y) * output->mouse_scale_h);
+
+ mouse_cal = _e_rdp_mouse_cal(output, x, y);
+ if (mouse_cal)
+ {
+ move_x = (int)((x * output->mouse_scale_w) - e_comp->pointer->x);
+ move_y = (int)((y * output->mouse_scale_h) - e_comp->pointer->y);
+ }
+ else
+ {
+ 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;
}
ecore_event_handler_del(h);
b->handlers = NULL;
}
+ if (b->output->mouse_cal_timer)
+ {
+ ecore_timer_del(b->output->mouse_cal_timer);
+ b->output->mouse_cal_timer = NULL;
+ }
if (b->output->frame_timer)
{