[input] input_update_last_event() and variables

This commit is contained in:
Mariusz Bialonczyk 2023-10-19 11:53:50 +02:00 committed by akallabeth
parent c4c8571710
commit 21f7bd37cf
2 changed files with 29 additions and 0 deletions

View File

@ -17,6 +17,7 @@
* limitations under the License. * limitations under the License.
*/ */
#include <time.h>
#include <freerdp/config.h> #include <freerdp/config.h>
#include <winpr/crt.h> #include <winpr/crt.h>
@ -884,6 +885,30 @@ BOOL input_register_client_callbacks(rdpInput* input)
return TRUE; return TRUE;
} }
/* Save last input timestamp and/or mouse position in prevent-session-lock mode */
static BOOL input_update_last_event(rdpInput* input, BOOL mouse, UINT16 x, UINT16 y)
{
rdp_input_internal* in = input_cast(input);
WINPR_ASSERT(input);
WINPR_ASSERT(input->context);
if (freerdp_settings_get_uint32(input->context->settings, FreeRDP_FakeMouseMotionInterval) > 0)
{
struct timespec ts = { 0 };
if (timespec_get(&ts, TIME_UTC) == 0)
return FALSE;
in->lastInputTimestamp = ts.tv_sec;
if (mouse)
{
in->lastX = x;
in->lastY = y;
}
}
return TRUE;
}
BOOL freerdp_input_send_synchronize_event(rdpInput* input, UINT32 flags) BOOL freerdp_input_send_synchronize_event(rdpInput* input, UINT32 flags)
{ {
if (!input || !input->context) if (!input || !input->context)

View File

@ -37,6 +37,10 @@ typedef struct
rdpInputProxy* proxy; rdpInputProxy* proxy;
wMessageQueue* queue; wMessageQueue* queue;
UINT32 lastInputTimestamp;
UINT16 lastX;
UINT16 lastY;
} rdp_input_internal; } rdp_input_internal;
static INLINE rdp_input_internal* input_cast(rdpInput* input) static INLINE rdp_input_internal* input_cast(rdpInput* input)