Hello,
You can try to disable RemoteFX in your server side:
Computer Configuration -> Administrative Templates -> Windows Components -> Remote Desktop Services -> Remote Desktop Session Host -> Remote Session Environment.
Disable the setting for "Use hardware graphics adapters for all Remote Desktop Services sessions".
If it doesn’t work, try modifying this registry:
HKEY_CURRENT_USER\Control Panel\Desktop
Set the ForegroundLockTimeout value to 0.
If the Answer is helpful, please click "Accept Answer" and upvote it.